foreman-export-upstart_user 0.0.1
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.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +18 -0
- data/LICENSE +18 -0
- data/README.md +7 -0
- data/Rakefile +2 -0
- data/data/export/upstart_user/process.conf.erb +11 -0
- data/foreman-export-upstart_user.gemspec +19 -0
- data/lib/foreman-export-upstart_user.rb +3 -0
- data/lib/foreman/export/upstart_user.rb +50 -0
- metadata +88 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
foreman-export-upstart_user (0.0.1)
|
5
|
+
foreman
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
foreman (0.59.0)
|
11
|
+
thor (>= 0.13.6)
|
12
|
+
thor (0.16.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
foreman-export-upstart_user!
|
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
2
|
+
a copy of this software and associated documentation files (the
|
3
|
+
"Software"), to deal in the Software without restriction, including
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
7
|
+
the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be
|
10
|
+
included in all copies or substantial portions of the Software.
|
11
|
+
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
15
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
16
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
17
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
18
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
start on starting <%= app %>-<%= name %>
|
2
|
+
stop on stopping <%= app %>-<%= name %>
|
3
|
+
respawn
|
4
|
+
|
5
|
+
chdir <%= engine.root %>
|
6
|
+
env PORT=<%= port %>
|
7
|
+
<% engine.env.each_pair do |var,env| %>
|
8
|
+
env <%= var.upcase %>=<%= shell_quote(env) %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
exec <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "foreman-export-upstart_user"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.authors = ["Micah Geisel"]
|
8
|
+
s.email = ["micah@botandrose.com"]
|
9
|
+
s.homepage = "http://github.com/botandrose/foreman-export-upstart_user"
|
10
|
+
s.summary = "Upstart user-level export scripts for foreman"
|
11
|
+
s.description = "Upstart user-level export scripts for foreman"
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_runtime_dependency "foreman"
|
19
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "foreman/export"
|
3
|
+
|
4
|
+
class Foreman::Export::UpstartUser < Foreman::Export::Upstart
|
5
|
+
def initialize location, engine, options={}
|
6
|
+
super
|
7
|
+
# what a pain in the ass
|
8
|
+
# template is obviously not intended to be overriden
|
9
|
+
unless @options.has_key?(:template)
|
10
|
+
template = File.expand_path("../../../../data/export/upstart_user", __FILE__)
|
11
|
+
@options = { :template => template }.merge(@options).freeze
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def export
|
16
|
+
super
|
17
|
+
|
18
|
+
Dir["#{location}/#{app}*.conf"].each do |file|
|
19
|
+
clean file
|
20
|
+
end
|
21
|
+
|
22
|
+
write_template "upstart/master.conf.erb", "#{app}.conf", binding
|
23
|
+
|
24
|
+
engine.each_process do |name, process|
|
25
|
+
next if engine.formation[name] < 1
|
26
|
+
write_template "upstart/process_master.conf.erb", "#{app}-#{name}.conf", binding
|
27
|
+
|
28
|
+
1.upto(engine.formation[name]) do |num|
|
29
|
+
port = engine.port_for(process, num)
|
30
|
+
write_template "upstart_user/process.conf.erb", "#{app}-#{name}-#{num}.conf", binding
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def location
|
36
|
+
options[:location] || "/home/#{user}/.init"
|
37
|
+
end
|
38
|
+
|
39
|
+
def app
|
40
|
+
options[:app] || File.basename(Dir.pwd)
|
41
|
+
end
|
42
|
+
|
43
|
+
def log
|
44
|
+
options[:log] || "log"
|
45
|
+
end
|
46
|
+
|
47
|
+
def user
|
48
|
+
options[:user] || `whoami`.strip
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman-export-upstart_user
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Micah Geisel
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-09-16 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: foreman
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Upstart user-level export scripts for foreman
|
35
|
+
email:
|
36
|
+
- micah@botandrose.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- Gemfile
|
46
|
+
- Gemfile.lock
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- data/export/upstart_user/process.conf.erb
|
51
|
+
- foreman-export-upstart_user.gemspec
|
52
|
+
- lib/foreman-export-upstart_user.rb
|
53
|
+
- lib/foreman/export/upstart_user.rb
|
54
|
+
homepage: http://github.com/botandrose/foreman-export-upstart_user
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.8.24
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: Upstart user-level export scripts for foreman
|
87
|
+
test_files: []
|
88
|
+
|