capistrano-foreman 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +1 -0
- data/LICENSE.md +22 -0
- data/README.md +8 -7
- data/capistrano-foreman.gemspec +8 -4
- data/lib/capistrano-foreman.rb +0 -6
- data/lib/capistrano/foreman.rb +1 -44
- data/lib/capistrano/tasks/foreman.rb +54 -0
- metadata +41 -12
- data/lib/capistrano/version.rb +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5938a6e7555b79410d32279c0634bb3319e3d668
|
4
|
+
data.tar.gz: e0b9fb4b1b2f787f6d093f0408643ad723fcc00e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0f04d9f7fa93dde0c3950fb6ba97b99ae4c825f144fff7e24031555e9391a662bbf46b9513b961eab36172b7ce18f3649f9a728dacef2ff3d14b8063c20275b
|
7
|
+
data.tar.gz: b8bcc2cf08aec5edebfd61304f97006d273e43f43ba3b4819ec199644a193aa20b618dc487d0633e65fbf648dd7e1328bb02d30e13566cc0623caf0cfad428bc
|
data/LICENSE
CHANGED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Licensed under the **MIT** license
|
2
|
+
|
3
|
+
> Copyright (c) 2014 Hyper Interaktiv AS
|
4
|
+
>
|
5
|
+
> Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
> a copy of this software and associated documentation files (the
|
7
|
+
> "Software"), to deal in the Software without restriction, including
|
8
|
+
> without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
> distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
> permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
> the following conditions:
|
12
|
+
>
|
13
|
+
> The above copyright notice and this permission notice shall be
|
14
|
+
> included in all copies or substantial portions of the Software.
|
15
|
+
>
|
16
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Capistrano Foreman
|
2
2
|
|
3
|
-
[![Code Climate](https://
|
3
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/hyperoslo/capistrano-foreman.svg?style=flat)](https://codeclimate.com/github/hyperoslo/capistrano-foreman)
|
4
4
|
|
5
5
|
Capistrano tasks for foreman and upstart.
|
6
6
|
|
@@ -14,12 +14,13 @@ Add this to your `Capfile`:
|
|
14
14
|
require 'capistrano/foreman'
|
15
15
|
|
16
16
|
# Default settings
|
17
|
-
set :
|
18
|
-
set :
|
17
|
+
set :foreman_use_sudo, false
|
18
|
+
set :foreman_roles, :all
|
19
|
+
set :foreman_template, 'upstart'
|
20
|
+
set :foreman_export_path, File.join(Dir.home, '.init')
|
19
21
|
set :foreman_options, {
|
20
22
|
app: application,
|
21
|
-
log:
|
22
|
-
user: user,
|
23
|
+
log: File.join(shared_path, 'log')
|
23
24
|
}
|
24
25
|
```
|
25
26
|
|
@@ -29,11 +30,11 @@ See [exporting options](http://ddollar.github.io/foreman/#EXPORTING0) for an exh
|
|
29
30
|
|
30
31
|
Export Procfile to upstart:
|
31
32
|
|
32
|
-
$ cap foreman:export
|
33
|
+
$ bundle exec cap production foreman:export
|
33
34
|
|
34
35
|
Restart the application services:
|
35
36
|
|
36
|
-
$ cap foreman:restart
|
37
|
+
$ bundle exec cap production foreman:restart
|
37
38
|
|
38
39
|
## Credits
|
39
40
|
|
data/capistrano-foreman.gemspec
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
|
4
5
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Johannes Gorset"]
|
6
|
-
gem.email = ["jgorset@gmail.com"]
|
6
|
+
gem.authors = ["Johannes Gorset", 'John Bellone']
|
7
|
+
gem.email = ["jgorset@gmail.com", 'jbellone@bloomberg.net']
|
7
8
|
gem.description = "Capistrano tasks for foreman and upstart."
|
8
9
|
gem.summary = "Capistrano tasks for foreman and upstart."
|
9
10
|
gem.homepage = "http://github.com/hyperoslo/capistrano-foreman"
|
@@ -13,5 +14,8 @@ Gem::Specification.new do |gem|
|
|
13
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
15
|
gem.name = "capistrano-foreman"
|
15
16
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version =
|
17
|
+
gem.version = '1.1.0'
|
18
|
+
|
19
|
+
gem.add_dependency 'capistrano', '~> 3.1'
|
20
|
+
gem.add_dependency 'capistrano-bundler', '~> 1.1'
|
17
21
|
end
|
data/lib/capistrano-foreman.rb
CHANGED
data/lib/capistrano/foreman.rb
CHANGED
@@ -1,44 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
_cset :foreman_sudo, "sudo"
|
4
|
-
_cset :foreman_upstart_path, "/etc/init/sites"
|
5
|
-
_cset :foreman_options, {}
|
6
|
-
_cset :foreman_use_binstubs, false
|
7
|
-
|
8
|
-
namespace :foreman do
|
9
|
-
desc "Export the Procfile to Ubuntu's upstart scripts"
|
10
|
-
task :export, roles: :app do
|
11
|
-
cmd = foreman_use_binstubs ? 'bin/foreman' : 'bundle exec foreman'
|
12
|
-
run "if [[ -d #{foreman_upstart_path} ]]; then #{foreman_sudo} mkdir -p #{foreman_upstart_path}; fi"
|
13
|
-
run "cd #{release_path} && #{foreman_sudo} #{cmd} export upstart #{foreman_upstart_path} #{format(options)}"
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Start the application services"
|
17
|
-
task :start, roles: :app do
|
18
|
-
sudo "service #{options[:app]} start"
|
19
|
-
end
|
20
|
-
|
21
|
-
desc "Stop the application services"
|
22
|
-
task :stop, roles: :app do
|
23
|
-
sudo "service #{options[:app]} stop"
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "Restart the application services"
|
27
|
-
task :restart, roles: :app do
|
28
|
-
run "sudo service #{options[:app]} start || sudo service #{options[:app]} restart"
|
29
|
-
end
|
30
|
-
|
31
|
-
def options
|
32
|
-
{
|
33
|
-
app: application,
|
34
|
-
log: "#{shared_path}/log",
|
35
|
-
user: user
|
36
|
-
}.merge foreman_options
|
37
|
-
end
|
38
|
-
|
39
|
-
def format opts
|
40
|
-
opts.map { |opt, value| "--#{opt}='#{value}'" }.join " "
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
1
|
+
load File.expand_path('../tasks/foreman.rb', __FILE__)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
namespace :foreman do
|
2
|
+
task :setup do
|
3
|
+
invoke :'foreman:export'
|
4
|
+
invoke :'foreman:start'
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'Export the Procfile'
|
8
|
+
task :export do
|
9
|
+
on roles fetch(:foreman_roles) do
|
10
|
+
within release_path do
|
11
|
+
opts = {
|
12
|
+
app: fetch(:application),
|
13
|
+
log: File.join(shared_path, 'log'),
|
14
|
+
}.merge fetch(:foreman_options, {})
|
15
|
+
|
16
|
+
execute :foreman, 'export',
|
17
|
+
fetch(:foreman_template),
|
18
|
+
fetch(:foreman_export_path),
|
19
|
+
opts.map { |opt, value| "--#{opt}='#{value}'" }.join(' ')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Start the application services'
|
25
|
+
task :start do
|
26
|
+
on roles fetch(:foreman_roles) do
|
27
|
+
sudo :start, fetch(:foreman_app)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Stop the application services'
|
32
|
+
task :stop do
|
33
|
+
on roles fetch(:foreman_roles) do
|
34
|
+
sudo :stop, fetch(:foreman_app)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Restart the application services'
|
39
|
+
task :restart do
|
40
|
+
on roles fetch(:foreman_roles) do
|
41
|
+
sudo :restart, fetch(:foreman_app)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
namespace :load do
|
47
|
+
task :defaults do
|
48
|
+
set :bundle_bins, fetch(:bundle_bins, []).push(%w(foreman))
|
49
|
+
set :foreman_template, 'upstart'
|
50
|
+
set :foreman_export_path, '/etc/init/sites'
|
51
|
+
set :foreman_roles, :all
|
52
|
+
set :foreman_app, -> { fetch(:application) }
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,54 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Johannes Gorset
|
8
|
+
- John Bellone
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
12
|
+
date: 2014-11-01 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: capistrano-bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.1'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.1'
|
14
42
|
description: Capistrano tasks for foreman and upstart.
|
15
43
|
email:
|
16
44
|
- jgorset@gmail.com
|
45
|
+
- jbellone@bloomberg.net
|
17
46
|
executables: []
|
18
47
|
extensions: []
|
19
48
|
extra_rdoc_files: []
|
20
49
|
files:
|
21
|
-
- .gitignore
|
50
|
+
- ".gitignore"
|
22
51
|
- Gemfile
|
23
52
|
- LICENSE
|
53
|
+
- LICENSE.md
|
24
54
|
- README.md
|
25
55
|
- Rakefile
|
26
56
|
- capistrano-foreman.gemspec
|
27
57
|
- lib/capistrano-foreman.rb
|
28
58
|
- lib/capistrano/foreman.rb
|
29
|
-
- lib/capistrano/
|
59
|
+
- lib/capistrano/tasks/foreman.rb
|
30
60
|
homepage: http://github.com/hyperoslo/capistrano-foreman
|
31
61
|
licenses: []
|
62
|
+
metadata: {}
|
32
63
|
post_install_message:
|
33
64
|
rdoc_options: []
|
34
65
|
require_paths:
|
35
66
|
- lib
|
36
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
68
|
requirements:
|
39
|
-
- -
|
69
|
+
- - ">="
|
40
70
|
- !ruby/object:Gem::Version
|
41
71
|
version: '0'
|
42
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
73
|
requirements:
|
45
|
-
- -
|
74
|
+
- - ">="
|
46
75
|
- !ruby/object:Gem::Version
|
47
76
|
version: '0'
|
48
77
|
requirements: []
|
49
78
|
rubyforge_project:
|
50
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.2.2
|
51
80
|
signing_key:
|
52
|
-
specification_version:
|
81
|
+
specification_version: 4
|
53
82
|
summary: Capistrano tasks for foreman and upstart.
|
54
83
|
test_files: []
|