vagrant_cloud 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65b0abd2cea9c76ca3f0714c69c5bd7c21849466
4
- data.tar.gz: d3e8d3525d3c23e7731d9b01ae2b8b4f58fb0c6b
3
+ metadata.gz: dcdd9dd3b5ac00bf1add77d8a837f727c61c0041
4
+ data.tar.gz: 2bd31b671ba202ca7b2cbba4a06e767949732b95
5
5
  SHA512:
6
- metadata.gz: f8396103dd63169611a5857e14c1d2b956e723394caba4bddb6691e4f46f2d8b6f995e2fa8920e5c6e12ea46cd32c37ad7e7a45d4b42fa613461df5a52c8ab31
7
- data.tar.gz: bd24477f03ae16a4e61083a0ffa191dfcf72f41b2747233ffc4342f0b26cc6e8a4060cf6f052ce2ba80d96a656446a54a5bb295078dcefc720399ceabeda4188
6
+ metadata.gz: 72b0c2dbc26b450f46df0eb47111ea80742e4890a1ff143cb7e9ad03c724e499368c69eb5d4c4378a851261bd948801d2d928f9ccd97633a40e4c04de5ef7d8a
7
+ data.tar.gz: 9b11a23883516758c7da2f4f0f851ea270030a9c4b128d62260f7503005835bbcf8b06cbf693b065197331a6d84d9713785da6a4d178e2d7e1bc0f849e1ba6a5
@@ -14,24 +14,29 @@ module VagrantCloud
14
14
  Box.new(self, name, data)
15
15
  end
16
16
 
17
- def create_box(name, description = nil)
17
+ def create_box(name, description = nil, is_private = false)
18
18
  params = {:name => name}
19
19
  params[:description] = description if description
20
20
  params[:short_description] = description if description
21
+ params[:is_private] = is_private ? 1 : 0
21
22
  data = request('post', '/boxes', {:box => params})
22
23
  get_box(name, data)
23
24
  end
24
25
 
25
- def ensure_box(name, description = nil)
26
+ def ensure_box(name, description = nil, is_private = nil)
26
27
  begin
27
28
  box = get_box(name)
28
29
  box.data
29
30
  rescue RestClient::ResourceNotFound => e
30
- box = create_box(name, description)
31
+ box = create_box(name, description, is_private)
31
32
  end
32
- if description and (description != box.description || description != box.description_short)
33
- box.update(description)
33
+
34
+ updated_description = (!description.nil? && (description != box.description || description != box.description_short))
35
+ updated_private = (!is_private.nil? && (is_private != box.private))
36
+ if updated_description || updated_private
37
+ box.update(description, is_private)
34
38
  end
39
+
35
40
  box
36
41
  end
37
42
 
@@ -20,6 +20,10 @@ module VagrantCloud
20
20
  data['short_description']
21
21
  end
22
22
 
23
+ def private
24
+ data['private']
25
+ end
26
+
23
27
  def versions
24
28
  version_list = data['versions'].map { |data| Version.new(self, data['number'], data) }
25
29
  version_list.sort_by { |version| Gem::Version.new(version.number) }
@@ -29,8 +33,12 @@ module VagrantCloud
29
33
  @data ||= account.request('get', "/box/#{account.username}/#{name}")
30
34
  end
31
35
 
32
- def update(description)
33
- box = {:short_description => description, :description => description}
36
+ def update(description, is_private)
37
+ box = {
38
+ :short_description => description,
39
+ :description => description,
40
+ :is_private => is_private,
41
+ }
34
42
  @data = account.request('put', "/box/#{account.username}/#{name}", {:box => box})
35
43
  end
36
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
11
+ date: 2015-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.4.5
74
+ rubygems_version: 2.4.6
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Vagrant Cloud API wrapper