capistrano-windows-server 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -211,6 +211,17 @@ The following tasks were removed:
211
211
  * `cap deploy:symlink`
212
212
 
213
213
 
214
+ Deploying to both Windows and Linux servers
215
+ -------------------------------------------
216
+
217
+ If you use capistrano/ext/multistage, you can specify that some stages are not Windows servers.
218
+
219
+ In your stage configuration file (eg: config/deploy/linux_target.rb) call the method
220
+
221
+ not_windows!
222
+
223
+ This will prevent capistrano from loading capistrano-windows-server when deploying to that stage.
224
+
214
225
  Contributing to capistrano-windows-server
215
226
  -----------------------------------------
216
227
 
@@ -227,4 +238,4 @@ We would love if you contribute back changes that you make to make it work for y
227
238
  Copyright
228
239
  ---------
229
240
 
230
- Copyright (c) 2011 SciMed Solutions, Inc. See LICENSE.txt for further details.
241
+ Copyright (c) 2011-2012 SciMed Solutions, Inc. See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.7.0
@@ -4,16 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{capistrano-windows-server}
8
- s.version = "0.6.1"
7
+ s.name = "capistrano-windows-server"
8
+ s.version = "0.7.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Edward Anderson"]
12
- s.date = %q{2012-07-01}
13
- s.description = %q{This gem modifies capistrano recipes to allow deploys to windows machines.
14
- Several nuances such as the lack of symlinks make the deploy a little different, but it's better than doing it by hand.
15
- See the github page for instruction on how to set up Windows to get it ready for a deploy.}
16
- s.email = %q{edward.anderson@scimedsolutions.com}
12
+ s.date = "2012-11-09"
13
+ s.description = "This gem modifies capistrano recipes to allow deploys to windows machines.\nSeveral nuances such as the lack of symlinks make the deploy a little different, but it's better than doing it by hand.\nSee the github page for instruction on how to set up Windows to get it ready for a deploy."
14
+ s.email = "edward.anderson@scimedsolutions.com"
17
15
  s.extra_rdoc_files = [
18
16
  "LICENSE.txt",
19
17
  "README.md"
@@ -28,13 +26,14 @@ See the github page for instruction on how to set up Windows to get it ready for
28
26
  "VERSION",
29
27
  "capistrano-windows-server.gemspec",
30
28
  "lib/capistrano-windows-server.rb",
31
- "lib/capistrano/ext/windows_server.rb"
29
+ "lib/capistrano/ext/windows_server.rb",
30
+ "lib/capistrano/ext/windows_server/target_system_check.rb"
32
31
  ]
33
- s.homepage = %q{http://github.com/nilbus/capistrano-windows-server}
32
+ s.homepage = "http://github.com/nilbus/capistrano-windows-server"
34
33
  s.licenses = ["MIT"]
35
34
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.4.2}
37
- s.summary = %q{Deploy Ruby on Rails applications with Capistrano to Windows servers}
35
+ s.rubygems_version = "1.8.24"
36
+ s.summary = "Deploy Ruby on Rails applications with Capistrano to Windows servers"
38
37
 
39
38
  if s.respond_to? :specification_version then
40
39
  s.specification_version = 3
@@ -1,270 +1,282 @@
1
+ require 'capistrano/ext/windows_server/target_system_check'
2
+
1
3
  # Capistrano 1 and 2 have different configuration locations
2
4
  configuration = Capistrano::Configuration.respond_to?(:instance) ?
3
5
  Capistrano::Configuration.instance(:must_exist) :
4
6
  Capistrano.configuration(:must_exist)
5
7
 
6
- configuration.load do
7
- set :scm, :git
8
- set :deploy_via, :remote_cache
9
- set :shared_dir, "."
10
- set :repository_cache, "current"
11
- set :scm_verbose, true
12
- set :use_sudo, false
13
- set :default_shell, false
8
+ if TargetSystemCheck.windows?
9
+ configuration.load do
10
+ set :scm, :git
11
+ set :deploy_via, :remote_cache
12
+ set :shared_dir, "."
13
+ set :repository_cache, "current"
14
+ set :scm_verbose, true
15
+ set :use_sudo, false
16
+ set :default_shell, false
14
17
 
