cft_smartcloud 0.2.2 → 0.3.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.
- data/.gitignore +1 -0
- data/CHANGELOG +11 -0
- data/README.md +106 -0
- data/VERSION +1 -1
- data/bin/cft_smartcloud +33 -7
- data/bin/smartcloud +33 -7
- data/cft_smartcloud.gemspec +84 -20
- data/lib/config/config.yml +2 -0
- data/lib/curl_client.rb +42 -0
- data/lib/rest-client-1.6.6-master/.gitignore +6 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/README.rdoc +10 -1
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/Rakefile +0 -0
- data/lib/rest-client-1.6.6-master/VERSION +1 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/bin/restclient +5 -4
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/history.md +22 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/rest-client.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/rest_client.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/abstract_response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/exceptions.rb +0 -0
- data/lib/rest-client-1.6.6-master/lib/restclient/net_http_ext.rb +55 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/payload.rb +17 -2
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/raw_response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/request.rb +21 -19
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/resource.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient.rb +0 -0
- data/lib/rest-client-1.6.6-master/rest-client.gemspec +76 -0
- data/lib/rest-client-1.6.6-master/spec/abstract_response_spec.rb +85 -0
- data/lib/rest-client-1.6.6-master/spec/base.rb +16 -0
- data/lib/rest-client-1.6.6-master/spec/exceptions_spec.rb +98 -0
- data/lib/rest-client-1.6.6-master/spec/integration/certs/equifax.crt +19 -0
- data/lib/rest-client-1.6.6-master/spec/integration/certs/verisign.crt +14 -0
- data/lib/rest-client-1.6.6-master/spec/integration/request_spec.rb +25 -0
- data/lib/rest-client-1.6.6-master/spec/integration_spec.rb +38 -0
- data/lib/rest-client-1.6.6-master/spec/master_shake.jpg +0 -0
- data/lib/rest-client-1.6.6-master/spec/payload_spec.rb +234 -0
- data/lib/rest-client-1.6.6-master/spec/raw_response_spec.rb +17 -0
- data/lib/rest-client-1.6.6-master/spec/request2_spec.rb +40 -0
- data/lib/rest-client-1.6.6-master/spec/request_spec.rb +536 -0
- data/lib/rest-client-1.6.6-master/spec/resource_spec.rb +134 -0
- data/lib/rest-client-1.6.6-master/spec/response_spec.rb +169 -0
- data/lib/rest-client-1.6.6-master/spec/restclient_spec.rb +73 -0
- data/lib/slop-2.3.1/.gemtest +0 -0
- data/lib/slop-2.3.1/.gitignore +6 -0
- data/lib/slop-2.3.1/.yardopts +6 -0
- data/lib/slop-2.3.1/CHANGES.md +137 -0
- data/lib/slop-2.3.1/LICENSE +20 -0
- data/lib/slop-2.3.1/README.md +293 -0
- data/lib/slop-2.3.1/Rakefile +6 -0
- data/lib/slop-2.3.1/lib/slop.rb +1022 -0
- data/lib/slop-2.3.1/slop.gemspec +11 -0
- data/lib/slop-2.3.1/test/commands_test.rb +151 -0
- data/lib/slop-2.3.1/test/helper.rb +13 -0
- data/lib/slop-2.3.1/test/option_test.rb +198 -0
- data/lib/slop-2.3.1/test/slop_test.rb +574 -0
- data/lib/smartcloud.rb +186 -116
- data/lib/terminal-table-1.4.4/History.rdoc +53 -0
- data/lib/terminal-table-1.4.4/Manifest +24 -0
- data/lib/terminal-table-1.4.4/README.rdoc +240 -0
- data/lib/terminal-table-1.4.4/Rakefile +15 -0
- data/lib/terminal-table-1.4.4/Todo.rdoc +14 -0
- data/lib/terminal-table-1.4.4/examples/examples.rb +80 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/cell.rb +88 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/core_ext.rb +8 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/import.rb +4 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/row.rb +48 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/separator.rb +14 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/style.rb +61 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/table.rb +217 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/table_helper.rb +9 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/version.rb +6 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table.rb +27 -0
- data/lib/terminal-table-1.4.4/spec/cell_spec.rb +54 -0
- data/lib/terminal-table-1.4.4/spec/core_ext_spec.rb +18 -0
- data/lib/terminal-table-1.4.4/spec/import_spec.rb +11 -0
- data/lib/terminal-table-1.4.4/spec/spec.opts +1 -0
- data/lib/terminal-table-1.4.4/spec/spec_helper.rb +8 -0
- data/lib/terminal-table-1.4.4/spec/table_spec.rb +525 -0
- data/lib/terminal-table-1.4.4/tasks/docs.rake +13 -0
- data/lib/terminal-table-1.4.4/tasks/gemspec.rake +3 -0
- data/lib/terminal-table-1.4.4/tasks/spec.rake +25 -0
- data/lib/terminal-table-1.4.4/terminal-table.gemspec +30 -0
- data/responses/addresses +26 -0
- data/responses/addresses.blank +2 -0
- data/responses/instances +74 -0
- data/responses/keys +33 -0
- data/responses/locations +142 -0
- data/responses/offerings_image +3780 -0
- data/responses/storage +379 -0
- metadata +86 -22
- data/README.rdoc +0 -75
- data/lib/rest-client-1.6.3/VERSION +0 -1
- data/lib/rest-client-1.6.3/lib/restclient/net_http_ext.rb +0 -21
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
require File.join( File.dirname(File.expand_path(__FILE__)), 'base')
|
|
2
|
+
|
|
3
|
+
require 'webmock/rspec'
|
|
4
|
+
include WebMock
|
|
5
|
+
|
|
6
|
+
describe RestClient::Response do
|
|
7
|
+
before do
|
|
8
|
+
@net_http_res = mock('net http response', :to_hash => {"Status" => ["200 OK"]}, :code => 200)
|
|
9
|
+
@request = mock('http request', :user => nil, :password => nil)
|
|
10
|
+
@response = RestClient::Response.create('abc', @net_http_res, {})
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "behaves like string" do
|
|
14
|
+
@response.should.to_s == 'abc'
|
|
15
|
+
@response.to_str.should == 'abc'
|
|
16
|
+
@response.to_i.should == 200
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "accepts nil strings and sets it to empty for the case of HEAD" do
|
|
20
|
+
RestClient::Response.create(nil, @net_http_res, {}).should.to_s == ""
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "test headers and raw headers" do
|
|
24
|
+
@response.raw_headers["Status"][0].should == "200 OK"
|
|
25
|
+
@response.headers[:status].should == "200 OK"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "cookie processing" do
|
|
29
|
+
it "should correctly deal with one Set-Cookie header with one cookie inside" do
|
|
30
|
+
net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]})
|
|
31
|
+
response = RestClient::Response.create('abc', net_http_res, {})
|
|
32
|
+
response.headers[:set_cookie].should == ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]
|
|
33
|
+
response.cookies.should == { "main_page" => "main_page_no_rewrite" }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should correctly deal with multiple cookies [multiple Set-Cookie headers]" do
|
|
37
|
+
net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
|
|
38
|
+
response = RestClient::Response.create('abc', net_http_res, {})
|
|
39
|
+
response.headers[:set_cookie].should == ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]
|
|
40
|
+
response.cookies.should == {
|
|
41
|
+
"main_page" => "main_page_no_rewrite",
|
|
42
|
+
"remember_me" => "",
|
|
43
|
+
"user" => "somebody"
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should correctly deal with multiple cookies [one Set-Cookie header with multiple cookies]" do
|
|
48
|
+
net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT, remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT, user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
|
|
49
|
+
response = RestClient::Response.create('abc', net_http_res, {})
|
|
50
|
+
response.cookies.should == {
|
|
51
|
+
"main_page" => "main_page_no_rewrite",
|
|
52
|
+
"remember_me" => "",
|
|
53
|
+
"user" => "somebody"
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "exceptions processing" do
|
|
59
|
+
it "should return itself for normal codes" do
|
|
60
|
+
(200..206).each do |code|
|
|
61
|
+
net_http_res = mock('net http response', :code => '200')
|
|
62
|
+
response = RestClient::Response.create('abc', net_http_res, {})
|
|
63
|
+
response.return! @request
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "should throw an exception for other codes" do
|
|
68
|
+
RestClient::Exceptions::EXCEPTIONS_MAP.each_key do |code|
|
|
69
|
+
unless (200..207).include? code
|
|
70
|
+
net_http_res = mock('net http response', :code => code.to_i)
|
|
71
|
+
response = RestClient::Response.create('abc', net_http_res, {})
|
|
72
|
+
lambda { response.return!}.should raise_error
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe "redirection" do
|
|
80
|
+
|
|
81
|
+
it "follows a redirection when the request is a get" do
|
|
82
|
+
stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
|
|
83
|
+
stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
|
|
84
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "follows a redirection and keep the parameters" do
|
|
88
|
+
stub_request(:get, 'http://foo:bar@some/resource').with(:headers => {'Accept' => 'application/json'}).to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
|
|
89
|
+
stub_request(:get, 'http://foo:bar@new/resource').with(:headers => {'Accept' => 'application/json'}).to_return(:body => 'Foo')
|
|
90
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get, :user => 'foo', :password => 'bar', :headers => {:accept => :json}).body.should == 'Foo'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "follows a redirection and keep the cookies" do
|
|
94
|
+
stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Set-Cookie' => CGI::Cookie.new('Foo', 'Bar'), 'Location' => 'http://new/resource', })
|
|
95
|
+
stub_request(:get, 'http://new/resource').with(:headers => {'Cookie' => 'Foo=Bar'}).to_return(:body => 'Qux')
|
|
96
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Qux'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "doesn't follow a 301 when the request is a post" do
|
|
100
|
+
net_http_res = mock('net http response', :code => 301)
|
|
101
|
+
response = RestClient::Response.create('abc', net_http_res, {:method => :post})
|
|
102
|
+
lambda { response.return!(@request)}.should raise_error(RestClient::MovedPermanently)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "doesn't follow a 302 when the request is a post" do
|
|
106
|
+
net_http_res = mock('net http response', :code => 302)
|
|
107
|
+
response = RestClient::Response.create('abc', net_http_res, {:method => :post})
|
|
108
|
+
lambda { response.return!(@request)}.should raise_error(RestClient::Found)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "doesn't follow a 307 when the request is a post" do
|
|
112
|
+
net_http_res = mock('net http response', :code => 307)
|
|
113
|
+
response = RestClient::Response.create('abc', net_http_res, {:method => :post})
|
|
114
|
+
lambda { response.return!(@request)}.should raise_error(RestClient::TemporaryRedirect)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it "doesn't follow a redirection when the request is a put" do
|
|
118
|
+
net_http_res = mock('net http response', :code => 301)
|
|
119
|
+
response = RestClient::Response.create('abc', net_http_res, {:method => :put})
|
|
120
|
+
lambda { response.return!(@request)}.should raise_error(RestClient::MovedPermanently)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "follows a redirection when the request is a post and result is a 303" do
|
|
124
|
+
stub_request(:put, 'http://some/resource').to_return(:body => '', :status => 303, :headers => {'Location' => 'http://new/resource'})
|
|
125
|
+
stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
|
|
126
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :put).body.should == 'Foo'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it "follows a redirection when the request is a head" do
|
|
130
|
+
stub_request(:head, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
|
|
131
|
+
stub_request(:head, 'http://new/resource').to_return(:body => 'Foo')
|
|
132
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :head).body.should == 'Foo'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it "handles redirects with relative paths" do
|
|
136
|
+
stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index'})
|
|
137
|
+
stub_request(:get, 'http://some/index').to_return(:body => 'Foo')
|
|
138
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "handles redirects with relative path and query string" do
|
|
142
|
+
stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index?q=1'})
|
|
143
|
+
stub_request(:get, 'http://some/index?q=1').to_return(:body => 'Foo')
|
|
144
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it "follow a redirection when the request is a get and the response is in the 30x range" do
|
|
148
|
+
stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
|
|
149
|
+
stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
|
|
150
|
+
RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it "follows no more than 10 redirections before raising error" do
|
|
154
|
+
stub_request(:get, 'http://some/redirect-1').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
|
|
155
|
+
stub_request(:get, 'http://some/redirect-2').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
|
|
156
|
+
lambda { RestClient::Request.execute(:url => 'http://some/redirect-1', :method => :get) }.should raise_error(RestClient::MaxRedirectsReached)
|
|
157
|
+
WebMock.should have_requested(:get, 'http://some/redirect-2').times(10)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it "follows no more than max_redirects redirections, if specified" do
|
|
161
|
+
stub_request(:get, 'http://some/redirect-1').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
|
|
162
|
+
stub_request(:get, 'http://some/redirect-2').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
|
|
163
|
+
lambda { RestClient::Request.execute(:url => 'http://some/redirect-1', :method => :get, :max_redirects => 5) }.should raise_error(RestClient::MaxRedirectsReached)
|
|
164
|
+
WebMock.should have_requested(:get, 'http://some/redirect-2').times(5)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require File.join( File.dirname(File.expand_path(__FILE__)), 'base')
|
|
2
|
+
|
|
3
|
+
describe RestClient do
|
|
4
|
+
describe "API" do
|
|
5
|
+
it "GET" do
|
|
6
|
+
RestClient::Request.should_receive(:execute).with(:method => :get, :url => 'http://some/resource', :headers => {})
|
|
7
|
+
RestClient.get('http://some/resource')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "POST" do
|
|
11
|
+
RestClient::Request.should_receive(:execute).with(:method => :post, :url => 'http://some/resource', :payload => 'payload', :headers => {})
|
|
12
|
+
RestClient.post('http://some/resource', 'payload')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "PUT" do
|
|
16
|
+
RestClient::Request.should_receive(:execute).with(:method => :put, :url => 'http://some/resource', :payload => 'payload', :headers => {})
|
|
17
|
+
RestClient.put('http://some/resource', 'payload')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "PATCH" do
|
|
21
|
+
RestClient::Request.should_receive(:execute).with(:method => :patch, :url => 'http://some/resource', :payload => 'payload', :headers => {})
|
|
22
|
+
RestClient.patch('http://some/resource', 'payload')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "DELETE" do
|
|
26
|
+
RestClient::Request.should_receive(:execute).with(:method => :delete, :url => 'http://some/resource', :headers => {})
|
|
27
|
+
RestClient.delete('http://some/resource')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "HEAD" do
|
|
31
|
+
RestClient::Request.should_receive(:execute).with(:method => :head, :url => 'http://some/resource', :headers => {})
|
|
32
|
+
RestClient.head('http://some/resource')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "OPTIONS" do
|
|
36
|
+
RestClient::Request.should_receive(:execute).with(:method => :options, :url => 'http://some/resource', :headers => {})
|
|
37
|
+
RestClient.options('http://some/resource')
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe "logging" do
|
|
42
|
+
after do
|
|
43
|
+
RestClient.log = nil
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "uses << if the log is not a string" do
|
|
47
|
+
log = RestClient.log = []
|
|
48
|
+
log.should_receive(:<<).with('xyz')
|
|
49
|
+
RestClient.log << 'xyz'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "displays the log to stdout" do
|
|
53
|
+
RestClient.log = 'stdout'
|
|
54
|
+
STDOUT.should_receive(:puts).with('xyz')
|
|
55
|
+
RestClient.log << 'xyz'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "displays the log to stderr" do
|
|
59
|
+
RestClient.log = 'stderr'
|
|
60
|
+
STDERR.should_receive(:puts).with('xyz')
|
|
61
|
+
RestClient.log << 'xyz'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "append the log to the requested filename" do
|
|
65
|
+
RestClient.log = '/tmp/restclient.log'
|
|
66
|
+
f = mock('file handle')
|
|
67
|
+
File.should_receive(:open).with('/tmp/restclient.log', 'a').and_yield(f)
|
|
68
|
+
f.should_receive(:puts).with('xyz')
|
|
69
|
+
RestClient.log << 'xyz'
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
2.3.1 (2011-11-11)
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
* Return `nil` for any options using casting which don't expect arguments (#33)
|
|
5
|
+
* Fix parenthesis warning on 1.8.7 (@shevegen)
|
|
6
|
+
* Ensure long argument is a string before attempting to use `#[]` method on it
|
|
7
|
+
|
|
8
|
+
2.3.0 (2011-11-04)
|
|
9
|
+
------------------
|
|
10
|
+
|
|
11
|
+
* Allow flags to have suffixed `=` char for options which accept an argument
|
|
12
|
+
|
|
13
|
+
2.2.0 (2011-11-02)
|
|
14
|
+
------------------
|
|
15
|
+
|
|
16
|
+
* Support `bup.options` style optspec parsing
|
|
17
|
+
* http://apenwarr.ca/log/?m=201111
|
|
18
|
+
|
|
19
|
+
* Allow `:as` to accept a `count` value (Conrad Irwin):
|
|
20
|
+
|
|
21
|
+
`on :v, :verbose, :as => :count # -vv; opts[:verbose] #=> 2`
|
|
22
|
+
|
|
23
|
+
2.1.0 (2011-08-03)
|
|
24
|
+
------------------
|
|
25
|
+
|
|
26
|
+
* Added `Slop#missing` for returning a list of missing options parsed
|
|
27
|
+
* Allow `Slop#present?` to accept multiple arguments
|
|
28
|
+
* Added `:all_accept_arguments` to Slop configuration options, this saves
|
|
29
|
+
having to specify that every option takes an argument
|
|
30
|
+
* Added `Slop#to_struct` for building new classes from options
|
|
31
|
+
|
|
32
|
+
2.0.0 (2011-07-07)
|
|
33
|
+
------------------
|
|
34
|
+
|
|
35
|
+
* Deprecations:
|
|
36
|
+
* Removed `Slop::Options#to_hash` continue using `Slop#to_hash` directly.
|
|
37
|
+
This method also now returns symbols by default instead of strings. If
|
|
38
|
+
you want strings use `opts.to_hash(false)`
|
|
39
|
+
* `:multiple_switches` is now enabled by default, to parse `fbar` as the
|
|
40
|
+
option `f` with value `bar` you must disable `:multiple_switches`
|
|
41
|
+
* Removed `Slop::Options#to_help` and merged its contents into `Slop#help`
|
|
42
|
+
* Removed `lib/slop/options.rb` and merged `Slop::Options` into slop.rb
|
|
43
|
+
* Removed `lib/slop/option.rb` and merged `Slop::Option` into slop.rb
|
|
44
|
+
* These changes make Slop much easier to vendor in libraries
|
|
45
|
+
* `Slop::Option` now inherits from `Struct.new`
|
|
46
|
+
* Added Slop::Error subclassing from StandardError which all exception
|
|
47
|
+
classes should inherit from
|
|
48
|
+
* Added Slop::MissingOptionError and `:required` option to Slop::Option.
|
|
49
|
+
This exception is raised when a mandatory option is not used
|
|
50
|
+
|
|
51
|
+
1.9.1 (2011-06-16)
|
|
52
|
+
------------------
|
|
53
|
+
|
|
54
|
+
* Ensure optional items with no arguments still return true when searching
|
|
55
|
+
for presence
|
|
56
|
+
|
|
57
|
+
1.9.0 (2011-06-15)
|
|
58
|
+
------------------
|
|
59
|
+
|
|
60
|
+
* Add command completion and support for an error message when ambiguous
|
|
61
|
+
commands are used
|
|
62
|
+
* Add command aliases
|
|
63
|
+
* Fix: Ensure parsed elements are removed from original arguments when using
|
|
64
|
+
`:multiple_switches`
|
|
65
|
+
* Ensure anything after `--` is parsed as an argument and not option even
|
|
66
|
+
if prefixed with `/--?/`
|
|
67
|
+
* Performance improvements when making many calls to `Slop#option?` for
|
|
68
|
+
checking an options presence (Rob Gleeson)
|
|
69
|
+
* Ensure `execute` passes command arguments to the block
|
|
70
|
+
* Support for summary and description (Denis Defreyne)
|
|
71
|
+
|
|
72
|
+
1.8.0 (2011-06-12)
|
|
73
|
+
------------------
|
|
74
|
+
|
|
75
|
+
* Added `execute` method to Slop for commands. This block will be invoked
|
|
76
|
+
when a specific command is used. The Slop object will be yielded to the
|
|
77
|
+
block
|
|
78
|
+
* Allow passing a class name to `on` to be used as an `:as` option. ie:
|
|
79
|
+
`on :people, 'Some people', Array`
|
|
80
|
+
* Get smart with parsing options optparse style: `on '--name NAME'` and
|
|
81
|
+
`on 'password [OPTIONAL]'`
|
|
82
|
+
* Feature: `:arguments` setting to enable argument passing for all options
|
|
83
|
+
|
|
84
|
+
1.7.0 (2011-06-06)
|
|
85
|
+
------------------
|
|
86
|
+
|
|
87
|
+
* Feature: Autocreate (auto create options at parse time, making assumptions)
|
|
88
|
+
* Feature: When parsing options as arrays, push multiple arguments into a
|
|
89
|
+
single array
|
|
90
|
+
|
|
91
|
+
1.6.1 (2011-06-01)
|
|
92
|
+
------------------
|
|
93
|
+
|
|
94
|
+
* Fix tests and using a temporary Array for ARGV, fixes RubyGems Test issues
|
|
95
|
+
* General cleanup of code
|
|
96
|
+
|
|
97
|
+
1.6.0 (2011-05-18)
|
|
98
|
+
------------------
|
|
99
|
+
|
|
100
|
+
* Add `:ignore_case` to Slop options for case insensitive option matching
|
|
101
|
+
* Add `:on_noopts` for triggering an event when the arguments contain no
|
|
102
|
+
options
|
|
103
|
+
* Add `:unless` to Slop::Option for omitting execution of the Options block
|
|
104
|
+
when this object exists in the Array of items passed to Slop.new
|
|
105
|
+
* Bugfix: Do not parse negative integers as options. A valid option must
|
|
106
|
+
start with an alphabet character
|
|
107
|
+
* Bugfix: Allow a Range to accept a negative Integer at either end
|
|
108
|
+
|
|
109
|
+
1.5.5 (2011-05-03)
|
|
110
|
+
------------------
|
|
111
|
+
|
|
112
|
+
* Bugfix: only attempt to extract options prefixed with `-`
|
|
113
|
+
|
|
114
|
+
1.5.4 (2011-05-01)
|
|
115
|
+
------------------
|
|
116
|
+
|
|
117
|
+
* Bugfix: `parse!` should not remove items with the same value as items used
|
|
118
|
+
in option arguments. Fixes #22 (Utkarsh Kukreti)
|
|
119
|
+
|
|
120
|
+
1.5.3 (2011-04-22)
|
|
121
|
+
------------------
|
|
122
|
+
|
|
123
|
+
* Bugfix: Use integers when fetching array indexes, not strings
|
|
124
|
+
|
|
125
|
+
1.5.2 (2011-04-17)
|
|
126
|
+
------------------
|
|
127
|
+
|
|
128
|
+
* Bugfix: Ensure `ARGV` is empty when using the `on_empty` event
|
|
129
|
+
|
|
130
|
+
1.5.0 (2011-04-15)
|
|
131
|
+
------------------
|
|
132
|
+
|
|
133
|
+
* Add `Slop#get` as alias to `Slop#[]`
|
|
134
|
+
* Add `Slop#present?` as alias for `Slop#<option>?`
|
|
135
|
+
* Add `Option#count` for monitoring how many times an option is called
|
|
136
|
+
* Add `:io` for using a custom IO object when using the `:help` option
|
|
137
|
+
* Numerous performance tweaks
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Lee Jarvis
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|