Skip to content

Commit d070a62

Browse files
committed
[Addon] Add deploy hooks for heroku.
1 parent 112fe52 commit d070a62

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/tasks/_prepend/deploy.rake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# List of environments and their heroku git remotes
2+
ENVIRONMENTS = {
3+
staging: 'coderwall-staging',
4+
production: 'coderwall-production'
5+
}
6+
namespace :deploy do
7+
ENVIRONMENTS.keys.each do |env|
8+
desc "Deploy to #{env}"
9+
task env do
10+
Rake::Task['deploy:after_deploy'].invoke
11+
end
12+
end
13+
14+
task :after_deploy do |t, args|
15+
Rake::Task['humans'].invoke
16+
end
17+
end

lib/tasks/humans.rake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
task :humans do
2-
erb = ERB.new(File.read(Rails.root.join('lib', 'templates', 'erb', 'humans.txt.erb')), nil, '-')
2+
begin
3+
erb = ERB.new(File.read(Rails.root.join('lib', 'templates', 'erb', 'humans.txt.erb')), nil, '-')
34

4-
File.open(Rails.root.join('public', 'humans.txt'), 'w') do |file|
5-
file.write(erb.result)
5+
File.open(Rails.root.join('public', 'humans.txt'), 'w') do |file|
6+
file.write(erb.result)
7+
end
8+
rescue => e
9+
puts "Rake task humans failed: #{e}"
610
end
711
end

0 commit comments

Comments
 (0)