brightbox-cli 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/Rakefile +0 -6
- data/lib/brightbox-cli/commands/accounts-accept-invite.rb +1 -0
- data/lib/brightbox-cli/commands/accounts-default.rb +1 -1
- data/lib/brightbox-cli/gli_global_hooks.rb +2 -1
- data/lib/brightbox-cli/version.rb +1 -1
- data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_is_not_authenticated/does_not_raise_an_error.yml +258 -193
- data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_may_access_one_account/updates_the_setting.yml +258 -195
- data/spec/cassettes/Firewall_policies/update/when_the_policy_does_not_exist/prints_error_to_STDERR.yml +153 -0
- data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/does_not_error.yml +229 -160
- data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/sets_up_the_config.yml +229 -162
- data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_change_the_default_client.yml +229 -162
- data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_error.yml +229 -162
- data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_this_as_the_default_client.yml +229 -162
- data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_up_the_config.yml +229 -162
- data/spec/commands/accounts/list_spec.rb +1 -1
- data/spec/commands/config/user_add_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- data/spec/support/vcr.rb +2 -2
- data/spec/unit/brightbox/bb_config/add_section_spec.rb +1 -1
- data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_policy/create_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/create_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/find_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +1 -1
- data/spec/unit/brightbox/server/destroy_spec.rb +1 -1
- data/spec/unit/brightbox/server/find_or_call_spec.rb +1 -1
- data/spec/unit/brightbox/server/shutdown_spec.rb +1 -1
- data/spec/unit/brightbox/server/start_spec.rb +1 -1
- data/spec/unit/brightbox/server/stop_spec.rb +1 -1
- data/spec/unit/brightbox/server/update_spec.rb +1 -1
- data/spec/unit/brightbox/server_group/find_spec.rb +1 -1
- metadata +5 -4
- data/lib/brightbox-cli/command_generator.rb +0 -53
data/spec/spec_helper.rb
CHANGED
@@ -29,6 +29,10 @@ RSpec.configure do |config|
|
|
29
29
|
config.include TokenHelpers
|
30
30
|
config.include PasswordPromptHelpers
|
31
31
|
|
32
|
+
if RUBY_VERSION >= "1.8.7"
|
33
|
+
config.filter_run_excluding :broken_1_8 => true
|
34
|
+
end
|
35
|
+
|
32
36
|
# For each test, point to the testing endpoint to make it safer and easier to
|
33
37
|
# record from dev endpoints. Devs can DNS api.brightbox.dev to their dev service
|
34
38
|
config.before do
|
data/spec/support/vcr.rb
CHANGED
@@ -11,8 +11,8 @@ VCR.configure do |vcr|
|
|
11
11
|
|
12
12
|
vcr.configure_rspec_metadata!
|
13
13
|
vcr.default_cassette_options = {
|
14
|
-
|
15
|
-
|
14
|
+
#:record => :new_episodes,
|
15
|
+
:record => :none,
|
16
16
|
:match_requests_on => [:method, :path, :body],
|
17
17
|
:update_content_length_header => true
|
18
18
|
}
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Brightbox::BBConfig do
|
4
4
|
|
5
5
|
describe "#add_section" do
|
6
|
-
context "when first and only client", :vcr do
|
6
|
+
context "when first and only client", :vcr, :broken_1_8 do
|
7
7
|
let(:config) { Brightbox::BBConfig.new }
|
8
8
|
let(:client_alias) { "dev" }
|
9
9
|
let(:client_id) { "app-12345" }
|
@@ -11,7 +11,7 @@ describe Brightbox::BBConfig do
|
|
11
11
|
let(:cli_id) { "cli-12345" }
|
12
12
|
let(:cli_secret) { "qy6xxnvy4o0tgv5" }
|
13
13
|
|
14
|
-
describe "#renew_tokens" do
|
14
|
+
describe "#renew_tokens", :broken_1_8 do
|
15
15
|
context "when using a user app with no tokens", :vcr do
|
16
16
|
before do
|
17
17
|
contents = <<-EOS
|
@@ -4,7 +4,7 @@ describe Brightbox::Server do
|
|
4
4
|
include ServerHelpers
|
5
5
|
|
6
6
|
describe "#destroy" do
|
7
|
-
context "when server exists", :vcr do
|
7
|
+
context "when server exists", :vcr, :broken_1_8 do
|
8
8
|
it "should work" do
|
9
9
|
#FIXME Spec never actually calls destroy, just checks output of creation!!
|
10
10
|
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Brightbox::Server do
|
4
4
|
include ServerHelpers
|
5
5
|
|
6
|
-
describe "#shutdown", :vcr do
|
6
|
+
describe "#shutdown", :vcr, :broken_1_8 do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
9
|
options = server_params("rspec_server_shutdown",type)
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Brightbox::Server do
|
4
4
|
include ServerHelpers
|
5
5
|
|
6
|
-
describe "#start", :vcr do
|
6
|
+
describe "#start", :vcr, :broken_1_8 do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
9
|
options = server_params("rspec_server_start",type)
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Brightbox::Server do
|
4
4
|
include ServerHelpers
|
5
5
|
|
6
|
-
describe "#stop", :vcr do
|
6
|
+
describe "#stop", :vcr, :broken_1_8 do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
9
|
options = server_params("rspec_server_stop",type)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
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-
|
12
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
@@ -236,7 +236,6 @@ files:
|
|
236
236
|
- lib/brightbox-cli/cloud_ips.rb
|
237
237
|
- lib/brightbox-cli/collaborating_account.rb
|
238
238
|
- lib/brightbox-cli/collaboration.rb
|
239
|
-
- lib/brightbox-cli/command_generator.rb
|
240
239
|
- lib/brightbox-cli/commands/accounts-accept-invite.rb
|
241
240
|
- lib/brightbox-cli/commands/accounts-default.rb
|
242
241
|
- lib/brightbox-cli/commands/accounts-list.rb
|
@@ -382,6 +381,7 @@ files:
|
|
382
381
|
- spec/cassettes/Brightbox_Server/_stop/should_work.yml
|
383
382
|
- spec/cassettes/Brightbox_Server/_update/when_passing_new_group_membership/should_update_with_group.yml
|
384
383
|
- spec/cassettes/Brightbox_ServerGroup/_find_all_/when_a_group_exists/list_server_groups.yml
|
384
|
+
- spec/cassettes/Firewall_policies/update/when_the_policy_does_not_exist/prints_error_to_STDERR.yml
|
385
385
|
- spec/cassettes/brightbox_accounts/list/_when_access_token_expired_/does_not_report_invalid_token_errors.yml
|
386
386
|
- spec/cassettes/brightbox_accounts/list/_when_both_tokens_expired_/does_not_report_invalid_token_errors.yml
|
387
387
|
- spec/cassettes/brightbox_accounts/list/_when_invalid_tokens_/does_not_report_invalid_token_errors.yml
|
@@ -610,7 +610,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
610
610
|
version: '0'
|
611
611
|
segments:
|
612
612
|
- 0
|
613
|
-
hash:
|
613
|
+
hash: -4345128981479648464
|
614
614
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
615
615
|
none: false
|
616
616
|
requirements:
|
@@ -658,6 +658,7 @@ test_files:
|
|
658
658
|
- spec/cassettes/Brightbox_Server/_stop/should_work.yml
|
659
659
|
- spec/cassettes/Brightbox_Server/_update/when_passing_new_group_membership/should_update_with_group.yml
|
660
660
|
- spec/cassettes/Brightbox_ServerGroup/_find_all_/when_a_group_exists/list_server_groups.yml
|
661
|
+
- spec/cassettes/Firewall_policies/update/when_the_policy_does_not_exist/prints_error_to_STDERR.yml
|
661
662
|
- spec/cassettes/brightbox_accounts/list/_when_access_token_expired_/does_not_report_invalid_token_errors.yml
|
662
663
|
- spec/cassettes/brightbox_accounts/list/_when_both_tokens_expired_/does_not_report_invalid_token_errors.yml
|
663
664
|
- spec/cassettes/brightbox_accounts/list/_when_invalid_tokens_/does_not_report_invalid_token_errors.yml
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Brightbox
|
2
|
-
class CommandGenerator
|
3
|
-
COMMAND_LIST = [
|
4
|
-
'brightbox-accounts',
|
5
|
-
'brightbox-cloudips',
|
6
|
-
'brightbox-config',
|
7
|
-
'brightbox-groups',
|
8
|
-
'brightbox-images',
|
9
|
-
'brightbox-lbs',
|
10
|
-
'brightbox-servers',
|
11
|
-
'brightbox-firewall-policies',
|
12
|
-
'brightbox-firewall-rules',
|
13
|
-
'brightbox-types',
|
14
|
-
'brightbox-users',
|
15
|
-
'brightbox-zones'
|
16
|
-
]
|
17
|
-
|
18
|
-
def initialize(brightbox_cli_path)
|
19
|
-
@brightbox_cli_path = brightbox_cli_path
|
20
|
-
COMMAND_LIST.each do |command|
|
21
|
-
File.open("#{cli_binary_path}/#{command}","w+") do |fl|
|
22
|
-
fl.write(command_template(command))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
def command_template(file_name)
|
29
|
-
cmd_name = file_name.sub("brightbox-", "")
|
30
|
-
brightbox_command =<<-EOF
|
31
|
-
#!/usr/bin/env ruby
|
32
|
-
|
33
|
-
begin
|
34
|
-
require "brightbox_cli"
|
35
|
-
require "brightbox-cli/legacy/args_adjuster"
|
36
|
-
rescue LoadError
|
37
|
-
brightbox_cli_path = File.expand_path('../../lib', __FILE__)
|
38
|
-
$:.unshift(brightbox_cli_path)
|
39
|
-
require "brightbox_cli"
|
40
|
-
require "brightbox-cli/legacy/args_adjuster"
|
41
|
-
end
|
42
|
-
|
43
|
-
Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("#{cmd_name}")
|
44
|
-
EOF
|
45
|
-
brightbox_command
|
46
|
-
end
|
47
|
-
|
48
|
-
def cli_binary_path
|
49
|
-
File.join(@brightbox_cli_path,"..","bin")
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|