dark-capistrano-recipes 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Jeweler::Tasks.new do |gem|
20
20
  gem.summary =%q{Capistrano recipes}
21
21
  gem.description = %q{Extend the Capistrano gem with these useful recipes}
22
22
  gem.email = "leonardobighetti@gmail.com"
23
- gem.authors = ["Phil Misiowiec", "Leonardo Bighetti"]
23
+ gem.authors = ["Phil Misiowiec", "Leonardo Bighetti", "Rogerio Augusto"]
24
24
  # dependencies defined in Gemfile
25
25
 
26
26
  end
data/VERSION CHANGED
@@ -1,2 +1 @@
1
- 0.8.1
2
-
1
+ 0.8.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dark-capistrano-recipes}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Phil Misiowiec", "Leonardo Bighetti"]
12
- s.date = %q{2011-07-12}
11
+ s.authors = [%q{Phil Misiowiec}, %q{Leonardo Bighetti}, %q{Rogerio Augusto}]
12
+ s.date = %q{2011-08-06}
13
13
  s.description = %q{Extend the Capistrano gem with these useful recipes}
14
14
  s.email = %q{leonardobighetti@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  "dark-capistrano-recipes.gemspec",
27
27
  "doc/god/god",
28
28
  "doc/god/god.conf",
29
- "doc/god/god.init",
29
+ "doc/god/god.init.erb",
30
30
  "doc/nginx/nginx.init",
31
31
  "generators/app.god.erb",
32
32
  "generators/nginx.conf.erb",
@@ -49,9 +49,9 @@ Gem::Specification.new do |s|
49
49
  "lib/recipes/unicorn.rb"
50
50
  ]
51
51
  s.homepage = %q{http://github.com/darkside/capistrano-recipes}
52
- s.licenses = ["MIT"]
53
- s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.6.2}
52
+ s.licenses = [%q{MIT}]
53
+ s.require_paths = [%q{lib}]
54
+ s.rubygems_version = %q{1.8.6}
55
55
  s.summary = %q{Capistrano recipes}
56
56
 
57
57
  if s.respond_to? :specification_version then
@@ -12,7 +12,7 @@
12
12
  NAME=god
13
13
  DESC=god
14
14
 
15
- GOD_BIN=/usr/local/bin/bootup_god
15
+ GOD_BIN=/usr/local/bin/<%= bin_god %>
16
16
  GOD_PID=/var/run/god.pid
17
17
  GOD_LOG=/var/log/god.log
18
18
  set -e
@@ -60,3 +60,4 @@ case "$1" in
60
60
  esac
61
61
 
62
62
  exit $RETVAL
63
+
@@ -2,17 +2,17 @@
2
2
  # These are helper methods that will be available to your recipes.
3
3
  # =========================================================================
4
4
 
5
- # automatically sets the environment based on presence of
5
+ # automatically sets the environment based on presence of
6
6
  # :stage (multistage gem), :rails_env, or RAILS_ENV variable; otherwise defaults to 'production'
7
- def environment
7
+ def environment
8
8
  if exists?(:stage)
9
9
  stage
10
10
  elsif exists?(:rails_env)
11
- rails_env
11
+ rails_env
12
12
  elsif(ENV['RAILS_ENV'])
13
13
  ENV['RAILS_ENV']
14
14
  else
15
- "production"
15
+ "production"
16
16
  end
17
17
  end
18
18
 
@@ -66,18 +66,20 @@ end
66
66
  # Generates a configuration file parsing through ERB
67
67
  # Fetches local file and uploads it to remote_file
68
68
  # Make sure your user has the right permissions.
69
- def generate_config(local_file,remote_file)
69
+ def generate_config(local_file,remote_file,use_sudo=false)
70
70
  temp_file = '/tmp/' + File.basename(local_file)
71
71
  buffer = parse_config(local_file)
72
72
  File.open(temp_file, 'w+') { |f| f << buffer }
73
- upload temp_file, remote_file, :via => :scp
73
+ upload temp_file, temp_file, :via => :scp
74
+ run "#{use_sudo ? sudo : ""} mv #{temp_file} #{remote_file}"
74
75
  `rm #{temp_file}`
75
- end
76
+ end
76
77
 
77
78
  # =========================================================================
78
- # Executes a basic rake task.
79
+ # Executes a basic rake task.
79
80
  # Example: run_rake log:clear
80
81
  # =========================================================================
81
82
  def run_rake(task)
82
83
  run "cd #{current_path} && rake #{task} RAILS_ENV=#{environment}"
83
- end
84
+ end
85
+
@@ -7,7 +7,7 @@ Capistrano::Configuration.instance.load do
7
7
  _cset(:god_remote_config) { "#{shared_path}/config/app.god" }
8
8
 
9
9
  namespace :god do
10
-
10
+
11
11
  desc "|capistrano-recipes| Parses and uploads god configuration for this app"
12
12
  task :setup, :roles => :app do
13
13
  generate_config(god_local_config, god_remote_config)
@@ -15,7 +15,7 @@ Capistrano::Configuration.instance.load do
15
15
 
