bosh-gen 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## v0.7.0
4
+
5
+ Added:
6
+
7
+ * `extract-pkg` - extract a package and its dependencies from a target release
8
+
9
+ Changed/Renamed:
10
+
11
+ * `extract` -> `extract-job`
12
+ * `new` -> `.gitignore` includes `.vagrant`, to support `bosh-solo`
13
+ * `manifest` -> update to soon-to-be-released stemcell 0.6.2
14
+
3
15
  ## v0.6.0
4
16
 
5
17
  Added:
data/lib/bosh/gen/cli.rb CHANGED
@@ -69,13 +69,19 @@ module Bosh
69
69
  Bosh::Gen::Generators::JobTemplateGenerator.start([job_name, file_path])
70
70
  end
71
71
 
72
- desc "extract SOURCE_RELEASE_PATH SOURCE_JOB_NAME [JOB_NAME]", "Extracts a job from another release and all its dependent packages and source"
73
- def extract(source_release_path, source_job_name, target_job_name=nil)
72
+ desc "extract-job SOURCE_RELEASE_PATH SOURCE_JOB_NAME [JOB_NAME]", "Extracts a job from another release and all its dependent packages and source"
73
+ def extract_job(source_release_path, source_job_name, target_job_name=nil)
74
74
  target_job_name ||= source_job_name
75
75
  require 'bosh/gen/generators/extract_job_generator'
76
76
  Bosh::Gen::Generators::ExtractJobGenerator.start([source_release_path, source_job_name, target_job_name])
77
77
  end
78
78
 
79
+ desc "extract-pkg SOURCE_RELEASE_PATH SOURCE_PACKAGE_NAME", "Extracts a package from another release and all its dependent packages and sources"
80
+ def extract_pkg(source_release_path, source_package_name)
81
+ require 'bosh/gen/generators/extract_package_generator'
82
+ Bosh::Gen::Generators::ExtractPackageGenerator.start([source_release_path, source_package_name])
83
+ end
84
+
79
85
  desc "manifest NAME PATH UUID", "Creates a deployment manifest based on the release located at PATH"
80
86
  method_option :force, :type => :boolean, :desc => "Force override existing target manifest file"
81
87
  method_option :addresses, :aliases => ['-a'], :type => :array, :desc => "List of IP addresses available for jobs"
@@ -12,6 +12,12 @@ module Bosh::Gen
12
12
  argument :ip_addresses
13
13
  argument :flags, :type => :hash
14
14
 
15
+ def create_root
16
+ self.destination_root = File.expand_path(name, destination_root)
17
+ empty_directory '.'
18
+ FileUtils.cd(destination_root) unless options[:pretend]
19
+ end
20
+
15
21
  def check_release_path_is_release
16
22
  unless File.exist?(release_path)
17
23
  raise Thor::Error.new("target path '#{release_path}' doesn't exist")
@@ -33,6 +39,10 @@ module Bosh::Gen
33
39
  create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]
34
40
  end
35
41
 
42
+ def setup_bosh_deployment_target
43
+ run "bosh deployment #{manifest_file_name}"
44
+ end
45
+
36
46
  private
37
47
  def release_detector
38
48
  @release_detector ||= Bosh::Gen::Models::ReleaseDetection.new(release_path)
@@ -40,7 +50,7 @@ module Bosh::Gen
40
50
 
41
51
  # Whether +name+ contains .yml suffix or nor, returns a .yml filename for manifest to be generated
42
52
  def manifest_file_name
43
- basename = name.gsub(/\.yml/, '') + ".yml"
53
+ basename = "manifest.yml"
44
54
  end
45
55
 
46
56
  def job_manifests
