capistrano-system-v-service 0.1.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 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +34 -0
- data/LICENSE +21 -0
- data/README.md +68 -0
- data/Rakefile +1 -0
- data/capistrano-system-v-service.gemspec +24 -0
- data/lib/capistrano/system-v-service.rb +1 -0
- data/lib/capistrano/tasks/system-v-service.rake +39 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: db40f6b5536f9748cbd5faeb76999ab33dd9225a
|
4
|
+
data.tar.gz: d6f88ab3c4aeb7360ef195ec157a58cdbfe4167e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4df0470694747851547bfe1780bbaef79719fc251006069d3c52a2be841c384ca5d084400c7c2276ae7831ed613314324970b4530c006275bd5ee97c8cdf20cf
|
7
|
+
data.tar.gz: 1355394453e3d5bae73958b57198713b8d24393f92a2456f7c3fae23b4b8f2011386d0aaf71337cef2cae29e502e48fa41bede91fb1d06c97350a6b47cb09eb2
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-system-v (0.1.0)
|
5
|
+
capistrano (>= 3.0.0.pre)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
capistrano (3.4.0)
|
11
|
+
i18n
|
12
|
+
rake (>= 10.0.0)
|
13
|
+
sshkit (~> 1.3)
|
14
|
+
colorize (0.7.7)
|
15
|
+
i18n (0.7.0)
|
16
|
+
net-scp (1.2.1)
|
17
|
+
net-ssh (>= 2.6.5)
|
18
|
+
net-ssh (2.9.2)
|
19
|
+
rake (10.4.2)
|
20
|
+
sshkit (1.7.1)
|
21
|
+
colorize (>= 0.7.0)
|
22
|
+
net-scp (>= 1.1.2)
|
23
|
+
net-ssh (>= 2.8.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.3)
|
30
|
+
capistrano-system-v!
|
31
|
+
rake
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
1.10.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 PJ Kelly & Pablo Castillo (Crush & Lovely)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Capistrano System-V Service
|
2
|
+
|
3
|
+
Define Capistrano 3.x tasks for your System V services via a simple YAML configuration file.
|
4
|
+
|
5
|
+
This gem is a successor to [capistrano-service](https://github.com/crushlovely/capistrano-service).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'capistrano', '~> 3.0.0'
|
13
|
+
gem 'capistrano-system-v-service'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install capistrano-system-v-service
|
23
|
+
|
24
|
+
## Setup
|
25
|
+
|
26
|
+
``` ruby
|
27
|
+
require 'capistrano/system-v-service'
|
28
|
+
```
|
29
|
+
|
30
|
+
Then add a file named `config/capistrano-system-v-service.yml` in your project with the following content:
|
31
|
+
|
32
|
+
``` yaml
|
33
|
+
system_v_services:
|
34
|
+
- name: nginx
|
35
|
+
roles: :all
|
36
|
+
```
|
37
|
+
|
38
|
+
Once you've done this, you'll see that several tasks are defined for each service you added:
|
39
|
+
|
40
|
+
``` bash
|
41
|
+
$ cap -T
|
42
|
+
...
|
43
|
+
cap service:nginx:reload # Reload the nginx service via upstart on all servers
|
44
|
+
cap service:nginx:restart # Restart the nginx service via upstart on all servers
|
45
|
+
cap service:nginx:start # Start the nginx service via upstart on all servers
|
46
|
+
cap service:nginx:status # Status the nginx service via upstart on all servers
|
47
|
+
cap service:nginx:stop # Stop the nginx service via upstart on all servers
|
48
|
+
```
|
49
|
+
|
50
|
+
You can add as many services to this YAML file as you like; tasks will be defined for all of them. If you omit the `roles` option, the service will default to `:all`.
|
51
|
+
|
52
|
+
## Usage
|
53
|
+
|
54
|
+
Once you've set everything up, simply call your tasks directly (`cap service:nginx:restart`), or add them to your deploy flow:
|
55
|
+
|
56
|
+
``` ruby
|
57
|
+
namespace :deploy do
|
58
|
+
after :publishing, 'service:nginx:restart'
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
1. Fork it
|
65
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
66
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
67
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
68
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'capistrano-system-v-service'
|
7
|
+
spec.version = '0.1.0'
|
8
|
+
spec.authors = ['PJ Kelly', 'Pablo Castillo']
|
9
|
+
spec.email = ['pj@crushlovely.com', 'pablo@crushlovely.com']
|
10
|
+
spec.description = %q{Easily define Capistrano 3.x tasks for your System V services.}
|
11
|
+
spec.summary = spec.description
|
12
|
+
spec.homepage = 'https://github.com/crushlovely/capistrano-system-v-service'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.0.0.pre'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/system-v-service.rake', __FILE__)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
system_v_configuration = YAML.load_file('config/capistrano-system-v-service.yml')['system_v_services']
|
2
|
+
|
3
|
+
class SystemVCommand
|
4
|
+
attr_reader :name, :roles, :command
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
@name = options.fetch(:name)
|
8
|
+
@roles = options.fetch(:roles) || :all
|
9
|
+
@command = options.fetch(:command)
|
10
|
+
end
|
11
|
+
|
12
|
+
def description
|
13
|
+
"#{command.capitalize} the #{name} service via system-v on #{roles} servers."
|
14
|
+
end
|
15
|
+
|
16
|
+
def task_name
|
17
|
+
"service:#{name}:#{command}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
[:sudo, :service, name, command].join(' ')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
system_v_configuration.each do |config|
|
26
|
+
%w(start stop restart reload status).each do |command|
|
27
|
+
service = SystemVCommand.new(:name => config['name'], :roles => config['roles'], :command => command)
|
28
|
+
desc service.description
|
29
|
+
Rake::Task.define_task(service.task_name) do |t|
|
30
|
+
on roles service.roles do
|
31
|
+
if %w(reload status).include?(command)
|
32
|
+
info capture(service.to_s)
|
33
|
+
else
|
34
|
+
execute service.to_s
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-system-v-service
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- PJ Kelly
|
8
|
+
- Pablo Castillo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-09-11 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.0.0.pre
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 3.0.0.pre
|
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: Easily define Capistrano 3.x tasks for your System V services.
|
57
|
+
email:
|
58
|
+
- pj@crushlovely.com
|
59
|
+
- pablo@crushlovely.com
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- CHANGELOG.md
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- capistrano-system-v-service.gemspec
|
72
|
+
- lib/capistrano/system-v-service.rb
|
73
|
+
- lib/capistrano/tasks/system-v-service.rake
|
74
|
+
homepage: https://github.com/crushlovely/capistrano-system-v-service
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Easily define Capistrano 3.x tasks for your System V services.
|
98
|
+
test_files: []
|
99
|
+
has_rdoc:
|