ninja-deploy 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -38,6 +38,25 @@ Dependencies:
38
38
  * The configured local development user must have permission to load the database form a MySQL dump file.
39
39
 
40
40
 
41
+ == Deploy Recipes
42
+
43
+ Require the deploy recipes in your deploy.rb file:
44
+
45
+ require 'ninja_deploy/recipes/deploy'
46
+
47
+ === web:disable
48
+
49
+ Presents a maintenance page to visitors.
50
+
51
+ As Callback:
52
+
53
+ after "deploy:update_code", "deploy:web:disable"
54
+
55
+ From Command-Line:
56
+
57
+ cap production deploy:web:disable REASON="hardware upgrade" UNTIL="12pm Central Time"
58
+
59
+
41
60
  == Log Recipes
42
61
 
43
62
  Require the database recipes in your deploy.rb file:
@@ -53,7 +72,7 @@ Tails the remote server's log for the current environment.
53
72
 
54
73
  == Passenger Recipes
55
74
 
56
- Require the database recipes in your deploy.rb file:
75
+ Require the passenger recipes in your deploy.rb file:
57
76
 
58
77
  require 'ninja_deploy/recipes/passenger'
59
78
 
@@ -84,7 +103,7 @@ From Command-Line:
84
103
 
85
104
  == Sass Recipes
86
105
 
87
- Require the database recipes in your deploy.rb file:
106
+ Require the sass recipes in your deploy.rb file:
88
107
 
89
108
  require 'ninja_deploy/recipes/sass'
90
109
 
@@ -101,9 +120,84 @@ From Command-Line:
101
120
  cap production sass:update
102
121
 
103
122
 
123
+ == Thinking Sphinx Recipes
124
+
125
+ Require the thinking sphinx recipes in your deploy.rb file:
126
+
127
+ require 'ninja_deploy/recipes/thinking_sphinx'
128
+
129
+ === configure
130
+
131
+ Generates the Thinking Sphinx configuration file from the sphinx.yml file.
132
+
133
+ As Callback:
134
+
135
+ after "deploy:update_code", "thinking_sphinx:configure"
136
+
137
+ From Command-Line:
138
+
139
+ cap production thinking_sphinx:configure
140
+
141
+ === index
142
+
143
+ Builds the Sphinx index files.
144
+
145
+ From Command-Line:
146
+
147
+ cap production thinking_sphinx:configure
148
+
149
+ === start
150
+
151
+ Start Sphinx searchd daemon.
152
+
153
+ As Callback:
154
+
155
+ after "deploy:update_code", "thinking_sphinx:start"
156
+
157
+ === stop
158
+
159
+ Stops Sphinx searchd daemon.
160
+
161
+ As Callback:
162
+
163
+ after "deploy:update_code", "thinking_sphinx:stop"
164
+
165
+ === restart
166
+
167
+ Stops and starts the Sphinx searchd daemon.
168
+
169
+ From Command-Line:
170
+
171
+ cap production thinking_sphinx:restart
172
+
173
+ === rebuild
174
+
175
+ Stops the Sphinx searchd daemon, re-indexes and then starts the searchd daemon.
176
+
177
+ From Command-Line:
178
+
179
+ cap production thinking_sphinx:rebuild
180
+
181
+ === shared_sphinx_folder
182
+
183
+ Create the folder in the shared directory to store the Sphinx files.
184
+
185
+ As Callback:
186
+
187
+ after "deploy:update_code", "thinking_sphinx:shared_sphinx_folder"
188
+
189
+ === symlink_sphinx_indexes
190
+
191
+ symlink to the folder in the shared directory to store the Sphinx files.
192
+
193
+ As Callback:
194
+
195
+ after "deploy:update_code", "thinking_sphinx:symlink_sphinx_indexes"
196
+
197
+
104
198
  == Version Recipes
105
199
 
106
- Require the database recipes in your deploy.rb file:
200
+ Require the version recipes in your deploy.rb file:
107
201
 
108
202
  require 'ninja_deploy/recipes/version'
109
203
 
@@ -122,7 +216,7 @@ Dependencies:
122
216
 
123
217
  == Whenever Recipes
124
218
 
125
- Require the database recipes in your deploy.rb file:
219
+ Require the whenever recipes in your deploy.rb file:
126
220
 
127
221
  require 'ninja_deploy/recipes/whenever'
