capistrano-kyan 0.2.11 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d3ae3b47b060f5f6d9c001e79327d546bdd0f05
4
- data.tar.gz: 20916d7312a1056a983f6e1a72106b60dd89e818
3
+ metadata.gz: 4cd2659b32416d402c899c30ca4f9ea3dc989dc1
4
+ data.tar.gz: 8ff0b261d55c5d74d7a670675c237ee1318967f4
5
5
  SHA512:
6
- metadata.gz: ec10f9251dfa36b3f8b70f5070dab40c0b995e486f89168b63a418536a6eec669bdd3620de67596767a6d44264211c5cb23b2ee886a1372c28b06ae90e349ddf
7
- data.tar.gz: 6901ecfa52e484cdf3c5da1595ce5cbf5e0fd393c76d2ff3487752ba73a986f79f90932235be06a7a49663acb8aab38b53cb33dfb16f869df6aa06776238ac72
6
+ metadata.gz: 0a2a4966493eb324c4edc605840d42c50ddfce3a1a6162f5975b39795e7354b00ec6ba9ac3676ab1e54cd312d8a25f46c7068b334c3fd8f411de7e68da531b8f
7
+ data.tar.gz: b732e1293fdbc1f3104950d2961b6e709da0d90a15a1a71c9821d3d9f103c9aafd665c09e9a3b989a508a49a8ae5e503b42333993ff7921ac8f746d879c69c85
data/README.md CHANGED
@@ -4,6 +4,10 @@ Capistrano plugin that includes a collection of tasks we find useful here at Kya
4
4
 
5
5
  ## Usage
6
6
 
7
+ ### Prerequisites
8
+
9
+ We assume you are using multi-stage environments.
10
+
7
11
  ### Setup
8
12
 
9
13
  Add the library to your `Gemfile`:
@@ -14,36 +18,132 @@ group :development do
14
18
  end
15
19
  ```
16
20
 
17
- And load it into your deployment script `config/deploy.rb`:
21
+ Update your config/deploy.rb. Here's an example one:
18
22
 
19
23
  ```ruby
20
24
  require 'capistrano-kyan'
25
+ require 'capistrano/ext/multistage'
26
+
27
+ set :stages, %w(production staging)
28
+ set :default_stage, "staging"
29
+ set :application, "ournewserver.co.uk"
30
+
31
+ set :user, "deploy"
32
+ set :use_sudo, false
33
+
34
+ ssh_options[:forward_agent] = true
35
+ default_run_options[:pty] = true
36
+
37
+ set :scm, :git
38
+ set :deploy_via, :copy
39
+ set :repository, "."
40
+ set :branch, "master"
41
+
42
+ # If you are using Passenger mod_rails uncomment this:
43
+ namespace :deploy do
44
+ task :start do ; end
45
+ task :stop do ; end
46
+ task :restart, :roles => :app, :except => { :no_release => true } do
47
+ run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
48
+ end
49
+ end
50
+
51
+ # these are the capistrano-kyan bits
52
+ after "deploy:setup", "kyan:vhost:setup"
53
+ after "deploy:finalize_update", "kyan:db:symlink"
54
+ after "deploy:create_symlink", "nginx:reload"
21
55
  ```
22
56
 
23
- Add kyan vhost task hook:
57
+ Add your vhost files:
24
58
 
25
- ```ruby
26
- after "deploy:setup", "kyan:vhost:setup"
59
+ ```
60
+ #
61
+ # /config/vhosts/staging.vhost.conf.erb
62
+ #
63
+
64
+ server {
65
+ listen 80;
66
+
67
+ server_name staging.ournewserver.co.uk;
68
+ root /var/www/staging.ournewserver.co.uk/current/public;
69
+ passenger_enabled on;
70
+ rails_env staging;
71
+ client_max_body_size 4M;
72
+
73
+ # serve static content directly
74
+ location ~* \.(ico|jpg|gif|png|swf|html)$ {
75
+ if (-f $request_filename) {
76
+ expires max;
77
+ break;
78
+ }
79
+ }
80
+ }
27
81
  ```
