crushserver 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -1
- data/crushserver.gemspec +1 -1
- data/lib/crushserver/recipes.rb +81 -80
- metadata +2 -2
data/VERSION.yml
CHANGED
data/crushserver.gemspec
CHANGED
data/lib/crushserver/recipes.rb
CHANGED
@@ -1,101 +1,102 @@
|
|
1
1
|
require 'tinder'
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :sync do
|
4
|
+
desc "Sync both database and attachments to local machine. Requires awesome-backup plugin."
|
5
|
+
task :all do
|
6
|
+
sync.db
|
7
|
+
sync.attachments
|
8
|
+
end
|
2
9
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
sync.attachments
|
8
|
-
end
|
10
|
+
desc "Sync database to local computer. Requires awesome-backup plugin."
|
11
|
+
task :db do
|
12
|
+
backup.mirror
|
13
|
+
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
15
|
+
desc "Copy attachments from server."
|
16
|
+
task :attachments, :roles => :app, :only => { :primary => true } do
|
17
|
+
FileUtils.mkdir_p "public/system"
|
18
|
+
# While we could use the following command...
|
19
|
+
# download("#{shared_path}/system", "public/system", :recursive => true)
|
20
|
+
# let's use rsync instead so we only download what we need...
|
21
|
+
system "rsync --delete --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{shared_path}/system/ public/system/"
|
22
|
+
end
|
13
23
|
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# let's use rsync instead so we only download what we need...
|
21
|
-
system "rsync --delete --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{shared_path}/system/ public/system/"
|
22
|
-
end
|
23
|
-
end
|
25
|
+
namespace(:db) do
|
26
|
+
desc "Execute db:populate rake task in appropriate environment"
|
27
|
+
task :populate, :roles => :app, :only => { :primary => true } do
|
28
|
+
run "cd #{current_path}; rake RAILS_ENV=#{rails_env} db:populate"
|
29
|
+
end
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
31
|
+
desc "Execute db:seed rake task in appropriate environment"
|
32
|
+
task :seed, :roles => :app, :only => { :primary => true } do
|
33
|
+
run "cd #{current_path}; rake RAILS_ENV=#{rails_env} db:seed"
|
34
|
+
end
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
desc "Execute db:seed_fu rake task in appropriate environment"
|
37
|
+
task :seed_fu, :roles => :app, :only => { :primary => true } do
|
38
|
+
run "cd #{current_path}; rake RAILS_ENV=#{rails_env} db:seed_fu"
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
|
-
|
37
|
-
|
38
|
-
|
42
|
+
namespace(:asset) do
|
43
|
+
namespace(:packager) do
|
44
|
+
desc "Execute asset:packager:build_all rake task in appropriate environment"
|
45
|
+
task :build_all, :roles => :app do
|
46
|
+
run "cd #{latest_release}; rake RAILS_ENV=#{rails_env} asset:packager:build_all"
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Execute asset:packager:delete_all rake task in appropriate environment"
|
50
|
+
task :delete_all, :roles => :app do
|
51
|
+
run "cd #{latest_release}; rake RAILS_ENV=#{rails_env} asset:packager:delete_all"
|
52
|
+
end
|
53
|
+
end
|
39
54
|
end
|
40
|
-
end
|
41
55
|
|
42
|
-
namespace
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
56
|
+
namespace :campfire do
|
57
|
+
desc "Send a message to the campfire chat room"
|
58
|
+
task :snitch do
|
59
|
+
if ENV['CAMPFIRE_SUBDOMAIN'].blank? || ENV['CAMPFIRE_TOKEN'].blank? || ENV['CAMPFIRE_ROOM'].blank?
|
60
|
+
puts "Campfire notifications are not configured in your environment. The CAMPFIRE_SUBDOMAIN, CAMPFIRE_TOKEN and CAMPFIRE_ROOM environment variables must be set."
|
61
|
+
else
|
62
|
+
campfire = Tinder::Campfire.new ENV['CAMPFIRE_SUBDOMAIN'], :ssl => true, :token => ENV['CAMPFIRE_TOKEN']
|
63
|
+
room = campfire.find_room_by_name ENV['CAMPFIRE_ROOM']
|
64
|
+
snitch_message = fetch(:snitch_message) { ENV['MESSAGE'] || abort('Capfire snitch message is missing. Use set :snitch_message, "Your message"') }
|
65
|
+
room.speak(snitch_message)
|
66
|
+
end
|
47
67
|
end
|
48
68
|
|
49
|
-
desc "
|
50
|
-
task :
|
51
|
-
|
69
|
+
# desc "Send a message to the campfire chat room about the deploy start"
|
70
|
+
# task :snitch_begin do
|
71
|
+
# set :snitch_message, "BEGIN DEPLOY [#{stage.to_s.upcase}]: #{ENV['USER']}, #{branch}/#{real_revision[0, 7]} to #{deploy_to}"
|
72
|
+
# snitch
|
73
|
+
# end
|
74
|
+
|
75
|
+
desc "Send a message to the campfire chat room about the deploy end"
|
76
|
+
task :snitch_end do
|
77
|
+
# set :snitch_message, "END DEPLOY [#{stage.to_s.upcase}]: #{ENV['USER']}, #{branch}/#{real_revision[0, 7]} to #{deploy_to}"
|
78
|
+
set :snitch_message, "#{application.upcase} was deployed to #{stage.to_s.upcase} by #{ENV['USER'].upcase} (#{branch}/#{real_revision[0, 7]})"
|
79
|
+
snitch
|
52
80
|
end
|
53
|
-
end
|
54
|
-
end
|
55
81
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
else
|
62
|
-
campfire = Tinder::Campfire.new ENV['CAMPFIRE_SUBDOMAIN'], :ssl => true, :token => ENV['CAMPFIRE_TOKEN']
|
63
|
-
room = campfire.find_room_by_name ENV['CAMPFIRE_ROOM']
|
64
|
-
snitch_message = fetch(:snitch_message) { ENV['MESSAGE'] || abort('Capfire snitch message is missing. Use set :snitch_message, "Your message"') }
|
65
|
-
room.speak(snitch_message)
|
66
|
-
end
|
82
|
+
# desc "Send a message to the campfire chat roob about the rollback"
|
83
|
+
# task :snitch_rollback do
|
84
|
+
# set :snitch_message, "ROLLBACK [#{stage.to_s.upcase}]: #{ENV['USER']}, #{latest_revision[0, 7]} to #{previous_revision[0, 7]} on #{deploy_to}"
|
85
|
+
# snitch
|
86
|
+
# end
|
67
87
|
end
|
68
88
|
|
69
|
-
|
70
|
-
#
|
71
|
-
|
72
|
-
# snitch
|
73
|
-
# end
|
89
|
+
#############################################################
|
90
|
+
# Hooks
|
91
|
+
#############################################################
|
74
92
|
|
75
|
-
|
76
|
-
|
77
|
-
# set :snitch_message, "END DEPLOY [#{stage.to_s.upcase}]: #{ENV['USER']}, #{branch}/#{real_revision[0, 7]} to #{deploy_to}"
|
78
|
-
set :snitch_message, "#{application.upcase} was deployed to #{stage.to_s.upcase} by #{ENV['USER'].upcase} (#{branch}/#{real_revision[0, 7]})"
|
79
|
-
snitch
|
80
|
-
end
|
81
|
-
|
82
|
-
# desc "Send a message to the campfire chat roob about the rollback"
|
83
|
-
# task :snitch_rollback do
|
84
|
-
# set :snitch_message, "ROLLBACK [#{stage.to_s.upcase}]: #{ENV['USER']}, #{latest_revision[0, 7]} to #{previous_revision[0, 7]} on #{deploy_to}"
|
85
|
-
# snitch
|
93
|
+
# before :deploy do
|
94
|
+
# campfire.snitch_begin unless ENV['QUIET'].to_i > 0
|
86
95
|
# end
|
87
|
-
end
|
88
|
-
|
89
|
-
#############################################################
|
90
|
-
# Hooks
|
91
|
-
#############################################################
|
92
96
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
after :deploy do
|
98
|
-
campfire.snitch_end unless ENV['QUIET'].to_i > 0
|
99
|
-
end
|
97
|
+
after :deploy do
|
98
|
+
campfire.snitch_end unless ENV['QUIET'].to_i > 0
|
99
|
+
end
|
100
100
|
|
101
|
-
# before 'deploy:rollback', 'campfire:snitch_rollback'
|
101
|
+
# before 'deploy:rollback', 'campfire:snitch_rollback'
|
102
|
+
end
|