bosh-gen 0.8.0 → 0.8.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/ChangeLog.md
CHANGED
@@ -31,14 +31,20 @@ module Bosh::Gen
|
|
31
31
|
def copy_dependent_packages
|
32
32
|
@packages.each {|package| directory "packages/#{package}"}
|
33
33
|
end
|
34
|
-
|
35
|
-
def
|
34
|
+
|
35
|
+
def copy_package_spec_files
|
36
36
|
@blobs = false
|
37
37
|
@packages.each do |package|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
spec = source_file("packages", package, "spec")
|
39
|
+
files = YAML.load_file(spec)["files"]
|
40
|
+
|
41
|
+
files.each do |relative_file|
|
42
|
+
if File.exist?(source_file("src", relative_file))
|
43
|
+
copy_file "src/#{relative_file}"
|
44
|
+
elsif File.exist?(source_file("blobs", relative_file))
|
45
|
+
copy_file "blobs/#{relative_file}"
|
46
|
+
@blobs = true
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -54,6 +60,9 @@ module Bosh::Gen
|
|
54
60
|
File.join("jobs", job_name, path)
|
55
61
|
end
|
56
62
|
|
63
|
+
def source_file(*path)
|
64
|
+
File.join(source_release_path, *path)
|
65
|
+
end
|
57
66
|
end
|
58
67
|
end
|
59
68
|
end
|
@@ -30,13 +30,19 @@ module Bosh::Gen
|
|
30
30
|
@packages.each {|package| directory "packages/#{package}"}
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def copy_package_spec_files
|
34
34
|
@blobs = false
|
35
35
|
@packages.each do |package|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
spec = source_file("packages", package, "spec")
|
37
|
+
files = YAML.load_file(spec)["files"]
|
38
|
+
|
39
|
+
files.each do |relative_file|
|
40
|
+
if File.exist?(source_file("src", relative_file))
|
41
|
+
copy_file "src/#{relative_file}"
|
42
|
+
elsif File.exist?(source_file("blobs", relative_file))
|
43
|
+
copy_file "blobs/#{relative_file}"
|
44
|
+
@blobs = true
|
45
|
+
end
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
@@ -9,21 +9,23 @@ module Bosh::Gen
|
|
9
9
|
argument :name
|
10
10
|
argument :dependencies, :type => :array
|
11
11
|
argument :files, :type => :array
|
12
|
-
|
12
|
+
|
13
|
+
BLOB_FILE_MIN_SIZE=20_000 # files over 20k are blobs
|
14
|
+
|
13
15
|
def self.source_root
|
14
16
|
File.join(File.dirname(__FILE__), "package_generator", "templates")
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
def check_root_is_release
|
18
20
|
unless File.exist?("jobs") && File.exist?("packages")
|
19
21
|
raise Thor::Error.new("run inside a BOSH release project")
|
20
22
|
end
|
21
23
|
end
|
22
|
-
|
24
|
+
|
23
25
|
def check_name
|
24
26
|
raise Thor::Error.new("'#{name}' is not a vaild BOSH id") unless name.bosh_valid_id?
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
def warn_missing_dependencies
|
28
30
|
dependencies.each do |d|
|
29
31
|
raise Thor::Error.new("dependency '#{d}' is not a vaild BOSH id") unless d.bosh_valid_id?
|
@@ -32,7 +34,7 @@ module Bosh::Gen
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
|
-
|
37
|
+
|
36
38
|
def packaging
|
37
39
|
create_file package_dir("packaging") do
|
38
40
|
packaging = <<-SHELL.gsub(/^\s{10}/, '')
|
@@ -72,16 +74,30 @@ module Bosh::Gen
|
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
|
-
# Copy the local source files into src
|
76
|
-
#
|
77
|
+
# Copy the local source files into src or blobs
|
78
|
+
# * into src/NAME/filename (if < 20k) or
|
79
|
+
# * into blobs/NAME/filename (if >= 20k)
|
80
|
+
# Skip a file if:
|
81
|
+
# * filename already exists as a blob in blobs/NAME/filename
|
82
|
+
# * file doesn't exist
|
77
83
|
def copy_src_files
|
78
|
-
files.each do |
|
84
|
+
files.each do |file|
|
85
|
+
file_path = File.expand_path(file)
|
86
|
+
unless File.exist?(file_path)
|
87
|
+
say "Skipping unknown file #{file_path}", :red
|
88
|
+
next
|
89
|
+
end
|
90
|
+
|
91
|
+
size = File.size(file_path)
|
79
92
|
file_name = File.basename(file_path)
|
80
|
-
src_file
|
81
|
-
|
93
|
+
src_file = src_dir(file_name)
|
94
|
+
blob_file = blob_dir(file_name)
|
95
|
+
if File.exist?(blob_file)
|
82
96
|
say "Blob '#{file_name}' exists as a blob, skipping..."
|
83
97
|
else
|
84
|
-
|
98
|
+
# if < 20k, put in src/, else blobs/
|
99
|
+
target = size >= BLOB_FILE_MIN_SIZE ? blob_file : src_file
|
100
|
+
copy_file File.expand_path(file_path), target
|
85
101
|
end
|
86
102
|
end
|
87
103
|
end
|
@@ -125,7 +141,7 @@ module Bosh::Gen
|
|
125
141
|
|
126
142
|
# Returns all .tar.gz in the files list
|
127
143
|
def tarballs_in_files
|
128
|
-
files.select { |file| file =~ /.tar.gz/ }
|
144
|
+
files.select { |file| file =~ /.(?:tar.gz|tgz)/ }
|
129
145
|
end
|
130
146
|
|
131
147
|
# If primary_package_file was mysql's client-5.1.62-rel13.3-435-Linux-x86_64.tar.gz
|
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.8.
|
4
|
+
version: 0.8.1
|
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-07-
|
12
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
segments:
|
211
211
|
- 0
|
212
|
-
hash:
|
212
|
+
hash: 3642309180596894033
|
213
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
214
|
none: false
|
215
215
|
requirements:
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
segments:
|
220
220
|
- 0
|
221
|
-
hash:
|
221
|
+
hash: 3642309180596894033
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
224
|
rubygems_version: 1.8.24
|