capistrano-nginx 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -16
- data/Gemfile +0 -4
- data/LICENSE +17 -18
- data/README.md +36 -24
- data/Rakefile +1 -13
- data/capistrano-nginx.gemspec +21 -14
- data/lib/capistrano-nginx.rb +0 -1
- data/lib/capistrano/nginx.rb +1 -0
- data/lib/capistrano/tasks/nginx.rake +66 -0
- data/lib/generators/capistrano/nginx/templates/_nginx_conf.erb +14 -15
- metadata +61 -30
- data/CHANGELOG.md +0 -3
- data/lib/capistrano/nginx/tasks.rb +0 -22
- data/lib/capistrano/nginx/version.rb +0 -5
- data/test/generator_test.rb +0 -15
- data/test/tasks_test.rb +0 -26
- data/test/test_helper.rb +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 55d3192b8603820b356596f5f1c9412f0881dbd4
|
4
|
+
data.tar.gz: 974c08a6ae4b2476184b2bd307a647a8cb3b55b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8907ac4fceea95f85121caf1f9985a7d9d24795365f72efd6a85765604f6b9b90709fb4281e3cd9b42842f0092a8437526a9d95d8dcec2f2edbc19901fafa18d
|
7
|
+
data.tar.gz: 26ad384626cce4f1e2c044eedfd5c2484d1b5af5ed9f8d4e2d610386567c206fbfddad7d2d60dfd63c15ec6abbc8d43d21c2b0d8905adb9eb858df44c4d3e6ef
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2012 Ivan Tkalin
|
4
|
+
Copyright (c) 2013 Koen Punt
|
4
5
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
+
this software and associated documentation files (the "Software"), to deal in
|
8
|
+
the Software without restriction, including without limitation the rights to
|
9
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
10
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
11
|
+
subject to the following conditions:
|
12
12
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
15
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
18
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
19
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
20
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# Capistrano::nginx
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
* `nginx:setup` -- creates /etc/nginx/sites-available/YOUR\_APP and links it to /etc/nginx/sites-enabled/YOUR\_APP
|
6
|
-
* `nginx:reload` -- invokes `/etc/init.d/nginx reload` on server
|
7
|
-
|
8
|
-
And nginx configuration file generator, that will create local copy of default nginx config for customization.
|
3
|
+
Nginx support for Capistrano 3.x
|
9
4
|
|
10
5
|
## Installation
|
11
6
|
|
12
7
|
Add this line to your application's Gemfile:
|
13
8
|
|
14
|
-
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano', '~> 3.0.0'
|
11
|
+
gem 'capistrano-nginx', github: 'koenpunt/capistrano-nginx'
|
12
|
+
```
|
15
13
|
|
16
14
|
And then execute:
|
17
15
|
|
@@ -23,32 +21,46 @@ Or install it yourself as:
|
|
23
21
|
|
24
22
|
## Usage
|
25
23
|
|
26
|
-
|
24
|
+
Require in `Capfile`:
|
27
25
|
|
28
|
-
|
26
|
+
```ruby
|
27
|
+
require 'capistrano/nginx'
|
28
|
+
```
|
29
29
|
|
30
|
-
|
30
|
+
Launch new tasks:
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
* `deploy_to` - deployment path
|
35
|
-
* `sudo_user` - user name with sudo privileges (needed to config/restart nginx)
|
36
|
-
* `app_port` - application port (optional)
|
32
|
+
$ cap production nginx:setup
|
33
|
+
$ cap production nginx:reload
|
37
34
|
|
38
|
-
|
35
|
+
If you want to customize the nginx configuration, you can use the Rails generator to create a local copy of the config template:
|
39
36
|
|
40
|
-
$
|
41
|
-
$ cap nginx:reload
|
37
|
+
$ rails generate capistrano:nginx:config
|
42
38
|
|
43
|
-
|
39
|
+
And then edit `config/deploy/nginx_conf.erb` as you like.
|
44
40
|
|
45
|
-
|
41
|
+
Configurable options, shown here with defaults:
|
46
42
|
|
47
|
-
|
43
|
+
```ruby
|
44
|
+
set :nginx_path, '/etc/nginx' # directory containing sites-available and sites-enabled
|
45
|
+
set :nginx_template, 'config/deploy/nginx_conf.erb' # configuration template
|
46
|
+
set :nginx_server_name, 'example.com' # optional, defaults to :application
|
47
|
+
set :nginx_upstream, 'example-app' # optional, defaults to :application
|
48
|
+
set :nginx_listen, 80 # optional, default is not set
|
49
|
+
set :nginx_roles, :all
|
50
|
+
```
|
48
51
|
|
49
|
-
|
52
|
+
### Tasks
|
53
|
+
|
54
|
+
This gem provides the following Capistrano tasks:
|
50
55
|
|
51
|
-
|
56
|
+
* `nginx:setup` creates `/etc/nginx/sites-available/APPLICATION.conf` and links it to `/etc/nginx/sites-enabled/APPLICATION.conf`
|
57
|
+
* `nginx:stop` invokes `service nginx stop` on server
|
58
|
+
* `nginx:start` invokes `service nginx start` on server
|
59
|
+
* `nginx:restart` invokes `service nginx restart` on server
|
60
|
+
* `nginx:reload` invokes `service nginx reload` on server
|
61
|
+
* `nginx:force-reload` invokes `service nginx force-reload` on server
|
62
|
+
* `nginx:enable_site` creates symlink in sites-enabled directory
|
63
|
+
* `nginx:disable_site` removes symlink from sites-enabled directory
|
52
64
|
|
53
65
|
## Contributing
|
54
66
|
|
data/Rakefile
CHANGED
@@ -1,13 +1 @@
|
|
1
|
-
require
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
desc 'Default: run unit tests.'
|
5
|
-
task :default => :test
|
6
|
-
|
7
|
-
desc 'Run tests'
|
8
|
-
Rake::TestTask.new(:test) do |t|
|
9
|
-
t.libs << 'lib'
|
10
|
-
t.libs << 'test'
|
11
|
-
t.pattern = 'test/**/*_test.rb'
|
12
|
-
t.verbose = true
|
13
|
-
end
|
1
|
+
require 'bundler/gem_tasks'
|
data/capistrano-nginx.gemspec
CHANGED
@@ -1,17 +1,24 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'capistrano-nginx'
|
7
|
+
spec.version = '1.0.0'
|
8
|
+
spec.authors = ['Ivan Tkalin', 'Koen Punt']
|
9
|
+
spec.email = ['itkalin@gmail.com', 'mail@koen.pt']
|
10
|
+
spec.description = %q{Simple nginx management for Capistrano 3.x}
|
11
|
+
spec.summary = %q{Simple nginx management for Capistrano 3.x}
|
12
|
+
spec.homepage = 'https://github.com/ivalkeen/capistrano-nginx'
|
13
|
+
spec.license = 'MIT'
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'capistrano', '~> 3.1'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
17
24
|
end
|
data/lib/capistrano-nginx.rb
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
require "capistrano/nginx/version"
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/nginx.rake', __FILE__)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
namespace :nginx do
|
2
|
+
desc <<-DESC
|
3
|
+
Setup nginx configuration
|
4
|
+
|
5
|
+
Configurable options are:
|
6
|
+
|
7
|
+
set :nginx_roles, :all
|
8
|
+
set :nginx_path, "/etc/nginx"
|
9
|
+
set :nginx_upstream, -> { fetch(:application) }
|
10
|
+
set :nginx_server_name, -> { fetch(:application) }
|
11
|
+
set :nginx_template, "config/deploy/nginx_conf.erb"
|
12
|
+
DESC
|
13
|
+
task :setup do
|
14
|
+
invoke :'nginx:create_config'
|
15
|
+
invoke :'nginx:enable_site'
|
16
|
+
end
|
17
|
+
|
18
|
+
task :create_config do
|
19
|
+
on roles fetch(:nginx_roles) do
|
20
|
+
config_file = fetch(:nginx_template)
|
21
|
+
unless File.exists?(config_file)
|
22
|
+
config_file = File.join(File.dirname(__FILE__), "../../generators/capistrano/nginx/templates/_nginx_conf.erb")
|
23
|
+
end
|
24
|
+
config = ERB.new(File.new(config_file).read, 0, '-').result(binding)
|
25
|
+
upload! StringIO.new(config), "#{fetch(:nginx_path)}/sites-available/#{fetch(:application)}.conf"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
[:stop, :start, :restart, :reload, :'force-reload'].each do |action|
|
30
|
+
desc "#{action.to_s.capitalize} nginx"
|
31
|
+
task action do
|
32
|
+
on roles fetch(:nginx_roles) do
|
33
|
+
sudo :service, "nginx", action.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Enable nginx site'
|
39
|
+
task :enable_site do
|
40
|
+
on roles fetch(:nginx_roles) do
|
41
|
+
execute :ln, "-sf",
|
42
|
+
"#{fetch(:nginx_path)}/sites-available/#{fetch(:application)}.conf",
|
43
|
+
"#{fetch(:nginx_path)}/sites-enabled/#{fetch(:application)}.conf"
|
44
|
+
end
|
45
|
+
invoke :'nginx:reload'
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'Disable nginx site'
|
49
|
+
task :disable_site do
|
50
|
+
on roles fetch(:nginx_roles) do
|
51
|
+
config_link = "#{fetch(:nginx_path)}/sites-enabled/#{fetch(:application)}.conf"
|
52
|
+
execute :unlink, config_link if test "[ -f #{config_link} ]"
|
53
|
+
end
|
54
|
+
invoke :'nginx:reload'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace :load do
|
59
|
+
task :defaults do
|
60
|
+
set :nginx_roles, :all
|
61
|
+
set :nginx_path, "/etc/nginx"
|
62
|
+
set :nginx_upstream, -> { fetch(:application) }
|
63
|
+
set :nginx_server_name, -> { fetch(:application) }
|
64
|
+
set :nginx_template, "config/deploy/nginx_conf.erb"
|
65
|
+
end
|
66
|
+
end
|
@@ -1,28 +1,27 @@
|
|
1
|
-
upstream <%=
|
2
|
-
server unix:/tmp/<%=
|
1
|
+
upstream <%= fetch(:nginx_upstream) %> {
|
2
|
+
server unix:/tmp/<%= fetch(:nginx_upstream) %>.sock fail_timeout=0;
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
|
-
<% if
|
7
|
-
listen <%=
|
6
|
+
<% if fetch(:nginx_listen, false) %>
|
7
|
+
listen <%= fetch(:nginx_listen) %>;
|
8
8
|
<% end %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
10
|
+
root <%= current_path.join('public') %>;
|
11
|
+
|
12
|
+
try_files $uri/index.html $uri.html $uri @<%= fetch(:nginx_upstream) %>;
|
13
|
+
|
15
14
|
location ^~ /assets/ {
|
16
15
|
gzip_static on;
|
17
16
|
expires max;
|
18
17
|
add_header Cache-Control public;
|
19
18
|
}
|
20
|
-
|
21
|
-
location @<%=
|
19
|
+
|
20
|
+
location @<%= fetch(:nginx_upstream) %> {
|
22
21
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
23
22
|
proxy_set_header Host $http_host;
|
24
23
|
proxy_redirect off;
|
25
|
-
proxy_pass http://<%=
|
24
|
+
proxy_pass http://<%= fetch(:nginx_upstream) %>;
|
26
25
|
}
|
27
26
|
|
28
27
|
if (-f $document_root/system/maintenance.html) {
|
@@ -31,11 +30,11 @@ server {
|
|
31
30
|
|
32
31
|
error_page 500 502 504 /500.html;
|
33
32
|
location = /500.html {
|
34
|
-
root <%=
|
33
|
+
root <%= current_path.join('public') %>;
|
35
34
|
}
|
36
35
|
|
37
36
|
error_page 503 @maintenance;
|
38
37
|
location @maintenance {
|
39
|
-
rewrite
|
38
|
+
rewrite ^(.*)$ /system/maintenance.html break;
|
40
39
|
}
|
41
40
|
}
|
metadata
CHANGED
@@ -1,70 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-nginx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ivan Tkalin
|
8
|
+
- Koen Punt
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2016-01-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.3'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.3'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: Simple nginx management for Capistrano 3.x
|
15
57
|
email:
|
16
58
|
- itkalin@gmail.com
|
59
|
+
- mail@koen.pt
|
17
60
|
executables: []
|
18
61
|
extensions: []
|
19
62
|
extra_rdoc_files: []
|
20
63
|
files:
|
21
|
-
- .gitignore
|
22
|
-
- CHANGELOG.md
|
64
|
+
- ".gitignore"
|
23
65
|
- Gemfile
|
24
66
|
- LICENSE
|
25
67
|
- README.md
|
26
68
|
- Rakefile
|
27
69
|
- capistrano-nginx.gemspec
|
28
70
|
- lib/capistrano-nginx.rb
|
29
|
-
- lib/capistrano/nginx
|
30
|
-
- lib/capistrano/nginx
|
71
|
+
- lib/capistrano/nginx.rb
|
72
|
+
- lib/capistrano/tasks/nginx.rake
|
31
73
|
- lib/generators/capistrano/nginx/USAGE
|
32
74
|
- lib/generators/capistrano/nginx/config_generator.rb
|
33
75
|
- lib/generators/capistrano/nginx/templates/_nginx_conf.erb
|
34
|
-
- test/generator_test.rb
|
35
|
-
- test/tasks_test.rb
|
36
|
-
- test/test_helper.rb
|
37
76
|
homepage: https://github.com/ivalkeen/capistrano-nginx
|
38
|
-
licenses:
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
39
80
|
post_install_message:
|
40
81
|
rdoc_options: []
|
41
82
|
require_paths:
|
42
83
|
- lib
|
43
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
44
85
|
requirements:
|
45
|
-
- -
|
86
|
+
- - ">="
|
46
87
|
- !ruby/object:Gem::Version
|
47
88
|
version: '0'
|
48
|
-
segments:
|
49
|
-
- 0
|
50
|
-
hash: -1440542809374887780
|
51
|
-
none: false
|
52
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
90
|
requirements:
|
54
|
-
- -
|
91
|
+
- - ">="
|
55
92
|
- !ruby/object:Gem::Version
|
56
93
|
version: '0'
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
hash: -1440542809374887780
|
60
|
-
none: false
|
61
94
|
requirements: []
|
62
95
|
rubyforge_project:
|
63
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.4.5
|
64
97
|
signing_key:
|
65
|
-
specification_version:
|
66
|
-
summary:
|
67
|
-
test_files:
|
68
|
-
|
69
|
-
- test/tasks_test.rb
|
70
|
-
- test/test_helper.rb
|
98
|
+
specification_version: 4
|
99
|
+
summary: Simple nginx management for Capistrano 3.x
|
100
|
+
test_files: []
|
101
|
+
has_rdoc:
|
data/CHANGELOG.md
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Capistrano::Configuration.instance.load do
|
2
|
-
namespace :nginx do
|
3
|
-
desc "Setup application in nginx"
|
4
|
-
task "setup", :role => :web do
|
5
|
-
config_file = "config/deploy/nginx_conf.erb"
|
6
|
-
unless File.exists?(config_file)
|
7
|
-
config_file = File.join(File.dirname(__FILE__), "../../generators/capistrano/nginx/templates/_nginx_conf.erb")
|
8
|
-
end
|
9
|
-
config = ERB.new(File.read(config_file)).result(binding)
|
10
|
-
set :user, sudo_user
|
11
|
-
put config, "/tmp/#{application}"
|
12
|
-
run "#{sudo} mv /tmp/#{application} /etc/nginx/sites-available/#{application}"
|
13
|
-
run "#{sudo} ln -fs /etc/nginx/sites-available/#{application} /etc/nginx/sites-enabled/#{application}"
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Reload nginx configuration"
|
17
|
-
task :reload, :role => :web do
|
18
|
-
set :user, sudo_user
|
19
|
-
run "#{sudo} /etc/init.d/nginx reload"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/test/generator_test.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rails/generators/test_case'
|
3
|
-
require 'generators/capistrano/nginx/config_generator'
|
4
|
-
|
5
|
-
class GeneratorTest < Rails::Generators::TestCase
|
6
|
-
tests Capistrano::Nginx::Generators::ConfigGenerator
|
7
|
-
destination File.expand_path('../../tmp', __FILE__)
|
8
|
-
setup :prepare_destination
|
9
|
-
teardown { rm_rf(destination_root) }
|
10
|
-
|
11
|
-
def test_generates_local_config_file
|
12
|
-
run_generator
|
13
|
-
assert_file 'config/deploy/nginx_conf.erb'
|
14
|
-
end
|
15
|
-
end
|
data/test/tasks_test.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
require 'capistrano'
|
4
|
-
|
5
|
-
class TasksTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
@config = Capistrano::Configuration.new
|
8
|
-
Capistrano::Configuration.instance = @config
|
9
|
-
task = @config.find_task("nginx:setup")
|
10
|
-
load 'capistrano/nginx/tasks.rb'
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_add_setup_task
|
14
|
-
namespace = @config.namespaces[:nginx]
|
15
|
-
assert_not_nil namespace
|
16
|
-
setup_task = namespace.tasks[:setup]
|
17
|
-
assert_not_nil setup_task
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_add_reload_task
|
21
|
-
namespace = @config.namespaces[:nginx]
|
22
|
-
assert_not_nil namespace
|
23
|
-
setup_task = namespace.tasks[:reload]
|
24
|
-
assert_not_nil setup_task
|
25
|
-
end
|
26
|
-
end
|
data/test/test_helper.rb
DELETED