buildable 1.3.4
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 +15 -0
- data/.gitignore +22 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/buildable +17 -0
- data/buildable.gemspec +24 -0
- data/lib/buildable.rb +63 -0
- data/lib/buildable/file_maker.rb +34 -0
- data/lib/buildable/rake_helper.rb +29 -0
- data/lib/buildable/rake_task.rb +3 -0
- data/lib/buildable/recipe.rb +18 -0
- data/lib/buildable/recipes/build.rb +80 -0
- data/lib/buildable/recipes/init.rb +12 -0
- data/lib/buildable/shell.rb +29 -0
- data/lib/buildable/version.rb +3 -0
- data/lib/core_ext/hash.rb +11 -0
- data/templates/.buildable.yml.erb +21 -0
- data/templates/Procfile.erb +1 -0
- data/templates/foreman/master.erb +97 -0
- data/templates/production.env.erb +3 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2ViNGI3Yjc5MTAyZjExZDBlODhjMzU5ZGQ1YzY2ODMxZTFlYTk0Yg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzU0YWE5ZTg4M2E5NDc4NGQ4MDU4MjBkZGNmOWIxYzk1Mjg0N2M2Mg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGQ1ODJjZjI2MzgxMDhjZTA0ZjJkMjI1MTA4ZGJlMjQyOTE1MWYyNTI5MzEx
|
10
|
+
MmFmZDY3MmQzMGIxNTk0NjY2ZDRkMDBhZmMyYjg1MjM5NjQ1OWFjNWRiYWQ2
|
11
|
+
NzEyYjFjNGY2NGMxMTJiZWIwNzM3ZGMzZjUxZWZmN2Y1OTcxZmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGZiN2Q3ZGYxOWY0NTNhMzkzNGM4NTM0OGU4NDlhZDQzOGRmNThiZTVkOTJj
|
14
|
+
ZjlhMjJmYTZiMWM0ZjliZGUwMTJkMTQwYmMxZTkyMjJkMDk0MDliYWRjZTFj
|
15
|
+
NWQ2NGIxNWEyN2YwNzZmMDIzMTRmYzlkM2UyMmVlMDQzYmMxNzk=
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p448
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Buildable
|
2
|
+
|
3
|
+
_O Buildable é um framework criação de pacotes Debian (deb)._
|
4
|
+
|
5
|
+
Sempre que preciso criar um pacote Debian para fazer a distribuição de meus projetos passava basicamente pelos mesmo problemas, criar scripts para gerar o pacote no build, fazer o script de init, e por ai vai. E isto me motivou a criar um framework para facilitar este processo e poder dedicar meu tempo ao ~~código~~ :beer:.
|
6
|
+
|
7
|
+
Sei que muitos de voces estão pensando: _Mas peraí, eu uso ruby! não seria muito mais fácil criar uma gem?_
|
8
|
+
Sim criar gem é muito mais simples, se você estiver fazendo algo para rubistas utilizarem, quando você tem uma aplicação que é direcionada ao público em geral ela é muito melhor aceita se possuir um instalador em um formato conhecido (como o Debian) :relieved:
|
9
|
+
|
10
|
+
## Como usar
|
11
|
+
|
12
|
+
Primeiramente adicione o *Buildable* no seu Gemfile
|
13
|
+
|
14
|
+
```
|
15
|
+
gem 'buildable'
|
16
|
+
```
|
17
|
+
|
18
|
+
Execute o bunlder para instalar a gem
|
19
|
+
|
20
|
+
```shell
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
Agora basta criar os arquivos de configuração do seu projeto (este passo é feito apenas uma vez)
|
25
|
+
|
26
|
+
```bash
|
27
|
+
$ buildable init
|
28
|
+
```
|
29
|
+
|
30
|
+
Este comando criará os seguintes arquivos:
|
31
|
+
|
32
|
+
#TO BE CONTINUED
|
33
|
+
|
34
|
+
|
35
|
+
O Buildable pode ser utilizado de duas formas seu executável ou via rake (ideal para automatização do build),
|
36
|
+
|
37
|
+
# Dicas sujestões e agradecimentos eternos
|
38
|
+
|
39
|
+
:email: [ajfprates@gmail.com](mailto:ajfprates@gmail.com)
|
data/Rakefile
ADDED
data/bin/buildable
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
require 'buildable'
|
3
|
+
|
4
|
+
case ARGV.join(' ')
|
5
|
+
when 'init'
|
6
|
+
Buildable.init
|
7
|
+
when 'build'
|
8
|
+
Buildable.build
|
9
|
+
when 'version'
|
10
|
+
Buildable.VERSION
|
11
|
+
else
|
12
|
+
puts %Q{Usage: buildable [option]
|
13
|
+
init\t\tCreate buildable structure
|
14
|
+
build\t\tGenerate debian package in ./pkg
|
15
|
+
version\tDisplay version
|
16
|
+
}
|
17
|
+
end
|
data/buildable.gemspec
ADDED
@@ -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
|
+
require 'buildable/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "buildable"
|
8
|
+
spec.version = Buildable::VERSION
|
9
|
+
spec.authors = ["Alexandre Prates"]
|
10
|
+
spec.email = ["ajfprates@gmail.com"]
|
11
|
+
spec.summary = %q{Gem para criar pacotes (debian) para deploy de projetos ruby.}
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(spec)/})
|
17
|
+
spec.require_paths = ["lib", "lib/tasks", "lib/buildable"]
|
18
|
+
|
19
|
+
spec.add_runtime_dependency "rake"
|
20
|
+
spec.add_runtime_dependency "fpm", ">= 1.3.3"
|
21
|
+
spec.add_runtime_dependency "foreman", ">= 0.78.0"
|
22
|
+
spec.add_runtime_dependency "foreman-export-initscript"
|
23
|
+
spec.add_runtime_dependency "configureasy", ">= 1.0.0"
|
24
|
+
end
|
data/lib/buildable.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require(:default)
|
3
|
+
|
4
|
+
module Buildable
|
5
|
+
require_relative 'core_ext/hash'
|
6
|
+
require_relative 'buildable/version'
|
7
|
+
require_relative 'buildable/shell'
|
8
|
+
require_relative 'buildable/file_maker'
|
9
|
+
require_relative 'buildable/recipe'
|
10
|
+
require_relative 'buildable/rake_helper'
|
11
|
+
|
12
|
+
include Configureasy
|
13
|
+
load_config '.buildable', as: 'config', path: '.'
|
14
|
+
|
15
|
+
BUILD_DIR = './.build'
|
16
|
+
BUILD_ROOT_DIR = './.build/root'
|
17
|
+
PACKAGE_DIR = './pkg'
|
18
|
+
|
19
|
+
module_function
|
20
|
+
|
21
|
+
def init
|
22
|
+
Recipe[:init]
|
23
|
+
end
|
24
|
+
|
25
|
+
def build
|
26
|
+
STDOUT.sync = true
|
27
|
+
check_configs
|
28
|
+
Recipe[:create_path]
|
29
|
+
Recipe[:copy_source]
|
30
|
+
Recipe[:vendor_gems]
|
31
|
+
Recipe[:make_init_script]
|
32
|
+
Recipe[:make_package]
|
33
|
+
Recipe[:remove_path]
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_app_dir
|
37
|
+
File.join(BUILD_ROOT_DIR, Buildable.config.root_dir)
|
38
|
+
end
|
39
|
+
|
40
|
+
def upstart_folder
|
41
|
+
File.join(BUILD_ROOT_DIR, 'etc/init')
|
42
|
+
end
|
43
|
+
|
44
|
+
def initd_folder
|
45
|
+
File.join(BUILD_ROOT_DIR, 'etc/init.d')
|
46
|
+
end
|
47
|
+
|
48
|
+
def check_configs
|
49
|
+
return if File.exist?('.buildable.yml') && File.exist?('production.env') && File.exist?('Procfile')
|
50
|
+
puts "Missing config please run buildable init to create it."
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
def files_to_pack
|
55
|
+
files_to_ignore = self.config.files_to_ignore + %w{. .. .build .buildable.yml vendor}
|
56
|
+
Dir.entries('.') - files_to_ignore
|
57
|
+
end
|
58
|
+
|
59
|
+
def foreman_templates
|
60
|
+
File.expand_path('../../templates/foreman', __FILE__)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Buildable::FileMaker
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# create plain_text file with content
|
7
|
+
#
|
8
|
+
# plain_text('test.txt') { |content| content << "hi" }
|
9
|
+
# # => create test.txt file with "hi" inside
|
10
|
+
def plain_text(filename, options = {})
|
11
|
+
# check if exist and be overwrite
|
12
|
+
content = yield('')
|
13
|
+
File.open(filename, 'w') { |file| file.write content }
|
14
|
+
end
|
15
|
+
|
16
|
+
def template(name, location = './', options = {})
|
17
|
+
destination = File.join(location, name)
|
18
|
+
# check if exist and can overwrite
|
19
|
+
|
20
|
+
template = load_template(name)
|
21
|
+
raise "Template #{name} not found" unless template
|
22
|
+
|
23
|
+
builder = ERB.new(template)
|
24
|
+
File.open(destination, 'w') { |f| f.write builder.result }
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def load_template(name)
|
30
|
+
filename = File.expand_path("../../../templates/#{name}.erb", __FILE__)
|
31
|
+
File.read(filename) if File.exist? filename
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module Buildable::RakeHelper
|
4
|
+
include Rake::DSL if defined? Rake::DSL
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def install_tasks
|
8
|
+
namespace :buildable do
|
9
|
+
set_init_task
|
10
|
+
set_build_task
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def set_init_task
|
17
|
+
desc "Create package buildable structure"
|
18
|
+
task :init do
|
19
|
+
Buildable.init
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_build_task
|
24
|
+
desc "Make debian (deb) package"
|
25
|
+
task :build do
|
26
|
+
Buildable.build
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Buildable::Recipe
|
4
|
+
class << self
|
5
|
+
@@recipes = {}
|
6
|
+
|
7
|
+
def [](name)
|
8
|
+
@@recipes[name].call if @@recipes.has_key?(name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def recipe(name, &block)
|
12
|
+
@@recipes[name] = block
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
dir = File.expand_path('../recipes/*.rb', __FILE__)
|
18
|
+
Dir[dir].each { |source| require source }
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Buildable::Recipe
|
2
|
+
|
3
|
+
recipe :create_path do
|
4
|
+
puts "* Preparing structure to build"
|
5
|
+
Buildable::Recipe[:clean_pkg] if Dir.exist? Buildable::PACKAGE_DIR
|
6
|
+
Buildable::Recipe[:remove_path] if Dir.exist? Buildable::BUILD_DIR
|
7
|
+
FileUtils.mkdir_p(Buildable.build_app_dir)
|
8
|
+
FileUtils.mkdir_p('./pkg')
|
9
|
+
end
|
10
|
+
|
11
|
+
recipe :copy_source do
|
12
|
+
Buildable.files_to_pack.each do |file|
|
13
|
+
puts "\tCopying #{file}"
|
14
|
+
FileUtils.cp_r file, File.join(Buildable.build_app_dir, file)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
recipe :vendor_gems do
|
19
|
+
puts '* Fetching gems'
|
20
|
+
Bundler.with_clean_env do
|
21
|
+
Dir.chdir Buildable.build_app_dir do
|
22
|
+
Buildable::Shell.do 'bundle install --deployment --without development test'
|
23
|
+
raise "Can't fetching gems" unless Buildable::Shell.success?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
recipe :make_init_script do
|
29
|
+
puts "* Generating init scripts"
|
30
|
+
params = {
|
31
|
+
'--user' => Buildable.config.app_user,
|
32
|
+
'--env' => 'production.env',
|
33
|
+
'--app' => Buildable.config.project_name.downcase,
|
34
|
+
'--log' => '/tmp',
|
35
|
+
'--template' => Buildable.foreman_templates,
|
36
|
+
'-f' => 'Procfile',
|
37
|
+
'-d' => Buildable.config.root_dir
|
38
|
+
}
|
39
|
+
Buildable::Shell.do "foreman export initscript #{Buildable.initd_folder}", params
|
40
|
+
|
41
|
+
raise "Can't generate init scripts" unless Buildable::Shell.success?
|
42
|
+
initscript = File.join Buildable.initd_folder, Buildable.config.project_name
|
43
|
+
FileUtils.chmod "+x", initscript
|
44
|
+
end
|
45
|
+
|
46
|
+
recipe :make_package do
|
47
|
+
puts "* Creating package"
|
48
|
+
version = Buildable::Shell.do_quiet %Q{git describe --abbrev=0 --match="[0-9]*\.[0-9]*\.[0-9]*"}
|
49
|
+
raise "Can't define build version, please check git describe" unless Buildable::Shell.success?
|
50
|
+
|
51
|
+
params = {
|
52
|
+
'-s' => 'dir',
|
53
|
+
'-t' => 'deb',
|
54
|
+
'--name' => "r7-#{Buildable.config.project_name.downcase}",
|
55
|
+
'--version' => version,
|
56
|
+
'--architecture' => 'all',
|
57
|
+
'--package' => './pkg',
|
58
|
+
'--prefix' => '/',
|
59
|
+
'--description' => Buildable.config.description.inspect,
|
60
|
+
'--force' => nil,
|
61
|
+
'-C' => "#{Buildable::BUILD_ROOT_DIR} ."
|
62
|
+
}
|
63
|
+
|
64
|
+
result = Buildable::Shell.do_quiet 'bundle exec fpm', params
|
65
|
+
raise "Can't create package, error:\n#{result}" unless Buildable::Shell.success?
|
66
|
+
package_name = result.match(/:path=>"\.\/pkg\/([^"]*)/)[1]
|
67
|
+
puts "\tPackage created #{package_name}"
|
68
|
+
end
|
69
|
+
|
70
|
+
recipe :remove_path do
|
71
|
+
puts "* Clean up build folder"
|
72
|
+
FileUtils.rm_rf Buildable::BUILD_DIR
|
73
|
+
end
|
74
|
+
|
75
|
+
recipe :clean_pkg do
|
76
|
+
puts "* Clean up pkg folder"
|
77
|
+
FileUtils.rm_rf Buildable::PACKAGE_DIR
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Buildable::Recipe
|
2
|
+
recipe :init do
|
3
|
+
puts "Creating .buildable.yml"
|
4
|
+
Buildable::FileMaker.template '.buildable.yml'
|
5
|
+
puts "Creating production.env"
|
6
|
+
Buildable::FileMaker.template 'production.env'
|
7
|
+
puts "Creating Procfile"
|
8
|
+
Buildable::FileMaker.template 'Procfile'
|
9
|
+
|
10
|
+
puts "Please edit all files above to setup your application"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'pty'
|
2
|
+
|
3
|
+
module Buildable::Shell
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def success?
|
7
|
+
!!($? && $?.success?)
|
8
|
+
end
|
9
|
+
|
10
|
+
def do(command, params = {})
|
11
|
+
PTY.spawn(command_line(command, params)) do |r,w,pid|
|
12
|
+
r.each { |line| puts "\t#{line}" } rescue nil # prevents error when process ending
|
13
|
+
Process.wait(pid)
|
14
|
+
end
|
15
|
+
rescue PTY::ChildExited
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def do_quiet(command, params = {})
|
20
|
+
%x{#{command_line(command, params)}}.chomp
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def command_line(command, params)
|
26
|
+
"#{command} #{params.to_params} 2>&1"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Generate params string based on hash content
|
4
|
+
# {'--param': 'value', '-a': nil, '--config': 'path/to/config'}.to_params
|
5
|
+
# # "--param value -a --config path/to/config"
|
6
|
+
def to_params
|
7
|
+
return '' if self.empty?
|
8
|
+
self.flatten.compact.join(' ')
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
project_name: awesome_app
|
2
|
+
description: Most awesome project in the world
|
3
|
+
app_user: application_user
|
4
|
+
root_dir: application_root_path
|
5
|
+
files_to_ignore:
|
6
|
+
- .bundle
|
7
|
+
- .git
|
8
|
+
- .gitignore
|
9
|
+
- .rspec
|
10
|
+
- coverage
|
11
|
+
- doc
|
12
|
+
- features
|
13
|
+
- Guardfile
|
14
|
+
- Procfile
|
15
|
+
- log
|
16
|
+
- pkg
|
17
|
+
- README
|
18
|
+
- README.md
|
19
|
+
- README.rdoc
|
20
|
+
- spec
|
21
|
+
- test
|
@@ -0,0 +1 @@
|
|
1
|
+
server: ruby -e 'puts "Edit Procfile to setup your application"'
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
### BEGIN INIT INFO
|
3
|
+
# Provides: <%= app %>
|
4
|
+
# Required-Start: $remote_fs $syslog
|
5
|
+
# Required-Stop: $remote_fs $syslog
|
6
|
+
# Default-Start: 2 3 4 5
|
7
|
+
# Default-Stop: 0 1 6
|
8
|
+
# Short-Description: Generated initscript for <%= app %>
|
9
|
+
# Description: This file starts <%= app %>. It should be placed in /etc/init.d
|
10
|
+
### END INIT INFO
|
11
|
+
|
12
|
+
# Auto generated by Buildable
|
13
|
+
|
14
|
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
15
|
+
DESC="Runs <%= app %>"
|
16
|
+
NAME=<%= app %>
|
17
|
+
PIDDIR=/var/run/$NAME
|
18
|
+
SCRIPTNAME=/etc/init.d/$NAME
|
19
|
+
USERNAME=<%= user %>
|
20
|
+
<% engine.environment.each_pair do |var,env| %>export <%= var.upcase %>=<%= env %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
[ -r /lib/lsb/init-functions ] &&. /lib/lsb/init-functions
|
24
|
+
|
25
|
+
#
|
26
|
+
# Function that starts the service
|
27
|
+
#
|
28
|
+
do_start()
|
29
|
+
{
|
30
|
+
mkdir -p $PIDDIR
|
31
|
+
# START APPLICATION: <%= app %><% engine.each_process do |name, process| %>
|
32
|
+
# START PROCESS: <%= name %><% 1.upto(engine.formation[name]) do |num| %>
|
33
|
+
# START CONCURRENT: <%= num %>
|
34
|
+
# Start: <%= app %>.<%= name %>.<%= num %>
|
35
|
+
# Create $PIDDIR/<%= name %>.<%= num %>.pid
|
36
|
+
su -m $USERNAME -c 'cd <%= engine.root %>; <%= process.command %> & echo $!' > $PIDDIR/<%= name %>.<%= num %>.pid
|
37
|
+
<% end %><% end %>
|
38
|
+
}
|
39
|
+
|
40
|
+
#
|
41
|
+
# Function that stops the service
|
42
|
+
#
|
43
|
+
do_stop()
|
44
|
+
{
|
45
|
+
# STOP APPLICATION: <%= app %><% engine.each_process do |name, process| %>
|
46
|
+
# STOP PROCESS: <%= name %><% 1.upto(engine.formation[name]) do |num| %>
|
47
|
+
# STOP CONCURRENT: <%= num %>
|
48
|
+
# Stop: <%= app %>.<%= name %>.<%= num %>
|
49
|
+
kill `cat $PIDDIR/<%= name %>.<%= num %>.pid`
|
50
|
+
rm $PIDDIR/<%= name %>.<%= num %>.pid
|
51
|
+
<% end %><% end %>
|
52
|
+
rmdir $PIDDIR
|
53
|
+
}
|
54
|
+
|
55
|
+
case "$1" in
|
56
|
+
start)
|
57
|
+
log_daemon_msg "Starting $DESC" "$NAME"
|
58
|
+
do_start
|
59
|
+
case "$?" in
|
60
|
+
0|1) log_end_msg 0 ;;
|
61
|
+
2) log_end_msg 1 ;;
|
62
|
+
esac
|
63
|
+
;;
|
64
|
+
stop)
|
65
|
+
log_daemon_msg "Stopping $DESC" "$NAME"
|
66
|
+
do_stop
|
67
|
+
case "$?" in
|
68
|
+
0|1) log_end_msg 0 ;;
|
69
|
+
2) log_end_msg 1 ;;
|
70
|
+
esac
|
71
|
+
;;
|
72
|
+
status)
|
73
|
+
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
74
|
+
;;
|
75
|
+
restart)
|
76
|
+
log_daemon_msg "Restarting $DESC" "$NAME"
|
77
|
+
do_stop
|
78
|
+
case "$?" in
|
79
|
+
0|1)
|
80
|
+
do_start
|
81
|
+
case "$?" in
|
82
|
+
0) log_end_msg 0 ;;
|
83
|
+
1) log_end_msg 1 ;; # Old process is still running
|
84
|
+
*) log_end_msg 1 ;; # Failed to start
|
85
|
+
esac
|
86
|
+
;;
|
87
|
+
*)
|
88
|
+
# Failed to stop
|
89
|
+
log_end_msg 1
|
90
|
+
;;
|
91
|
+
esac
|
92
|
+
;;
|
93
|
+
*)
|
94
|
+
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
|
95
|
+
exit 3
|
96
|
+
;;
|
97
|
+
esac
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: buildable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandre Prates
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fpm
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: foreman
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.78.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.78.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: foreman-export-initscript
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: configureasy
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.0
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- ajfprates@gmail.com
|
86
|
+
executables:
|
87
|
+
- buildable
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .ruby-version
|
93
|
+
- Gemfile
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/buildable
|
97
|
+
- buildable.gemspec
|
98
|
+
- lib/buildable.rb
|
99
|
+
- lib/buildable/file_maker.rb
|
100
|
+
- lib/buildable/rake_helper.rb
|
101
|
+
- lib/buildable/rake_task.rb
|
102
|
+
- lib/buildable/recipe.rb
|
103
|
+
- lib/buildable/recipes/build.rb
|
104
|
+
- lib/buildable/recipes/init.rb
|
105
|
+
- lib/buildable/shell.rb
|
106
|
+
- lib/buildable/version.rb
|
107
|
+
- lib/core_ext/hash.rb
|
108
|
+
- templates/.buildable.yml.erb
|
109
|
+
- templates/Procfile.erb
|
110
|
+
- templates/foreman/master.erb
|
111
|
+
- templates/production.env.erb
|
112
|
+
homepage:
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
- lib/tasks
|
121
|
+
- lib/buildable
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.4.8
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Gem para criar pacotes (debian) para deploy de projetos ruby.
|
138
|
+
test_files: []
|