28
82
 
29
- Add kyan db task hook:
83
+ and
30
84
 
31
- ```ruby
32
- after "deploy:setup", "kyan:db:setup"
85
+ ```
86
+ #
87
+ # /config/vhosts/production.vhost.conf.erb
88
+ #
89
+
90
+ server {
91
+ listen 80;
92
+
93
+ server_name ournewserver.co.uk;
94
+ root /var/www/ournewserver.co.uk/current/public;
95
+ passenger_enabled on;
96
+ rails_env staging;
97
+ client_max_body_size 4M;
98
+
99
+ # serve static content directly
100
+ location ~* \.(ico|jpg|gif|png|swf|html)$ {
101
+ if (-f $request_filename) {
102
+ expires max;
103
+ break;
104
+ }
105
+ }
106
+ }
33
107
  ```
34
108
 
35
- ### Test
109
+ Now you need to update your multi-stage files to include these:
110
+
111
+ ```
112
+ #
113
+ # config/deploy/staging.rb
114
+ #
115
+
116
+ server 'ournewserver.co.uk', :app, :web, :db, :primary => true
117
+ set :branch, "staging"
118
+ set :rails_env, 'staging'
119
+ set :deploy_to, "/var/www/staging.#{application}"
120
+ set :vhost_tmpl_name, "staging.vhost.conf.erb"
121
+ ```
122
+
123
+ ```
124
+ #
125
+ # config/deploy/production.rb
126
+ #
127
+
128
+ server 'ournewserver.co.uk', :app, :web, :db, :primary => true
129
+ set :branch, "staging"
130
+ set :rails_env, 'staging'
131
+ set :deploy_to, "/var/www/staging.#{application}"
132
+ set :vhost_tmpl_name, "production.vhost.conf.erb"
133
+ ```
134
+
135
+ ## Deploying
136
+
137
+ This will create the directory structure.
36
138
 
37
- First, make sure you're running the latest release:
38
139
 
39
140
  ```
40
- cap deploy:setup
141
+ $ cap deploy:setup
41
142
  ```
42
143
 
43
144
  Then you can test each individual task:
44
145
 
45
146
  ```
46
- cap kyan:db:setup
47
147
  cap kyan:vhost:setup
48
148
  ```
49
149
 
@@ -55,16 +155,12 @@ You can modify any of the following options in your `deploy.rb` config.
55
155
  - `vhost_tmpl_path` - Set vhost template path. Default to `config/deploy`.
56
156
  - `vhost_tmpl_name` - Set vhost template name. Default to `vhost.conf.erb`.
57
157
  - `vhost_server_path` - Set vhost server path. Default to `/etc/nginx/sites-enabled`.
58
- - `vhost_server_name` - Set vhost server name. Default to `File.basename(deploy_to)`.
59
-
60
- I'm assuming you are using capistrano multistage.
61
158
 
62
159
  ## Available Tasks
63
160
 
64
161
  To get a list of all capistrano tasks, run `cap -T`:
65
162
 
66
163
  ```
67
- cap kyan:db:setup # Creates a database.yml file in the apps shared path.
68
164
  cap kyan:vhost:setup # Creates and symlinks an Nginx virtualhost entry.
