capper 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/capper.gemspec +4 -4
- data/lib/capper.rb +16 -0
- data/lib/capper/base.rb +72 -87
- data/lib/capper/bundler.rb +21 -21
- data/lib/capper/config.rb +13 -15
- data/lib/capper/delayed_job.rb +24 -29
- data/lib/capper/gem.rb +5 -7
- data/lib/capper/git.rb +2 -6
- data/lib/capper/hoptoad.rb +14 -21
- data/lib/capper/monit.rb +25 -29
- data/lib/capper/multistage.rb +11 -15
- data/lib/capper/rails.rb +74 -14
- data/lib/capper/resque.rb +23 -30
- data/lib/capper/rvm.rb +33 -37
- data/lib/capper/templates/delayed_job.sh.erb +5 -2
- data/lib/capper/templates/rails.console.sh.erb +6 -3
- data/lib/capper/templates/resque.sh.erb +5 -2
- data/lib/capper/templates/unicorn.sh.erb +5 -2
- data/lib/capper/unicorn.rb +50 -60
- data/lib/capper/whenever.rb +22 -42
- metadata +6 -6
- data/lib/capper/sass.rb +0 -14
data/capper.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "capper"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.8.0"
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.licenses = ["MIT"]
|
8
8
|
s.authors = ["Benedikt Böhm"]
|
9
9
|
s.email = ["bb@xnull.de"]
|
10
|
-
s.homepage = "http://github.com/
|
11
|
-
s.summary = %q{
|
12
|
-
s.description = %q{
|
10
|
+
s.homepage = "http://github.com/zenops/capper"
|
11
|
+
s.summary = %q{Capper is a collection of opinionated Capistrano recipes}
|
12
|
+
s.description = %q{Capper is a collection of opinionated Capistrano recipes}
|
13
13
|
|
14
14
|
s.add_dependency "erubis"
|
15
15
|
s.add_dependency "capistrano"
|
data/lib/capper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# mixin various helpers
|
2
|
+
require 'capper/utils/templates'
|
3
|
+
include Capper::Utils::Templates
|
4
|
+
|
5
|
+
require 'capper/utils/multistage'
|
6
|
+
include Capper::Utils::Multistage
|
7
|
+
|
8
|
+
require 'capper/utils/monit'
|
9
|
+
include Capper::Utils::Monit
|
10
|
+
|
11
|
+
# make sure capper recipes can be found by load() too
|
12
|
+
Capistrano::Configuration.instance(true).load do
|
13
|
+
load_paths << File.expand_path(File.dirname(__FILE__))
|
14
|
+
load 'deploy'
|
15
|
+
load 'capper/base'
|
16
|
+
end
|
data/lib/capper/base.rb
CHANGED
@@ -1,94 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
unless Capistrano::Configuration.respond_to?(:instance)
|
4
|
-
abort "capper requires Capistrano 2"
|
5
|
-
end
|
6
|
-
|
7
|
-
# mixin various helpers
|
1
|
+
# add custom color scheme
|
8
2
|
require 'capistrano_colors/configuration'
|
9
3
|
require 'capistrano_colors/logger'
|
10
4
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
dirs = [releases_path, shared_path]
|
79
|
-
dirs += shared.map { |d| File.join(shared_path, d) }
|
80
|
-
run "mkdir -p #{dirs.join(' ')}"
|
81
|
-
end
|
5
|
+
colorize([
|
6
|
+
{ :match => /executing `multistage.*/, :color => :hide, :level => 2, :prio => 0 },
|
7
|
+
{ :match => /executing `.*/, :color => :yellow, :level => 2, :prio => -10, :attribute => :bright, :prepend => "== Currently " },
|
8
|
+
{ :match => /executing ".*/, :color => :magenta, :level => 2, :prio => -20 },
|
9
|
+
{ :match => /sftp upload complete/, :color => :hide, :level => 2, :prio => -20 },
|
10
|
+
|
11
|
+
{ :match => /sftp upload/, :color => :hide, :level => 1, :prio => -10 },
|
12
|
+
{ :match => /^transaction:.*/, :color => :blue, :level => 1, :prio => -10, :attribute => :bright },
|
13
|
+
{ :match => /.*out\] (fatal:|ERROR:).*/, :color => :red, :level => 1, :prio => -10 },
|
14
|
+
{ :match => /Permission denied/, :color => :red, :level => 1, :prio => -20 },
|
15
|
+
{ :match => /sh: .+: command not found/, :color => :magenta, :level => 1, :prio => -30 },
|
16
|
+
|
17
|
+
{ :match => /^err ::/, :color => :red, :level => 0, :prio => -10 },
|
18
|
+
{ :match => /.*/, :color => :blue, :level => 0, :prio => -20, :attribute => :bright },
|
19
|
+
])
|
20
|
+
|
21
|
+
# do not trace by default
|
22
|
+
logger.level = Capistrano::Logger::DEBUG
|
23
|
+
|
24
|
+
# default app layout
|
25
|
+
_cset(:user) { application }
|
26
|
+
|
27
|
+
_cset(:base_path) { "/var/app" }
|
28
|
+
set(:deploy_to) { "#{base_path}/#{application}" }
|
29
|
+
|
30
|
+
_cset(:bin_path) { File.join(deploy_to, "bin") }
|
31
|
+
_cset(:pid_path) { File.join(shared_path, "pids") }
|
32
|
+
_cset(:config_path) { File.join(shared_path, "config") }
|
33
|
+
|
34
|
+
# apps should not require root access
|
35
|
+
set(:use_sudo, false)
|
36
|
+
set(:group_writable, false)
|
37
|
+
|
38
|
+
# set proper unicode locale, so gemspecs with unicode chars will not crash
|
39
|
+
# bundler. see https://github.com/capistrano/capistrano/issues/70
|
40
|
+
_cset(:default_environment, { 'LANG' => 'en_US.UTF-8' })
|
41
|
+
|
42
|
+
# set a global (empty) prefix for ruby applications so that
|
43
|
+
# other recipes (bundler) can override it (with bundle exec)
|
44
|
+
_cset(:ruby_exec_prefix, "")
|
45
|
+
set(:rake) { "#{ruby_exec_prefix} rake" }
|
46
|
+
|
47
|
+
# cleanup by default
|
48
|
+
after "deploy:update", "deploy:cleanup"
|
49
|
+
after "deploy:update_code", "deploy:symlink_shared"
|
50
|
+
|
51
|
+
# overwrite deploy:setup to get rid of the annoying chmod g+w which makes ssh
|
52
|
+
# logins impossible
|
53
|
+
namespace :deploy do
|
54
|
+
desc <<-DESC
|
55
|
+
Prepares one or more servers for deployment. Before you can use any \
|
56
|
+
of the Capistrano deployment tasks with your project, you will need to \
|
57
|
+
make sure all of your servers have been prepared with `cap deploy:setup'. When \
|
58
|
+
you add a new server to your cluster, you can easily run the setup task \
|
59
|
+
on just that server by specifying the HOSTS environment variable:
|
60
|
+
|
61
|
+
$ cap HOSTS=new.server.com deploy:setup
|
62
|
+
|
63
|
+
It is safe to run this task on servers that have already been set up; it \
|
64
|
+
will not destroy any deployed revisions or data.
|
65
|
+
DESC
|
66
|
+
task :setup, :except => { :no_release => true } do
|
67
|
+
shared = %w(system log pids) | shared_children
|
68
|
+
dirs = [releases_path, shared_path]
|
69
|
+
dirs += shared.map { |d| File.join(shared_path, d) }
|
70
|
+
run "mkdir -p #{dirs.join(' ')}"
|
71
|
+
end
|
82
72
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
73
|
+
desc "Create symlinks from shared to current"
|
74
|
+
task :symlink_shared, :roles => :app, :except => { :no_release => true } do
|
75
|
+
fetch(:symlinks, {}).each do |source, dest|
|
76
|
+
run "rm -rf #{release_path}/#{dest} && ln -nfs #{shared_path}/#{source} #{release_path}/#{dest}"
|
88
77
|
end
|
89
78
|
end
|
90
|
-
|
91
|
-
# cleanup by default
|
92
|
-
after "deploy:update", "deploy:cleanup"
|
93
|
-
after "deploy:update_code", "deploy:symlink_shared"
|
94
79
|
end
|
data/lib/capper/bundler.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/base' unless defined?(Capper)
|
2
1
|
require 'bundler/capistrano'
|
3
2
|
|
4
|
-
#
|
5
|
-
|
3
|
+
# use bundle exec for all ruby programs
|
4
|
+
set(:ruby_exec_prefix, "bundle exec")
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# do not install a global bundle if rvm has been enabled
|
7
|
+
# instead, use the gemset selected by rvm_ruby_string
|
8
|
+
set(:bundle_dir) do
|
9
|
+
begin
|
10
|
+
File.join(shared_path, 'bundle', rvm_ruby_string)
|
11
|
+
rescue NoMethodError
|
12
|
+
File.join(shared_path, 'bundle')
|
13
|
+
end
|
14
|
+
end
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
set(:bundle_dir) { File.join(shared_path, 'bundle', rvm_ruby_string) }
|
16
|
+
# freeze bundler version
|
17
|
+
_cset(:bundler_version, "1.0.17")
|
14
18
|
|
15
|
-
|
16
|
-
_cset(:bundler_version, "1.0.17")
|
19
|
+
before "bundle:install", "bundle:setup"
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
namespace :bundle do
|
22
|
+
desc "Setup bundler"
|
23
|
+
task :setup, :except => {:no_release => true} do
|
24
|
+
run "if ! gem query -i -n ^bundler$ -v #{bundler_version} >/dev/null; then " +
|
25
|
+
"gem install bundler -v #{bundler_version}; " +
|
26
|
+
"fi"
|
27
|
+
run "mkdir -p #{bundle_dir}"
|
26
28
|
end
|
27
|
-
|
28
|
-
before "bundle:install", "bundle:setup"
|
29
29
|
end
|
data/lib/capper/config.rb
CHANGED
@@ -1,26 +1,24 @@
|
|
1
|
-
|
1
|
+
_cset(:config_repo, nil)
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
after "deploy:setup", "config:setup"
|
4
|
+
after "deploy:update_code", "config:deploy"
|
5
5
|
|
6
|
-
|
6
|
+
namespace :config do
|
7
|
+
desc "Setup configuration repository if any"
|
8
|
+
task :setup, :roles => :app, :except => { :no_release => true } do
|
7
9
|
unless config_repo.nil?
|
8
10
|
run "rm -rf #{config_path} && git clone -q #{config_repo} #{config_path}"
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
desc "Deploy config files from shared/config to current release"
|
15
|
+
task :deploy, :roles => :app, :except => { :no_release => true } do
|
16
|
+
unless config_repo.nil?
|
17
|
+
run "cd #{config_path} && git pull -q"
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
end
|
20
|
+
fetch(:config_files, []).each do |f|
|
21
|
+
run "cp #{config_path}/#{f} #{release_path}/config/"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
after "deploy:update_code", "config:setup"
|
26
24
|
end
|
data/lib/capper/delayed_job.rb
CHANGED
@@ -1,45 +1,40 @@
|
|
1
|
-
|
1
|
+
load 'capper/monit'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# configuration variables
|
4
|
+
_cset(:delayed_job_workers, {})
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
_cset(:delayed_job_workers, {})
|
6
|
+
# these cannot be overriden
|
7
|
+
set(:delayed_job_script) { File.join(bin_path, "delayed_job") }
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
after "deploy:update_code", "delayed_job:setup"
|
10
|
+
after "deploy:restart", "delayed_job:restart"
|
12
11
|
|
13
|
-
|
12
|
+
monit_config "delayed_job", <<EOF, :roles => :worker
|
14
13
|
<% delayed_job_workers.each do |name, range| %>
|
15
14
|
check process delayed_job_<%= name %>
|
16
|
-
|
15
|
+
with pidfile <%= pid_path %>/delayed_job.<%= name %>.pid
|
17
16
|
<% if range.nil? %>
|
18
|
-
|
19
|
-
|
17
|
+
start program = "<%= delayed_job_script %> start <%= name %>"
|
18
|
+
stop program = "<%= delayed_job_script %> stop <%= name %>"
|
20
19
|
<% else %>
|
21
|
-
|
22
|
-
|
20
|
+
start program = "<%= delayed_job_script %> start <%= name %> <%= range.begin %> <%= range.end %>"
|
21
|
+
stop program = "<%= delayed_job_script %> stop <%= name %> <%= range.begin %> <%= range.end %>"
|
23
22
|
<% end %>
|
24
|
-
|
23
|
+
group delayed_job
|
25
24
|
|
26
25
|
<% end %>
|
27
26
|
EOF
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
desc "Restart DelayedJob workers"
|
38
|
-
task :restart, :roles => :worker, :except => { :no_release => true } do
|
39
|
-
run "monit -g delayed_job restart all"
|
40
|
-
end
|
28
|
+
namespace :delayed_job do
|
29
|
+
desc "Generate DelayedJob configuration files"
|
30
|
+
task :setup, :roles => :worker, :except => { :no_release => true } do
|
31
|
+
upload_template_file("delayed_job.sh",
|
32
|
+
delayed_job_script,
|
33
|
+
:mode => "0755")
|
41
34
|
end
|
42
35
|
|
43
|
-
|
44
|
-
|
36
|
+
desc "Restart DelayedJob workers"
|
37
|
+
task :restart, :roles => :worker, :except => { :no_release => true } do
|
38
|
+
run "monit -g delayed_job restart all"
|
39
|
+
end
|
45
40
|
end
|
data/lib/capper/gem.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
|
1
|
+
before "deploy:setup", "gemrc:setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
put("gem: --no-ri --no-rdoc", "#{deploy_to}/.gemrc")
|
8
|
-
end
|
3
|
+
namespace :gemrc do
|
4
|
+
desc "Setup global ~/.gemrc file"
|
5
|
+
task :setup do
|
6
|
+
put("gem: --no-ri --no-rdoc", "#{deploy_to}/.gemrc")
|
9
7
|
end
|
10
8
|
end
|
data/lib/capper/git.rb
CHANGED
data/lib/capper/hoptoad.rb
CHANGED
@@ -1,25 +1,18 @@
|
|
1
|
-
|
1
|
+
# redefine the notify task without after hooks, so we can use them in
|
2
|
+
# specific stages only.
|
3
|
+
namespace :hoptoad do
|
4
|
+
desc "Notify Hoptoad of the deployment"
|
5
|
+
task :notify, :except => { :no_release => true } do
|
6
|
+
rails_env = fetch(:hoptoad_env, fetch(:rails_env, "production"))
|
7
|
+
local_user = ENV['USER'] || ENV['USERNAME']
|
8
|
+
executable = fetch(:rake, 'rake')
|
2
9
|
|
3
|
-
# hoptoad
|
4
|
-
|
10
|
+
notify_command = "#{executable} hoptoad:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
|
11
|
+
notify_command << " DRY_RUN=true" if dry_run
|
12
|
+
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
5
13
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
namespace :hoptoad do
|
10
|
-
desc "Notify Hoptoad of the deployment"
|
11
|
-
task :notify, :except => { :no_release => true } do
|
12
|
-
rails_env = fetch(:hoptoad_env, fetch(:rails_env, "production"))
|
13
|
-
local_user = ENV['USER'] || ENV['USERNAME']
|
14
|
-
executable = fetch(:rake, 'rake')
|
15
|
-
|
16
|
-
notify_command = "#{executable} hoptoad:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
|
17
|
-
notify_command << " DRY_RUN=true" if dry_run
|
18
|
-
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
19
|
-
|
20
|
-
puts "Notifying Hoptoad of Deploy (#{notify_command})"
|
21
|
-
`#{notify_command}`
|
22
|
-
puts "Hoptoad Notification Complete."
|
23
|
-
end
|
14
|
+
puts "Notifying Hoptoad of Deploy (#{notify_command})"
|
15
|
+
`#{notify_command}`
|
16
|
+
puts "Hoptoad Notification Complete."
|
24
17
|
end
|
25
18
|
end
|
data/lib/capper/monit.rb
CHANGED
@@ -1,36 +1,32 @@
|
|
1
|
-
|
1
|
+
set(:monitrc) { "#{deploy_to}/.monitrc.local" }
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
after "deploy:update_code", "monit:setup"
|
4
|
+
before "deploy:restart", "monit:reload"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
namespace :monit do
|
7
|
+
desc "Setup monit configuration files"
|
8
|
+
task :setup do
|
9
|
+
configs = fetch(:monit_configs, {})
|
10
|
+
servers = find_servers
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Reload monit configuration"
|
29
|
-
task :reload do
|
30
|
-
run "monit reload &>/dev/null && sleep 1"
|
12
|
+
upload_template(monitrc, :mode => "0644") do |server|
|
13
|
+
configs.keys.select do |name|
|
14
|
+
roles = configs[name][:options][:roles]
|
15
|
+
if roles.nil?
|
16
|
+
true
|
17
|
+
else
|
18
|
+
[roles].flatten.select do |r|
|
19
|
+
self.roles[r.to_sym].include?(server)
|
20
|
+
end.any?
|
21
|
+
end
|
22
|
+
end.map do |name|
|
23
|
+
"# #{name}\n#{configs[name][:body]}"
|
24
|
+
end.join("\n\n")
|
31
25
|
end
|
32
26
|
end
|
33
27
|
|
34
|
-
|
35
|
-
|
28
|
+
desc "Reload monit configuration"
|
29
|
+
task :reload do
|
30
|
+
run "monit reload &>/dev/null && sleep 1"
|
31
|
+
end
|
36
32
|
end
|
data/lib/capper/multistage.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
on :load do
|
6
|
-
if stages.include?(ARGV.first)
|
7
|
-
find_and_execute_task(ARGV.first) if ARGV.any?{ |option| option =~ /-T|--tasks|-e|--explain/ }
|
8
|
-
end
|
1
|
+
# execute the specified stage so that recipes required in stage can contribute to task list
|
2
|
+
on :load do
|
3
|
+
if stages.include?(ARGV.first)
|
4
|
+
find_and_execute_task(ARGV.first) if ARGV.any?{ |option| option =~ /-T|--tasks|-e|--explain/ }
|
9
5
|
end
|
6
|
+
end
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
8
|
+
namespace :multistage do
|
9
|
+
task :ensure do
|
10
|
+
unless exists?(:current_stage)
|
11
|
+
abort "No stage specified. Please specify one of: #{stages.join(', ')} (e.g. `cap #{stages.first} #{ARGV.last}')"
|
16
12
|
end
|
17
13
|
end
|
18
|
-
|
19
|
-
on :start, "multistage:ensure", :except => stages
|
20
14
|
end
|
15
|
+
|
16
|
+
on :start, "multistage:ensure", :except => stages
|
data/lib/capper/rails.rb
CHANGED
@@ -1,20 +1,80 @@
|
|
1
|
-
|
1
|
+
_cset(:rails_env, "production")
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
_cset(:asset_pipeline, true)
|
4
|
+
_cset(:asset_env, "RAILS_GROUPS=assets")
|
5
|
+
_cset(:assets_prefix, "assets")
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
set(:normalize_asset_timestamps) do
|
8
|
+
if asset_pipeline
|
9
|
+
false
|
10
|
+
else
|
11
|
+
true
|
12
|
+
end
|
13
|
+
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
before 'deploy:finalize_update', 'rails:assets:symlink'
|
16
|
+
after 'deploy:update_code', 'rails:assets:precompile'
|
17
|
+
after 'deploy:update_code', 'rails:setup'
|
18
|
+
|
19
|
+
namespace :rails do
|
20
|
+
desc "Generate rails configuration and helpers"
|
21
|
+
task :setup, :roles => :app, :except => { :no_release => true } do
|
22
|
+
upload_template_file("rails.console.sh",
|
23
|
+
File.join(bin_path, "con"),
|
24
|
+
:mode => "0755")
|
17
25
|
end
|
18
26
|
|
19
|
-
|
27
|
+
namespace :assets do
|
28
|
+
desc <<-DESC
|
29
|
+
[internal] This task will set up a symlink to the shared directory \
|
30
|
+
for the assets directory. Assets are shared across deploys to avoid \
|
31
|
+
mid-deploy mismatches between old application html asking for assets \
|
32
|
+
and getting a 404 file not found error. The assets cache is shared \
|
33
|
+
for efficiency. If you cutomize the assets path prefix, override the \
|
34
|
+
:assets_prefix variable to match.
|
35
|
+
DESC
|
36
|
+
task :symlink, :roles => [:web, :asset], :except => { :no_release => true } do
|
37
|
+
if asset_pipeline
|
38
|
+
run <<-CMD
|
39
|
+
rm -rf #{latest_release}/public/#{assets_prefix} &&
|
40
|
+
mkdir -p #{latest_release}/public &&
|
41
|
+
mkdir -p #{shared_path}/assets &&
|
42
|
+
ln -s #{shared_path}/assets #{latest_release}/public/#{assets_prefix}
|
43
|
+
CMD
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc <<-DESC
|
48
|
+
Run the asset precompilation rake task. You can specify the full path \
|
49
|
+
to the rake executable by setting the rake variable. You can also \
|
50
|
+
specify additional environment variables to pass to rake via the \
|
51
|
+
asset_env variable. The defaults are:
|
52
|
+
|
53
|
+
set :rake, "rake"
|
54
|
+
set :rails_env, "production"
|
55
|
+
set :asset_env, "RAILS_GROUPS=assets"
|
56
|
+
DESC
|
57
|
+
task :precompile, :roles => [:web, :asset], :except => { :no_release => true } do
|
58
|
+
if asset_pipeline
|
59
|
+
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc <<-DESC
|
64
|
+
Run the asset clean rake task. Use with caution, this will delete \
|
65
|
+
all of your compiled assets. You can specify the full path \
|
66
|
+
to the rake executable by setting the rake variable. You can also \
|
67
|
+
specify additional environment variables to pass to rake via the \
|
68
|
+
asset_env variable. The defaults are:
|
69
|
+
|
70
|
+
set :rake, "rake"
|
71
|
+
set :rails_env, "production"
|
72
|
+
set :asset_env, "RAILS_GROUPS=assets"
|
73
|
+
DESC
|
74
|
+
task :clean, :roles => [:web, :asset], :except => { :no_release => true } do
|
75
|
+
if asset_pipeline
|
76
|
+
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:clean"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
20
80
|
end
|
data/lib/capper/resque.rb
CHANGED
@@ -1,45 +1,38 @@
|
|
1
|
-
|
1
|
+
# configuration variables
|
2
|
+
_cset(:resque_workers, {})
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
# these cannot be overriden
|
5
|
+
set(:resque_script) { File.join(bin_path, "resque") }
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
_cset(:resque_workers, {})
|
7
|
+
after "deploy:update_code", "resque:setup"
|
8
|
+
after "deploy:restart", "resque:restart"
|
9
9
|
|
10
|
-
|
11
|
-
set(:resque_script) { File.join(bin_path, "resque") }
|
12
|
-
|
13
|
-
monit_config "resque", <<EOF, :roles => :worker
|
10
|
+
monit_config "resque", <<EOF, :roles => :worker
|
14
11
|
<% resque_workers.each do |name, queue| %>
|
15
12
|
check process resque_<%= name %>
|
16
|
-
|
13
|
+
with pidfile <%= pid_path %>/resque.<%= name %>.pid
|
17
14
|
<% if queue.nil? %>
|
18
|
-
|
19
|
-
|
15
|
+
start program = "<%= resque_script %> <%= name %> * start"
|
16
|
+
stop program = "<%= resque_script %> <%= name %> * stop"
|
20
17
|
<% else %>
|
21
|
-
|
22
|
-
|
18
|
+
start program = "<%= resque_script %> <%= name %> <%= queue %> start"
|
19
|
+
stop program = "<%= resque_script %> <%= name %> <%= queue %> stop"
|
23
20
|
<% end %>
|
24
|
-
|
21
|
+
group resque
|
25
22
|
|
26
23
|
<% end %>
|
27
24
|
EOF
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
desc "Restart resque workers"
|
38
|
-
task :restart, :roles => :worker, :except => { :no_release => true } do
|
39
|
-
run "monit -g resque restart all"
|
40
|
-
end
|
26
|
+
namespace :resque do
|
27
|
+
desc "Generate resque configuration files"
|
28
|
+
task :setup, :roles => :worker, :except => { :no_release => true } do
|
29
|
+
upload_template_file("resque.sh",
|
30
|
+
resque_script,
|
31
|
+
:mode => "0755")
|
41
32
|
end
|
42
33
|
|
43
|
-
|
44
|
-
|
34
|
+
desc "Restart resque workers"
|
35
|
+
task :restart, :roles => :worker, :except => { :no_release => true } do
|
36
|
+
run "monit -g resque restart all"
|
37
|
+
end
|
45
38
|
end
|
data/lib/capper/rvm.rb
CHANGED
@@ -1,44 +1,40 @@
|
|
1
|
-
|
1
|
+
load "capper/gem"
|
2
2
|
|
3
3
|
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
|
4
4
|
require 'rvm/capistrano'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# prevents interactive rvm dialog
|
35
|
-
task :trust_rvmrc, :except => {:no_release => true} do
|
36
|
-
run "rvm rvmrc trust #{release_path} >/dev/null"
|
37
|
-
run "rvm rvmrc trust #{current_path} >/dev/null"
|
38
|
-
end
|
6
|
+
set(:rvm_type, :user)
|
7
|
+
set(:rvm_ruby_string, File.read(".rvmrc").gsub(/^rvm use --create (.*)/, '\1').strip)
|
8
|
+
|
9
|
+
_cset(:rvm_rubygems_version, "1.6.2")
|
10
|
+
|
11
|
+
before "deploy:setup", "rvm:setup"
|
12
|
+
after "deploy:symlink", "rvm:trust_rvmrc"
|
13
|
+
|
14
|
+
namespace :rvm do
|
15
|
+
# install the requested ruby if missing
|
16
|
+
desc "Install the selected ruby version using RVM."
|
17
|
+
task :setup, :except => {:no_release => true} do
|
18
|
+
wo_gemset = rvm_ruby_string.gsub(/@.*/, '')
|
19
|
+
|
20
|
+
run("echo silent > ~/.curlrc", :shell => "/bin/bash")
|
21
|
+
run("source ~/.rvm/scripts/rvm && " +
|
22
|
+
"if ! rvm list rubies | grep -q #{wo_gemset}; then " +
|
23
|
+
"rvm install #{wo_gemset}; fi && " +
|
24
|
+
"rvm use --create #{rvm_ruby_string} >/dev/null",
|
25
|
+
:shell => "/bin/bash")
|
26
|
+
run("rm ~/.curlrc")
|
27
|
+
|
28
|
+
# this ensures that Gentoos declare -x RUBYOPT="-rauto_gem" is ignored.
|
29
|
+
run "touch ~/.rvm/rubies/#{wo_gemset}/lib/ruby/site_ruby/auto_gem.rb"
|
30
|
+
|
31
|
+
# freeze rubygems version
|
32
|
+
run("rvm rubygems #{rvm_rubygems_version}")
|
39
33
|
end
|
40
34
|
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
# prevents interactive rvm dialog
|
36
|
+
task :trust_rvmrc, :except => {:no_release => true} do
|
37
|
+
run "rvm rvmrc trust #{release_path} >/dev/null"
|
38
|
+
run "rvm rvmrc trust #{current_path} >/dev/null"
|
39
|
+
end
|
44
40
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
export HOME=<%= deploy_to %>
|
3
|
-
source <%= deploy_to %>/.rvm/scripts/rvm
|
4
3
|
export RAILS_ENV=<%= rails_env %>
|
5
4
|
|
5
|
+
if [[ -e "${HOME}"/.rvm/scripts/rvm ]]; then
|
6
|
+
source "${HOME}"/.rvm/scripts/rvm
|
7
|
+
fi
|
8
|
+
|
6
9
|
cd <%= current_path %> >/dev/null
|
7
10
|
|
8
11
|
CMD=$1 && shift
|
@@ -16,4 +19,4 @@ if [[ $# -ge 1 ]]; then
|
|
16
19
|
MAX="--max-priority $1" && shift
|
17
20
|
fi
|
18
21
|
|
19
|
-
exec
|
22
|
+
exec <%= ruby_exec_prefix %> ./script/delayed_job $CMD --prefix <%= application %> --identifier $ID --pid-dir=<%= pid_path %> $MIN $MAX
|
@@ -1,12 +1,15 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
export HOME=<%= deploy_to %>
|
3
|
-
source <%= deploy_to %>/.rvm/scripts/rvm
|
4
3
|
export RAILS_ENV=<%= rails_env %>
|
5
4
|
|
5
|
+
if [[ -e "${HOME}"/.rvm/scripts/rvm ]]; then
|
6
|
+
source "${HOME}"/.rvm/scripts/rvm
|
7
|
+
fi
|
8
|
+
|
6
9
|
cd <%= current_path %> >/dev/null
|
7
10
|
|
8
11
|
if [[ -e ./script/console ]]; then
|
9
|
-
|
12
|
+
exec <%= ruby_exec_prefix %> ruby ./script/console
|
10
13
|
else
|
11
|
-
|
14
|
+
exec <%= ruby_exec_prefix %> ruby ./script/rails console
|
12
15
|
fi
|
@@ -1,13 +1,16 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
export HOME=<%= deploy_to %>
|
3
|
-
source <%= deploy_to %>/.rvm/scripts/rvm
|
4
3
|
export RAILS_ENV=<%= rails_env %>
|
5
4
|
|
5
|
+
if [[ -e "${HOME}"/.rvm/scripts/rvm ]]; then
|
6
|
+
source "${HOME}"/.rvm/scripts/rvm
|
7
|
+
fi
|
8
|
+
|
6
9
|
WORKER="$1" && shift
|
7
10
|
QUEUE="$1" && shift
|
8
11
|
|
9
12
|
PIDFILE=<%= pid_path %>/resque.${WORKER}.pid
|
10
|
-
CMD="
|
13
|
+
CMD="<%= rake %> environment resque:work QUEUE=${QUEUE} PIDFILE=${PIDFILE}"
|
11
14
|
|
12
15
|
cd <%= current_path %> >/dev/null
|
13
16
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
export HOME=<%= deploy_to %>
|
3
|
-
source <%= deploy_to %>/.rvm/scripts/rvm
|
4
3
|
export RAILS_ENV=<%= rails_env %>
|
5
4
|
|
5
|
+
if [[ -e "${HOME}"/.rvm/scripts/rvm ]]; then
|
6
|
+
source "${HOME}"/.rvm/scripts/rvm
|
7
|
+
fi
|
8
|
+
|
6
9
|
PIDFILE=<%= shared_path %>/pids/unicorn.pid
|
7
10
|
CONFIG=<%= shared_path %>/config/unicorn.rb
|
8
|
-
CMD="
|
11
|
+
CMD="<%= ruby_exec_prefix %> unicorn -c $CONFIG -E $RAILS_ENV -D config.ru"
|
9
12
|
|
10
13
|
cd <%= current_path %> >/dev/null
|
11
14
|
|
data/lib/capper/unicorn.rb
CHANGED
@@ -1,75 +1,65 @@
|
|
1
|
-
|
1
|
+
# unicorn configuration variables
|
2
|
+
_cset(:unicorn_worker_processes, 4)
|
3
|
+
_cset(:unicorn_timeout, 30)
|
2
4
|
|
3
|
-
#
|
4
|
-
|
5
|
+
# these cannot be overriden
|
6
|
+
set(:unicorn_script) { File.join(bin_path, "unicorn") }
|
7
|
+
set(:unicorn_config) { File.join(config_path, "unicorn.rb") }
|
8
|
+
set(:unicorn_pidfile) { File.join(pid_path, "unicorn.pid") }
|
5
9
|
|
6
|
-
|
7
|
-
|
10
|
+
after "deploy:update_code", "unicorn:setup"
|
11
|
+
after "deploy:restart", "unicorn:restart"
|
8
12
|
|
9
|
-
|
10
|
-
# unicorn configuration variables
|
11
|
-
_cset(:unicorn_worker_processes, 4)
|
12
|
-
_cset(:unicorn_timeout, 30)
|
13
|
-
|
14
|
-
# these cannot be overriden
|
15
|
-
set(:unicorn_script) { File.join(bin_path, "unicorn") }
|
16
|
-
set(:unicorn_config) { File.join(config_path, "unicorn.rb") }
|
17
|
-
set(:unicorn_pidfile) { File.join(pid_path, "unicorn.pid") }
|
18
|
-
|
19
|
-
monit_config "unicorn", <<EOF, :roles => :app
|
13
|
+
monit_config "unicorn", <<EOF, :roles => :app
|
20
14
|
check process unicorn
|
21
|
-
|
22
|
-
|
23
|
-
|
15
|
+
with pidfile "<%= unicorn_pidfile %>"
|
16
|
+
start program = "<%= unicorn_script %> start" with timeout 60 seconds
|
17
|
+
stop program = "<%= unicorn_script %> stop"
|
24
18
|
EOF
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
desc "Start unicorn"
|
38
|
-
task :start, :roles => :app, :except => { :no_release => true } do
|
39
|
-
run "#{unicorn_script} start"
|
40
|
-
end
|
20
|
+
namespace :unicorn do
|
21
|
+
desc "Generate unicorn configuration files"
|
22
|
+
task :setup, :roles => :app, :except => { :no_release => true } do
|
23
|
+
upload_template_file("unicorn.rb",
|
24
|
+
unicorn_config,
|
25
|
+
:mode => "0644")
|
26
|
+
upload_template_file("unicorn.sh",
|
27
|
+
unicorn_script,
|
28
|
+
:mode => "0755")
|
29
|
+
end
|
41
30
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
31
|
+
desc "Start unicorn"
|
32
|
+
task :start, :roles => :app, :except => { :no_release => true } do
|
33
|
+
run "#{unicorn_script} start"
|
34
|
+
end
|
46
35
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
36
|
+
desc "Stop unicorn"
|
37
|
+
task :stop, :roles => :app, :except => { :no_release => true } do
|
38
|
+
run "#{unicorn_script} stop"
|
39
|
+
end
|
51
40
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
desc "Restart unicorn with zero downtime"
|
42
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
43
|
+
run "#{unicorn_script} upgrade"
|
44
|
+
end
|
56
45
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
desc "Kill unicorn (this should only be used if all else fails)"
|
47
|
+
task :kill, :roles => :app, :except => { :no_release => true } do
|
48
|
+
run "#{unicorn_script} kill"
|
49
|
+
end
|
61
50
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
51
|
+
desc "Add a new worker to the currently running process"
|
52
|
+
task :addworker, :roles => :app, :except => { :no_release => true } do
|
53
|
+
run "#{unicorn_script} addworker"
|
54
|
+
end
|
66
55
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
56
|
+
desc "Remove a worker from the currently running process"
|
57
|
+
task :delworker, :roles => :app, :except => { :no_release => true } do
|
58
|
+
run "#{unicorn_script} delworker"
|
71
59
|
end
|
72
60
|
|
73
|
-
|
74
|
-
|
61
|
+
desc "Rotate all logfiles in the currently running process"
|
62
|
+
task :logrotate, :roles => :app, :except => { :no_release => true } do
|
63
|
+
run "#{unicorn_script} logrotate"
|
64
|
+
end
|
75
65
|
end
|
data/lib/capper/whenever.rb
CHANGED
@@ -1,49 +1,29 @@
|
|
1
|
-
|
1
|
+
set(:whenever_command) { "#{ruby_exec_prefix} whenever" }
|
2
|
+
set(:whenever_identifier) { application }
|
3
|
+
set(:whenever_environment) { fetch(:rails_env, "production") }
|
4
|
+
set(:whenever_update_flags) { "--update-crontab #{whenever_identifier} --set environment=#{whenever_environment}" }
|
5
|
+
set(:whenever_clear_flags) { "--clear-crontab #{whenever_identifier}" }
|
2
6
|
|
3
|
-
|
4
|
-
|
7
|
+
after "deploy:update_code", "whenever:clear_crontab"
|
8
|
+
after "deploy:symlink", "whenever:update_crontab"
|
9
|
+
after "deploy:rollback", "whenever:update_crontab"
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
after "deploy:update_code", "whenever:clear_crontab"
|
15
|
-
# Write the new cron jobs near the end.
|
16
|
-
after "deploy:symlink", "whenever:update_crontab"
|
17
|
-
# If anything goes wrong, undo.
|
18
|
-
after "deploy:rollback", "whenever:update_crontab"
|
19
|
-
|
20
|
-
namespace :whenever do
|
21
|
-
desc <<-DESC
|
22
|
-
Update application's crontab entries using Whenever. You can configure \
|
23
|
-
the command used to invoke Whenever by setting the :whenever_command \
|
24
|
-
variable, which can be used with Bundler to set the command to \
|
25
|
-
"bundle exec whenever". You can configure the identifier used by setting \
|
26
|
-
the :whenever_identifier variable, which defaults to the same value configured \
|
27
|
-
for the :application variable. You can configure the environment by setting \
|
28
|
-
the :whenever_environment variable, which defaults to the same value \
|
29
|
-
configured for the :rails_env variable which itself defaults to "production". \
|
30
|
-
Finally, you can completely override all arguments to the Whenever command \
|
31
|
-
by setting the :whenever_update_flags variable.
|
32
|
-
DESC
|
33
|
-
task :update_crontab do
|
34
|
-
on_rollback do
|
35
|
-
if previous_release
|
36
|
-
run "cd #{previous_release} && #{whenever_command} #{whenever_update_flags}"
|
37
|
-
else
|
38
|
-
run "crontab /dev/null"
|
39
|
-
end
|
11
|
+
namespace :whenever do
|
12
|
+
desc "Update application's crontab entries"
|
13
|
+
task :update_crontab do
|
14
|
+
on_rollback do
|
15
|
+
if previous_release
|
16
|
+
run "cd #{previous_release} && #{whenever_command} #{whenever_update_flags}"
|
17
|
+
else
|
18
|
+
run "crontab /dev/null"
|
40
19
|
end
|
41
|
-
|
42
|
-
run "cd #{current_path} && #{whenever_command} #{whenever_update_flags}"
|
43
20
|
end
|
44
21
|
|
45
|
-
|
46
|
-
|
47
|
-
|
22
|
+
run "cd #{current_path} && #{whenever_command} #{whenever_update_flags}"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Remove all entries from application's crontab"
|
26
|
+
task :clear_crontab do
|
27
|
+
run "crontab /dev/null"
|
48
28
|
end
|
49
29
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: capper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.8.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Benedikt B\xC3\xB6hm"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-23 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: 1.0.0
|
58
58
|
type: :development
|
59
59
|
version_requirements: *id004
|
60
|
-
description:
|
60
|
+
description: Capper is a collection of opinionated Capistrano recipes
|
61
61
|
email:
|
62
62
|
- bb@xnull.de
|
63
63
|
executables: []
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- README.md
|
78
78
|
- Rakefile
|
79
79
|
- capper.gemspec
|
80
|
+
- lib/capper.rb
|
80
81
|
- lib/capper/base.rb
|
81
82
|
- lib/capper/bundler.rb
|
82
83
|
- lib/capper/config.rb
|
@@ -89,7 +90,6 @@ files:
|
|
89
90
|
- lib/capper/rails.rb
|
90
91
|
- lib/capper/resque.rb
|
91
92
|
- lib/capper/rvm.rb
|
92
|
-
- lib/capper/sass.rb
|
93
93
|
- lib/capper/templates/delayed_job.sh.erb
|
94
94
|
- lib/capper/templates/rails.console.sh.erb
|
95
95
|
- lib/capper/templates/resque.sh.erb
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- lib/capper/utils/templates.rb
|
103
103
|
- lib/capper/whenever.rb
|
104
104
|
has_rdoc: true
|
105
|
-
homepage: http://github.com/
|
105
|
+
homepage: http://github.com/zenops/capper
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
108
|
post_install_message:
|
@@ -128,6 +128,6 @@ rubyforge_project:
|
|
128
128
|
rubygems_version: 1.6.2
|
129
129
|
signing_key:
|
130
130
|
specification_version: 3
|
131
|
-
summary:
|
131
|
+
summary: Capper is a collection of opinionated Capistrano recipes
|
132
132
|
test_files: []
|
133
133
|
|
data/lib/capper/sass.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/base' unless defined?(Capper)
|
2
|
-
|
3
|
-
require "capper/rails"
|
4
|
-
|
5
|
-
Capper.load do
|
6
|
-
namespace :sass do
|
7
|
-
desc "Updates the stylesheets generated by Sass"
|
8
|
-
task :update, :roles => :app do
|
9
|
-
run "cd #{release_path} && RAILS_ENV=#{rails_env} bundle exec rake --silent sass:update"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
before "deploy:symlink", "sass:update"
|
14
|
-
end
|