@@ -0,0 +1,65 @@
1
+ require 'yaml'
2
+ require 'thor/group'
3
+
4
+ module Bosh::Gen
5
+ module Generators
6
+ class ExtractPackageGenerator < Thor::Group
7
+ include Thor::Actions
8
+
9
+ argument :source_release_path
10
+ argument :source_package_name
11
+
12
+ def check_root_is_release
13
+ unless File.exist?("jobs") && File.exist?("packages")
14
+ raise Thor::Error.new("run inside a BOSH release project")
15
+ end
16
+ end
17
+
18
+ def using_source_release_for_templates
19
+ source_paths << File.join(source_release_path)
20
+ end
21
+
22
+ # Extract target package and all its dependencies
23
+ def detect_dependent_packages
24
+ spec = YAML.load_file(source_package_dir("spec"))
25
+ @packages = [target_package_name]
26
+ @packages << spec["packages"] if spec["packages"]
27
+ end
28
+
29
+ def copy_dependent_packages
30
+ @packages.each {|package| directory "packages/#{package}"}
31
+ end
32
+
33
+ def copy_dependent_sources
34
+ @blobs = false
35
+ @packages.each do |package|
36
+ directory "src/#{package}" if File.exist?(File.join(source_release_path, "src", package))
37
+ if File.exist?(File.join(source_release_path, "blobs", package))
38
+ directory "blobs/#{package}"
39
+ @blobs = true
40
+ end
41
+ end
42
+ end
43
+
44
+ def readme
45
+ if @blobs
46
+ say_status "readme", "Upload blobs with 'bosh upload blobs'"
47
+ end
48
+ end
49
+
50
+ private
51
+ def target_package_name
52
+ source_package_name
53
+ end
54
+
55
+ def package_dir(path="")
56
+ File.join("packages", source_package_name, path)
57
+ end
58
+
59
+ def source_package_dir(path="")
60
+ File.join(source_release_path, "packages", source_package_name, path)
61
+ end
62
+
63
+ end
64
+ end
65
+ end
@@ -89,6 +89,7 @@ module Bosh::Gen
89
89
  blobs/*
90
90
  .blobs
91
91
  .dev_builds
92
+ .vagrant
92
93
  .idea
93
94
  .DS_Store
94
95
  .final_builds/jobs/**/*.tgz
@@ -8,7 +8,7 @@ module Bosh::Gen::Models
8
8
  @manifest = {}
9
9
  @cloud_properties = cloud_properties
10
10
  @security_groups = ["default"]
11
- @stemcell_version = "0.5.1"
11
+ @stemcell_version = "0.6.2"
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") || []
@@ -18,7 +18,7 @@ module Bosh::Gen::Models
18
18
  end
19
19
 
20
20
  def latest_dev_release_version
21
- @latest_dev_release["version"].to_i
21
+ @latest_dev_release["version"]
22
22
  end
23
23
 
24
24
  def latest_dev_release_job_names
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Gen
3
- VERSION = "0.6.2"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  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.6.2
4
+ version: 0.7.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-18 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -128,6 +128,7 @@ files:
128
128
  - lib/bosh/gen/cli.rb
129
129
  - lib/bosh/gen/generators/deployment_manifest_generator.rb
130
130
  - lib/bosh/gen/generators/extract_job_generator.rb
131
+ - lib/bosh/gen/generators/extract_package_generator.rb
131
132
  - lib/bosh/gen/generators/job_generator.rb
132
133
  - lib/bosh/gen/generators/job_generator/templates/.gitkeep
133
134
  - lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/monit.tt
@@ -208,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
209
  version: '0'
209
210
  segments:
210
211
  - 0
211
- hash: -3864668292302149746
212
+ hash: 1843884671280331738
212
213
  required_rubygems_version: !ruby/object:Gem::Requirement
213
214
  none: false
214
215
  requirements:
@@ -217,10 +218,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  version: '0'
218
219
  segments:
219
220
  - 0
220
- hash: -3864668292302149746
221
+ hash: 1843884671280331738
221
222
  requirements: []
222
223
  rubyforge_project:
223
- rubygems_version: 1.8.23
224
+ rubygems_version: 1.8.24
224
225
  signing_key:
225
226
  specification_version: 3
226
227
  summary: ''