lib/tasks/pipeline_setup.rake in heroku_ops-0.0.4 vs lib/tasks/pipeline_setup.rake in heroku_ops-0.0.5
- old
+ new
@@ -3,13 +3,13 @@
end
def app_name_from_environment(env)
case env.downcase
when "production"
- ENV['HEROKU_APPNAME_PRODUCTION'] || "#{Rails.application.class.parent_name.underscore.gsub('_','-')}-production"
- when "staging"
- ENV['HEROKU_APPNAME_STAGING'] || "#{Rails.application.class.parent_name.underscore.gsub('_','-')}-staging"
+ ENV['HEROKU_APPNAME_PRODUCTION'] || base_app_name
+ else
+ ENV['HEROKU_APPNAME_STAGING'] || "#{base_app_name}-#{env}"
end
end
def create_addons_for_appname(appname)
sh "heroku addons:create heroku-postgresql:hobby-dev -a #{appname}"
@@ -34,27 +34,27 @@
end
namespace :setup do
desc "Setup a staging app (with addons) and remote for heroku"
task :staging do
- app_name = app_name_for_env("staging")
+ app_name = app_name_from_environment("staging")
sh "heroku create #{app_name}"
sh "git remote remove heroku"
create_addons_for_appname(app_name)
create_remote_for_appname("staging", app_name)
end
desc "Setup a production app (with addons) and git remote for heroku"
task :production do
- app_name = app_name_for_env("production")
+ app_name = app_name_from_environment("production")
sh "heroku create #{app_name}"
sh "git remote remove heroku"
create_addons_for_appname(app_name)
create_remote_for_appname("production", app_name)
end
desc "Setup a pipeline with your applications in the appropriate stages."
task :pipeline do
- sh "heroku pipelines:create -a#{app_name_for_env("staging")} --stage staging"
- sh "heroku pipelines:add -a#{app_name_for_env("production")} #{base_app_name} --stage production"
+ sh "heroku pipelines:create -a#{app_name_from_environment("staging")} --stage staging"
+ sh "heroku pipelines:add -a#{app_name_from_environment("production")} #{base_app_name} --stage production"
end
end
end
end