publiclab/spectral-workbench

View on GitHub
lib/tasks/cloud9.rake

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

# rake cloud9 username=foo
task :cloud9 do
  username = ENV['username']
  infile = 'config/database.yml.cloud9'
  outfile = 'config/database.yml'

  File.open(outfile, 'w') do |out|
    out << File.open(infile).read.gsub(/<username>/, username)
  end
  infile = 'config/config.yml.example'
  outfile = 'config/config.yml'

  File.open(outfile, 'w') do |out|
    out << File.open(infile).read
  end
end