bosh_cli 1.5.0.pre.1226 → 1.5.0.pre.1244

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.
@@ -0,0 +1,22 @@
1
+ module Bosh::Cli::Client
2
+ class CompiledPackagesClient
3
+ def initialize(director)
4
+ @director = director
5
+ end
6
+
7
+ def export(release_name, release_version, stemcell_name, stemcell_version)
8
+ path = "/compiled_package_groups/export"
9
+ content_type = 'application/json'
10
+
11
+ body = JSON.dump(
12
+ stemcell_name: stemcell_name,
13
+ stemcell_version: stemcell_version,
14
+ release_name: release_name,
15
+ release_version: release_version,
16
+ )
17
+
18
+ _, file_path, _ = @director.post(path, content_type, body, {}, file: true)
19
+ file_path
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ require 'fileutils'
2
+ require 'cli/name_version_pair'
3
+ require 'cli/client/compiled_packages_client'
4
+
5
+ module Bosh::Cli::Command
6
+ class ExportCompiledPackages < Base
7
+ usage 'export compiled_packages'
8
+ desc 'Download compiled packages for a specific release and stemcell combination'
9
+ def perform(release, stemcell, download_dir)
10
+ auth_required
11
+
12
+ release = Bosh::Cli::NameVersionPair.parse(release)
13
+ stemcell = Bosh::Cli::NameVersionPair.parse(stemcell)
14
+
15
+ unless Dir.exists?(download_dir)
16
+ err("Directory `#{download_dir}' must exist.")
17
+ end
18
+
19
+ download_file_name = "#{release.name}-#{release.version}-#{stemcell.name}-#{stemcell.version}.tgz"
20
+ download_path = File.join(download_dir, download_file_name)
21
+
22
+ if File.exists?(download_path)
23
+ err("File `#{download_path}' already exists.")
24
+ end
25
+
26
+ client = Bosh::Cli::Client::CompiledPackagesClient.new(director)
27
+ tmp_path = client.export(release.name, release.version, stemcell.name, stemcell.version)
28
+ FileUtils.mv(tmp_path, download_path)
29
+
30
+ say("Exported compiled packages to `#{download_path.make_green}'.")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ module Bosh::Cli
2
+
3
+ class NameVersionPair
4
+ def self.parse(str)
5
+ raise ArgumentError, 'str must not be nil' if str.nil?
6
+ #raise ArgumentError, 'str must not be empty' if str.empty?
7
+
8
+ name, _, version = str.rpartition('/')
9
+ if name.empty? || version.empty?
10
+ raise ArgumentError, 'str must be in the form name/version'
11
+ end
12
+
13
+ new(name, version)
14
+ end
15
+
16
+ attr_reader :name, :version
17
+
18
+ def initialize(name, version)
19
+ @name, @version = name, version
20
+ end
21
+ end
22
+
23
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bosh
4
4
  module Cli
5
- VERSION = '1.5.0.pre.1226'
5
+ VERSION = '1.5.0.pre.1244'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.1226
4
+ version: 1.5.0.pre.1244
5
5
  prerelease: 6
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: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2013-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bosh_common
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0.pre.1226
21
+ version: 1.5.0.pre.1244
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0.pre.1226
29
+ version: 1.5.0.pre.1244
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: json_pure
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.5.0.pre.1226
117
+ version: 1.5.0.pre.1244
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.5.0.pre.1226
125
+ version: 1.5.0.pre.1244
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: net-ssh
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +221,7 @@ dependencies:
221
221
  version: '0'
222
222
  description: ! 'BOSH CLI
223
223
 
224
- 21ba44'
224
+ 1e7603'
225
225
  email: support@cloudfoundry.com
226
226
  executables:
227
227
  - bosh
@@ -235,6 +235,7 @@ files:
235
235
  - lib/cli/blob_manager.rb
236
236
  - lib/cli/cache.rb
237
237
  - lib/cli/changeset_helper.rb
238
+ - lib/cli/client/compiled_packages_client.rb
238
239
  - lib/cli/client/director.rb
239
240
  - lib/cli/command_discovery.rb
240
241
  - lib/cli/command_handler.rb
@@ -244,6 +245,7 @@ files:
244
245
  - lib/cli/commands/cloudcheck.rb
245
246
  - lib/cli/commands/complete.rb
246
247
  - lib/cli/commands/deployment.rb
248
+ - lib/cli/commands/export_compiled_packages.rb
247
249
  - lib/cli/commands/help.rb
248
250
  - lib/cli/commands/job.rb
249
251
  - lib/cli/commands/job_management.rb
@@ -277,6 +279,7 @@ files:
277
279
  - lib/cli/job_property_validator.rb
278
280
  - lib/cli/job_state.rb
279
281
  - lib/cli/line_wrap.rb
282
+ - lib/cli/name_version_pair.rb
280
283
  - lib/cli/null_renderer.rb
281
284
  - lib/cli/package_builder.rb
282
285
  - lib/cli/packaging_helper.rb