bosh-gen 0.4.0 → 0.5.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.
- data/ChangeLog.md +6 -0
- data/lib/bosh/gen/cli.rb +15 -8
- data/lib/bosh/gen/generators/job_generator.rb +1 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt +3 -3
- data/lib/bosh/gen/generators/package_source_generator.rb +35 -1
- data/lib/bosh/gen/version.rb +1 -1
- metadata +4 -4
data/ChangeLog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## v0.5.0
|
4
|
+
|
5
|
+
* `job` - takes a COMMAND argument
|
6
|
+
* `source --blob/-b` - file stored in blobs/ folder instead of src/
|
7
|
+
* `source` - packaging script includes standard configure/make/make install if .tar.gz or .tgz
|
8
|
+
|
3
9
|
## v0.4
|
4
10
|
|
5
11
|
* `job` - added --ruby flag to include a ruby/rack-specifc ctl script
|
data/lib/bosh/gen/cli.rb
CHANGED
@@ -33,27 +33,34 @@ module Bosh
|
|
33
33
|
end
|
34
34
|
|
35
35
|
desc "source NAME", "Downloads a source item into the named project"
|
36
|
+
method_option :blob, :aliases => ['-b'], :type => :boolean, :desc => "Store file in blobstore"
|
36
37
|
def source(name, uri)
|
38
|
+
flags = { :blob => options[:blob] || false }
|
37
39
|
dir = Dir.mktmpdir
|
38
40
|
files = []
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
if File.exist?(uri)
|
42
|
+
files = [uri]
|
43
|
+
else
|
44
|
+
say "Downloading #{uri}..."
|
45
|
+
FileUtils.chdir(dir) do
|
46
|
+
`wget '#{uri}'`
|
47
|
+
files = Dir['*'].map {|f| File.expand_path(f)}
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
require 'bosh/gen/generators/package_source_generator'
|
46
|
-
Bosh::Gen::Generators::PackageSourceGenerator.start([name, files])
|
52
|
+
Bosh::Gen::Generators::PackageSourceGenerator.start([name, files, flags])
|
47
53
|
end
|
48
54
|
|
49
|
-
desc "job NAME", "Create a new job"
|
55
|
+
desc "job NAME COMMAND", "Create a new job to run 'COMMAND' to launch the process"
|
50
56
|
method_option :dependencies, :aliases => ['-d'], :type => :array, :desc => "List of package dependencies"
|
51
57
|
method_option :ruby, :type => :boolean, :desc => "Use templates for running Ruby/Rack process"
|
52
|
-
def job(name)
|
58
|
+
def job(name, command=nil)
|
59
|
+
command ||= 'EXECUTABLE_SERVER'
|
53
60
|
flags = { :ruby => options["ruby"] || false }
|
54
61
|
dependencies = options[:dependencies] || []
|
55
62
|
require 'bosh/gen/generators/job_generator'
|
56
|
-
Bosh::Gen::Generators::JobGenerator.start([name, dependencies, flags])
|
63
|
+
Bosh::Gen::Generators::JobGenerator.start([name, command, dependencies, flags])
|
57
64
|
end
|
58
65
|
|
59
66
|
desc "template JOB FILE_PATH", "Add a Job template (example FILE_PATH: config/httpd.conf)"
|
data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
#
|
13
13
|
# Clear logs:
|
14
14
|
# jobs/<%= job_name %>/templates/<%= job_name %>_ctl clearlogs
|
15
|
-
|
15
|
+
<% if command == "EXECUTABLE_SERVER" %>
|
16
16
|
# TODO - change "EXECUTABLE_SERVER" to the command to run
|
17
|
-
|
17
|
+
<% end %>
|
18
18
|
RUN_DIR=/var/vcap/sys/run/<%= job_name %>
|
19
19
|
LOG_DIR=/var/vcap/sys/log/<%= job_name %>
|
20
20
|
STORE=/var/vcap/store/<%= job_name %>
|
@@ -22,7 +22,7 @@ PIDFILE=$RUN_DIR/<%= job_name %>.pid
|
|
22
22
|
|
23
23
|
export PATH=/var/vcap/packages/ruby/bin:$PATH
|
24
24
|
|
25
|
-
COMMAND=${COMMAND:-/var/vcap/packages/<%= job_name %>/bin
|
25
|
+
COMMAND=${COMMAND:-/var/vcap/packages/<%= job_name %>/bin/<%= command %>}
|
26
26
|
HOME=${HOME:-/home/vcap}
|
27
27
|
|
28
28
|
case $1 in
|
@@ -8,6 +8,7 @@ module Bosh::Gen
|
|
8
8
|
|
9
9
|
argument :package_name
|
10
10
|
argument :file_paths
|
11
|
+
argument :flags, :type => :hash
|
11
12
|
|
12
13
|
def check_root_is_release
|
13
14
|
unless File.exist?("jobs") && File.exist?("packages")
|
@@ -36,13 +37,46 @@ module Bosh::Gen
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
40
|
+
# Add a guess about the packaging/compilation of the file
|
41
|
+
def packaging
|
42
|
+
packaging_for_files = ""
|
43
|
+
file_paths.each do |path|
|
44
|
+
filename = File.basename(path)
|
45
|
+
if filename =~ /^(.*)(\.tar\.gz|\.tgz)$/
|
46
|
+
package_dir = $1
|
47
|
+
# assume its a standard installable source package
|
48
|
+
packaging_for_files += <<-BASH.gsub(/^\s{12}/, '')
|
49
|
+
tar xfz #{package_name}/#{filename}
|
50
|
+
(
|
51
|
+
cd #{package_dir}
|
52
|
+
./configure --prefix=$BOSH_INSTALL_TARGET
|
53
|
+
make
|
54
|
+
make install
|
55
|
+
)
|
56
|
+
|
57
|
+
BASH
|
58
|
+
end
|
59
|
+
end
|
60
|
+
append_file "packages/#{package_name}/packaging", packaging_for_files
|
61
|
+
end
|
62
|
+
|
63
|
+
def readme
|
64
|
+
if flags[:blob]
|
65
|
+
say_status "readme", "Upload blobs with 'bosh upload blobs'"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
39
69
|
private
|
40
70
|
def package_dir(path)
|
41
71
|
File.join("packages", package_name, path)
|
42
72
|
end
|
43
73
|
|
44
74
|
def source_dir(path)
|
45
|
-
|
75
|
+
if flags[:blob]
|
76
|
+
File.join("blobs", package_name, path)
|
77
|
+
else
|
78
|
+
File.join("src", package_name, path)
|
79
|
+
end
|
46
80
|
end
|
47
81
|
end
|
48
82
|
end
|
data/lib/bosh/gen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash: -
|
175
|
+
hash: -3354968755098444003
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash: -
|
184
|
+
hash: -3354968755098444003
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
187
|
rubygems_version: 1.8.23
|