[Refactor] Extract #replace_pattern from Subject#replace_path
[Refactor] Extract #apply_replacements from Subject#write_output
[Refactor] Extract #environment_var_assignments from Subject#run
Keep command line compatible