capistrano-windows-server 0.4.6 → 0.5.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/Gemfile.lock +2 -2
- data/README.md +6 -6
- data/VERSION +1 -1
- data/capistrano-windows-server.gemspec +3 -2
- data/lib/capistrano-windows-server.rb +0 -0
- data/lib/capistrano/ext/windows_server.rb +57 -44
- metadata +6 -5
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
capistrano (2.
|
4
|
+
capistrano (2.11.2)
|
5
5
|
highline
|
6
6
|
net-scp (>= 1.0.0)
|
7
7
|
net-sftp (>= 2.0.0)
|
8
8
|
net-ssh (>= 2.0.14)
|
9
9
|
net-ssh-gateway (>= 1.1.0)
|
10
10
|
git (1.2.5)
|
11
|
-
highline (1.6.
|
11
|
+
highline (1.6.11)
|
12
12
|
jeweler (1.6.4)
|
13
13
|
bundler (~> 1.0)
|
14
14
|
git (>= 1.2.5)
|
data/README.md
CHANGED
@@ -99,12 +99,12 @@ There are a few configuration values that need to be set in your deploy.rb, in a
|
|
99
99
|
|
100
100
|
set :rails_env, 'production'
|
101
101
|
set :user, 'git'
|
102
|
-
set :deploy_to, "/cygdrive/c/rails_apps/#{application}"
|
103
|
-
set :mongrel_instances, (1..3)
|
104
|
-
set :mongrel_instance_prefix, 'mongrel_'
|
105
|
-
set :base_port, 8000
|
106
|
-
|
107
|
-
|
102
|
+
set :deploy_to, "/cygdrive/c/rails_apps/#{application}" # Deploy to C:\rails_apps\#{application}
|
103
|
+
set :mongrel_instances, (1..3) # Create 3 mongrel instances
|
104
|
+
set :mongrel_instance_prefix, 'mongrel_' # named mongrel_{1..3}
|
105
|
+
set :base_port, 8000 # on ports 8000, 8001, 8002
|
106
|
+
set :bundler_git_command, '/cygdrive/c/RailsInstaller/Git/bin/git.exe' # Specify the remote location of a Windows installation of git
|
107
|
+
# Required only when your Gemfile pulls gems from a git repository
|
108
108
|
|
109
109
|
Your final config/deploy.rb might look something like this:
|
110
110
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{capistrano-windows-server}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.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-02-
|
12
|
+
s.date = %q{2012-02-24}
|
13
13
|
s.description = %q{This gem modifies capistrano recipes to allow deploys to windows machines.
|
14
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
15
|
See the github page for instruction on how to set up Windows to get it ready for a deploy.}
|
@@ -27,6 +27,7 @@ See the github page for instruction on how to set up Windows to get it ready for
|
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
29
|
"capistrano-windows-server.gemspec",
|
30
|
+
"lib/capistrano-windows-server.rb",
|
30
31
|
"lib/capistrano/ext/windows_server.rb"
|
31
32
|
]
|
32
33
|
s.homepage = %q{http://github.com/nilbus/capistrano-windows-server}
|
File without changes
|
@@ -10,6 +10,7 @@ configuration.load do
|
|
10
10
|
set :repository_cache, "current"
|
11
11
|
set :scm_verbose, true
|
12
12
|
set :use_sudo, false
|
13
|
+
set :default_shell, false
|
13
14
|
|
14
15
|
def strip_cygdrive(path)
|
15
16
|
path.sub /\/cygdrive\/([c-z])\//, '\1:/'
|
@@ -18,28 +19,31 @@ configuration.load do
|
|
18
19
|
def latest_release
|
19
20
|
strip_cygdrive current_path
|
20
21
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
|
23
|
+
def system_path
|
24
|
+
return @system_path if @system_path
|
25
|
+
run 'echo "/bin:/usr/bin:$PATH"' do |channel, stream, data|
|
26
|
+
return @system_path = data.strip # Probably not compatible with multiple run targets with different PATHs
|
27
|
+
end
|
25
28
|
end
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
task :path do
|
31
|
+
puts system_path.inspect
|
29
32
|
end
|
30
|
-
|
31
|
-
def
|
33
|
+
|
34
|
+
def run_ruby_cmd(cmd)
|
35
|
+
bundler_git_path = "#{File.dirname(bundler_git_command)}:" rescue nil
|
36
|
+
run "cd #{current_path} && PATH='#{bundler_git_path}#{system_path}' ruby -S #{cmd}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def bundle_exec(cmd)
|
32
40
|
if gemfile_present?
|
33
|
-
run_ruby_cmd
|
41
|
+
run_ruby_cmd "bundle exec #{cmd}"
|
34
42
|
else
|
35
|
-
run_ruby_cmd cmd
|
43
|
+
run_ruby_cmd cmd
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
39
|
-
def rubygems_cmd
|
40
|
-
"PATH=\"#{File.dirname ruby_exe_path}:$PATH\" #{ruby_exe_path} -e \"require 'rubygems';require 'rubygems/gem_runner';require 'rubygems/exceptions';Gem::GemRunner.new.run ARGV.clone\""
|
41
|
-
end
|
42
|
-
|
43
47
|
def application_server
|
44
48
|
app_server rescue :mongrel
|
45
49
|
end
|
@@ -53,17 +57,31 @@ configuration.load do
|
|
53
57
|
task :update_code do
|
54
58
|
# update_repository_cache will attempt to clean out the repository; we must prevent that.
|
55
59
|
# /bin/git below is where www.windowsgit.com's windows git/ssh installation puts the git executable.
|
56
|
-
# This creates a git
|
57
|
-
run "mkdir -p '#{shared_path}/bin'"
|
60
|
+
# This creates a git wrapper that goes in $PATH before /bin, which will filter out any `git clean` commands.
|
61
|
+
run "/bin/mkdir -p '#{shared_path}/bin'"
|
58
62
|
run <<-RUN
|
59
63
|
echo 'if [ "$1" != "clean" ]; then /bin/git $*; fi' > "#{shared_path}/bin/git.exe"
|
60
64
|
RUN
|
61
65
|
alter_path_cmd = "export PATH=#{shared_path}/bin:$PATH # Required for capistrano-windows-server"
|
62
66
|
run <<-RUN
|
63
|
-
if ! grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
|
67
|
+
if ! /bin/grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
|
64
68
|
RUN
|
65
69
|
|
66
|
-
|
70
|
+
continue = true
|
71
|
+
while continue
|
72
|
+
begin
|
73
|
+
strategy.send 'update_repository_cache'
|
74
|
+
continue = false
|
75
|
+
rescue
|
76
|
+
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."
|
77
|
+
puts "It often works to just try again repeatedly (a lot! 30+ times for an initial clone - it's like playing the lottery :-)"
|
78
|
+
@try_again_response ||= Capistrano::CLI.ui.ask("Keep trying? [Y/n]: ").to_s.chomp
|
79
|
+
unless @try_again_response.empty? || @try_again_response.downcase == 'y'
|
80
|
+
continue = false
|
81
|
+
raise $!
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
67
85
|
finalize_update
|
68
86
|
end
|
69
87
|
|
@@ -81,10 +99,10 @@ configuration.load do
|
|
81
99
|
DESC
|
82
100
|
task :setup do
|
83
101
|
dirs = [deploy_to]
|
84
|
-
run "mkdir -p #{dirs.join(' ')} && chmod g+w #{dirs.join(' ')}"
|
102
|
+
run "/bin/mkdir -p #{dirs.join(' ')} && /bin/chmod g+w #{dirs.join(' ')}"
|
85
103
|
|
86
104
|
if exists?(:repository_host_key)
|
87
|
-
run "if ! grep '#{repository_host_key}' ~/.ssh/known_hosts > /dev/null; then echo '#{repository_host_key}' >> ~/.ssh/known_hosts; fi"
|
105
|
+
run "if ! /bin/grep '#{repository_host_key}' ~/.ssh/known_hosts > /dev/null; then echo '#{repository_host_key}' >> ~/.ssh/known_hosts; fi"
|
88
106
|
end
|
89
107
|
end
|
90
108
|
|
@@ -98,9 +116,9 @@ configuration.load do
|
|
98
116
|
end
|
99
117
|
end
|
100
118
|
|
101
|
-
desc "Run pending migrations"
|
119
|
+
desc "Run pending migrations. Override the default rails environment with RAILS_ENV"
|
102
120
|
task :migrate do
|
103
|
-
bundle_exec
|
121
|
+
bundle_exec "rake db:migrate RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
|
104
122
|
end
|
105
123
|
|
106
124
|
desc "Start mongrel"
|
@@ -133,8 +151,8 @@ configuration.load do
|
|
133
151
|
task :setup do
|
134
152
|
return unless application_server == :mongrel
|
135
153
|
mongrel_instances.each do |n|
|
136
|
-
run "mkdir -p #{current_path}/{tmp,log}" # These are often not under version control, but their absence keeps mongrel from recognizing the rails app
|
137
|
-
bundle_exec
|
154
|
+
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
|
155
|
+
bundle_exec "mongrel_rails service::install -e #{rails_env} -N #{mongrel_instance_prefix}#{n} -p #{base_port + n - mongrel_instances.first}; true"
|
138
156
|
run %Q(sc.exe config "#{mongrel_instance_prefix}#{n}" start= auto type= interact type= own; true)
|
139
157
|
end
|
140
158
|
end
|
@@ -142,47 +160,42 @@ configuration.load do
|
|
142
160
|
desc "Remove mongrel services"
|
143
161
|
task :remove do
|
144
162
|
mongrel_instances.each do |n|
|
145
|
-
bundle_exec
|
163
|
+
bundle_exec "mongrel_rails service::remove -N #{mongrel_instance_prefix}#{n}; true"
|
146
164
|
end
|
147
165
|
end
|
148
|
-
|
149
166
|
end
|
150
|
-
|
151
167
|
end
|
152
168
|
|
153
|
-
desc "Run a rake command in COMMAND"
|
169
|
+
desc "Run a rake command in COMMAND. RAILS_ENV for the configured environment will be included; it can be overridden by setting RAILS_ENV"
|
154
170
|
task :rake do
|
155
171
|
raise "Specify the command with COMMAND='some:task with_arguments'" unless ENV['COMMAND']
|
156
|
-
bundle_exec
|
172
|
+
bundle_exec "rake #{ENV['COMMAND']} RAILS_ENV=#{ENV['RAILS_ENV'] || rails_env}"
|
157
173
|
end
|
158
174
|
|
159
175
|
desc "Run a rubygems (gem) command in COMMAND"
|
160
176
|
task :rubygems do
|
161
177
|
raise "Specify the command with COMMAND='install rails'" unless ENV['COMMAND']
|
162
|
-
|
178
|
+
bundle_exec "gem #{ENV['COMMAND']}"
|
163
179
|
end
|
164
180
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
run "cd #{current_path} && git #{ENV['COMMAND']}"
|
170
|
-
end
|
181
|
+
desc "Run a git command in COMMAND"
|
182
|
+
task :git do
|
183
|
+
raise "Specify the command with COMMAND. eg: COMMAND='diff HEAD^^'" unless ENV['COMMAND']
|
184
|
+
run "cd #{current_path} && /bin/git #{ENV['COMMAND']}"
|
171
185
|
end
|
172
186
|
|
173
187
|
namespace :bundle do
|
174
|
-
desc "
|
175
|
-
task :
|
188
|
+
desc "Execute a COMMAND with bundle exec"
|
189
|
+
task :default do
|
176
190
|
raise "No Gemfile detected" unless gemfile_present?
|
177
|
-
|
191
|
+
raise "Specify the command with COMMAND. eg: COMMAND='rake db:migrate'" unless ENV['COMMAND']
|
192
|
+
bundle_exec ENV['COMMAND']
|
178
193
|
end
|
179
194
|
|
180
|
-
desc "
|
181
|
-
task :
|
195
|
+
desc "Install gems with bundler"
|
196
|
+
task :install do
|
182
197
|
raise "No Gemfile detected" unless gemfile_present?
|
183
|
-
|
184
|
-
args = ENV['COMMAND'].split
|
185
|
-
bundle_exec args.shift, args.join(' ')
|
198
|
+
run_ruby_cmd "bundle install --without test development --path ../bundle"
|
186
199
|
end
|
187
200
|
end
|
188
201
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-windows-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Edward Anderson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-24 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- VERSION
|
71
71
|
- capistrano-windows-server.gemspec
|
72
|
+
- lib/capistrano-windows-server.rb
|
72
73
|
- lib/capistrano/ext/windows_server.rb
|
73
74
|
has_rdoc: true
|
74
75
|
homepage: http://github.com/nilbus/capistrano-windows-server
|