File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace :deployer do
2
+ desc "Creates default deploy.yml file based on ENV variables"
3
+ task :create_deploy_yaml do
4
+ YamlGenerator . create
5
+ puts "Generator Finished"
6
+ end
7
+ end
Original file line number Diff line number Diff line change
1
+ module YamlGenerator
2
+ def self . create
3
+ app_name = ENV [ "HEROKU_APP_NAME" ]
4
+ deploy_name = ENV [ "HEROKU_DEPLOY_NAME" ]
5
+ app_url = ENV [ "APP_URL" ]
6
+
7
+ yaml_content = YAML . load_file ( 'template.yml' )
8
+ yaml_content [ "source-repo" ] = "[email protected] :wizarddevelopment/#{ deploy_name } .com.git"
9
+ yaml_content [ "website" ] = app_url
10
+ yaml_content [ "heroku-environments" ] [ "staging" ] [ "app-name" ] = "#{ deploy_name } -staging"
11
+ yaml_content [ "heroku-environments" ] [ "production" ] [ "app-name" ] = "#{ deploy_name } -production"
12
+ out_file = File . new ( "deploy.yml" , "w" )
13
+ out_file . puts ( yaml_content . to_yaml )
14
+ out_file . close
15
+ end
16
+ end
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : app_name
3
+ description : Great app to use all the time.
4
+ website : deploy_url
5
+ heroku-environments :
6
+ staging :
7
+ app-name : " deploy_name-staging"
8
+ tag-name : false
9
+ force-push : true
10
+ scripts :
11
+ - cmd : rake db:migrate
12
+ restart : true
13
+ remote : true
14
+ production :
15
+ app-name : " deploy_name-production"
16
+ force-push : false
17
+ tag-name : prod
18
+ scripts :
19
+ - cmd : rake db:migrate
20
+ restart : true
21
+ remote : true
22
+ - cmd : say 'deploy complete'
23
+ source-repo :
" [email protected] :wizarddevelopment/deploy_name.com.git"
You can’t perform that action at this time.
0 commit comments