Sha256: 8c9841ce4421033273a5b93a172302d582bc8b4dd327e93b05ae4a48b29411a1

Contents?: true

Size: 557 Bytes

Versions: 2

Compression:

Stored size: 557 Bytes

Contents

module Trireme
  module Actions
    def configure_environment(rails_env, config)
      inject_into_file(
        "config/environments/#{rails_env}.rb",
        "\n\n  #{config}",
        before: "\nend"
      )
    end
    
    def replace_in_file(relative_path, find, replace)
      path = File.join(destination_root, relative_path)
      contents = IO.read(path)
      unless contents.gsub!(find, replace)
        raise "#{find.inspect} not found in #{relative_path}"
      end
      File.open(path, "w") { |file| file.write(contents) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trireme-0.2.0 lib/trireme/actions.rb
trireme-0.0.1 lib/trireme/actions.rb