lib/fourchette/heroku.rb in fourchette-0.0.7 vs lib/fourchette/heroku.rb in fourchette-0.0.8
- old
+ new
@@ -8,10 +8,11 @@
def fork from, to
create_app(to)
copy_config(from, to)
copy_add_ons(from, to)
copy_pg(from, to)
+ copy_RACK_AND_RAILS_ENV_again(from, to)
end
def delete app_name
logger.info "Deleting #{app_name}"
client.app.delete(app_name)
@@ -31,11 +32,10 @@
def git_url app_name
client.app.info(app_name)['git_url']
end
- private
def create_app name
logger.info "Creating #{name}"
client.app.create({ name: name })
end
@@ -64,7 +64,24 @@
def copy_pg from, to
logger.info "Copying Postgres's data from #{from} to #{to}"
backup = Fourchette::Pgbackups.new
backup.copy(from, to)
+ end
+
+ def copy_RACK_AND_RAILS_ENV_again(from, to)
+ env_to_update = get_original_env(from)
+ unless env_to_update.empty?
+ client.config_var.update(to, env_to_update)
+ end
+ end
+
+ def get_original_env(from)
+ environments = {}
+ ['RACK_ENV', 'RAILS_ENV'].each do |var|
+ if client.config_var.info(from)[var]
+ environments[var] = client.config_var.info(from)[var]
+ end
+ end
+ environments
end
end