Skip to content

Commit dfa012d

Browse files
committed
default yaml generator
1 parent 045f27f commit dfa012d

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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

lib/wizarddev/template.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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"

0 commit comments

Comments
 (0)