capistrano-windows-server 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +20 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/lib/capistrano/windows_server.rb +122 -0
- metadata +107 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
capistrano (2.6.0)
|
5
|
+
highline
|
6
|
+
net-scp (>= 1.0.0)
|
7
|
+
net-sftp (>= 2.0.0)
|
8
|
+
net-ssh (>= 2.0.14)
|
9
|
+
net-ssh-gateway (>= 1.1.0)
|
10
|
+
git (1.2.5)
|
11
|
+
highline (1.6.2)
|
12
|
+
jeweler (1.6.4)
|
13
|
+
bundler (~> 1.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rake
|
16
|
+
net-scp (1.0.4)
|
17
|
+
net-ssh (>= 1.99.1)
|
18
|
+
net-sftp (2.0.5)
|
19
|
+
net-ssh (>= 2.0.9)
|
20
|
+
net-ssh (2.1.4)
|
21
|
+
net-ssh-gateway (1.1.0)
|
22
|
+
net-ssh (>= 1.99.1)
|
23
|
+
rake (0.8.7)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
capistrano
|
30
|
+
jeweler (~> 1.6.4)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 SciMed Solutions, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= capistrano-windows-server
|
2
|
+
|
3
|
+
Deploy Ruby on Rails applications with Capistrano to Windows servers
|
4
|
+
|
5
|
+
This gem modifies capistrano recipes to allow deploys to windows machines.
|
6
|
+
Several nuances such as the lack of symlinks make the deploy a little different, but it's better than doing it by hand.
|
7
|
+
See the github page for instruction on how to set up Windows to get it ready for a deploy.
|
8
|
+
|
9
|
+
== Contributing to capistrano-windows-server
|
10
|
+
|
11
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
12
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
13
|
+
* Fork the project
|
14
|
+
* Start a feature/bugfix branch
|
15
|
+
* Commit and push until you are happy with your contribution
|
16
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
17
|
+
|
18
|
+
== Copyright
|
19
|
+
|
20
|
+
Copyright (c) 2011 SciMed Solutions, Inc. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "capistrano-windows-server"
|
18
|
+
gem.homepage = "http://github.com/nilbus/capistrano-windows-server"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "Deploy Ruby on Rails applications with Capistrano to Windows servers"
|
21
|
+
gem.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."
|
22
|
+
gem.email = "edward.anderson@scimedsolutions.com"
|
23
|
+
gem.authors = ["Edward Anderson"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
task :default => :test
|
29
|
+
|
30
|
+
require 'rake/rdoctask'
|
31
|
+
Rake::RDocTask.new do |rdoc|
|
32
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
33
|
+
|
34
|
+
rdoc.rdoc_dir = 'rdoc'
|
35
|
+
rdoc.title = "capistrano-windows-server #{version}"
|
36
|
+
rdoc.rdoc_files.include('README*')
|
37
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,122 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
2
|
+
Capistrano::Configuration.instance(:must_exist) :
|
3
|
+
Capistrano.configuration(:must_exist)
|
4
|
+
|
5
|
+
configuration.load do
|
6
|
+
set :scm, :git
|
7
|
+
set :deploy_via, :remote_cache
|
8
|
+
set :git_enable_submodules, false # Git submodules not supported on windows
|
9
|
+
set :shared_dir, "."
|
10
|
+
set :repository_cache, "current"
|
11
|
+
set :scm_verbose, true
|
12
|
+
set :use_sudo, false
|
13
|
+
|
14
|
+
namespace :deploy do
|
15
|
+
desc "Custom for Windows - no releases; just update git in place"
|
16
|
+
task :update do
|
17
|
+
# update_repository_cache will attempt to clean out the repository; we must prevent that with this deploy method.
|
18
|
+
# /bin/git below is where www.windowsgit.com's windows git/ssh installation puts the git executable.
|
19
|
+
run "mkdir -p '#{shared_path}/bin'"
|
20
|
+
run <<-RUN
|
21
|
+
echo 'if [ "$1" != "clean" ]; then /bin/git $*; fi' > "#{shared_path}/bin/git.exe"
|
22
|
+
RUN
|
23
|
+
alter_path_cmd = "export PATH=#{shared_path}/bin:$PATH"
|
24
|
+
run <<-RUN
|
25
|
+
if ! grep '#{alter_path_cmd}' ~/.bashrc > /dev/null; then echo '#{alter_path_cmd}' >> ~/.bashrc; fi
|
26
|
+
RUN
|
27
|
+
|
28
|
+
strategy.send 'update_repository_cache'
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "On windows, this is an alias for update"
|
32
|
+
task :update_code do
|
33
|
+
update
|
34
|
+
end
|
35
|
+
|
36
|
+
desc <<-DESC
|
37
|
+
Prepares one or more servers for deployment. Before you can use any \
|
38
|
+
of the Capistrano deployment tasks with your project, you will need to \
|
39
|
+
make sure all of your servers have been prepared with `cap deploy:setup'. When \
|
40
|
+
you add a new server to your cluster, you can easily run the setup task \
|
41
|
+
on just that server by specifying the HOSTS environment variable:
|
42
|
+
|
43
|
+
$ cap HOSTS=new.server.com deploy:setup
|
44
|
+
|
45
|
+
It is safe to run this task on servers that have already been set up; it \
|
46
|
+
will not destroy any deployed revisions or data.
|
47
|
+
DESC
|
48
|
+
task :setup do
|
49
|
+
dirs = [deploy_to]
|
50
|
+
run "mkdir -p #{dirs.join(' ')} && chmod g+w #{dirs.join(' ')}"
|
51
|
+
|
52
|
+
if exists?(:repository_host_key)
|
53
|
+
run "if ! grep '#{repository_host_key}' ~/.ssh/known_hosts > /dev/null; then echo '#{repository_host_key}' >> ~/.ssh/known_hosts; fi"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Do nothing for Windows
|
58
|
+
task :finalize_update do; end
|
59
|
+
|
60
|
+
# Do nothing for Windows
|
61
|
+
task :symlink do; end
|
62
|
+
|
63
|
+
desc "Run migrations"
|
64
|
+
task :migrate do
|
65
|
+
set :rake_cmd, "#{ruby_exe_path} -e \"require 'rubygems'; gem 'rake', '>= 0'; load Gem.bin_path('rake', 'rake', '>= 0')\""
|
66
|
+
run "cd #{current_path} && #{rake_cmd} db:migrate RAILS_ENV=#{rails_env}"
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "start mongrel"
|
70
|
+
task :start do
|
71
|
+
mongrel_instances.each do |n|
|
72
|
+
run "net start #{mongrel_instance_prefix}#{n}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "stop mongrel"
|
77
|
+
task :stop do
|
78
|
+
mongrel_instances.each do |n|
|
79
|
+
run "net stop #{mongrel_instance_prefix}#{n}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "restart mongrel"
|
84
|
+
task :restart do
|
85
|
+
mongrel_instances.each do |n|
|
86
|
+
run "net stop #{mongrel_instance_prefix}#{n}"
|
87
|
+
run "net start #{mongrel_instance_prefix}#{n}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
namespace :mongrel do
|
92
|
+
desc "create mongrel services"
|
93
|
+
task :setup do
|
94
|
+
mongrel_instances.each do |n|
|
95
|
+
run "cd #{current_path} && #{mongrel_cmd} service::install -e #{rails_env} -N #{mongrel_instance_prefix}#{n} -p #{base_port + n - mongrel_instances.first}"
|
96
|
+
run %Q(sc.exe config "#{mongrel_instance_prefix}#{n}" start= auto)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
desc "remove mongrel services"
|
101
|
+
task :remove do
|
102
|
+
set :mongrel_cmd, "#{ruby_exe_path} -e \"require 'rubygems'; gem 'mongrel', '>= 0'; load Gem.bin_path('mongrel', 'mongrel_rails', '>= 0')\""
|
103
|
+
mongrel_instances.each do |n|
|
104
|
+
run "#{mongrel_cmd} service::remove -N #{mongrel_instance_prefix}#{n}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
desc "Run a rake command in CMD"
|
113
|
+
task :rake do
|
114
|
+
raise "Specify the command with CMD='some:task with_arguments'" unless ENV['CMD']
|
115
|
+
set :rake_cmd, "#{ruby_exe_path} -e \"require 'rubygems'; gem 'rake', '>= 0'; load Gem.bin_path('rake', 'rake', '>= 0')\""
|
116
|
+
run "cd #{current_path} && #{rake_cmd} #{ENV['CMD']} RAILS_ENV=#{rails_env}"
|
117
|
+
end
|
118
|
+
|
119
|
+
after 'deploy:setup', 'deploy:update_code'
|
120
|
+
after 'deploy:setup', 'deploy:mongrel:setup'
|
121
|
+
|
122
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-windows-server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Edward Anderson
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-22 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
name: capistrano
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
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
|
36
|
+
prerelease: false
|
37
|
+
name: jeweler
|
38
|
+
type: :development
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 6
|
48
|
+
- 4
|
49
|
+
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.
|
55
|
+
email: edward.anderson@scimedsolutions.com
|
56
|
+
executables: []
|
57
|
+
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files:
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.rdoc
|
63
|
+
files:
|
64
|
+
- .document
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.rdoc
|
69
|
+
- Rakefile
|
70
|
+
- VERSION
|
71
|
+
- lib/capistrano/windows_server.rb
|
72
|
+
has_rdoc: true
|
73
|
+
homepage: http://github.com/nilbus/capistrano-windows-server
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.4.2
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Deploy Ruby on Rails applications with Capistrano to Windows servers
|
106
|
+
test_files: []
|
107
|
+
|