128
222
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.1.0
@@ -0,0 +1,37 @@
1
+ Capistrano::Configuration.instance( :must_exist ).load do
2
+ namespace :deploy do
3
+ namespace :web do
4
+ desc <<-DESC
5
+ Present custom maintenance page to visitors. Disables your application's web \
6
+ interface by writing a "maintenance.html" file to each web server. The \
7
+ servers must be configured to detect the presence of this file, and if \
8
+ it is present, always display it instead of performing the request.
9
+
10
+ By default, the maintenance page will just say the site is down for \
11
+ "maintenance", and will be back "shortly", but you can customize the \
12
+ page by specifying the REASON and UNTIL environment variables:
13
+
14
+ $ cap deploy:web:disable \\
15
+ REASON="hardware upgrade" \\
16
+ UNTIL="12pm Central Time"
17
+
18
+ Further customization copy your html file to shared_path+'/system/maintenance.html.custom'.
19
+ If this file exists it will be used instead of the default capistrano ugly page
20
+ DESC
21
+ task :disable, :roles => :web, :except => { :no_release => true } do
22
+ maint_file = "#{shared_path}/system/maintenance.html"
23
+ on_rollback { run "rm #{shared_path}/system/maintenance.html" }
24
+
25
+ reason = ENV['REASON']
26
+ deadline = ENV['UNTIL']
27
+
28
+ template = File.read(File.join(File.dirname(__FILE__), "templates", "maintenance.html.erb"))
29
+ #result = Haml::Engine.new(template).to_html
30
+ result = ERB.new(template).result(binding)
31
+
32
+ put result, "#{shared_path}/system/maintenance.html.tmp", :mode => 0644
33
+ run "if [ -f #{shared_path}/system/maintenance.html.custom ]; then cp #{shared_path}/system/maintenance.html.custom #{maint_file}; else cp #{shared_path}/system/maintenance.html.tmp #{maint_file}; fi"
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,54 @@
1
+ Capistrano::Configuration.instance( :must_exist ).load do
2
+ namespace :thinking_sphinx do
3
+ desc "Generate the Sphinx configuration file"
4
+ task :configure do
5
+ rake "thinking_sphinx:configure"
6
+ end
7
+
8
+ desc "Index data"
9
+ task :index do
10
+ rake "thinking_sphinx:index"
11
+ end
12
+
13
+ desc "Start the Sphinx daemon"
14
+ task :start do
15
+ rake "thinking_sphinx:start"
16
+ end
17
+
18
+ desc "Stop the Sphinx daemon"
19
+ task :stop do
20
+ rake "thinking_sphinx:stop"
21
+ end
22
+
23
+ desc "Stop and then start the Sphinx daemon"
24
+ task :restart do
25
+ stop
26
+ start
27
+ end
28
+
29
+ desc "Stop, re-index and then start the Sphinx daemon"
30
+ task :rebuild do
31
+ stop
32
+ index
33
+ start
34
+ end
35
+
36
+ desc "Add the shared folder for sphinx files for the production environment"
37
+ task :shared_sphinx_folder, :roles => :web do
38
+ run "mkdir -p #{shared_path}/db/sphinx/#{rails_env}"
39
+ end
40
+
41
+ desc "Symlink to the shared folder for sphinx files for the production environment"
42
+ task :symlink_sphinx_indexes, :roles => [:app] do
43
+ run "ln -nfs #{shared_path}/db/sphinx #{release_path}/db/sphinx"
44
+ end
45
+
46
+ def rake(*tasks)
47
+ rails_env = fetch(:rails_env, "production")
48
+ rake = fetch(:rake, "rake")
49
+ tasks.each do |t|
50
+ run "if [ -d #{release_path} ]; then cd #{release_path}; else cd #{current_path}; fi; #{rake} RAILS_ENV=#{rails_env} #{t}"
51
+ end
52
+ end
53
+ end
54
+ end
data/ninja-deploy.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ninja-deploy}
8
- s.version = "1.0.2"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ninja Loss"]
@@ -26,9 +26,11 @@ Gem::Specification.new do |s|
26
26
  "VERSION",
27
27
  "lib/ninja_deploy.rb",
28
28
  "lib/ninja_deploy/recipes/database.rb",
29
+ "lib/ninja_deploy/recipes/deploy.rb",
29
30
  "lib/ninja_deploy/recipes/log.rb",
30
31
  "lib/ninja_deploy/recipes/passenger.rb",
31
32
  "lib/ninja_deploy/recipes/sass.rb",
33
+ "lib/ninja_deploy/recipes/thinking_sphinx.rb",
32
34
  "lib/ninja_deploy/recipes/version.rb",
33
35
  "lib/ninja_deploy/recipes/whenever.rb",
34
36
  "ninja-deploy.gemspec",
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 1.0.2
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ninja Loss
@@ -67,9 +67,11 @@ files:
67
67
  - VERSION
68
68
  - lib/ninja_deploy.rb
69
69
  - lib/ninja_deploy/recipes/database.rb
70
+ - lib/ninja_deploy/recipes/deploy.rb
70
71
  - lib/ninja_deploy/recipes/log.rb
71
72
  - lib/ninja_deploy/recipes/passenger.rb
72
73
  - lib/ninja_deploy/recipes/sass.rb
74
+ - lib/ninja_deploy/recipes/thinking_sphinx.rb
73
75
  - lib/ninja_deploy/recipes/version.rb
74
76
  - lib/ninja_deploy/recipes/whenever.rb
75
77
  - ninja-deploy.gemspec