16
16
  _cset(:bin_god) { defined?(:rvm_ruby_string) ? 'bootup_god' : 'god' }
17
17
  _cset(:server_name) { "#{application}-#{app_server}" }
18
- _cset(:god_init_local) { "#{docs_path}/god/god.init" }
18
+ _cset(:god_init_local) { "#{docs_path}/god/god.init.erb" }
19
19
  _cset :god_init_temp, '/tmp/god.init'
20
20
  _cset :god_init_remote, '/etc/init.d/god'
21
21
  _cset(:god_defo_local) { "#{docs_path}/god/god"}
@@ -24,53 +24,53 @@ Capistrano::Configuration.instance.load do
24
24
  _cset(:god_conf_local) { "#{docs_path}/god/god.conf" }
25
25
  _cset :god_conf_temp, '/tmp/god.conf'
26
26
  _cset :god_conf_remote, '/etc/god/god.conf'
27
-
27
+
28
28
  task :setup_temp, :roles => :app do
29
29
  sudo "rm -f #{god_conf_remote} #{god_init_remote} #{god_defo_remote}"
30
30
  end
31
-
31
+
32
32
  task :setup_conf, :roles => :app do
33
33
  upload god_conf_local, god_conf_temp, :via => :scp
34
34
  sudo "mkdir -p #{File.dirname(god_conf_remote)}"
35
35
  sudo "mv #{god_conf_temp} #{god_conf_remote}"
36
36
  end
37
-
37
+
38
38
  task :setup_init, :roles => :app do
39
- upload god_init_local, god_init_temp, :via => :scp
40
- sudo "mv #{god_init_temp} #{god_init_remote}"
39
+ # Generate the init file and move it as root.
40
+ generate_config(god_init_local, god_init_remote,true)
41
41
  # Allow executing the init.d script
42
42
  sudo "chmod +x #{god_init_remote}"
43
- # Make it run at bootup
44
- sudo "update-rc.d god defaults"
43
+ # Make it run at bootup
44
+ sudo "update-rc.d god defaults"
45
45
  end
46
-
46
+
47
47
  task :setup_defo, :roles => :app do
48
48
  upload god_defo_local, god_defo_temp, :via => :scp
49
49
  sudo "mv #{god_defo_temp} #{god_defo_remote}"
50
50
  end
51
-
51
+
52
52
  desc "|capistrano-recipes| Bootstraps god on your server. Be careful with this."
53
53
  task :bootstrap, :roles => :app do
54
54
  setup_temp
55
55
  setup_defo
56
56
  setup_init
57
- setup_conf
57
+ setup_conf
58
58
 
59
59
  puts "God is bootstrapped. To remove use 'cap god:implode'"
60
60
  end
61
-
61
+
62
62
  desc "|capistrano-recipes| (Seppuku) Completely remove god from the system init"
63
63
  task :implode, :roles => :app do
64
64
  # Removing any system startup links for /etc/init.d/god ...
65
65
  sudo "update-rc.d -f god remove"
66
-
66
+
67
67
  # Suicide follows.
68
68
  sudo "rm -f #{god_conf_remote}"
69
69
  sudo "rm -f #{god_defo_remote}"
70
70
  sudo "rm -f #{god_init_remote}"
71
71
  puts "God is no more."
72
72
  end
73
-
73
+
74
74
  desc "|capistrano-recipes| Use god to restart the app"
75
75
  namespace :restart do
76
76
  task :default, :roles => :app, :except => { :no_release => true } do
@@ -82,12 +82,12 @@ Capistrano::Configuration.instance.load do
82
82
  sudo "#{bin_god} restart #{application}-#{app_server.to_s.downcase}"
83
83
  end
84
84
  end
85
-
85
+
86
86
  desc "|capistrano-recipes| Fetches the log for the whole group"
87
87
  task :log, :roles => :app do
88
88
  sudo "#{bin_god} log #{application}"
89
89
  end
90
-
90
+
91
91
  desc "|capistrano-recipes| Reload config"
92
92
  task :reload, :roles => :app do
93
93
  sudo "#{bin_god} load #{god_remote_config}"
@@ -97,12 +97,12 @@ Capistrano::Configuration.instance.load do
97
97
  task :start, :roles => :app do
98
98
  sudo "service god start"
99
99
  end
100
-
100
+
101
101
  desc "|capistrano-recipes| Stops god service"
102
102
  task :stop, :roles => :app do
103
103
  sudo "service god stop"
104
104
  end
105
-
105
+
106
106
  desc "|capistrano-recipes| Quit god, but not the processes it's monitoring"
107
107
  task :quit, :roles => :app do
108
108
  sudo "#{bin_god} quit"
@@ -118,8 +118,9 @@ Capistrano::Configuration.instance.load do
118
118
  sudo "#{bin_god} status"
119
119
  end
120
120
  end
121
-
121
+
122
122
  after 'deploy:setup' do
123
123
  god.setup if Capistrano::CLI.ui.agree("Create app.god in app's shared path? [Yn]")
124
124
  end if is_using('god', :monitorer)
125
125
  end
126
+
@@ -7,12 +7,12 @@ Capistrano::Configuration.instance.load do
7
7
 
8
8
  desc "|capistrano-recipes| Inspect Phusion Passenger's memory usage."
9
9
  task :memory, :roles => :app do
10
- run "sudo passenger-memory-stats"
10
+ run "#{sudo} passenger-memory-stats"
11
11
  end
12
12
 
13
13
  desc "|capistrano-recipes| Inspect Phusion Passenger's internal status."
14
14
  task :status, :roles => :app do
15
- run "sudo passenger-status"
15
+ run "#{sudo} passenger-status"
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,26 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dark-capistrano-recipes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Phil Misiowiec
14
14
  - Leonardo Bighetti
15
+ - Rogerio Augusto
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-07-12 00:00:00 -03:00
20
- default_executable:
20
+ date: 2011-08-06 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- type: :runtime
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
@@ -32,11 +31,11 @@ dependencies:
32
31
  - 5
33
32
  - 9
34
33
  version: 2.5.9
35
- name: capistrano
36
34
  version_requirements: *id001
35
+ name: capistrano
37
36
  prerelease: false
38
- - !ruby/object:Gem::Dependency
39
37
  type: :runtime
38
+ - !ruby/object:Gem::Dependency
40
39
  requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
@@ -48,11 +47,11 @@ dependencies:
48
47
  - 2
49
48
  - 1
50
49
  version: 1.2.1
51
- name: capistrano-ext
52
50
  version_requirements: *id002
51
+ name: capistrano-ext
53
52
  prerelease: false
53
+ type: :runtime
54
54
  - !ruby/object:Gem::Dependency
55
- type: :development
56
55
  requirement: &id003 !ruby/object:Gem::Requirement
57
56
  none: false
58
57
  requirements:
@@ -62,11 +61,11 @@ dependencies:
62
61
  segments:
63
62
  - 0
64
63
  version: "0"
65
- name: shoulda
66
64
  version_requirements: *id003
65
+ name: shoulda
67
66
  prerelease: false
68
- - !ruby/object:Gem::Dependency
69
67
  type: :development
68
+ - !ruby/object:Gem::Dependency
70
69
  requirement: &id004 !ruby/object:Gem::Requirement
71
70
  none: false
72
71
  requirements:
@@ -78,11 +77,11 @@ dependencies:
78
77
  - 0
79
78
  - 0
80
79
  version: 1.0.0
81
- name: bundler
82
80
  version_requirements: *id004
81
+ name: bundler
83
82
  prerelease: false
84
- - !ruby/object:Gem::Dependency
85
83
  type: :development
84
+ - !ruby/object:Gem::Dependency
86
85
  requirement: &id005 !ruby/object:Gem::Requirement
87
86
  none: false
88
87
  requirements:
@@ -94,11 +93,11 @@ dependencies:
94
93
  - 6
95
94
  - 4
96
95
  version: 1.6.4
97
- name: jeweler
98
96
  version_requirements: *id005
97
+ name: jeweler
99
98
  prerelease: false
100
- - !ruby/object:Gem::Dependency
101
99
  type: :development
100
+ - !ruby/object:Gem::Dependency
102
101
  requirement: &id006 !ruby/object:Gem::Requirement
103
102
  none: false
104
103
  requirements:
@@ -109,11 +108,11 @@ dependencies:
109
108
  - 2
110
109
  - 4
111
110
  version: "2.4"
112
- name: rdoc
113
111
  version_requirements: *id006
112
+ name: rdoc
114
113
  prerelease: false
115
- - !ruby/object:Gem::Dependency
116
114
  type: :development
115
+ - !ruby/object:Gem::Dependency
117
116
  requirement: &id007 !ruby/object:Gem::Requirement
118
117
  none: false
119
118
  requirements:
@@ -123,9 +122,10 @@ dependencies:
123
122
  segments:
124
123
  - 0
125
124
  version: "0"
126
- name: rcov
127
125
  version_requirements: *id007
126
+ name: rcov
128
127
  prerelease: false
128
+ type: :development
129
129
  description: Extend the Capistrano gem with these useful recipes
130
130
  email: leonardobighetti@gmail.com
131
131
  executables: []
@@ -145,7 +145,7 @@ files:
145
145
  - dark-capistrano-recipes.gemspec
146
146
  - doc/god/god
147
147
  - doc/god/god.conf
148
- - doc/god/god.init
148
+ - doc/god/god.init.erb
149
149
  - doc/nginx/nginx.init
150
150
  - generators/app.god.erb
151
151
  - generators/nginx.conf.erb
@@ -166,7 +166,6 @@ files:
166
166
  - lib/recipes/sphinx.rb
167
167
  - lib/recipes/symlinks.rb
168
168
  - lib/recipes/unicorn.rb
169
- has_rdoc: true
170
169
  homepage: http://github.com/darkside/capistrano-recipes
171
170
  licenses:
172
171
  - MIT
@@ -196,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
195
  requirements: []
197
196
 
198
197
  rubyforge_project:
199
- rubygems_version: 1.6.2
198
+ rubygems_version: 1.8.6
200
199
  signing_key:
201
200
  specification_version: 3
202
201
  summary: Capistrano recipes