15
- def strip_cygdrive(path)
16
- path.sub /\/cygdrive\/([c-z])\//, '\1:/'
17
- end
18
+ def strip_cygdrive(path)
19
+ path.sub /\/cygdrive\/([c-z])\//, '\1:/'
20
+ end
18
21
 
19
- def latest_release
20
- strip_cygdrive current_path
21
- end
22
-
23
- # Probably not compatible with multiple roles with different PATHs
24
- def system_path
25
- return @system_path if @system_path
22
+ def latest_release
23
+ strip_cygdrive current_path
24
+ end
26
25
 
27
- @system_path = "/bin:" + "/usr/bin:"
28
- run 'echo $PATH' { |channel, stream, data| @system_path << data.strip }
29
- @system_path
30
- end
31
-
32
- task :path do
33
- puts system_path.inspect
34
- end
35
-
36
- def run_ruby_cmd(cmd)
37
- bundler_git_path = "#{File.dirname(bundler_git_command)}:" rescue nil
38
- run "cd #{current_path} && PATH='#{bundler_git_path}#{system_path}' ruby -S #{cmd}"
39
- end
40
-
41
- def bundle_exec(cmd)
42
- if gemfile_present?
43
- run_ruby_cmd "bundle exec #{cmd}"
44
- else
45
- run_ruby_cmd cmd
26
+ # Probably not compatible with multiple roles with different PATHs
27
+ def system_path
28
+ return @system_path if @system_path
29
+
30
+ @system_path = "/bin:" + "/usr/bin:"
31
+ run('echo $PATH') { |channel, stream, data| @system_path << data.strip }
32
+ @system_path
33
+ end
34
+
35
+ task :path do
36
+ puts system_path.inspect
37
+ end
38
+
39
+ def run_ruby_cmd(cmd)
40
+ bundler_git_path = "#{File.dirname(bundler_git_command)}:" rescue nil
41
+ run "cd #{current_path} && PATH='#{bundler_git_path}#{system_path}' ruby -S #{cmd}"
42
+ end
43
+
44
+ def bundle_exec(cmd)
45
+ if gemfile_present?
46
+ run_ruby_cmd "bundle exec #{cmd}"
47
+ else
48
+ run_ruby_cmd cmd
49
+ end
50
+ end
51
+
52
+ def application_server
53
+ app_server rescue :mongrel
54
+ end
55
+
56
+ def gemfile_present?
57
+ File.exists? "Gemfile"
46
58
  end
47
- end
48
-
49
- def application_server
50
- app_server rescue :mongrel
51
- end
52
-
53
- def gemfile_present?
54
- File.exists? "Gemfile"
55
- end
56
59
 
57
- namespace :deploy do
58
- desc "Update the code on the server by doing a git reset --hard <ref> in the current/ directory"
59
- task :update_code do
60
- # update_repository_cache will attempt to clean out the repository; we must prevent that.
61
- # /bin/git below is where www.windowsgit.com's windows git/ssh installation puts the git executable.
62
- # This creates a git wrapper that goes in $PATH before /bin, which will filter out any `git clean` commands.
63
- run "/bin/mkdir -p '#{shared_path}/bin'"
64
- run <<-RUN
65
- echo 'if [ "$1" != "clean" ]; then /bin/git $*; fi' > "#{shared_path}/bin/git.exe"
66
- RUN
67
- alter_path_cmd = "export PATH=#{shared_path}/bin:$PATH # Required for capistrano-windows-server"
68
- run <<-RUN
69
- if ! /bin/grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
70
- RUN
60
+ namespace :deploy do
61
+ desc "Update the code on the server by doing a git reset --hard <ref> in the current/ directory"
62
+ task :update_code do
63
+ # update_repository_cache will attempt to clean out the repository; we must prevent that.
64
+ # /bin/git below is where www.windowsgit.com's windows git/ssh installation puts the git executable.
65
+ # This creates a git wrapper that goes in $PATH before /bin, which will filter out any `git clean` commands.
66
+ run "/bin/mkdir -p '#{shared_path}/bin'"
67
+ run <<-RUN
68
+ echo 'if [ "$1" != "clean" ]; then /bin/git $*; fi' > "#{shared_path}/bin/git.exe"
69
+ RUN
70
+ alter_path_cmd = "export PATH=#{shared_path}/bin:$PATH # Required for capistrano-windows-server"
71
+ run <<-RUN
72
+ if ! /bin/grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
73
+ RUN
71
74
 
72
- continue = true
73
- while continue
74
- begin
75
- strategy.send 'update_repository_cache'
76
- continue = false
77
- rescue
78
- puts "Failed to check out git. If the error was 'fatal: The remote end hung up unexpectedly', this is due to a cygwin ssh bug."
79
- puts "It often works to just try again repeatedly (a lot! 30+ times for an initial clone - it's like playing the lottery :-)"
80
- @try_again_response ||= Capistrano::CLI.ui.ask("Keep trying? [Y/n]: ").to_s.chomp
81
- unless @try_again_response.empty? || @try_again_response.downcase == 'y'
75
+ continue = true
76
+ while continue
77
+ begin
78
+ strategy.send 'update_repository_cache'
82
79
  continue = false
83
- raise $!
80
+ rescue
81
+ puts "Failed to check out git. If the error was 'fatal: The remote end hung up unexpectedly', this is due to a cygwin ssh bug."
82
+ puts "It often works to just try again repeatedly (a lot! 30+ times for an initial clone - it's like playing the lottery :-)"
83
+ @try_again_response ||= Capistrano::CLI.ui.ask("Keep trying? [Y/n]: ").to_s.chomp
84
+ unless @try_again_response.empty? || @try_again_response.downcase == 'y'
85
+ continue = false
86
+ raise $!
87
+ end
84
88
  end
85
89
  end
90
+ finalize_update
86
91
  end
87
- finalize_update
88
- end
89
92
 
90
- desc <<-DESC
91
- Prepares one or more servers for deployment. Before you can use any \
92
- of the Capistrano deployment tasks with your project, you will need to \
93
- make sure all of your servers have been prepared with `cap deploy:setup'. When \
94
- you add a new server to your cluster, you can easily run the setup task \
95
- on just that server by specifying the HOSTS environment variable:
93
+ desc <<-DESC
94
+ Prepares one or more servers for deployment. Before you can use any \
95
+ of the Capistrano deployment tasks with your project, you will need to \
96
+ make sure all of your servers have been prepared with `cap deploy:setup'. When \
97
+ you add a new server to your cluster, you can easily run the setup task \
98
+ on just that server by specifying the HOSTS environment variable:
96
99
 
97
- $ cap HOSTS=new.server.com deploy:setup
100
+ $ cap HOSTS=new.server.com deploy:setup
98
101
 
99
- It is safe to run this task on servers that have already been set up; it \
100
- will not destroy any deployed revisions or data.
101
- DESC
102
- task :setup do
103
- dirs = [deploy_to]
104
- run "/bin/mkdir -p #{dirs.join(' ')} && /bin/chmod g+w #{dirs.join(' ')}"
102
+ It is safe to run this task on servers that have already been set up; it \
103
+ will not destroy any deployed revisions or data.
104
+ DESC
105
+ task :setup do
106
+ dirs = [deploy_to]
107
+ run "/bin/mkdir -p #{dirs.join(' ')} && /bin/chmod g+w #{dirs.join(' ')}"
105
108
 
106
- if exists?(:repository_host_key)
107
- run "if ! /bin/grep '#{repository_host_key}' ~/.ssh/known_hosts > /dev/null; then echo '#{repository_host_key}' >> ~/.ssh/known_hosts; fi"
109
+ if exists?(:repository_host_key)
110
+ run "if ! /bin/grep '#{repository_host_key}' ~/.ssh/known_hosts > /dev/null; then echo '#{repository_host_key}' >> ~/.ssh/known_hosts; fi"
111
+ end
108
112
  end
109
- end
110
113
 
111
- # Clear out tasks that are not appropriate on Windows
112
- %w(finalize_update create_symlink symlink cleanup).each do |removed_task|
113
- task removed_task do; end
114
- end
115
- namespace :rollback do
116
- %w(code default).each do |removed_task|
114
+ # Clear out tasks that are not appropriate on Windows
115
+ %w(finalize_update create_symlink symlink cleanup).each do |removed_task|
117
116
  task removed_task do; end
118
117
  end
119
- end
120
-
121
- desc "Run pending migrations. Override the default rails environment with RAILS_ENV"
122
- task :migrate do
123
- bundle_exec "rake db:migrate RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
124
- end
125
-
126
- desc "Start mongrel"
127
- task :start do
128
- return unless application_server == :mongrel
129
- mongrel_instances.each do |n|
130
- run "net start #{mongrel_instance_prefix}#{n}; true"
118
+ namespace :rollback do
119
+ %w(code default).each do |removed_task|
120
+ task removed_task do; end
121
+ end
131
122
  end
132
- end
133
123
 
134
- desc "Stop mongrel"
135
- task :stop do
136
- return unless application_server == :mongrel
137
- mongrel_instances.each do |n|
138
- run "net stop #{mongrel_instance_prefix}#{n}; true"
124
+ desc "Run pending migrations. Override the default rails environment with RAILS_ENV"
125
+ task :migrate do
126
+ bundle_exec "rake db:migrate RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
139
127
  end
140
- end
141
128
 
142
- desc "Restart mongrel"
143
- task :restart do
144
- return unless application_server == :mongrel
145
- mongrel_instances.each do |n|
146
- run "net stop #{mongrel_instance_prefix}#{n}; true"
147
- run "net start #{mongrel_instance_prefix}#{n}; true"
129
+ desc "Start mongrel"
130
+ task :start do
131
+ return unless application_server == :mongrel
132
+ mongrel_instances.each do |n|
133
+ run "net start #{mongrel_instance_prefix}#{n}; true"
134
+ end
148
135
  end
149
- end
150
136
 
151
- namespace :mongrel do
152
- desc "Create mongrel services"
153
- task :setup do
137
+ desc "Stop mongrel"
138
+ task :stop do
154
139
  return unless application_server == :mongrel
155
140
  mongrel_instances.each do |n|
156
- run "/bin/mkdir -p #{current_path}/{tmp,log}" # These are often not under version control, but their absence keeps mongrel from recognizing the rails app
157
- bundle_exec "mongrel_rails service::install -e #{rails_env} -N #{mongrel_instance_prefix}#{n} -p #{base_port + n - mongrel_instances.first}; true"
158
- run %Q(sc.exe config "#{mongrel_instance_prefix}#{n}" start= auto type= interact type= own; true)
141
+ run "net stop #{mongrel_instance_prefix}#{n}; true"
159
142
  end
160
143
  end
161
144
 
162
- desc "Remove mongrel services"
163
- task :remove do
145
+ desc "Restart mongrel"
146
+ task :restart do
147
+ return unless application_server == :mongrel
164
148
  mongrel_instances.each do |n|
165
- bundle_exec "mongrel_rails service::remove -N #{mongrel_instance_prefix}#{n}; true"
149
+ run "net stop #{mongrel_instance_prefix}#{n}; true"
150
+ run "net start #{mongrel_instance_prefix}#{n}; true"
166
151
  end
167
152
  end
168
- end
169
153
 
170
- namespace :assets do
171
- task :symlink, :roles => :web, :except => { :no_release => true } do
154
+ namespace :mongrel do
155
+ desc "Create mongrel services"
156
+ task :setup do
157
+ return unless application_server == :mongrel
158
+ mongrel_instances.each do |n|
159
+ run "/bin/mkdir -p #{current_path}/{tmp,log}" # These are often not under version control, but their absence keeps mongrel from recognizing the rails app
160
+ bundle_exec "mongrel_rails service::install -e #{rails_env} -N #{mongrel_instance_prefix}#{n} -p #{base_port + n - mongrel_instances.first}; true"
161
+ run %Q(sc.exe config "#{mongrel_instance_prefix}#{n}" start= auto type= interact type= own; true)
162
+ end
163
+ end
164
+
165
+ desc "Remove mongrel services"
166
+ task :remove do
167
+ mongrel_instances.each do |n|
168
+ bundle_exec "mongrel_rails service::remove -N #{mongrel_instance_prefix}#{n}; true"
169
+ end
170
+ end
172
171
  end
173
172
 
174
- desc <<-DESC
175
- Run the asset precompilation rake task. You can specify the full path \
176
- to the rake executable by setting the rake variable. You can also \
177
- specify additional environment variables to pass to rake via the \
178
- asset_env variable. The defaults are:
173
+ namespace :assets do
174
+ task :symlink, :roles => :web, :except => { :no_release => true } do
175
+ end
179
176
 
180
- set :rake, "rake"
181
- set :rails_env, "production"
182
- set :asset_env, "RAILS_GROUPS=assets"
183
- DESC
184
- task :precompile, :roles => :web, :except => { :no_release => true } do
185
- run "rm -rf #{current_path}/public/#{assets_prefix}"
186
- bundle_exec "rake RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
187
- end
177
+ desc <<-DESC
178
+ Run the asset precompilation rake task. You can specify the full path \
179
+ to the rake executable by setting the rake variable. You can also \
180
+ specify additional environment variables to pass to rake via the \
181
+ asset_env variable. The defaults are:
188
182
 
189
- desc <<-DESC
190
- Run the asset clean rake task. Use with caution, this will delete \
191
- all of your compiled assets. You can specify the full path \
192
- to the rake executable by setting the rake variable. You can also \
193
- specify additional environment variables to pass to rake via the \
194
- asset_env variable. The defaults are:
183
+ set :rake, "rake"
184
+ set :rails_env, "production"
185
+ set :asset_env, "RAILS_GROUPS=assets"
186
+ DESC
187
+ task :precompile, :roles => :web, :except => { :no_release => true } do
188
+ run "rm -rf #{current_path}/public/#{assets_prefix}"
189
+ bundle_exec "rake RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
190
+ end
195
191
 
196
- set :rake, "rake"
197
- set :rails_env, "production"
198
- set :asset_env, "RAILS_GROUPS=assets"
199
- DESC
200
- task :clean, :roles => :web, :except => { :no_release => true } do
201
- bundle_exec "rake RAILS_ENV=#{rails_env} #{asset_env} assets:clean"
192
+ desc <<-DESC
193
+ Run the asset clean rake task. Use with caution, this will delete \
194
+ all of your compiled assets. You can specify the full path \
195
+ to the rake executable by setting the rake variable. You can also \
196
+ specify additional environment variables to pass to rake via the \
197
+ asset_env variable. The defaults are:
198
+
199
+ set :rake, "rake"
200
+ set :rails_env, "production"
201
+ set :asset_env, "RAILS_GROUPS=assets"
202
+ DESC
203
+ task :clean, :roles => :web, :except => { :no_release => true } do
204
+ bundle_exec "rake RAILS_ENV=#{rails_env} #{asset_env} assets:clean"
205
+ end
202
206
  end
203
207
  end
204
- end
205
-
206
- desc "Run a rake command in COMMAND. RAILS_ENV for the configured environment will be included; it can be overridden by setting RAILS_ENV"
207
- task :rake do
208
- raise "Specify the command with COMMAND='some:task with_arguments'" unless ENV['COMMAND']
209
- bundle_exec "rake #{ENV['COMMAND']} RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
210
- end
211
-
212
- desc "Run a rubygems (gem) command in COMMAND"
213
- task :rubygems do
214
- raise "Specify the command with COMMAND='install rails'" unless ENV['COMMAND']
215
- bundle_exec "gem #{ENV['COMMAND']}"
216
- end
217
-
218
- desc "Run a git command in COMMAND"
219
- task :git do
220
- raise "Specify the command with COMMAND. eg: COMMAND='diff HEAD^^'" unless ENV['COMMAND']
221
- run "cd #{current_path} && /bin/git #{ENV['COMMAND']}"
222
- end
223
208
 
