profitbricks 0.9.8 → 0.9.9

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: 927f517f665fe6a3edf1b95ba18d309a904cd921
4
- data.tar.gz: ef29502801a32db332dfdd289ece88bb3aea3c0f
3
+ metadata.gz: 8035c805cdebb8207c5a999ed7db0decdf92782d
4
+ data.tar.gz: b10e164d47f8e695897f101382f9088a850a0fc2
5
5
  SHA512:
6
- metadata.gz: 16b87afcb38284f88b8003180533a9c278849a93e065cda09319e1e89a8cab8e5c7117b880f427448bb09707172851dfc9033d9d44d6d20d60f19b49dc93ff1b
7
- data.tar.gz: 4cc02ae79a0db4a940a22d701acbbc41ca093e391ec9a9554fedd776864f20a8631eb7bd2d77903ccea96d4a1db5d9ac9cd9645634bb31e9285db06969062b13
6
+ metadata.gz: 0fdbc90fa42b874606f404551d99a1f880dcb23aaa19c8cf6588ee0056dfc3bb07857c5a32ce507b5ddacf5f5c678362d5bb6a687a993ad97ebdd7fe6318a25e
7
+ data.tar.gz: f66481fb1dcb2d9ee130936667ce25679ab94bb38785c659f0fc07a160fc05b1131945becb231e0058bf67494f8e8f01c0aeb6989f321f2ab257d16abdbc5ad5
data/.travis.yml CHANGED
@@ -3,7 +3,5 @@ rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - jruby-18mode # JRuby in 1.8 mode
7
6
  - jruby-19mode # JRuby in 1.9 mode
8
- - rbx-18mode
9
7
  - rbx-19mode
data/Gemfile CHANGED
@@ -5,10 +5,11 @@ group :test, :development do
5
5
  gem 'json'
6
6
  gem 'rspec'
7
7
  gem 'savon_spec'
8
- gem 'simplecov', :require => false
8
+ gem 'simplecov', require: false
9
9
  gem 'rake'
10
10
  gem 'guard'
11
11
  gem 'guard-rspec'
12
+ gem 'coveralls', require: false
12
13
  platforms :mri do
13
14
  # Temporary fix till hoe works with rbx in 1.9 mode
14
15
  gem 'hoe'
data/Gemfile.lock CHANGED
@@ -6,6 +6,13 @@ GEM
6
6
  nokogiri (>= 1.4.0)
7
7
  builder (3.1.4)
8
8
  coderay (1.0.9)
9
+ colorize (0.5.8)
10
+ coveralls (0.6.7)
11
+ colorize
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ thor
9
16
  diff-lcs (1.1.3)
10
17
  formatador (0.2.4)
11
18
  guard (1.7.0)
@@ -33,9 +40,10 @@ GEM
33
40
  lumberjack (1.0.3)
34
41
  metaclass (0.0.1)
35
42
  method_source (0.8.1)
43
+ mime-types (1.23)
36
44
  mocha (0.10.5)
37
45
  metaclass (~> 0.0.1)
38
- multi_json (1.2.0)
46
+ multi_json (1.7.2)
39
47
  nokogiri (1.5.6)
40
48
  nori (1.1.4)
41
49
  pry (0.9.12)
@@ -44,6 +52,8 @@ GEM
44
52
  slop (~> 3.4)
45
53
  rack (1.4.4)
46
54
  rake (0.9.2.2)
55
+ rest-client (1.6.7)
56
+ mime-types (>= 1.16)
47
57
  rspec (2.9.0)
48
58
  rspec-core (~> 2.9.0)
49
59
  rspec-expectations (~> 2.9.0)
@@ -64,10 +74,10 @@ GEM
64
74
  mocha (>= 0.9.8)
65
75
  rspec (>= 2.0.0)
66
76
  savon (>= 0.8.0)
67
- simplecov (0.6.1)
77
+ simplecov (0.7.1)
68
78
  multi_json (~> 1.0)
69
- simplecov-html (~> 0.5.3)
70
- simplecov-html (0.5.3)
79
+ simplecov-html (~> 0.7.1)
80
+ simplecov-html (0.7.1)
71
81
  slop (3.4.4)
72
82
  thor (0.18.1)
73
83
  wasabi (2.5.1)
@@ -78,6 +88,7 @@ PLATFORMS
78
88
  ruby
79
89
 
80
90
  DEPENDENCIES
