mascherano 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/img/mascherano-logo.png +0 -0
- data/lib/mascherano/env.rb +1 -0
- data/lib/mascherano/figaro.rb +1 -0
- data/lib/mascherano/foreman.rb +1 -0
- data/lib/mascherano/tasks/env.cap +35 -0
- data/lib/mascherano/tasks/figaro.cap +54 -0
- data/lib/mascherano/tasks/foreman.cap +63 -0
- data/lib/mascherano/tasks/upstart.cap +42 -0
- data/lib/mascherano/upstart.rb +1 -0
- data/lib/mascherano/version.rb +3 -0
- data/lib/mascherano.rb +4 -0
- data/mascherano.gemspec +25 -0
- metadata +112 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2013 Alif Rachmawadi <subosito@gmail.com>
|
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
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
![Logo](img/mascherano-logo.png)
|
2
|
+
|
3
|
+
# Mascherano
|
4
|
+
|
5
|
+
TODO: Write a gem description
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'mascherano'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mascherano
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/env.cap', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/figaro.cap', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/foreman.cap', __FILE__)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
namespace :env do
|
2
|
+
desc <<-DESC
|
3
|
+
Upload env file to the server
|
4
|
+
|
5
|
+
You can override any of these defaults by setting the variables shown below.
|
6
|
+
|
7
|
+
set :env_file, ".env"
|
8
|
+
set :target_file, -> { shared_path.join('.env') }
|
9
|
+
DESC
|
10
|
+
task :upload do
|
11
|
+
on roles(:app) do
|
12
|
+
upload! fetch(:env_file), fetch(:env_target), via: :scp
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc <<-DESC
|
17
|
+
Symlink the .env file to the release_path
|
18
|
+
DESC
|
19
|
+
task :symlink do
|
20
|
+
on roles(:app) do
|
21
|
+
execute :ln, "-sf #{fetch(:env_target)} #{release_path.join('.env')}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
namespace :load do
|
27
|
+
task :defaults do
|
28
|
+
set :env_file, ".env"
|
29
|
+
set :env_target, -> { shared_path.join('.env') }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :deploy do
|
34
|
+
after :updating, 'env:symlink'
|
35
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
namespace :figaro do
|
2
|
+
desc <<-DESC
|
3
|
+
Upload application config to the server
|
4
|
+
|
5
|
+
You can override any of these defaults by setting the variables shown below.
|
6
|
+
|
7
|
+
set :figaro_target, -> { shared_path.join('application.yml') }
|
8
|
+
set :figaro_config, -> { release_path.join('config', 'application.yml') }
|
9
|
+
set :figaro_to_env, false
|
10
|
+
DESC
|
11
|
+
task :upload do
|
12
|
+
on roles(:app) do
|
13
|
+
figaro_stage = fetch(:stage)
|
14
|
+
figaro_tmp = "figaro-#{figaro_stage}"
|
15
|
+
|
16
|
+
run_locally do
|
17
|
+
if fetch(:figaro_to_env)
|
18
|
+
figaro_cmd = %Q(Figaro.vars("#{figaro_stage}").split)
|
19
|
+
else
|
20
|
+
figaro_cmd = %Q(Figaro.env("#{figaro_stage}").to_yaml)
|
21
|
+
end
|
22
|
+
|
23
|
+
execute :bundle, "exec rails runner 'puts #{figaro_cmd}' > #{figaro_tmp}"
|
24
|
+
end
|
25
|
+
|
26
|
+
upload! figaro_tmp, fetch(:figaro_target), via: :scp
|
27
|
+
|
28
|
+
run_locally do
|
29
|
+
execute :rm, figaro_tmp
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc <<-DESC
|
35
|
+
Symlink the application config to the release_path
|
36
|
+
DESC
|
37
|
+
task :symlink do
|
38
|
+
on roles(:app) do
|
39
|
+
execute :ln, "-sf #{fetch(:figaro_target)} #{fetch(:figaro_config)}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :load do
|
45
|
+
task :defaults do
|
46
|
+
set :figaro_target, -> { shared_path.join('application.yml') }
|
47
|
+
set :figaro_config, -> { release_path.join('config', 'application.yml') }
|
48
|
+
set :figaro_to_env, false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
namespace :deploy do
|
53
|
+
after :updating, 'figaro:symlink'
|
54
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
namespace :foreman do
|
2
|
+
desc <<-DESC
|
3
|
+
Export the Procfile to upstart.
|
4
|
+
|
5
|
+
You can override any of these defaults by setting the variables shown below.
|
6
|
+
|
7
|
+
set :foreman_format, "upstart"
|
8
|
+
set :foreman_location, "/etc/init"
|
9
|
+
set :foreman_port, 5000
|
10
|
+
set :foreman_root, -> { release_path }
|
11
|
+
set :foreman_procfile, -> { release_path.join('Procfile') }
|
12
|
+
set :foreman_app, -> { fetch(:application) }
|
13
|
+
set :foreman_user, -> { fetch(:user) }
|
14
|
+
set :foreman_log, -> { shared_path.join('log') }
|
15
|
+
set :foreman_concurrency, false
|
16
|
+
set :foreman_sudo, false
|
17
|
+
DESC
|
18
|
+
|
19
|
+
task :export do
|
20
|
+
on roles(:all) do
|
21
|
+
within release_path do
|
22
|
+
concurrency = fetch(:foreman_concurrency)
|
23
|
+
sudo = fetch(:foreman_sudo)
|
24
|
+
|
25
|
+
args = [fetch(:foreman_format), fetch(:foreman_location)]
|
26
|
+
args << %Q(-f #{fetch(:foreman_procfile)})
|
27
|
+
args << %Q(-p #{fetch(:foreman_port)})
|
28
|
+
args << %Q(-d #{fetch(:foreman_root)})
|
29
|
+
args << %Q(-a #{fetch(:foreman_app)})
|
30
|
+
args << %Q(-u #{fetch(:foreman_user)})
|
31
|
+
args << %Q(-l #{fetch(:foreman_log)})
|
32
|
+
args << %Q(-c #{concurrency}) if concurrency
|
33
|
+
|
34
|
+
cmd = "foreman export #{args.join(' ')}"
|
35
|
+
|
36
|
+
if sudo
|
37
|
+
execute "sudo su - -c '#{cmd}'"
|
38
|
+
else
|
39
|
+
execute cmd
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
namespace :load do
|
47
|
+
task :defaults do
|
48
|
+
set :foreman_format, "upstart"
|
49
|
+
set :foreman_location, "/etc/init"
|
50
|
+
set :foreman_port, 5000
|
51
|
+
set :foreman_root, -> { release_path }
|
52
|
+
set :foreman_procfile, -> { release_path.join('Procfile') }
|
53
|
+
set :foreman_app, -> { fetch(:application) }
|
54
|
+
set :foreman_user, -> { fetch(:user) }
|
55
|
+
set :foreman_log, -> { shared_path.join('log') }
|
56
|
+
set :foreman_concurrency, false
|
57
|
+
set :foreman_sudo, false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
namespace :deploy do
|
62
|
+
after :updated, 'foreman:export'
|
63
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
def cmd(service_name, action, sudo = false)
|
2
|
+
sudo_cmd = sudo ? 'sudo ' : ''
|
3
|
+
"#{sudo_cmd} service #{service_name} #{action}"
|
4
|
+
end
|
5
|
+
|
6
|
+
namespace :upstart do
|
7
|
+
desc "Start the application services"
|
8
|
+
task :start do
|
9
|
+
on roles(:app) do
|
10
|
+
execute cmd(fetch(:upstart_service), 'start', fetch(:upstart_sudo))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Stop the application services"
|
15
|
+
task :stop do
|
16
|
+
on roles(:app) do
|
17
|
+
execute cmd(fetch(:upstart_service), 'stop', fetch(:upstart_sudo))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Restart the application services"
|
22
|
+
task :restart do
|
23
|
+
on roles(:app) do
|
24
|
+
cmd_sq = cmd(fetch(:upstart_service), 'start', fetch(:upstart_sudo))
|
25
|
+
cmd_sq += ' || '
|
26
|
+
cmd_sq += cmd(fetch(:upstart_service), 'restart', fetch(:upstart_sudo))
|
27
|
+
|
28
|
+
execute cmd_sq
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :load do
|
34
|
+
task :defaults do
|
35
|
+
set :upstart_service, -> { fetch(:application) }
|
36
|
+
set :upstart_sudo, false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
namespace :deploy do
|
41
|
+
after :publishing, 'upstart:restart'
|
42
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/upstart.cap', __FILE__)
|
data/lib/mascherano.rb
ADDED
data/mascherano.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mascherano/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mascherano"
|
8
|
+
spec.version = Mascherano::VERSION
|
9
|
+
spec.authors = ["Alif Rachmawadi"]
|
10
|
+
spec.email = ["subosito@gmail.com"]
|
11
|
+
spec.description = %q{Capistrano 3.x recipes}
|
12
|
+
spec.summary = %q{Capistrano 3.x recipes}
|
13
|
+
spec.homepage = "https://github.com/subosito/mascherano"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "capistrano", "~> 3.0.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mascherano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alif Rachmawadi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Capistrano 3.x recipes
|
63
|
+
email:
|
64
|
+
- subosito@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- img/mascherano-logo.png
|
75
|
+
- lib/mascherano.rb
|
76
|
+
- lib/mascherano/env.rb
|
77
|
+
- lib/mascherano/figaro.rb
|
78
|
+
- lib/mascherano/foreman.rb
|
79
|
+
- lib/mascherano/tasks/env.cap
|
80
|
+
- lib/mascherano/tasks/figaro.cap
|
81
|
+
- lib/mascherano/tasks/foreman.cap
|
82
|
+
- lib/mascherano/tasks/upstart.cap
|
83
|
+
- lib/mascherano/upstart.rb
|
84
|
+
- lib/mascherano/version.rb
|
85
|
+
- mascherano.gemspec
|
86
|
+
homepage: https://github.com/subosito/mascherano
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.8.23
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Capistrano 3.x recipes
|
111
|
+
test_files: []
|
112
|
+
has_rdoc:
|