224
- namespace :bundle do
225
- desc "Execute a COMMAND with bundle exec"
226
- task :default do
227
- raise "No Gemfile detected" unless gemfile_present?
228
- raise "Specify the command with COMMAND. eg: COMMAND='rake db:migrate'" unless ENV['COMMAND']
229
- bundle_exec ENV['COMMAND']
209
+ desc "Run a rake command in COMMAND. RAILS_ENV for the configured environment will be included; it can be overridden by setting RAILS_ENV"
210
+ task :rake do
211
+ raise "Specify the command with COMMAND='some:task with_arguments'" unless ENV['COMMAND']
212
+ bundle_exec "rake #{ENV['COMMAND']} RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
213
+ end
214
+
215
+ desc "Run a rubygems (gem) command in COMMAND"
216
+ task :rubygems do
217
+ raise "Specify the command with COMMAND='install rails'" unless ENV['COMMAND']
218
+ bundle_exec "gem #{ENV['COMMAND']}"
219
+ end
220
+
221
+ desc "Run a git command in COMMAND"
222
+ task :git do
223
+ raise "Specify the command with COMMAND. eg: COMMAND='diff HEAD^^'" unless ENV['COMMAND']
224
+ run "cd #{current_path} && /bin/git #{ENV['COMMAND']}"
230
225
  end
231
226
 
232
- desc <<-DESC
233
- Install the current Bundler environment. By default, gems will be \
234
- installed to the shared/bundle path. Gems in the development and \
235
- test group will not be installed. The install command is executed \
236
- with the --deployment and --quiet flags. If the bundle cmd cannot \
237
- be found then you can override the bundle_cmd variable to specifiy \
238
- which one it should use.
227
+ namespace :bundle do
228
+ desc "Execute a COMMAND with bundle exec"
229
+ task :default do
230
+ raise "No Gemfile detected" unless gemfile_present?
231
+ raise "Specify the command with COMMAND. eg: COMMAND='rake db:migrate'" unless ENV['COMMAND']
232
+ bundle_exec ENV['COMMAND']
233
+ end
239
234
 
240
- You can override any of these defaults by setting the variables shown below.
235
+ desc <<-DESC
236
+ Install the current Bundler environment. By default, gems will be \
237
+ installed to the shared/bundle path. Gems in the development and \
238
+ test group will not be installed. The install command is executed \
239
+ with the --deployment and --quiet flags. If the bundle cmd cannot \
240
+ be found then you can override the bundle_cmd variable to specifiy \
241
+ which one it should use.
241
242
 
242
- N.B. bundle_roles must be defined before you require 'bundler/capistrano' \
243
- in your deploy.rb file.
243
+ You can override any of these defaults by setting the variables shown below.
244
244
 
245
- set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
246
- set :bundle_flags, "--deployment --quiet"
247
- set :bundle_without, [:development, :test]
248
- set :bundle_roles, :app # e.g. [:app, :batch]
249
- DESC
250
- task :install do
251
- raise "No Gemfile detected" unless gemfile_present?
252
- bundle_flags = fetch(:bundle_flags, "--deployment --quiet")
253
- bundle_dir = '../bundle'
254
- bundle_without = [*fetch(:bundle_without, [:development, :test])].compact
255
- current_release = fetch(:current_path)
256
- if current_release.to_s.empty?
257
- raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
258
- end
259
- args = [bundle_flags.to_s]
260
- args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
261
- args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
245
+ N.B. bundle_roles must be defined before you require 'bundler/capistrano' \
246
+ in your deploy.rb file.
247
+
248
+ set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
249
+ set :bundle_flags, "--deployment --quiet"
250
+ set :bundle_without, [:development, :test]
251
+ set :bundle_roles, :app # e.g. [:app, :batch]
252
+ DESC
253
+ task :install do
254
+ raise "No Gemfile detected" unless gemfile_present?
255
+ bundle_flags = fetch(:bundle_flags, "--deployment --quiet")
256
+ bundle_dir = '../bundle'
257
+ bundle_without = [*fetch(:bundle_without, [:development, :test])].compact
258
+ current_release = fetch(:current_path)
259
+ if current_release.to_s.empty?
260
+ raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
261
+ end
262
+ args = [bundle_flags.to_s]
263
+ args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
264
+ args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
262
265
 
263
- run_ruby_cmd "bundle install #{args.join(' ')}"
266
+ run_ruby_cmd "bundle install #{args.join(' ')}"
267
+ end
264
268
  end
265
- end
266
269
 
