razor-client 0.14.0 → 0.15.0

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.
Files changed (48) hide show
  1. data/NEWS.md +18 -0
  2. data/bin/razor +9 -4
  3. data/lib/razor/cli.rb +10 -0
  4. data/lib/razor/cli/document.rb +59 -0
  5. data/lib/razor/cli/format.rb +70 -20
  6. data/lib/razor/cli/navigate.rb +114 -25
  7. data/lib/razor/cli/parse.rb +79 -10
  8. data/lib/razor/cli/transforms.rb +39 -0
  9. data/lib/razor/cli/version.rb +46 -0
  10. data/lib/razor/cli/views.rb +25 -0
  11. data/lib/razor/cli/views.yaml +189 -0
  12. data/spec/cli/format_spec.rb +77 -0
  13. data/spec/cli/navigate_spec.rb +102 -2
  14. data/spec/cli/parse_spec.rb +20 -0
  15. data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_spaces.yml +966 -0
  16. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_--help_command_.yml +99 -0
  17. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_-h_command_.yml +99 -0
  18. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_--help_.yml +99 -0
  19. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_-h_.yml +99 -0
  20. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_help_.yml +99 -0
  21. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_help_command_.yml +99 -0
  22. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_preserve_that_across_navigation.yml +9 -42
  23. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_supply_that_to_the_API_service.yml +5 -5
  24. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_bad_JSON.yml +228 -0
  25. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_malformed_argument.yml +120 -0
  26. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_an_array_into_an_existing_array.yml +2006 -0
  27. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_as_an_array.yml +2006 -0
  28. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_into_an_existing_array.yml +2006 -0
  29. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml +234 -0
  30. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_fail_with_mixed_types_array_then_hash_.yml +228 -0
  31. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_fail_with_mixed_types_hash_then_array_.yml +164 -0
  32. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_no_parameters/should_fail_with_bad_JSON.yml +36 -0
  33. data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml +5 -5
  34. data/spec/spec_helper.rb +12 -1
  35. data/spec/testing.md +16 -0
  36. data/spec/version_spec.rb +8 -0
  37. metadata +74 -66
  38. data/.gitignore +0 -7
  39. data/.yardopts +0 -2
  40. data/Gemfile +0 -35
  41. data/Gemfile.lock +0 -53
  42. data/Rakefile +0 -37
  43. data/lib/razor/cli/navigate.yaml +0 -28
  44. data/razor-client.gemspec +0 -32
  45. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_a_single_item_path/.yml +0 -69
  46. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_an_invalid_path/.yml +0 -36
  47. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_no_path/.yml +0 -36
  48. data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/.yml +0 -36
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- config.yaml
2
- log/*
3
- pkg/
4
- /.yardoc
5
- /Gemfile.local*
6
- /coverage
7
- /.project
data/.yardopts DELETED
@@ -1,2 +0,0 @@
1
- --markup-provider=redcarpet
2
- --markup=markdown
data/Gemfile DELETED
@@ -1,35 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # mime-types is a dependency of rest-client. We need to explicitly depend
4
- # on it and pin its version to make sure this works with Ruby 1.8.7
5
- gem 'mime-types', '< 2.0'
6
- gem 'rest-client'
7
- gem 'terminal-table'
8
-
9
- group :doc do
10
- gem 'yard'
11
- gem 'kramdown'
12
- end
13
-
14
- # This group will be excluded by default in `torquebox archive`
15
- group :test do
16
- gem 'rack-test'
17
- gem 'rspec', '~> 2.13.0'
18
- gem 'rspec-core', '~> 2.13.1'
19
- gem 'rspec-expectations', '~> 2.13.0'
20
- gem 'rspec-mocks', '~> 2.13.1'
21
- gem 'simplecov'
22
- gem 'webmock'
23
- gem 'vcr'
24
- end
25
-
26
- group :development do
27
- gem 'rake'
28
- end
29
-
30
- # This allows you to create `Gemfile.local` and have it loaded automatically;
31
- # the purpose of this is to allow you to put additional development gems
32
- # somewhere convenient without having to constantly mess with this file.
33
- #
34
- # Gemfile.local is in the .gitignore file; do not check one in!
35
- eval(File.read(File.dirname(__FILE__) + '/Gemfile.local'), binding) rescue nil
@@ -1,53 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- addressable (2.3.3)
5
- crack (0.3.2)
6
- diff-lcs (1.2.4)
7
- kramdown (1.1.0)
8
- mime-types (1.24)
9
- multi_json (1.7.9)
10
- rack (1.5.2)
11
- rack-test (0.6.2)
12
- rack (>= 1.0)
13
- rake (10.1.0)
14
- rest-client (1.6.7)
15
- mime-types (>= 1.16)
16
- rspec (2.13.0)
17
- rspec-core (~> 2.13.0)
18
- rspec-expectations (~> 2.13.0)
19
- rspec-mocks (~> 2.13.0)
20
- rspec-core (2.13.1)
21
- rspec-expectations (2.13.0)
22
- diff-lcs (>= 1.1.3, < 2.0)
23
- rspec-mocks (2.13.1)
24
- simplecov (0.7.1)
25
- multi_json (~> 1.0)
26
- simplecov-html (~> 0.7.1)
27
- simplecov-html (0.7.1)
28
- terminal-table (1.4.5)
29
- vcr (2.5.0)
30
- webmock (1.9.3)
31
- addressable (>= 2.2.7)
32
- crack (>= 0.3.2)
33
- yard (0.8.7)
34
-
35
- PLATFORMS
36
- java
37
- ruby
38
-
39
- DEPENDENCIES
40
- kramdown
41
- mime-types (< 2.0)
42
- rack-test
43
- rake
44
- rest-client
45
- rspec (~> 2.13.0)
46
- rspec-core (~> 2.13.1)
47
- rspec-expectations (~> 2.13.0)
48
- rspec-mocks (~> 2.13.1)
49
- simplecov
50
- terminal-table
51
- vcr
52
- webmock
53
- yard
data/Rakefile DELETED
@@ -1,37 +0,0 @@
1
- require 'rake'
2
- require "bundler/gem_tasks"
3
-
4
- # Needed to make the client work on Ruby 1.8.7
5
- unless Kernel.respond_to?(:require_relative)
6
- module Kernel
7
- def require_relative(path)
8
- require File.join(File.dirname(caller[0]), path.to_str)
9
- end
10
- end
11
- end
12
-
13
- require_relative 'spec/vcr_library'
14
-
15
- namespace :bundler do
16
- task :setup do
17
- require 'bundler/setup'
18
- end
19
- end
20
-
21
- namespace :spec do
22
- require 'rspec/core'
23
- require 'rspec/core/rake_task'
24
-
25
- desc <<EOS
26
- Run all specs. Set VCR_RECORD to 'all' to rerecord and to 'new_episodes'
27
- to record new tests. Tapes are in #{VCR_LIBRARY}
28
- EOS
29
- RSpec::Core::RakeTask.new(:all => :"bundler:setup") do |t|
30
- t.pattern = 'spec/**/*_spec.rb'
31
- end
32
- end
33
-
34
- desc "Erase all VCR recordings"
35
- task :"vcr:erase" do
36
- erase_vcr_library
37
- end
@@ -1,28 +0,0 @@
1
- ---
2
-
3
- # This file helps Razor::CLI::Navigate with a few things by annotating the
4
- # API. Ultimately, this should be something the server provides. But until
5
- # we better understand what sort of annotation we need from the server,
6
- # we'll keep this with the client.
7
- #
8
- # Possible argument types are
9
- # - json: parse the argument value as a JSON document and use that
10
- # - boolean: if the argument has no value associated with it, or the value
11
- # is "true", convert to +true+; everything else gets converted
12
- # to +false+
13
- commands:
14
- create-broker:
15
- args:
16
- configuration: json
17
- create-tag:
18
- args:
19
- rule: json
20
- add-policy-tag:
21
- args:
22
- rule: json
23
- update-tag-rule:
24
- args:
25
- rule: json
26
- reboot-node:
27
- args:
28
- hard: boolean
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "razor-client"
7
- spec.version = "0.14.0"
8
- spec.authors = ["Puppet Labs"]
9
- spec.email = ["info@puppetlabs.com"]
10
- spec.description = "The client for the Razor server"
11
- spec.summary = "The client for everybody's favorite provisioning tool"
12
- spec.homepage = "https://github.com/puppetlabs/razor-client"
13
- spec.license = "ASL2"
14
-
15
- spec.files = `git ls-files`.split($/)
16
- spec.bindir = "bin"
17
- spec.executables = ['razor']
18
- spec.test_files = spec.files.grep(%r{^spec/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.required_ruby_version
22
-
23
- # mime-types is a dependency of rest-client. We need to explicitly depend
24
- # on it and pin its version to make sure the gem works with Ruby 1.8.7
25
- spec.add_dependency "mime-types", '< 2.0'
26
- spec.add_dependency "multi_json"
27
- spec.add_dependency "rest-client"
28
- spec.add_dependency "terminal-table"
29
-
30
- spec.add_development_dependency "bundler", "~> 1.3"
31
- spec.add_development_dependency "rake"
32
- end
@@ -1,69 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost:8080/api
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip, deflate
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - Apache-Coyote/1.1
23
- X-Content-Type-Options:
24
- - nosniff
25
- Content-Type:
26
- - application/json;charset=utf-8
27
- Content-Length:
28
- - '1566'
29
- Date:
30
- - Wed, 28 Aug 2013 21:46:05 GMT
31
- body:
32
- encoding: US-ASCII
33
- string: ! '{"commands":[{"name":"create-image","rel":"http://api.puppetlabs.com/razor/v1/commands/create-image","id":"http://localhost:8080/api/commands/create-image"},{"name":"delete-image","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-image","id":"http://localhost:8080/api/commands/delete-image"},{"name":"create-installer","rel":"http://api.puppetlabs.com/razor/v1/commands/create-installer","id":"http://localhost:8080/api/commands/create-installer"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"images","rel":"http://api.puppetlabs.com/razor/v1/collections/images","id":"http://localhost:8080/api/collections/images"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"}]}'
34
- http_version:
35
- recorded_at: Wed, 28 Aug 2013 21:46:05 GMT
36
- - request:
37
- method: get
38
- uri: http://localhost:8080/api/collections/tags
39
- body:
40
- encoding: US-ASCII
41
- string: ''
42
- headers:
43
- Accept:
44
- - application/json
45
- Accept-Encoding:
46
- - gzip, deflate
47
- User-Agent:
48
- - Ruby
49
- response:
50
- status:
51
- code: 200
52
- message: OK
53
- headers:
54
- Server:
55
- - Apache-Coyote/1.1
56
- X-Content-Type-Options:
57
- - nosniff
58
- Content-Type:
59
- - application/json;charset=utf-8
60
- Content-Length:
61
- - '2'
62
- Date:
63
- - Wed, 28 Aug 2013 21:46:05 GMT
64
- body:
65
- encoding: US-ASCII
66
- string: ! '[]'
67
- http_version:
68
- recorded_at: Wed, 28 Aug 2013 21:46:05 GMT
69
- recorded_with: VCR 2.5.0
@@ -1,36 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost:8080/api
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip, deflate
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - Apache-Coyote/1.1
23
- X-Content-Type-Options:
24
- - nosniff
25
- Content-Type:
26
- - application/json;charset=utf-8
27
- Content-Length:
28
- - '1566'
29
- Date:
30
- - Wed, 28 Aug 2013 21:46:05 GMT
31
- body:
32
- encoding: US-ASCII
33
- string: ! '{"commands":[{"name":"create-image","rel":"http://api.puppetlabs.com/razor/v1/commands/create-image","id":"http://localhost:8080/api/commands/create-image"},{"name":"delete-image","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-image","id":"http://localhost:8080/api/commands/delete-image"},{"name":"create-installer","rel":"http://api.puppetlabs.com/razor/v1/commands/create-installer","id":"http://localhost:8080/api/commands/create-installer"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"images","rel":"http://api.puppetlabs.com/razor/v1/collections/images","id":"http://localhost:8080/api/collections/images"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"}]}'
34
- http_version:
35
- recorded_at: Wed, 28 Aug 2013 21:46:05 GMT
36
- recorded_with: VCR 2.5.0
@@ -1,36 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost:8080/api
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip, deflate
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - Apache-Coyote/1.1
23
- X-Content-Type-Options:
24
- - nosniff
25
- Content-Type:
26
- - application/json;charset=utf-8
27
- Content-Length:
28
- - '1566'
29
- Date:
30
- - Wed, 28 Aug 2013 21:46:05 GMT
31
- body:
32
- encoding: US-ASCII
33
- string: ! '{"commands":[{"name":"create-image","rel":"http://api.puppetlabs.com/razor/v1/commands/create-image","id":"http://localhost:8080/api/commands/create-image"},{"name":"delete-image","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-image","id":"http://localhost:8080/api/commands/delete-image"},{"name":"create-installer","rel":"http://api.puppetlabs.com/razor/v1/commands/create-installer","id":"http://localhost:8080/api/commands/create-installer"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"images","rel":"http://api.puppetlabs.com/razor/v1/collections/images","id":"http://localhost:8080/api/collections/images"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"}]}'
34
- http_version:
35
- recorded_at: Wed, 28 Aug 2013 21:46:05 GMT
36
- recorded_with: VCR 2.5.0
@@ -1,36 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost:8080/api
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip, deflate
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - Apache-Coyote/1.1
23
- X-Content-Type-Options:
24
- - nosniff
25
- Content-Type:
26
- - application/json;charset=utf-8
27
- Content-Length:
28
- - '1566'
29
- Date:
30
- - Wed, 28 Aug 2013 21:46:05 GMT
31
- body:
32
- encoding: US-ASCII
33
- string: ! '{"commands":[{"name":"create-image","rel":"http://api.puppetlabs.com/razor/v1/commands/create-image","id":"http://localhost:8080/api/commands/create-image"},{"name":"delete-image","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-image","id":"http://localhost:8080/api/commands/delete-image"},{"name":"create-installer","rel":"http://api.puppetlabs.com/razor/v1/commands/create-installer","id":"http://localhost:8080/api/commands/create-installer"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"images","rel":"http://api.puppetlabs.com/razor/v1/collections/images","id":"http://localhost:8080/api/collections/images"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"}]}'
34
- http_version:
35
- recorded_at: Wed, 28 Aug 2013 21:46:05 GMT
36
- recorded_with: VCR 2.5.0