bosh-gen 0.8.2 → 0.9.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 +13 -0
- data/lib/bosh/gen/cli.rb +45 -29
- data/lib/bosh/gen/generators/deployment_manifest_generator.rb +7 -3
- data/lib/bosh/gen/generators/extract_job_generator.rb +37 -6
- data/lib/bosh/gen/generators/extract_package_generator.rb +23 -5
- data/lib/bosh/gen/generators/job_generator.rb +34 -16
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_puma_migrate.yml +14 -0
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_rackup.yml.tt +8 -0
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_simple/default.yml +2 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/monit.tt +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/%job_name%_rack_ctl.tt +59 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_db_utils.sh.erb +54 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_nginx.sh.erb +17 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_redis_utils.sh.erb +18 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_setup.sh.erb +48 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_start.sh.erb +59 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_utils.sh +148 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/monit_debugger +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/nginx_ctl.tt +41 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/rails_ctl_setup.sh.erb +40 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/database.yml.erb +17 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/mime.types +73 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx.conf.erb +150 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx_proxy.conf +11 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/redis.yml.erb +6 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/monit.tt +5 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/%job_name%_ctl.tt +36 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/monit_debugger +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/data/properties.sh.erb +10 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_setup.sh +81 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh +156 -0
- data/lib/bosh/gen/generators/package_generator.rb +56 -10
- data/lib/bosh/gen/models.rb +1 -0
- data/lib/bosh/gen/models/bosh_config.rb +15 -0
- data/lib/bosh/gen/models/deployment_manifest.rb +5 -0
- data/lib/bosh/gen/version.rb +1 -1
- data/spec/fixtures/bosh_config/multiple_boshes.yml +34 -0
- data/spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml +2 -2
- data/spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml +2 -2
- data/spec/generators/generator_spec_helper.rb +102 -0
- data/spec/generators/jobs/webapp_job_generator_spec.rb +68 -0
- data/spec/models/bosh_config_spec.rb +11 -0
- metadata +38 -8
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/monit.tt +0 -5
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt +0 -62
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/monit.tt +0 -5
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/templates/%job_name%_ctl.tt +0 -64
@@ -23,12 +23,12 @@ module Bosh::Gen
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def check_name
|
26
|
-
raise Thor::Error.new("'#{name}' is not a
|
26
|
+
raise Thor::Error.new("'#{name}' is not a valid BOSH id") unless name.bosh_valid_id?
|
27
27
|
end
|
28
28
|
|
29
29
|
def warn_missing_dependencies
|
30
30
|
dependencies.each do |d|
|
31
|
-
raise Thor::Error.new("dependency '#{d}' is not a
|
31
|
+
raise Thor::Error.new("dependency '#{d}' is not a valid BOSH id") unless d.bosh_valid_id?
|
32
32
|
unless File.exist?(File.join("packages", d))
|
33
33
|
say_status "warning", "missing dependency '#{d}'", :yellow
|
34
34
|
end
|
@@ -41,27 +41,31 @@ module Bosh::Gen
|
|
41
41
|
set -e # exit immediately if a simple command exits with a non-zero status
|
42
42
|
set -u # report the usage of uninitialized variables
|
43
43
|
|
44
|
+
# Available variables
|
45
|
+
# $BOSH_COMPILE_TARGET - where this package & spec'd source files are available
|
46
|
+
# $BOSH_INSTALL_TARGET - where you copy/install files to be included in package
|
44
47
|
export HOME=/var/vcap
|
45
48
|
|
49
|
+
|
46
50
|
SHELL
|
47
51
|
|
48
52
|
dependencies.each do |package|
|
49
53
|
packaging << "PATH=/var/vcap/packages/#{package}/bin:$PATH\n"
|
50
54
|
end
|
51
55
|
|
52
|
-
|
53
|
-
package_file = File.basename(tarball_file)
|
54
|
-
unpacked_path = unpacked_path_for_tarball(tarball_file)
|
55
|
-
|
56
|
+
archives_in_files.each do |archive_type, unpack_command, archive_file, unpack_base_path|
|
56
57
|
packaging << <<-SHELL.gsub(/^\s{12}/, '')
|
57
58
|
|
58
|
-
|
59
|
-
cd #{
|
59
|
+
#{unpack_command} #{name}/#{archive_file}
|
60
|
+
cd #{unpack_base_path}
|
60
61
|
./configure --prefix=${BOSH_INSTALL_TARGET}
|
61
62
|
make
|
62
63
|
make install
|
64
|
+
# Alternatively, to copy archive contents:
|
65
|
+
# cp -a #{unpack_base_path}/* $BOSH_INSTALL_TARGET
|
63
66
|
SHELL
|
64
67
|
end
|
68
|
+
|
65
69
|
packaging
|
66
70
|
end
|
67
71
|
|
@@ -138,12 +142,40 @@ module Bosh::Gen
|
|
138
142
|
end
|
139
143
|
end
|
140
144
|
end
|
145
|
+
|
146
|
+
# Returns tuple for each archive mentioned in spec
|
147
|
+
# [archive_type, unpack_command, archive_file, unpack_base_path]
|
148
|
+
# e.g.
|
149
|
+
# ['tar', 'tar xfv', 'redis-1.2.3.tar.gz', 'redis-1.2.3']
|
150
|
+
# ['zip', 'unzip', 'mx4j-3.0.2.zip', 'redis-1.2.3']
|
151
|
+
def archives_in_files
|
152
|
+
archives = []
|
153
|
+
|
154
|
+
tarballs_in_files.each do |tarball_file|
|
155
|
+
package_file = File.basename(tarball_file)
|
156
|
+
unpacked_path = unpacked_path_for_tarball(tarball_file)
|
157
|
+
archives << ['tar', 'tar xfv', package_file, unpacked_path]
|
158
|
+
end
|
159
|
+
|
160
|
+
zipfiles_in_files.each do |zipfile|
|
161
|
+
package_file = File.basename(zipfile)
|
162
|
+
unpacked_path = unpacked_path_for_zipfile(zipfile)
|
163
|
+
archives << ['zip', 'unzip', package_file, unpacked_path]
|
164
|
+
end
|
165
|
+
|
166
|
+
archives
|
167
|
+
end
|
141
168
|
|
142
169
|
# Returns all .tar.gz in the files list
|
143
170
|
def tarballs_in_files
|
144
|
-
files.select { |file| file =~
|
171
|
+
files.select { |file| file =~ /\.(?:tar.gz|tgz)/ }
|
145
172
|
end
|
146
|
-
|
173
|
+
|
174
|
+
# Returns all .zip in the files list
|
175
|
+
def zipfiles_in_files
|
176
|
+
files.select { |file| file =~ /\.zip/ }
|
177
|
+
end
|
178
|
+
|
147
179
|
# If primary_package_file was mysql's client-5.1.62-rel13.3-435-Linux-x86_64.tar.gz
|
148
180
|
# then returns "client-5.1.62-rel13.3-435-Linux-x86_64"
|
149
181
|
#
|
@@ -152,6 +184,20 @@ module Bosh::Gen
|
|
152
184
|
file = `tar tfz #{tarball_path} | head -n 1`
|
153
185
|
File.basename(file.strip)
|
154
186
|
end
|
187
|
+
|
188
|
+
# Lists the files within zipfile and determines the base unpacking path
|
189
|
+
# E.g. from the following 'unzip -l' output:
|
190
|
+
#
|
191
|
+
# Archive: /Users/drnic/Downloads/mx4j-3.0.2.zip
|
192
|
+
# Length Date Time Name
|
193
|
+
# -------- ---- ---- ----
|
194
|
+
# 0 10-13-06 01:12 mx4j-3.0.2/
|
195
|
+
#
|
196
|
+
# it determines the base is: mx4j-3.0.2/
|
197
|
+
def unpacked_path_for_zipfile(zipfile)
|
198
|
+
`unzip -l #{zipfile} | head -n 4 | tail -n 1 | awk '{ print $4 }'`.strip
|
199
|
+
end
|
200
|
+
|
155
201
|
end
|
156
202
|
end
|
157
203
|
end
|
data/lib/bosh/gen/models.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "yaml"
|
2
|
+
module Bosh::Gen::Models
|
3
|
+
# Read-only interface to local ~/.bosh_config
|
4
|
+
# file
|
5
|
+
class BoshConfig
|
6
|
+
def initialize(config_file="~/.bosh_config")
|
7
|
+
@config_file = File.expand_path(config_file)
|
8
|
+
@config = YAML.load_file(@config_file)
|
9
|
+
end
|
10
|
+
|
11
|
+
def target_uuid
|
12
|
+
@config["target_uuid"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -12,6 +12,11 @@ module Bosh::Gen::Models
|
|
12
12
|
@stemcell = { "name" => "bosh-stemcell", "version" => @stemcell_version }
|
13
13
|
@persistent_disk = cloud_properties.delete("persistent_disk").to_i
|
14
14
|
@static_ips = cloud_properties.delete("static_ips") || []
|
15
|
+
|
16
|
+
# Ignore current release version and set to 'latest'
|
17
|
+
# This is much more helpful in early development days
|
18
|
+
# of a release
|
19
|
+
release_properties["version"] = 'latest'
|
15
20
|
|
16
21
|
manifest["name"] = name
|
17
22
|
manifest["director_uuid"] = director_uuid
|
data/lib/bosh/gen/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
target: http://23.23.128.40:25555
|
3
|
+
target_name: microbosh-aws-us-east-1
|
4
|
+
target_version: 0.5.1 (release:ffd6af9a bosh:8b7af232)
|
5
|
+
target_uuid: f734ed1f-6892-4d96-9123-018c830a8543
|
6
|
+
aliases:
|
7
|
+
target:
|
8
|
+
47ee0fca-68fc-4183-a9ed-863eaa619ff7: http://ec2-23-23-248-166.compute-1.amazonaws.com:25555
|
9
|
+
c897319f-9b4b-41ae-9ed7-7de00b4d770b: http://ec2-23-21-73-121.compute-1.amazonaws.com:25555
|
10
|
+
ad88170e-85ee-4d11-bc80-34e7e15df15d: http://ec2-23-21-73-121.compute-1.amazonaws.com:25555
|
11
|
+
979e4c3f-e74e-4c6d-ae21-45398473b70c: http://23.21.73.121:25555
|
12
|
+
1e753059-a2c8-4363-847f-cc31ca0f67e0: http://ec2-23-21-73-121.compute-1.amazonaws.com:25555
|
13
|
+
f734ed1f-6892-4d96-9123-018c830a8543: http://23.23.128.42:25555
|
14
|
+
auth:
|
15
|
+
http://ec2-23-23-248-166.compute-1.amazonaws.com:25555:
|
16
|
+
username: admin
|
17
|
+
password: admin
|
18
|
+
http://ec2-23-21-73-121.compute-1.amazonaws.com:25555:
|
19
|
+
username: admin
|
20
|
+
password: foobar
|
21
|
+
http://50.19.186.130:25555:
|
22
|
+
username: admin
|
23
|
+
password: admin
|
24
|
+
http://23.21.73.121:25555:
|
25
|
+
username: admin
|
26
|
+
password: ooooooo
|
27
|
+
http://23.23.128.42:25555:
|
28
|
+
username: admin
|
29
|
+
password: hahahah
|
30
|
+
deployment:
|
31
|
+
http://ec2-23-23-248-166.compute-1.amazonaws.com:25555: /Users/drnic/.bosh_deployments/wordpress/wordpress-aws.yml
|
32
|
+
http://ec2-23-21-73-121.compute-1.amazonaws.com:25555: /Users/drnic/Sites/boshdeployments/rackapp/manifest.yml
|
33
|
+
http://23.21.73.121:25555: /Users/drnic/Sites/boshdeployments/rackapp/manifest.yml
|
34
|
+
http://23.23.128.40:25555: /Users/drnic/Sites/boshdeployments/riak-cluster/manifest.yml
|
@@ -3,7 +3,7 @@ name: myproj
|
|
3
3
|
director_uuid: UUID
|
4
4
|
release:
|
5
5
|
name: myrelease
|
6
|
-
version:
|
6
|
+
version: latest
|
7
7
|
compilation:
|
8
8
|
workers: 10
|
9
9
|
network: default
|
@@ -32,7 +32,7 @@ resource_pools:
|
|
32
32
|
size: 2
|
33
33
|
stemcell:
|
34
34
|
name: bosh-stemcell
|
35
|
-
version: 0.
|
35
|
+
version: 0.6.2
|
36
36
|
cloud_properties:
|
37
37
|
instance_type: m1.small
|
38
38
|
persistent_disk: 8196
|
@@ -3,7 +3,7 @@ name: myproj
|
|
3
3
|
director_uuid: UUID
|
4
4
|
release:
|
5
5
|
name: myrelease
|
6
|
-
version:
|
6
|
+
version: latest
|
7
7
|
compilation:
|
8
8
|
workers: 10
|
9
9
|
network: default
|
@@ -32,7 +32,7 @@ resource_pools:
|
|
32
32
|
size: 2
|
33
33
|
stemcell:
|
34
34
|
name: bosh-stemcell
|
35
|
-
version: 0.
|
35
|
+
version: 0.6.2
|
36
36
|
cloud_properties:
|
37
37
|
instance_type: m1.small
|
38
38
|
jobs:
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require "bosh/gen/cli"
|
2
|
+
|
3
|
+
module GeneratorSpecHelper
|
4
|
+
def setup_universe
|
5
|
+
@tmp_root = File.expand_path("../../tmp", __FILE__)
|
6
|
+
@home_path = File.join(@tmp_root, "home")
|
7
|
+
@fixtures_path = File.expand_path('../../fixtures', __FILE__)
|
8
|
+
FileUtils.rm_rf @tmp_root
|
9
|
+
FileUtils.mkdir_p @home_path
|
10
|
+
ENV['HOME'] = @home_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup_project_release(name)
|
14
|
+
release_path = File.join(@fixtures_path, "releases", name)
|
15
|
+
FileUtils.cp_r(release_path, @tmp_root)
|
16
|
+
@active_project_folder = File.join(@tmp_root, name)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Runs 'bosh-gen job NAME ...'
|
20
|
+
#
|
21
|
+
# generate_job 'JOBNAME'
|
22
|
+
# generate_job 'JOBNAME', '-d', 'nginx'
|
23
|
+
# generate_job "JOBNAME", "--template", "nginx_rack", '-d', 'nginx', 'ruby', 'myapp'
|
24
|
+
def generate_job(*args)
|
25
|
+
stdout, stderr = capture_stdios do
|
26
|
+
Bosh::Gen::Command.start(["job", *args])
|
27
|
+
end
|
28
|
+
@stdout = File.expand_path(File.join(@tmp_root, "generate_job.out"))
|
29
|
+
File.open(@stdout, "w") {|f| f << stdout; f << stderr}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Test that a file exists in job
|
33
|
+
# job_file_exists "mywebapp", "monit"
|
34
|
+
# job_file_exists "mywebapp", "templates", "mywebapp_ctl", :executable => true
|
35
|
+
def job_file_exists(*args)
|
36
|
+
if args.last.is_a?(Hash)
|
37
|
+
options = args.pop
|
38
|
+
end
|
39
|
+
path = File.join(["jobs"] + args) # jobs/JOBNAME/monit
|
40
|
+
File.exist?(path).must_equal(true, "#{path} not created")
|
41
|
+
if options && options[:executable]
|
42
|
+
File.executable?(path).must_equal(true, "#{path} not executable")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Tests a job template and its spec
|
47
|
+
# job_template_exists "mywebapp", "mywebapp_ctl.erb", "bin/mywebapp_ctl"
|
48
|
+
#
|
49
|
+
# Spec would contain:
|
50
|
+
# mywebapp_ctl.erb: bin/mywebapp_ctl
|
51
|
+
def job_template_exists(job, template_name, spec_path)
|
52
|
+
path = File.join("jobs", job, "templates", template_name)
|
53
|
+
File.exist?(path).must_equal(true, "#{path} not created")
|
54
|
+
spec_templates = job_spec(job)["templates"]
|
55
|
+
spec_templates[template_name].wont_be_nil("spec.templates missing #{template_name}")
|
56
|
+
spec_templates[template_name].must_equal(spec_path, "spec.templates must be #{template_name} -> #{spec_path}")
|
57
|
+
end
|
58
|
+
|
59
|
+
def job_spec(job)
|
60
|
+
@specs ||= {}
|
61
|
+
@specs[job] ||= YAML.load_file(File.join("jobs", job, "spec"))
|
62
|
+
end
|
63
|
+
|
64
|
+
def setup_active_project_folder project_name
|
65
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
66
|
+
@project_name = project_name
|
67
|
+
end
|
68
|
+
|
69
|
+
def in_tmp_folder(&block)
|
70
|
+
FileUtils.chdir(@tmp_root, &block)
|
71
|
+
end
|
72
|
+
|
73
|
+
def in_project_folder(&block)
|
74
|
+
project_folder = @active_project_folder || @tmp_root
|
75
|
+
FileUtils.chdir(project_folder, &block)
|
76
|
+
end
|
77
|
+
|
78
|
+
def in_home_folder(&block)
|
79
|
+
FileUtils.chdir(@home_path, &block)
|
80
|
+
end
|
81
|
+
|
82
|
+
def capture_stdios(input = nil, &block)
|
83
|
+
require 'stringio'
|
84
|
+
org_stdin, $stdin = $stdin, StringIO.new(input) if input
|
85
|
+
org_stdout, $stdout = $stdout, StringIO.new
|
86
|
+
org_stderr, $stderr = $stdout, StringIO.new
|
87
|
+
yield
|
88
|
+
return [$stdout.string, $stderr.string]
|
89
|
+
ensure
|
90
|
+
$stderr = org_stderr
|
91
|
+
$stdout = org_stdout
|
92
|
+
$stdin = org_stdin
|
93
|
+
end
|
94
|
+
|
95
|
+
def get_command_output
|
96
|
+
strip_color_codes(File.read(@stdout)).chomp
|
97
|
+
end
|
98
|
+
|
99
|
+
def strip_color_codes(text)
|
100
|
+
text.gsub(/\e\[\d+m/, '')
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "generators/generator_spec_helper"
|
3
|
+
|
4
|
+
# in a tmp folder:
|
5
|
+
# * run generator
|
6
|
+
# * specific files created
|
7
|
+
# * run 'bosh create release'
|
8
|
+
# * it shouldn't fail
|
9
|
+
|
10
|
+
# generates job for a webapp application package
|
11
|
+
class WebappGeneratorSpec < MiniTest::Spec
|
12
|
+
include GeneratorSpecHelper
|
13
|
+
|
14
|
+
def self.pending(name, &block); end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
setup_universe
|
18
|
+
setup_project_release("bosh-sample-release")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "creates common job files" do
|
22
|
+
in_project_folder do
|
23
|
+
generate_job("mywebapp")
|
24
|
+
File.exist?("jobs/mywebapp/monit").must_equal(true, "jobs/mywebapp/monit not created")
|
25
|
+
File.exist?("jobs/mywebapp/spec").must_equal(true, "jobs/mywebapp/spec not created")
|
26
|
+
job_template_exists "mywebapp", "bin/mywebapp_ctl", "bin/mywebapp_ctl"
|
27
|
+
job_template_exists "mywebapp", "bin/monit_debugger", "bin/monit_debugger"
|
28
|
+
job_template_exists "mywebapp", "data/properties.sh.erb", "data/properties.sh"
|
29
|
+
job_template_exists "mywebapp", "helpers/ctl_setup.sh", "helpers/ctl_setup.sh"
|
30
|
+
job_template_exists "mywebapp", "helpers/ctl_utils.sh", "helpers/ctl_utils.sh"
|
31
|
+
|
32
|
+
example = File.join("examples", "mywebapp_simple", "default.yml")
|
33
|
+
File.exist?(example).must_equal(true, "#{example} not created")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
pending "creates job files with rails & nginx templates" do
|
38
|
+
in_project_folder do
|
39
|
+
generate_job("mywebapp", "--purpose", "nginx_rack", '-d', 'nginx', 'ruby', 'myapp')
|
40
|
+
File.exist?("jobs/mywebapp/monit").must_equal(true, "jobs/mywebapp/monit not created")
|
41
|
+
File.exist?("jobs/mywebapp/spec").must_equal(true, "jobs/mywebapp/spec not created")
|
42
|
+
|
43
|
+
job_spec("mywebapp")["packages"].must_equal(%w[nginx ruby myapp], "spec dependencies incorrect")
|
44
|
+
|
45
|
+
job_template_exists "mywebapp", "bin/mywebapp_ctl", "bin/mywebapp_ctl"
|
46
|
+
job_template_exists "mywebapp", "bin/monit_debugger", "bin/monit_debugger"
|
47
|
+
job_template_exists "mywebapp", "data/properties.sh.erb", "data/properties.sh"
|
48
|
+
job_template_exists "mywebapp", "helpers/ctl_setup.sh.erb", "helpers/ctl_setup.sh"
|
49
|
+
job_template_exists "mywebapp", "helpers/ctl_utils.sh", "helpers/ctl_utils.sh"
|
50
|
+
|
51
|
+
job_template_exists "mywebapp", "bin/ctl_db_utils.sh.erb", "bin/ctl_db_utils.sh"
|
52
|
+
job_template_exists "mywebapp", "bin/ctl_redis_utils.sh.erb", "bin/ctl_redis_utils.sh"
|
53
|
+
job_template_exists "mywebapp", "bin/rails_ctl_setup.sh.erb", "bin/rails_ctl_setup.sh"
|
54
|
+
job_template_exists "mywebapp", "bin/ctl_start.sh.erb", "bin/ctl_start.sh"
|
55
|
+
job_template_exists "mywebapp", "bin/ctl_nginx.sh.erb", "bin/ctl_nginx.sh"
|
56
|
+
job_template_exists "mywebapp", "bin/nginx_ctl", "bin/nginx_ctl"
|
57
|
+
job_template_exists "mywebapp", "config/nginx.conf.erb", "config/nginx.conf"
|
58
|
+
job_template_exists "mywebapp", "config/nginx_proxy.conf", "config/nginx_proxy.conf"
|
59
|
+
job_template_exists "mywebapp", "config/mime.types", "config/mime.types"
|
60
|
+
job_template_exists "mywebapp", "config/database.yml.erb", "config/database.yml"
|
61
|
+
job_template_exists "mywebapp", "config/redis.yml.erb", "config/redis.yml"
|
62
|
+
|
63
|
+
example = File.join("examples", "mywebapp_nginx_rack", "nginx_puma.yml")
|
64
|
+
example = File.join("examples", "mywebapp_nginx_rack", "nginx_rackup.yml")
|
65
|
+
File.exist?(example).must_equal(true, "#{example} not created")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "bosh/gen/models"
|
3
|
+
|
4
|
+
class BoshConfigSpec < MiniTest::Spec
|
5
|
+
it "knows UUID of current target bosh" do
|
6
|
+
fake_config = File.expand_path( \
|
7
|
+
"../../fixtures/bosh_config/multiple_boshes.yml", __FILE__)
|
8
|
+
config = Bosh::Gen::Models::BoshConfig.new(fake_config)
|
9
|
+
config.target_uuid.must_equal "f734ed1f-6892-4d96-9123-018c830a8543"
|
10
|
+
end
|
11
|
+
end
|
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.9.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-
|
12
|
+
date: 2012-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -131,10 +131,31 @@ files:
|
|
131
131
|
- lib/bosh/gen/generators/extract_package_generator.rb
|
132
132
|
- lib/bosh/gen/generators/job_generator.rb
|
133
133
|
- lib/bosh/gen/generators/job_generator/templates/.gitkeep
|
134
|
-
- lib/bosh/gen/generators/job_generator/templates/
|
135
|
-
- lib/bosh/gen/generators/job_generator/templates/
|
136
|
-
- lib/bosh/gen/generators/job_generator/templates/
|
137
|
-
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%
|
134
|
+
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_puma_migrate.yml
|
135
|
+
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_rackup.yml.tt
|
136
|
+
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_simple/default.yml
|
137
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/monit.tt
|
138
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/%job_name%_rack_ctl.tt
|
139
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_db_utils.sh.erb
|
140
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_nginx.sh.erb
|
141
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_redis_utils.sh.erb
|
142
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_setup.sh.erb
|
143
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_start.sh.erb
|
144
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_utils.sh
|
145
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/monit_debugger
|
146
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/nginx_ctl.tt
|
147
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/rails_ctl_setup.sh.erb
|
148
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/database.yml.erb
|
149
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/mime.types
|
150
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx.conf.erb
|
151
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx_proxy.conf
|
152
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/redis.yml.erb
|
153
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/monit.tt
|
154
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/%job_name%_ctl.tt
|
155
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/monit_debugger
|
156
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/data/properties.sh.erb
|
157
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_setup.sh
|
158
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh
|
138
159
|
- lib/bosh/gen/generators/job_template_generator.rb
|
139
160
|
- lib/bosh/gen/generators/new_release_generator.rb
|
140
161
|
- lib/bosh/gen/generators/new_release_generator/templates/README.md.tt
|
@@ -147,9 +168,11 @@ files:
|
|
147
168
|
- lib/bosh/gen/generators/package_generator/templates/.gitkeep
|
148
169
|
- lib/bosh/gen/generators/package_source_generator.rb
|
149
170
|
- lib/bosh/gen/models.rb
|
171
|
+
- lib/bosh/gen/models/bosh_config.rb
|
150
172
|
- lib/bosh/gen/models/deployment_manifest.rb
|
151
173
|
- lib/bosh/gen/models/release_detection.rb
|
152
174
|
- lib/bosh/gen/version.rb
|
175
|
+
- spec/fixtures/bosh_config/multiple_boshes.yml
|
153
176
|
- spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml
|
154
177
|
- spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml
|
155
178
|
- spec/fixtures/releases/bosh-sample-release/.gitignore
|
@@ -191,6 +214,9 @@ files:
|
|
191
214
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-1.yml
|
192
215
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-10.yml
|
193
216
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-2.yml
|
217
|
+
- spec/generators/generator_spec_helper.rb
|
218
|
+
- spec/generators/jobs/webapp_job_generator_spec.rb
|
219
|
+
- spec/models/bosh_config_spec.rb
|
194
220
|
- spec/models/deployment_manifest_spec.rb
|
195
221
|
- spec/models/extract_spec.rb
|
196
222
|
- spec/models/release_detection_spec.rb
|
@@ -209,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
235
|
version: '0'
|
210
236
|
segments:
|
211
237
|
- 0
|
212
|
-
hash:
|
238
|
+
hash: 2628842034372834781
|
213
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
240
|
none: false
|
215
241
|
requirements:
|
@@ -218,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
244
|
version: '0'
|
219
245
|
segments:
|
220
246
|
- 0
|
221
|
-
hash:
|
247
|
+
hash: 2628842034372834781
|
222
248
|
requirements: []
|
223
249
|
rubyforge_project:
|
224
250
|
rubygems_version: 1.8.24
|
@@ -226,6 +252,7 @@ signing_key:
|
|
226
252
|
specification_version: 3
|
227
253
|
summary: ''
|
228
254
|
test_files:
|
255
|
+
- spec/fixtures/bosh_config/multiple_boshes.yml
|
229
256
|
- spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml
|
230
257
|
- spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml
|
231
258
|
- spec/fixtures/releases/bosh-sample-release/.gitignore
|
@@ -267,6 +294,9 @@ test_files:
|
|
267
294
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-1.yml
|
268
295
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-10.yml
|
269
296
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-2.yml
|
297
|
+
- spec/generators/generator_spec_helper.rb
|
298
|
+
- spec/generators/jobs/webapp_job_generator_spec.rb
|
299
|
+
- spec/models/bosh_config_spec.rb
|
270
300
|
- spec/models/deployment_manifest_spec.rb
|
271
301
|
- spec/models/extract_spec.rb
|
272
302
|
- spec/models/release_detection_spec.rb
|