267
- after 'deploy:setup', 'deploy:update_code'
268
- after 'deploy:setup', 'deploy:mongrel:setup'
270
+ after 'deploy:setup', 'deploy:update_code'
271
+ after 'deploy:setup', 'deploy:mongrel:setup'
269
272
 
273
+ end
274
+ else
275
+ # Call this method in a stage's configuration file (eg: deploy/staging.rb)
276
+ # if that deploy target is not a Windows server.
277
+ # This method is a no-op, but if that method is called from a stage recipe,
278
+ # the capistrano-windows-server code does not load for that target.
279
+ # Use this when some of your servers are Windows and some are Linux, etc.
280
+ def not_windows!
281
+ end
270
282
  end
@@ -0,0 +1,21 @@
1
+ module TargetSystemCheck
2
+ class << self
3
+ def windows?
4
+ not recipe_disables_windows? stage_file
5
+ end
6
+
7
+ # @return current stage name
8
+ def stage_argument
9
+ ARGV.first
10
+ end
11
+
12
+ # @return [File] the stage configuration file
13
+ def stage_file
14
+ File.open "config/deploy/#{stage_argument}.rb"
15
+ end
16
+
17
+ def recipe_disables_windows?(file)
18
+ file.to_a.grep(/^\s*not_windows!(\(\s*\))?\s*(#.*)?$/).any?
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,66 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-windows-server
3
- version: !ruby/object:Gem::Version
4
- hash: 5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 6
9
- - 1
10
- version: 0.6.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Edward Anderson
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-01 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: capistrano
24
- type: :runtime
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
- version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
36
23
  prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
37
31
  name: jeweler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.6.4
38
38
  type: :development
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
40
41
  none: false
41
- requirements:
42
+ requirements:
42
43
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 7
45
- segments:
46
- - 1
47
- - 6
48
- - 4
44
+ - !ruby/object:Gem::Version
49
45
  version: 1.6.4
50
- requirement: *id002
51
- description: |-
52
- This gem modifies capistrano recipes to allow deploys to windows machines.
53
- Several nuances such as the lack of symlinks make the deploy a little different, but it's better than doing it by hand.
54
- See the github page for instruction on how to set up Windows to get it ready for a deploy.
46
+ description: ! 'This gem modifies capistrano recipes to allow deploys to windows machines.
47
+
48
+ Several nuances such as the lack of symlinks make the deploy a little different,
49
+ but it''s better than doing it by hand.
50
+
51
+ See the github page for instruction on how to set up Windows to get it ready for
52
+ a deploy.'
55
53
  email: edward.anderson@scimedsolutions.com
56
54
  executables: []
57
-
58
55
  extensions: []
59
-
60
- extra_rdoc_files:
56
+ extra_rdoc_files:
61
57
  - LICENSE.txt
62
58
  - README.md
63
- files:
59
+ files:
64
60
  - .document
65
61
  - Gemfile
66
62
  - Gemfile.lock
@@ -71,39 +67,33 @@ files:
71
67
  - capistrano-windows-server.gemspec
72
68
  - lib/capistrano-windows-server.rb
73
69
  - lib/capistrano/ext/windows_server.rb
74
- has_rdoc: true
70
+ - lib/capistrano/ext/windows_server/target_system_check.rb
75
71
  homepage: http://github.com/nilbus/capistrano-windows-server
76
- licenses:
72
+ licenses:
77
73
  - MIT
78
74
  post_install_message:
79
75
  rdoc_options: []
80
-
81
- require_paths:
76
+ require_paths:
82
77
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
78
+ required_ruby_version: !ruby/object:Gem::Requirement
84
79
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ segments:
90
85
  - 0
91
- version: "0"
92
- required_rubygems_version: !ruby/object:Gem::Requirement
86
+ hash: 2799260122082025510
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
88
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
101
93
  requirements: []
102
-
103
94
  rubyforge_project:
104
- rubygems_version: 1.4.2
95
+ rubygems_version: 1.8.24
105
96
  signing_key:
106
97
  specification_version: 3
107
98
  summary: Deploy Ruby on Rails applications with Capistrano to Windows servers
108
99
  test_files: []
109
-