69
165
  ```
70
166
 
@@ -12,14 +12,14 @@ Gem::Specification.new do |gem|
12
12
  gem.description = %q{Capistrano tasks for database.yml and vhost creation}
13
13
  gem.summary = %q{A bunch of useful Capistrano tasks}
14
14
  gem.homepage = "http://github.com/kyan/capistrano-kyan"
15
+ gem.licenses = ['MIT']
15
16
 
16
17
  gem.files = `git ls-files`.split($/)
17
18
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
20
  gem.require_paths = ["lib"]
20
21
 
22
+ gem.add_development_dependency 'rake', '~> 0'
21
23
 
22
- gem.add_development_dependency 'rake'
23
-
24
- gem.add_runtime_dependency 'capistrano', '~> 2.14.1'
24
+ gem.add_runtime_dependency 'capistrano', '~> 2.14', '>= 2.14.1'
25
25
  end
@@ -6,7 +6,6 @@ module CapistranoKyan
6
6
  TASKS = [
7
7
  'deploy:seed',
8
8
  'deploy:add_env',
9
- 'kyan:db:setup',
10
9
  'kyan:vhost:setup',
11
10
  'kyan:vhost:show',
12
11
  'nginx:start',
@@ -142,39 +141,6 @@ module CapistranoKyan
142
141
  # database.yml cap tasks
143
142
  #
144
143
  namespace :db do
145
- desc <<-DESC
146
- Creates a database.yml file in the apps shared path.
147
- DESC
148
- task :setup, :except => { :no_release => true } do
149
-
150
- require 'digest/sha1'
151
- app = appize(application, fetch(:stage))
152
- database = fetch(:db_database, app)
153
- username = fetch(:db_username, app)
154
- password = Capistrano::CLI.ui.ask("DB password for #{database} (empty for default): ")
155
- password = password.empty? ? Digest::SHA1.hexdigest(database) : password
156
-
157
- default_template = <<-EOF
158
- base: &base
159
- encoding: utf8
160
- adapter: postgresql
161
- pool: <%= fetch(:db_pool, 5) %>
162
- host: <%= fetch(:db_host, 'localhost') %>
163
- <%= fetch(:stage) %>:
164
- database: <%= database %>
165
- username: <%= username %>
166
- password: <%= password %>
167
- <<: *base
168
- EOF
169
-
170
- location = fetch(:template_dir, "config/deploy") + '/database.yml.erb'
171
- template = File.file?(location) ? File.read(location) : default_template
172
- config = ERB.new(template, nil , '-')
173
-
174
- run "mkdir -p #{shared_path}/config"
175
- put config.result(binding), "#{shared_path}/config/database.yml"
176
- end
177
-
178
144
  #
179
145
  # Updates the symlink for database.yml file to the just deployed release.
180
146
  #
@@ -1,3 +1,3 @@
1
1
  module CapistranoKyan
2
- VERSION = "0.2.11"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,41 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-kyan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duncan Robertson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-11 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.14'
34
+ - - ">="
32
35
  - !ruby/object:Gem::Version
33
36
  version: 2.14.1
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ~>
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.14'
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: 2.14.1
41
47
  description: Capistrano tasks for database.yml and vhost creation
@@ -45,7 +51,7 @@ executables: []
45
51
  extensions: []
46
52
  extra_rdoc_files: []
47
53
  files:
48
- - .gitignore
54
+ - ".gitignore"
49
55
  - Gemfile
50
56
  - LICENSE.txt
51
57
  - README.md
@@ -56,7 +62,8 @@ files:
56
62
  - lib/capistrano-kyan/version.rb
57
63
  - templates/vhost.conf.erb
58
64
  homepage: http://github.com/kyan/capistrano-kyan
59
- licenses: []
65
+ licenses:
66
+ - MIT
60
67
  metadata: {}
61
68
  post_install_message:
62
69
  rdoc_options: []
@@ -64,17 +71,17 @@ require_paths:
64
71
  - lib
65
72
  required_ruby_version: !ruby/object:Gem::Requirement
66
73
  requirements:
67
- - - '>='
74
+ - - ">="
68
75
  - !ruby/object:Gem::Version
69
76
  version: '0'
70
77
  required_rubygems_version: !ruby/object:Gem::Requirement
71
78
  requirements:
72
- - - '>='
79
+ - - ">="
73
80
  - !ruby/object:Gem::Version
74
81
  version: '0'
75
82
  requirements: []
76
83
  rubyforge_project:
77
- rubygems_version: 2.0.14
84
+ rubygems_version: 2.2.2
78
85
  signing_key:
79
86
  specification_version: 4
80
87
  summary: A bunch of useful Capistrano tasks