capistrano-deploy 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +12 -13
- data/capistrano-deploy.gemspec +1 -1
- data/lib/capistrano-deploy.rb +27 -0
- data/lib/capistrano-deploy/deploy.rb +2 -0
- data/lib/capistrano-deploy/git.rb +30 -0
- data/lib/capistrano-deploy/rails.rb +17 -0
- metadata +7 -4
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
Capistrano deploy recipes
|
2
|
-
|
2
|
+
=========================
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Git-based deployment process.
|
4
|
+
Git & Rails
|
5
|
+
-----------
|
8
6
|
|
9
|
-
Minimal Capfile for deploy:
|
7
|
+
Minimal Capfile for Rails deploy using Git:
|
10
8
|
|
11
|
-
require 'capistrano-deploy
|
9
|
+
require 'capistrano-deploy'
|
10
|
+
use_recipes :git, :rails
|
12
11
|
|
13
12
|
server 'server name or ip address', :web, :app, :db, :primary => true
|
14
13
|
set :user, 'user for deploy'
|
@@ -34,7 +33,7 @@ To look through changes to be deployed:
|
|
34
33
|
Multistage
|
35
34
|
----------
|
36
35
|
|
37
|
-
|
36
|
+
use_recipe :multistage
|
38
37
|
|
39
38
|
set :default_stage, :development
|
40
39
|
|
@@ -49,21 +48,21 @@ Multistage
|
|
49
48
|
Bundle
|
50
49
|
------
|
51
50
|
|
52
|
-
|
51
|
+
use_recipe :bundle
|
53
52
|
|
54
53
|
To automatically install missing gems:
|
55
54
|
|
56
|
-
after 'deploy:
|
55
|
+
after 'deploy:update', 'bundle:install'
|
57
56
|
|
58
57
|
Passenger
|
59
58
|
---------
|
60
59
|
|
61
|
-
|
60
|
+
use_recipe :passenger
|
62
61
|
|
63
62
|
Unicorn
|
64
63
|
-------
|
65
64
|
|
66
|
-
|
65
|
+
use_recipe :unicorn
|
67
66
|
|
68
67
|
Now you can setup to reload unicorn on `deploy:restart`:
|
69
68
|
|
@@ -72,7 +71,7 @@ Now you can setup to reload unicorn on `deploy:restart`:
|
|
72
71
|
Whenever
|
73
72
|
--------
|
74
73
|
|
75
|
-
|
74
|
+
use_recipe :whenever
|
76
75
|
|
77
76
|
To automatically update crontab file:
|
78
77
|
|
data/capistrano-deploy.gemspec
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
def use_recipe(recipe)
|
3
|
+
require "capistrano-deploy/#{recipe}"
|
4
|
+
end
|
5
|
+
|
6
|
+
def use_recipes(*recipes)
|
7
|
+
recipes.each do |recipe|
|
8
|
+
use_recipe(recipe)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :deploy do
|
13
|
+
desc 'Run deploy'
|
14
|
+
task :default do
|
15
|
+
update
|
16
|
+
restart
|
17
|
+
end
|
18
|
+
|
19
|
+
task :update do
|
20
|
+
# nothing
|
21
|
+
end
|
22
|
+
|
23
|
+
task :restart do
|
24
|
+
# nothing
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
ssh_options[:forward_agent] = true
|
3
|
+
|
4
|
+
set(:application) { repository.slice(/[^\/:]+?(?=\.git$)/) }
|
5
|
+
set(:repository) { abort "Please specify repository, set :repository, 'foo'" }
|
6
|
+
set :branch, 'master'
|
7
|
+
set :enable_submodules, false
|
8
|
+
|
9
|
+
set(:current_revision) { capture("cd #{deploy_to} && git rev-parse HEAD").chomp }
|
10
|
+
|
11
|
+
namespace :deploy do
|
12
|
+
desc 'Setup'
|
13
|
+
task :setup, :except => {:no_release => true} do
|
14
|
+
run "mkdir -p `dirname #{deploy_to}` && git clone --no-checkout #{repository} #{deploy_to}"
|
15
|
+
update_code
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Update the deployed code'
|
19
|
+
task :update, :except => {:no_release => true} do
|
20
|
+
command = ["cd #{deploy_to}", 'git fetch origin', "git reset --hard origin/#{branch}"]
|
21
|
+
command += ['git submodule init', 'git submodule -q sync', 'git submodule -q update'] if enable_submodules
|
22
|
+
run command.join(' && ')
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Show pending commits'
|
26
|
+
task :pending do
|
27
|
+
system("git log --pretty=medium --stat #{current_revision}..origin/#{branch}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :deploy do
|
3
|
+
desc 'Deploy & migrate'
|
4
|
+
task :migrations do
|
5
|
+
update
|
6
|
+
migrate
|
7
|
+
restart
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Run migrations'
|
11
|
+
task :migrate, :roles => :db, :only => {:primary => true} do
|
12
|
+
rake = fetch(:rake, 'rake')
|
13
|
+
rails_env = fetch(:rails_env, 'production')
|
14
|
+
run "cd #{deploy_to} && RAILS_ENV=#{rails_env} #{rake} db:migrate"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.7
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Just Lest
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-22 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -49,10 +49,13 @@ files:
|
|
49
49
|
- README.md
|
50
50
|
- Rakefile
|
51
51
|
- capistrano-deploy.gemspec
|
52
|
+
- lib/capistrano-deploy.rb
|
52
53
|
- lib/capistrano-deploy/bundle.rb
|
53
54
|
- lib/capistrano-deploy/deploy.rb
|
55
|
+
- lib/capistrano-deploy/git.rb
|
54
56
|
- lib/capistrano-deploy/multistage.rb
|
55
57
|
- lib/capistrano-deploy/passenger.rb
|
58
|
+
- lib/capistrano-deploy/rails.rb
|
56
59
|
- lib/capistrano-deploy/unicorn.rb
|
57
60
|
- lib/capistrano-deploy/whenever.rb
|
58
61
|
has_rdoc: true
|