capistrano-procfile 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1c30cd63d5797da7939b7bf366c10780394e5f29
4
+ data.tar.gz: ae8bb9ea9c82b961097f0a2fc41c74f93bfb29c6
5
+ SHA512:
6
+ metadata.gz: af8374434d2c6f16f92d2c9103e225cc025d17b499352e44120ea1d687f656be55b6ef4f90a9c0c50e04feccf01ebf7b9bc1c876ce9f9a735fc2eb93794b6f7c
7
+ data.tar.gz: 3c533f4d52c036917defc9714d5e36fd72372a49ae905e6a0dbd126684bf5c8c716ee8f63808028d53ed8efb692af9bdda9a4387e3992e450e59d99ba6837ac5
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-procfile.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 CrBoy
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,69 @@
1
+ # Capistrano::Procfile
2
+
3
+ This gem helps exporting [Procfile][https://devcenter.heroku.com/articles/procfile] to system init daemon (e.g. systemd, upstart) configurations.
4
+
5
+ Notice: This gem calls `foreman export` to do the things. Therefore the supported format by foreman should be supported as well. However I use only systemd, so others formats are not tested. PRs are welcome! :)
6
+
7
+ Currently we supports systemd only.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'capistrano-procfile'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install capistrano-procfile
24
+
25
+ ## Usage
26
+
27
+ The following options are available. You can set these options in `config/deploy.rb`.
28
+
29
+ ```
30
+ set :procfile_roles, %w(app)
31
+ set :procfile_use_sudo, false
32
+ set :procfile_options, {
33
+ export_format: :systemd,
34
+ export_path: "/etc/systemd/system",
35
+ working_dir: release_path,
36
+ log_dir: File.join(release_path, "log"),
37
+ base_port: 5000,
38
+ app_name: fetch(:application),
39
+ user: nil,
40
+ formation: "all=1"
41
+ }
42
+ ```
43
+
44
+ Run `cap production procfile:export` to export on the target machine.
45
+
46
+ Host property is also available for options. Check the following example.
47
+
48
+ ```
49
+ # config/deploy/production.rb
50
+
51
+ server 'production1', user: 'app', roles: %w{app}, procfile_options: { formation: "web=1,worker=1" }
52
+ server 'production2', user: 'app', roles: %w{app}, procfile_options: { formation: "worker=4" }
53
+ ```
54
+
55
+ ## Development
56
+
57
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58
+
59
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
+
61
+ ## Contributing
62
+
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-procfile.
64
+
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
69
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/procfile"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,23 @@
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-procfile"
7
+ spec.version = "0.1.0"
8
+ spec.authors = ["CrBoy"]
9
+ spec.email = ["crboy@crboy.net"]
10
+
11
+ spec.summary = %q{Export Procfile to system init daemon configurations}
12
+ spec.description = %q{Procfile defines what processes to run for whole application. This gem allows capistrano to export the Procfile to systemd init daemon (e.g. systemd, upstart) configurations. This makes the application integrating with systemd better.}
13
+ spec.homepage = "http://github.com/CrBoy/capistrano-procfile"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path('../tasks/procfile.rake', __FILE__)
@@ -0,0 +1,49 @@
1
+ namespace :load do
2
+ task :defaults do
3
+ set :procfile_roles, %w(app)
4
+ set :procfile_use_sudo, false
5
+ set :procfile_options, {}
6
+ end
7
+ end
8
+
9
+ namespace :procfile do
10
+ desc "Export procfile to system init daemon configurations"
11
+ task :export do
12
+ on roles fetch :procfile_roles do |host|
13
+ default_options = {
14
+ export_format: :systemd,
15
+ export_path: "/etc/systemd/system",
16
+ working_dir: release_path,
17
+ log_dir: File.join(release_path, "log"),
18
+ base_port: 5000,
19
+ app_name: fetch(:application),
20
+ user: nil,
21
+ formation: "all=1"
22
+ }
23
+ options = default_options.merge fetch(:procfile_options, {}).merge Hash(host.properties.procfile_options)
24
+ options_map = {
25
+ working_dir: "-d",
26
+ log_dir: "-l",
27
+ base_port: "-p",
28
+ app_name: "-a",
29
+ user: "-u",
30
+ formation: "-m"
31
+ }
32
+
33
+ execute(:mkdir, "-p", options[:log_dir])
34
+
35
+ within release_path do
36
+ args = %w(bundle exec foreman export)
37
+ args << options[:export_format]
38
+ args << options[:export_path]
39
+ options_map.each do |k, v|
40
+ args << "#{v} #{options[k]}" if options[k]
41
+ end
42
+
43
+ fetch(:procfile_use_sudo) ? sudo(*args) : execute(*args)
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ after "deploy:publishing", "procfile:export"
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-procfile
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - CrBoy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Procfile defines what processes to run for whole application. This gem
42
+ allows capistrano to export the Procfile to systemd init daemon (e.g. systemd, upstart)
43
+ configurations. This makes the application integrating with systemd better.
44
+ email:
45
+ - crboy@crboy.net
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".travis.yml"
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bin/console
57
+ - bin/setup
58
+ - capistrano-procfile.gemspec
59
+ - lib/capistrano/procfile.rb
60
+ - lib/capistrano/tasks/procfile.rake
61
+ homepage: http://github.com/CrBoy/capistrano-procfile
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.4.5.1
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Export Procfile to system init daemon configurations
85
+ test_files: []