capistrano_recipes 1.0.1 → 1.0.2
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.
- checksums.yaml +8 -8
- data/README.md +4 -4
- data/capistrano_recipes.gemspec +1 -1
- data/lib/capistrano/recipes/{rails_assets.rb → assets.rb} +1 -1
- data/lib/capistrano/recipes/git.rb +6 -6
- data/lib/capistrano/recipes/mysql.rb +1 -1
- data/lib/capistrano/recipes/templates/nginx.vhost.erb +30 -34
- data/lib/capistrano_recipes.rb +1 -1
- data/spec/{rails_assets.rb → assets.rb} +2 -2
- data/spec/git_spec.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDRmOTQyNTcxZDc0MjlkNjQ1NjEyOWQxNGM5NGU4YjY5MTg4YjZkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjU3MmE1MDNjYjdjMWM2MTA2NGMwN2YwY2Y5MDliNzQxNjg0MmI3Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGYxN2I0M2E0NDdmOWE0NjIzNWQwZmJkMDUxMTkxNzJhYTNiMTVlYTRlNmNi
|
10
|
+
OWRmNTEyN2FjNmVhZTA2ZTllYTFiYjRhM2I4MzMwZGE5NGUxMGY2MjZlNTc0
|
11
|
+
NzMxMWVlMDI1Yjg0NmQzNmE4NDcxMjhlODM3ZTUxY2UxZjhmN2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTEyNTY0N2FkOGNhY2U5MmRkOGM5MmFhNjg4MTE3ZmNlZTZhODZmMTE1ZWIz
|
14
|
+
MmY5OTk5N2MyYzA2MDVlZTkwMjlmZGFiOGU5MjU0ZTU2NTA3MDg1OTU5NmYw
|
15
|
+
MzkzYWFjOTNlMGYzZGM1ZDA4MGJhMDJlZTQ2ZTM4NDJhOTkzOWE=
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ For a single environment add:
|
|
11
11
|
```ruby
|
12
12
|
require 'capistrano/recipes'
|
13
13
|
|
14
|
-
use_recipes :
|
14
|
+
use_recipes :assets, :bundler, :git
|
15
15
|
|
16
16
|
server 'Add your web server domain or ip here', :app, :web, :db, :primary => true
|
17
17
|
|
@@ -26,7 +26,7 @@ For a multistage environment add:
|
|
26
26
|
```ruby
|
27
27
|
require 'capistrano/recipes'
|
28
28
|
|
29
|
-
use_recipes :bundler, :git, :multistage
|
29
|
+
use_recipes :assets, :bundler, :git, :multistage
|
30
30
|
|
31
31
|
stage :staging, :branch => :dev, :default => true do
|
32
32
|
server 'Add your web server domain or ip here', :app, :web, :db, :primary => true
|
@@ -49,18 +49,18 @@ use_recipe :bundle
|
|
49
49
|
|
50
50
|
To add multiple recipes:
|
51
51
|
```ruby
|
52
|
-
use_recipes :bundle, :git, :multistage
|
52
|
+
use_recipes :assets, :bundle, :git, :multistage
|
53
53
|
```
|
54
54
|
|
55
55
|
## Recipes
|
56
56
|
| Recipe | Documentation |
|
57
57
|
| ------------ | ------------- |
|
58
|
+
| :assets | [Assets recipe documentation](https://github.com/fernandoaleman/capistrano_recipes/wiki/Assets) |
|
58
59
|
| :bundle | [Bundle recipe documentation](https://github.com/fernandoaleman/capistrano_recipes/wiki/Bundle) |
|
59
60
|
| :git | [Git recipe documentation](https://github.com/fernandoaleman/capistrano_recipes/wiki/Git) |
|
60
61
|
| :multistage | [Multistage recipe documentation](https://github.com/fernandoaleman/capistrano_recipes/wiki/Multistage) |
|
61
62
|
| :mysql | [Mysql](https://github.com/fernandoaleman/capistrano_recipes/wiki/Mysql) |
|
62
63
|
| :nginx | [Nginx](https://github.com/fernandoaleman/capistrano_recipes/wiki/Nginx) |
|
63
|
-
| :rails_assets | [Rails assets recipe documentation](https://github.com/fernandoaleman/capistrano_recipes/wiki/Rails-Assets) |
|
64
64
|
| :unicorn | [Unicorn](https://github.com/fernandoaleman/capistrano_recipes/wiki/Unicorn) |
|
65
65
|
|
66
66
|
## Installation
|
data/capistrano_recipes.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'capistrano_recipes'
|
7
|
-
s.version = '1.0.
|
7
|
+
s.version = '1.0.2'
|
8
8
|
s.authors = ['Fernando Aleman']
|
9
9
|
s.email = ['fernandoaleman@mac.com']
|
10
10
|
s.description = 'Capistrano recipes to make your deployments fast and easy'
|
@@ -17,9 +17,9 @@ module CapistranoRecipes
|
|
17
17
|
set(:release_path) { fetch(:current_path) }
|
18
18
|
set(:releases_path) { fetch(:current_path) }
|
19
19
|
set(:current_release) { fetch(:current_path) }
|
20
|
-
set(:current_revision) { capture("cd #{
|
21
|
-
set(:latest_revision) { capture("cd #{
|
22
|
-
set(:previous_revision) { capture("cd #{
|
20
|
+
set(:current_revision) { capture("cd #{current_path} && git rev-parse --short HEAD").strip }
|
21
|
+
set(:latest_revision) { capture("cd #{current_path} && git rev-parse --short HEAD").strip }
|
22
|
+
set(:previous_revision) { capture("cd #{current_path} && git rev-parse --short HEAD@{1}").strip }
|
23
23
|
|
24
24
|
set :local_branch do
|
25
25
|
`git symbolic-ref HEAD 2> /dev/null`.strip.sub('refs/heads/', '')
|
@@ -45,13 +45,13 @@ module CapistranoRecipes
|
|
45
45
|
|
46
46
|
desc 'Update the deployed code'
|
47
47
|
task :update_code, :except => { :no_release => true } do
|
48
|
-
run "cd #{
|
48
|
+
run "cd #{current_path} && git fetch origin && git reset --hard origin/#{branch}"
|
49
49
|
finalize_update
|
50
50
|
end
|
51
51
|
|
52
52
|
desc 'Run migrations'
|
53
53
|
task :migrate, :roles => :db, :only => { :primary => true } do
|
54
|
-
run "cd #{
|
54
|
+
run "cd #{current_path} && RAILS_ENV=#{rails_env} #{rake} db:migrate"
|
55
55
|
end
|
56
56
|
|
57
57
|
desc 'Deploy and run migrations'
|
@@ -70,7 +70,7 @@ module CapistranoRecipes
|
|
70
70
|
|
71
71
|
desc 'Rewrite reflog so HEAD@{1} will continue to point to the next previous release'
|
72
72
|
task :cleanup, :except => { :no_release => true } do
|
73
|
-
run "cd #{
|
73
|
+
run "cd #{current_path}; git reflog delete --rewrite HEAD@{1}; git reflog delete --rewrite HEAD@{1}"
|
74
74
|
end
|
75
75
|
|
76
76
|
desc 'Roll back to the previously deployed version'
|
@@ -67,7 +67,7 @@ module CapistranoRecipes
|
|
67
67
|
|
68
68
|
desc 'Symlink the database.yml file into the latest deploy'
|
69
69
|
task :symlink, :roles => :app, :except => { :no_release => true } do
|
70
|
-
run "ln -nfs #{
|
70
|
+
run "ln -nfs #{mysql_remote_config_file} #{release_path}/config/database.yml"
|
71
71
|
end
|
72
72
|
after 'deploy:finalize_update', 'mysql:symlink'
|
73
73
|
|
@@ -27,25 +27,23 @@ server {
|
|
27
27
|
break;
|
28
28
|
}
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
rewrite (.*) $1.html break;
|
45
|
-
}
|
30
|
+
# If the file exists as a static file, serve it directly
|
31
|
+
# without running all the other rewrite tests on it
|
32
|
+
if (-f $request_filename) {
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
|
36
|
+
# Check for index.html
|
37
|
+
if (-f $request_filename/index.html) {
|
38
|
+
rewrite (.*) $1/index.html break;
|
39
|
+
}
|
40
|
+
|
41
|
+
# Check if .html file exists for page caching
|
42
|
+
if (-f $request_filename.html) {
|
43
|
+
rewrite (.*) $1.html break;
|
46
44
|
}
|
47
45
|
|
48
|
-
<% if using_recipe?(:
|
46
|
+
<% if using_recipe?(:assets) %>
|
49
47
|
# Asset pipeline
|
50
48
|
location ^~ /assets/ {
|
51
49
|
gzip_static on;
|
@@ -93,25 +91,23 @@ server {
|
|
93
91
|
break;
|
94
92
|
}
|
95
93
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
rewrite (.*) $1.html break;
|
111
|
-
}
|
94
|
+
# If the file exists as a static file, serve it directly
|
95
|
+
# without running all the other rewrite tests on it
|
96
|
+
if (-f $request_filename) {
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
|
100
|
+
# Check for index.html
|
101
|
+
if (-f $request_filename/index.html) {
|
102
|
+
rewrite (.*) $1/index.html break;
|
103
|
+
}
|
104
|
+
|
105
|
+
# Check if .html file exists for page caching
|
106
|
+
if (-f $request_filename.html) {
|
107
|
+
rewrite (.*) $1.html break;
|
112
108
|
}
|
113
109
|
|
114
|
-
<% if using_recipe?(:
|
110
|
+
<% if using_recipe?(:assets) %>
|
115
111
|
# Asset pipeline
|
116
112
|
location ^~ /assets/ {
|
117
113
|
gzip_static on;
|
data/lib/capistrano_recipes.rb
CHANGED
@@ -99,7 +99,7 @@ module CapistranoRecipes
|
|
99
99
|
|
100
100
|
desc 'Setup servers for deployment'
|
101
101
|
task :setup, :except => { :no_release => true } do
|
102
|
-
dirs = [deploy_to, releases_path, shared_path, config_path, backup_path]
|
102
|
+
dirs = [deploy_to, releases_path, shared_path, config_path, backup_path, pids_path, sockets_path]
|
103
103
|
dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) }
|
104
104
|
run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
|
105
105
|
run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
|
data/spec/git_spec.rb
CHANGED
@@ -35,13 +35,13 @@ describe 'git' do
|
|
35
35
|
describe 'deploy:update' do
|
36
36
|
it 'updates' do
|
37
37
|
cli_execute 'deploy:update'
|
38
|
-
config.should have_run('cd /foo/bar && git fetch origin && git reset --hard origin/master')
|
38
|
+
config.should have_run('cd /foo/bar/current && git fetch origin && git reset --hard origin/master')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'has current revision' do
|
44
|
-
config.should_receive(:capture).with('cd /foo/bar && git rev-parse --short HEAD') { "baz\n" }
|
44
|
+
config.should_receive(:capture).with('cd /foo/bar/current && git rev-parse --short HEAD') { "baz\n" }
|
45
45
|
config.current_revision.should == 'baz'
|
46
46
|
end
|
47
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Aleman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -68,26 +68,26 @@ files:
|
|
68
68
|
- Rakefile
|
69
69
|
- capistrano_recipes.gemspec
|
70
70
|
- lib/capistrano/recipes.rb
|
71
|
+
- lib/capistrano/recipes/assets.rb
|
71
72
|
- lib/capistrano/recipes/bundle.rb
|
72
73
|
- lib/capistrano/recipes/bundler.rb
|
73
74
|
- lib/capistrano/recipes/git.rb
|
74
75
|
- lib/capistrano/recipes/multistage.rb
|
75
76
|
- lib/capistrano/recipes/mysql.rb
|
76
77
|
- lib/capistrano/recipes/nginx.rb
|
77
|
-
- lib/capistrano/recipes/rails_assets.rb
|
78
78
|
- lib/capistrano/recipes/templates/mysql.yml.erb
|
79
79
|
- lib/capistrano/recipes/templates/nginx.vhost.erb
|
80
80
|
- lib/capistrano/recipes/templates/unicorn.rb.erb
|
81
81
|
- lib/capistrano/recipes/templates/unicorn_init.erb
|
82
82
|
- lib/capistrano/recipes/unicorn.rb
|
83
83
|
- lib/capistrano_recipes.rb
|
84
|
+
- spec/assets.rb
|
84
85
|
- spec/bundle_spec.rb
|
85
86
|
- spec/bundler_spec.rb
|
86
87
|
- spec/git_spec.rb
|
87
88
|
- spec/multistage_spec.rb
|
88
89
|
- spec/mysql_spec.rb
|
89
90
|
- spec/nginx_spec.rb
|
90
|
-
- spec/rails_assets.rb
|
91
91
|
- spec/spec_helper.rb
|
92
92
|
- spec/unicorn_spec.rb
|
93
93
|
homepage: https://github.com/fernandoaleman/capistrano_recipes
|
@@ -115,12 +115,12 @@ signing_key:
|
|
115
115
|
specification_version: 4
|
116
116
|
summary: Capistrano deployment recipes
|
117
117
|
test_files:
|
118
|
+
- spec/assets.rb
|
118
119
|
- spec/bundle_spec.rb
|
119
120
|
- spec/bundler_spec.rb
|
120
121
|
- spec/git_spec.rb
|
121
122
|
- spec/multistage_spec.rb
|
122
123
|
- spec/mysql_spec.rb
|
123
124
|
- spec/nginx_spec.rb
|
124
|
-
- spec/rails_assets.rb
|
125
125
|
- spec/spec_helper.rb
|
126
126
|
- spec/unicorn_spec.rb
|