91
+ coveralls
81
92
  guard
82
93
  guard-rspec
83
94
  hoe
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Profitbricks [![Build Status](https://secure.travis-ci.org/dsander/profitbricks.png?branch=master)](http://travis-ci.org/dsander/profitbricks)
1
+ # Profitbricks [![Build Status](https://secure.travis-ci.org/dsander/profitbricks.png?branch=master)](http://travis-ci.org/dsander/profitbricks) [![Coverage Status](https://coveralls.io/repos/dsander/profitbricks/badge.png?branch=master)](https://coveralls.io/r/dsander/profitbricks)
2
2
 
3
3
  * http://github.com/dsander/profitbricks
4
4
  * http://rubydoc.info/github/dsander/profitbricks/master/frames
data/lib/profitbricks.rb CHANGED
@@ -13,7 +13,7 @@ require 'profitbricks/firewall'
13
13
  require 'profitbricks/rule'
14
14
 
15
15
  module Profitbricks
16
- VERSION = '0.9.8'
16
+ VERSION = '0.9.9'
17
17
  end
18
18
 
19
19
  PB = Profitbricks
@@ -28,7 +28,7 @@ module Profitbricks
28
28
  # @return [Boolean] true on success, false otherwise
29
29
  def update(options = {})
30
30
  return false if options.empty?
31
- raise ArgumentError.new(":ram has to be at least 256MiB and a multiple of it") if options[:ram] < 256 or (options[:ram] % 256) > 0
31
+ raise ArgumentError.new(":ram has to be at least 256MiB and a multiple of it") if options[:ram] and (options[:ram] < 256 or (options[:ram] % 256) > 0)
32
32
  raise ArgumentError.new(":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'") if options[:availability_zone] and !['AUTO', 'ZONE_1', 'ZONE_2'].include? options[:availability_zone]
33
33
  raise ArgumentError.new(":os_type has to be either 'WINDOWS' or 'OTHER'") if options[:os_type] and !['WINDOWS', 'OTHER'].include? options[:os_type]
34
34
  xml = "<arg0><serverId>#{self.id}</serverId>"
@@ -76,7 +76,7 @@ module Profitbricks
76
76
  # @option options [String] :os_type Sets the OS type of the server. (WINDOWS, OTHER) If left empty, the server will inherit the OS Type of its selected boot image / storage.
77
77
  # @return [Server] The created virtual server
78
78
  def create(options = {})
79
- raise ArgumentError.new("You must provide :cores and :ram") if options[:ram].nil? and options[:cores].nil?
79
+ raise ArgumentError.new("You must provide :cores and :ram") if options[:ram].nil? or options[:cores].nil?
80
80
  raise ArgumentError.new(":ram has to be at least 256MiB and a multiple of it") if options[:ram].to_i < 256 or (options[:ram].to_i % 256) > 0
81
81
  raise ArgumentError.new(":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'") if options[:availability_zone] and !['AUTO', 'ZONE_1', 'ZONE_2'].include? options[:availability_zone]
82
82
  raise ArgumentError.new(":os_type has to be either 'WINDOWS' or 'OTHER'") if options[:os_type] and !['WINDOWS', 'OTHER'].include? options[:os_type]
data/profitbricks.gemspec CHANGED
@@ -2,38 +2,38 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "profitbricks"
5
- s.version = "0.9.2.20130121213328"
5
+ s.version = "0.9.8.20130501204252"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Dominik Sander"]
9
- s.date = "2013-01-21"
9
+ s.date = "2013-05-01"
10
10
  s.description = "A Ruby client for the ProfitBricks API."
11
11
  s.email = ["git@dsander.de"]
12
12
  s.executables = ["profitbricks"]
13
- s.extra_rdoc_files = ["Manifest.txt"]
13
+ s.extra_rdoc_files = ["CHANGELOG.md", "Manifest.txt", "README.md"]
14
14
  s.files = [".autotest", ".rspec", ".travis.yml", "CHANGELOG.md", "Gemfile", "Gemfile.lock", "Manifest.txt", "README.md", "Rakefile", "bin/profitbricks", "examples/create_datacenter.rb", "lib/profitbricks.rb", "lib/profitbricks/cli.rb", "lib/profitbricks/config.rb", "lib/profitbricks/data_center.rb", "lib/profitbricks/extensions.rb", "lib/profitbricks/firewall.rb", "lib/profitbricks/image.rb", "lib/profitbricks/ip_block.rb", "lib/profitbricks/load_balancer.rb", "lib/profitbricks/model.rb", "lib/profitbricks/nic.rb", "lib/profitbricks/profitbricks.rb", "lib/profitbricks/rule.rb", "lib/profitbricks/server.rb", "lib/profitbricks/storage.rb", "profitbricks.gemspec", "spec/fixtures/activate_firewalls/success.json", "spec/fixtures/activate_firewalls/success.xml", "spec/fixtures/activate_load_balancing_on_servers/success.json", "spec/fixtures/activate_load_balancing_on_servers/success.xml", "spec/fixtures/add_firewall_rules_to_load_balancer/success.json", "spec/fixtures/add_firewall_rules_to_load_balancer/success.xml", "spec/fixtures/add_firewall_rules_to_nic/success.json", "spec/fixtures/add_firewall_rules_to_nic/success.xml", "spec/fixtures/add_public_ip_to_nic/success.json", "spec/fixtures/add_public_ip_to_nic/success.xml", "spec/fixtures/clear_data_center/success.json", "spec/fixtures/clear_data_center/success.xml", "spec/fixtures/connect_storage_to_server/success.json", "spec/fixtures/connect_storage_to_server/success.xml", "spec/fixtures/create_data_center/success.json", "spec/fixtures/create_data_center/success.xml", "spec/fixtures/create_load_balancer/success.json", "spec/fixtures/create_load_balancer/success.xml", "spec/fixtures/create_nic/success.json", "spec/fixtures/create_nic/success.xml", "spec/fixtures/create_server/minimal.json", "spec/fixtures/create_server/minimal.xml", "spec/fixtures/create_storage/success.json", "spec/fixtures/create_storage/success.xml", "spec/fixtures/deactivate_firewalls/success.json", "spec/fixtures/deactivate_firewalls/success.xml", "spec/fixtures/deactivate_load_balancing_on_servers/success.json", "spec/fixtures/deactivate_load_balancing_on_servers/success.xml", "spec/fixtures/delete_data_center/success.json", "spec/fixtures/delete_data_center/success.xml", "spec/fixtures/delete_firewalls/success.json", "spec/fixtures/delete_firewalls/success.xml", "spec/fixtures/delete_load_balancer/success.json", "spec/fixtures/delete_load_balancer/success.xml", "spec/fixtures/delete_nic/success.json", "spec/fixtures/delete_nic/success.xml", "spec/fixtures/delete_server/success.json", "spec/fixtures/delete_server/success.xml", "spec/fixtures/delete_storage/failture.json", "spec/fixtures/delete_storage/failture.xml", "spec/fixtures/delete_storage/success.json", "spec/fixtures/delete_storage/success.xml", "spec/fixtures/deregister_servers_on_load_balancer/success.json", "spec/fixtures/deregister_servers_on_load_balancer/success.xml", "spec/fixtures/disconnect_storage_from_server/failture.json", "spec/fixtures/disconnect_storage_from_server/failture.xml", "spec/fixtures/disconnect_storage_from_server/success.json", "spec/fixtures/disconnect_storage_from_server/success.xml", "spec/fixtures/get_all_data_centers/empty.json", "spec/fixtures/get_all_data_centers/empty.xml", "spec/fixtures/get_all_data_centers/test_datacenter.json", "spec/fixtures/get_all_data_centers/test_datacenter.xml", "spec/fixtures/get_all_images/success.json", "spec/fixtures/get_all_images/success.xml", "spec/fixtures/get_all_public_ip_blocks/success.json", "spec/fixtures/get_all_public_ip_blocks/success.xml", "spec/fixtures/get_data_center/create.json", "spec/fixtures/get_data_center/create.xml", "spec/fixtures/get_data_center/firewall.json", "spec/fixtures/get_data_center/firewall.xml", "spec/fixtures/get_data_center/two_servers_with_storage.json", "spec/fixtures/get_data_center/two_servers_with_storage.xml", "spec/fixtures/get_data_center_state/in_process.json", "spec/fixtures/get_data_center_state/in_process.xml", "spec/fixtures/get_data_center_state/success.json", "spec/fixtures/get_data_center_state/success.xml", "spec/fixtures/get_firewall/success.json", "spec/fixtures/get_firewall/success.xml", "spec/fixtures/get_image/success.json", "spec/fixtures/get_image/success.xml", "spec/fixtures/get_load_balancer/success.json", "spec/fixtures/get_load_balancer/success.xml", "spec/fixtures/get_nic/success.json", "spec/fixtures/get_nic/success.xml", "spec/fixtures/get_nic/two_ips.json", "spec/fixtures/get_nic/two_ips.xml", "spec/fixtures/get_server/after_create.json", "spec/fixtures/get_server/after_create.xml", "spec/fixtures/get_server/connected_storage.json", "spec/fixtures/get_server/connected_storage.xml", "spec/fixtures/get_storage/success.json", "spec/fixtures/get_storage/success.xml", "spec/fixtures/reboot_server/success.json", "spec/fixtures/reboot_server/success.xml", "spec/fixtures/register_servers_on_load_balancer/success.json", "spec/fixtures/register_servers_on_load_balancer/success.xml", "spec/fixtures/release_public_ip_block/success.json", "spec/fixtures/release_public_ip_block/success.xml", "spec/fixtures/remove_firewall_rules/success.json", "spec/fixtures/remove_firewall_rules/success.xml", "spec/fixtures/remove_public_ip_from_nic/success.json", "spec/fixtures/remove_public_ip_from_nic/success.xml", "spec/fixtures/reserve_public_ip_block/success.json", "spec/fixtures/reserve_public_ip_block/success.xml", "spec/fixtures/set_image_os_type/success.json", "spec/fixtures/set_image_os_type/success.xml", "spec/fixtures/set_internet_access/success.json", "spec/fixtures/set_internet_access/success.xml", "spec/fixtures/update_data_center/success.json", "spec/fixtures/update_data_center/success.xml", "spec/fixtures/update_load_balancer/success.json", "spec/fixtures/update_load_balancer/success.xml", "spec/fixtures/update_nic/success.json", "spec/fixtures/update_nic/success.xml", "spec/fixtures/update_server/basic.json", "spec/fixtures/update_server/basic.xml", "spec/fixtures/update_storage/success.json", "spec/fixtures/update_storage/success.xml", "spec/profitbricks/cli_spec.rb", "spec/profitbricks/data_center_spec.rb", "spec/profitbricks/firewall_spec.rb", "spec/profitbricks/image_spec.rb", "spec/profitbricks/ip_block_spec.rb", "spec/profitbricks/load_balancer_spec.rb", "spec/profitbricks/model_spec.rb", "spec/profitbricks/nic_spec.rb", "spec/profitbricks/server_spec.rb", "spec/profitbricks/storage_spec.rb", "spec/spec_helper.rb", ".gemtest"]
15
15
  s.homepage = "http://github.com/dsander/profitbricks"
16
16
  s.rdoc_options = ["--main", "README.md"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = "profitbricks"
19
- s.rubygems_version = "1.8.24"
19
+ s.rubygems_version = "2.0.0"
20
20
  s.summary = "A Ruby client for the ProfitBricks API."
21
21
 
22
22
  if s.respond_to? :specification_version then
23
- s.specification_version = 3
23
+ s.specification_version = 4
24
24
 
25
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
26
  s.add_runtime_dependency(%q<savon>, ["= 1.2.0"])
27
- s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
28
- s.add_development_dependency(%q<hoe>, ["~> 3.4"])
27
+ s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
28
+ s.add_development_dependency(%q<hoe>, ["~> 3.6"])
29
29
  else
30
30
  s.add_dependency(%q<savon>, ["= 1.2.0"])
31
- s.add_dependency(%q<rdoc>, ["~> 3.10"])
32
- s.add_dependency(%q<hoe>, ["~> 3.4"])
31
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
32
+ s.add_dependency(%q<hoe>, ["~> 3.6"])
33
33
  end
34
34
  else
35
35
  s.add_dependency(%q<savon>, ["= 1.2.0"])
36
- s.add_dependency(%q<rdoc>, ["~> 3.10"])
37
- s.add_dependency(%q<hoe>, ["~> 3.4"])
36
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
37
+ s.add_dependency(%q<hoe>, ["~> 3.6"])
38
38
  end
39
39
  end
@@ -3,6 +3,76 @@ require 'spec_helper'
3
3
  describe Profitbricks::Server do
4
4
  include Savon::Spec::Macros
5
5
 
6
+ describe "enforcing required arguments" do
7
+ describe "on create" do
8
+ it "should require :cores and :ram" do
9
+ expect { Server.create(:cores => 1) }.to raise_error(ArgumentError, "You must provide :cores and :ram")
10
+ expect { Server.create(:ram => 256) }.to raise_error(ArgumentError, "You must provide :cores and :ram")
11
+ expect { Server.create(:ram => 256, :cores => 1) }.not_to raise_error(ArgumentError, "You must provide :cores and :ram")
12
+ end
13
+
14
+ it "should require :ram to be a multiple of 256" do
15
+ expect { Server.create(:ram => 100, :cores => 1) }.to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
16
+ expect { Server.create(:ram => 280, :cores => 1) }.to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
17
+ expect { Server.create(:ram => 256, :cores => 1) }.not_to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
18
+ end
19
+
20
+ it "should require that the availability_zone is either 'AUTO', 'ZONE_1', or 'ZONE_2'" do
21
+ expect { Server.create(:ram => 256, :cores => 1, :availability_zone => 'FAIL') }.to
22
+ raise_error(ArgumentError, ":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'")
23
+
24
+ ['AUTO', 'ZONE_1', 'ZONE_2'].each do |zone|
25
+ expect { Server.create(:ram => 256, :cores => 1, :availability_zone => zone) }.not_to
26
+ raise_error(ArgumentError, ":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'")
27
+ end
28
+ end
29
+
30
+ it "should require that :os_type is either 'WINDOWS' or 'OTHER'" do
31
+ expect { Server.create(:ram => 256, :cores => 1, :os_type => 'FAIL') }.to
32
+ raise_error(ArgumentError, ":os_type has to be either 'WINDOWS' or 'OTHER'")
33
+
34
+ ['WINDOWS', 'OTHER'].each do |type|
35
+ expect { Server.create(:ram => 256, :cores => 1, :os_type => type) }.not_to
36
+ raise_error(ArgumentError, ":os_type has to be either 'WINDOWS' or 'OTHER'")
37
+ end
38
+ end
39
+ end
40
+ describe "on update" do
41
+ before(:each) do
42
+ savon.expects(:create_server).returns(:minimal)
43
+ savon.expects(:get_server).returns(:after_create)
44
+ @server = Server.create(:ram => 256, :cores => 1)
45
+ end
46
+
47
+ it "should require :ram to be a multiple of 256" do
48
+ expect { @server.update(:ram => 100, :cores => 1) }.to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
49
+ expect { @server.update(:ram => 280, :cores => 1) }.to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
50
+ expect { @server.update(:ram => 256, :cores => 1) }.not_to raise_error(ArgumentError, ":ram has to be at least 256MiB and a multiple of it")
51
+ end
52
+
53
+ it "should require that the availability_zone is either 'AUTO', 'ZONE_1', or 'ZONE_2'" do
54
+ expect { @server.update(:ram => 256, :cores => 1, :availability_zone => 'FAIL') }.to
55
+ raise_error(ArgumentError, ":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'")
56
+
57
+ ['AUTO', 'ZONE_1', 'ZONE_2'].each do |zone|
58
+ expect { @server.update(:ram => 256, :cores => 1, :availability_zone => zone) }.not_to
59
+ raise_error(ArgumentError, ":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'")
60
+ end
61
+ end
62
+
63
+ it "should require that :os_type is either 'WINDOWS' or 'OTHER'" do
64
+ expect { @server.update(:ram => 256, :cores => 1, :os_type => 'FAIL') }.to
65
+ raise_error(ArgumentError, ":os_type has to be either 'WINDOWS' or 'OTHER'")
66
+
67
+ ['WINDOWS', 'OTHER'].each do |type|
68
+ expect { @server.update(:ram => 256, :cores => 1, :os_type => type) }.not_to
69
+ raise_error(ArgumentError, ":os_type has to be either 'WINDOWS' or 'OTHER'")
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+
6
76
  it "should create a new server with minimal arguments" do
7
77
  savon.expects(:create_server).returns(:minimal)
8
78
  savon.expects(:get_server).returns(:after_create)
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,9 @@ if ENV['COVERAGE']
12
12
  SimpleCov.start
13
13
  end
14
14
 
15
+ require 'coveralls'
16
+ Coveralls.wear!
17
+
15
18
  Savon.configure do |config|
16
19
  config.log = false
17
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: profitbricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Sander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-24 00:00:00.000000000 Z
11
+ date: 2013-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon