esod-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/VERSION +1 -1
  2. data/command_line_options.rb +3 -6
  3. data/esod-client.gemspec +29 -27
  4. data/lib/esod_client/esod_client.rb +2 -2
  5. data/lib/rest-client-1.4.2/README.rdoc +243 -0
  6. data/lib/rest-client-1.4.2/Rakefile +60 -0
  7. data/lib/rest-client-1.4.2/VERSION +1 -0
  8. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/bin/restclient +0 -0
  9. data/lib/rest-client-1.4.2/history.md +54 -0
  10. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/rest_client.rb +0 -0
  11. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient.rb +77 -21
  12. data/lib/rest-client-1.4.2/lib/restclient/abstract_response.rb +87 -0
  13. data/lib/rest-client-1.4.2/lib/restclient/exceptions.rb +146 -0
  14. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient/net_http_ext.rb +0 -0
  15. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient/payload.rb +15 -12
  16. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient/raw_response.rb +7 -6
  17. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient/request.rb +61 -89
  18. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/lib/restclient/resource.rb +11 -10
  19. data/lib/rest-client-1.4.2/lib/restclient/response.rb +46 -0
  20. data/lib/{rest-client-1.2.0/spec/mixin/response_spec.rb → rest-client-1.4.2/spec/abstract_response_spec.rb} +3 -12
  21. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/base.rb +0 -0
  22. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/exceptions_spec.rb +23 -9
  23. data/lib/rest-client-1.4.2/spec/integration_spec.rb +38 -0
  24. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/master_shake.jpg +0 -0
  25. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/payload_spec.rb +20 -6
  26. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/raw_response_spec.rb +1 -1
  27. data/lib/rest-client-1.4.2/spec/request_spec.rb +518 -0
  28. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/resource_spec.rb +24 -0
  29. data/lib/rest-client-1.4.2/spec/response_spec.rb +130 -0
  30. data/lib/{rest-client-1.2.0 → rest-client-1.4.2}/spec/restclient_spec.rb +21 -11
  31. metadata +38 -29
  32. data/lib/rest-client-1.2.0/README.rdoc +0 -102
  33. data/lib/rest-client-1.2.0/Rakefile +0 -57
  34. data/lib/rest-client-1.2.0/VERSION +0 -1
  35. data/lib/rest-client-1.2.0/lib/restclient/exceptions.rb +0 -89
  36. data/lib/rest-client-1.2.0/lib/restclient/mixin/response.rb +0 -48
  37. data/lib/rest-client-1.2.0/lib/restclient/response.rb +0 -20
  38. data/lib/rest-client-1.2.0/spec/request_spec.rb +0 -521
  39. data/lib/rest-client-1.2.0/spec/response_spec.rb +0 -21
@@ -1,5 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/base'
2
2
 
3
+ require 'webmock/rspec'
4
+ include WebMock
5
+
3
6
  describe RestClient::Resource do
4
7
  before do
5
8
  @resource = RestClient::Resource.new('http://some/resource', :user => 'jane', :password => 'mypass', :headers => { 'X-Something' => '1'})
@@ -72,4 +75,25 @@ describe RestClient::Resource do
72
75
  it "prints its url with to_s" do
73
76
  RestClient::Resource.new('x').to_s.should == 'x'
74
77
  end
78
+
79
+ describe 'block' do
80
+ it 'can use block when creating the resource' do
81
+ stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
82
+ resource = RestClient::Resource.new('www.example.com'){|response| 'foo'}
83
+ resource.get.should == 'foo'
84
+ end
85
+
86
+ it 'can use block when executing the resource' do
87
+ stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
88
+ resource = RestClient::Resource.new('www.example.com')
89
+ resource.get{|response| 'foo'}.should == 'foo'
90
+ end
91
+
92
+ it 'execution block override resource block' do
93
+ stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
94
+ resource = RestClient::Resource.new('www.example.com'){|response| 'foo'}
95
+ resource.get{|response| 'bar'}.should == 'bar'
96
+ end
97
+
98
+ end
75
99
  end
@@ -0,0 +1,130 @@
1
+ require File.dirname(__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"]})
9
+ @response = RestClient::Response.new('abc', @net_http_res, {})
10
+ end
11
+
12
+ it "behaves like string" do
13
+ @response.should.to_s == 'abc'
14
+ end
15
+
16
+ it "accepts nil strings and sets it to empty for the case of HEAD" do
17
+ RestClient::Response.new(nil, @net_http_res, {}).should.to_s == ""
18
+ end
19
+
20
+ it "test headers and raw headers" do
21
+ @response.raw_headers["Status"][0].should == "200 OK"
22
+ @response.headers[:status].should == "200 OK"
23
+ end
24
+
25
+ describe "cookie processing" do
26
+ it "should correctly deal with one Set-Cookie header with one cookie inside" do
27
+ 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"]})
28
+ response = RestClient::Response.new('abc', net_http_res, {})
29
+ response.headers[:set_cookie].should == ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]
30
+ response.cookies.should == { "main_page" => "main_page_no_rewrite" }
31
+ end
32
+
33
+ it "should correctly deal with multiple cookies [multiple Set-Cookie headers]" do
34
+ 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"]})
35
+ response = RestClient::Response.new('abc', net_http_res, {})
36
+ 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"]
37
+ response.cookies.should == {
38
+ "main_page" => "main_page_no_rewrite",
39
+ "remember_me" => "",
40
+ "user" => "somebody"
41
+ }
42
+ end
43
+
44
+ it "should correctly deal with multiple cookies [one Set-Cookie header with multiple cookies]" do
45
+ 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"]})
46
+ response = RestClient::Response.new('abc', net_http_res, {})
47
+ response.cookies.should == {
48
+ "main_page" => "main_page_no_rewrite",
49
+ "remember_me" => "",
50
+ "user" => "somebody"
51
+ }
52
+ end
53
+ end
54
+
55
+ describe "exceptions processing" do
56
+ it "should return itself for normal codes" do
57
+ (200..206).each do |code|
58
+ net_http_res = mock('net http response', :code => '200')
59
+ response = RestClient::Response.new('abc', net_http_res, {})
60
+ response.return!
61
+ end
62
+ end
63
+
64
+ it "should throw an exception for other codes" do
65
+ RestClient::Exceptions::EXCEPTIONS_MAP.each_key do |code|
66
+ unless (200..206).include? code
67
+ net_http_res = mock('net http response', :code => code.to_i)
68
+ response = RestClient::Response.new('abc', net_http_res, {})
69
+ lambda { response.return!}.should raise_error
70
+ end
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+ describe "redirection" do
77
+
78
+ it "follows a redirection when the request is a get" do
79
+ stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
80
+ stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
81
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
82
+ end
83
+
84
+ it "doesn't follow a redirection when the request is a post" do
85
+ net_http_res = mock('net http response', :code => 301)
86
+ response = RestClient::Response.new('abc', net_http_res, {:method => :post})
87
+ lambda { response.return!}.should raise_error(RestClient::MovedPermanently)
88
+ end
89
+
90
+ it "doesn't follow a redirection when the request is a put" do
91
+ net_http_res = mock('net http response', :code => 301)
92
+ response = RestClient::Response.new('abc', net_http_res, {:method => :put})
93
+ lambda { response.return!}.should raise_error(RestClient::MovedPermanently)
94
+ end
95
+
96
+ it "follows a redirection when the request is a post and result is a 303" do
97
+ stub_request(:put, 'http://some/resource').to_return(:body => '', :status => 303, :headers => {'Location' => 'http://new/resource'})
98
+ stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
99
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :put).body.should == 'Foo'
100
+ end
101
+
102
+ it "follows a redirection when the request is a head" do
103
+ stub_request(:head, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
104
+ stub_request(:head, 'http://new/resource').to_return(:body => 'Foo')
105
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :head).body.should == 'Foo'
106
+ end
107
+
108
+ it "handles redirects with relative paths" do
109
+ stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index'})
110
+ stub_request(:get, 'http://some/index').to_return(:body => 'Foo')
111
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
112
+ end
113
+
114
+ it "handles redirects with relative path and query string" do
115
+ stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index?q=1'})
116
+ stub_request(:get, 'http://some/index?q=1').to_return(:body => 'Foo')
117
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
118
+ end
119
+
120
+ it "follow a redirection when the request is a get and the response is in the 30x range" do
121
+ stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
122
+ stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
123
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
124
+ end
125
+
126
+
127
+ end
128
+
129
+
130
+ end
@@ -33,21 +33,31 @@ describe RestClient do
33
33
  RestClient.log = nil
34
34
  end
35
35
 
36
- it "gets the log source from the RESTCLIENT_LOG environment variable" do
37
- ENV.stub!(:[]).with('RESTCLIENT_LOG').and_return('from env')
38
- RestClient.log = 'from class method'
39
- RestClient.log.should == 'from env'
36
+ it "uses << if the log is not a string" do
37
+ log = RestClient.log = []
38
+ log.should_receive(:<<).with('xyz')
39
+ RestClient.log << 'xyz'
40
40
  end
41
41
 
42
- it "sets a destination for log output, used if no environment variable is set" do
43
- ENV.stub!(:[]).with('RESTCLIENT_LOG').and_return(nil)
44
- RestClient.log = 'from class method'
45
- RestClient.log.should == 'from class method'
42
+ it "displays the log to stdout" do
43
+ RestClient.log = 'stdout'
44
+ STDOUT.should_receive(:puts).with('xyz')
45
+ RestClient.log << 'xyz'
46
46
  end
47
47
 
48
- it "returns nil (no logging) if neither are set (default)" do
49
- ENV.stub!(:[]).with('RESTCLIENT_LOG').and_return(nil)
50
- RestClient.log.should == nil
48
+ it "displays the log to stderr" do
49
+ RestClient.log = 'stderr'
50
+ STDERR.should_receive(:puts).with('xyz')
51
+ RestClient.log << 'xyz'
52
+ end
53
+
54
+ it "append the log to the requested filename" do
55
+ RestClient.log = '/tmp/restclient.log'
56
+ f = mock('file handle')
57
+ File.should_receive(:open).with('/tmp/restclient.log', 'a').and_yield(f)
58
+ f.should_receive(:puts).with('xyz')
59
+ RestClient.log << 'xyz'
51
60
  end
52
61
  end
62
+
53
63
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esod-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Yan Pritzker
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2010-01-13 00:00:00 -08:00
18
+ date: 2010-10-06 00:00:00 -07:00
14
19
  default_executable:
15
20
  dependencies: []
16
21
 
@@ -85,30 +90,32 @@ files:
85
90
  - lib/mime-types-1.16/setup.rb
86
91
  - lib/mime-types-1.16/test/test_mime_type.rb
87
92
  - lib/mime-types-1.16/test/test_mime_types.rb
88
- - lib/rest-client-1.2.0/README.rdoc
89
- - lib/rest-client-1.2.0/Rakefile
90
- - lib/rest-client-1.2.0/VERSION
91
- - lib/rest-client-1.2.0/bin/restclient
92
- - lib/rest-client-1.2.0/lib/rest_client.rb
93
- - lib/rest-client-1.2.0/lib/restclient.rb
94
- - lib/rest-client-1.2.0/lib/restclient/exceptions.rb
95
- - lib/rest-client-1.2.0/lib/restclient/mixin/response.rb
96
- - lib/rest-client-1.2.0/lib/restclient/net_http_ext.rb
97
- - lib/rest-client-1.2.0/lib/restclient/payload.rb
98
- - lib/rest-client-1.2.0/lib/restclient/raw_response.rb
99
- - lib/rest-client-1.2.0/lib/restclient/request.rb
100
- - lib/rest-client-1.2.0/lib/restclient/resource.rb
101
- - lib/rest-client-1.2.0/lib/restclient/response.rb
102
- - lib/rest-client-1.2.0/spec/base.rb
103
- - lib/rest-client-1.2.0/spec/exceptions_spec.rb
104
- - lib/rest-client-1.2.0/spec/master_shake.jpg
105
- - lib/rest-client-1.2.0/spec/mixin/response_spec.rb
106
- - lib/rest-client-1.2.0/spec/payload_spec.rb
107
- - lib/rest-client-1.2.0/spec/raw_response_spec.rb
108
- - lib/rest-client-1.2.0/spec/request_spec.rb
109
- - lib/rest-client-1.2.0/spec/resource_spec.rb
110
- - lib/rest-client-1.2.0/spec/response_spec.rb
111
- - lib/rest-client-1.2.0/spec/restclient_spec.rb
93
+ - lib/rest-client-1.4.2/README.rdoc
94
+ - lib/rest-client-1.4.2/Rakefile
95
+ - lib/rest-client-1.4.2/VERSION
96
+ - lib/rest-client-1.4.2/bin/restclient
97
+ - lib/rest-client-1.4.2/history.md
98
+ - lib/rest-client-1.4.2/lib/rest_client.rb
99
+ - lib/rest-client-1.4.2/lib/restclient.rb
100
+ - lib/rest-client-1.4.2/lib/restclient/abstract_response.rb
101
+ - lib/rest-client-1.4.2/lib/restclient/exceptions.rb
102
+ - lib/rest-client-1.4.2/lib/restclient/net_http_ext.rb
103
+ - lib/rest-client-1.4.2/lib/restclient/payload.rb
104
+ - lib/rest-client-1.4.2/lib/restclient/raw_response.rb
105
+ - lib/rest-client-1.4.2/lib/restclient/request.rb
106
+ - lib/rest-client-1.4.2/lib/restclient/resource.rb
107
+ - lib/rest-client-1.4.2/lib/restclient/response.rb
108
+ - lib/rest-client-1.4.2/spec/abstract_response_spec.rb
109
+ - lib/rest-client-1.4.2/spec/base.rb
110
+ - lib/rest-client-1.4.2/spec/exceptions_spec.rb
111
+ - lib/rest-client-1.4.2/spec/integration_spec.rb
112
+ - lib/rest-client-1.4.2/spec/master_shake.jpg
113
+ - lib/rest-client-1.4.2/spec/payload_spec.rb
114
+ - lib/rest-client-1.4.2/spec/raw_response_spec.rb
115
+ - lib/rest-client-1.4.2/spec/request_spec.rb
116
+ - lib/rest-client-1.4.2/spec/resource_spec.rb
117
+ - lib/rest-client-1.4.2/spec/response_spec.rb
118
+ - lib/rest-client-1.4.2/spec/restclient_spec.rb
112
119
  - lib/trollop.rb
113
120
  has_rdoc: true
114
121
  homepage: http://github.com/cohesive/esod-client
@@ -123,18 +130,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
130
  requirements:
124
131
  - - ">="
125
132
  - !ruby/object:Gem::Version
133
+ segments:
134
+ - 0
126
135
  version: "0"
127
- version:
128
136
  required_rubygems_version: !ruby/object:Gem::Requirement
129
137
  requirements:
130
138
  - - ">="
131
139
  - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
132
142
  version: "0"
133
- version:
134
143
  requirements: []
135
144
 
136
145
  rubyforge_project:
137
- rubygems_version: 1.3.5
146
+ rubygems_version: 1.3.6
138
147
  signing_key:
139
148
  specification_version: 3
140
149
  summary: ESOD REST Client
@@ -1,102 +0,0 @@
1
- = REST Client -- simple DSL for accessing REST resources
2
-
3
- A simple REST client for Ruby, inspired by the Sinatra's microframework style
4
- of specifying actions: get, put, post, delete.
5
-
6
- == Usage: Raw URL
7
-
8
- require 'rest_client'
9
-
10
- RestClient.get 'http://example.com/resource'
11
-
12
- RestClient.get 'https://user:password@example.com/private/resource'
13
-
14
- RestClient.post 'http://example.com/resource', :param1 => 'one', :nested => { :param2 => 'two' }
15
-
16
- RestClient.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type => :json, :accept => :json
17
-
18
- RestClient.delete 'http://example.com/resource'
19
-
20
- == Multipart
21
-
22
- Yeah, that's right! This does multipart sends for you!
23
-
24
- RestClient.post '/data', :myfile => File.new("/path/to/image.jpg")
25
-
26
- This does two things for you:
27
-
28
- * Auto-detects that you have a File value sends it as multipart
29
- * Auto-detects the mime of the file and sets it in the HEAD of the payload for each entry
30
-
31
- If you are sending params that do not contain a File object but the payload needs to be multipart then:
32
-
33
- RestClient.post '/data', :foo => 'bar', :multipart => true
34
-
35
- == Usage: ActiveResource-Style
36
-
37
- resource = RestClient::Resource.new 'http://example.com/resource'
38
- resource.get
39
-
40
- private_resource = RestClient::Resource.new 'https://example.com/private/resource', 'user', 'pass'
41
- private_resource.put File.read('pic.jpg'), :content_type => 'image/jpg'
42
-
43
- See RestClient::Resource module docs for details.
44
-
45
- == Usage: Resource Nesting
46
-
47
- site = RestClient::Resource.new('http://example.com')
48
- site['posts/1/comments'].post 'Good article.', :content_type => 'text/plain'
49
-
50
- See RestClient::Resource docs for details.
51
-
52
- == Lower-level access
53
-
54
- For cases not covered by the general API, you can use the RestClient::Resource class which provide a lower-level API, see the class' rdoc for more information.
55
-
56
- == Shell
57
-
58
- The restclient shell command gives an IRB session with RestClient already loaded:
59
-
60
- $ restclient
61
- >> RestClient.get 'http://example.com'
62
-
63
- Specify a URL argument for get/post/put/delete on that resource:
64
-
65
- $ restclient http://example.com
66
- >> put '/resource', 'data'
67
-
68
- Add a user and password for authenticated resources:
69
-
70
- $ restclient https://example.com user pass
71
- >> delete '/private/resource'
72
-
73
- Create ~/.restclient for named sessions:
74
-
75
- sinatra:
76
- url: http://localhost:4567
77
- rack:
78
- url: http://localhost:9292
79
- private_site:
80
- url: http://example.com
81
- username: user
82
- password: pass
83
-
84
- Then invoke:
85
-
86
- $ restclient private_site
87
-
88
- == Meta
89
-
90
- Written by Adam Wiggins, major modifications by Blake Mizerany, maintained by Archiloque
91
-
92
- Patches contributed by: Chris Anderson, Greg Borenstein, Ardekantur, Pedro Belo, Rafael Souza, Rick Olson, Aman Gupta, François Beausoleil and Nick Plante.
93
-
94
- Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
95
-
96
- Main page: http://github.com/archiloque/rest-client
97
-
98
- Rdoc: http://rdoc.info/projects/archiloque/rest-client
99
-
100
- Mailing list: rest.client@librelist.com (send a mail to subscribe).
101
-
102
- IRC: #rest-client at freenode
@@ -1,57 +0,0 @@
1
- require 'rake'
2
-
3
- require 'jeweler'
4
-
5
- Jeweler::Tasks.new do |s|
6
- s.name = "rest-client"
7
- s.description = "A simple REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete."
8
- s.summary = "Simple REST client for Ruby, inspired by microframework syntax for specifying actions."
9
- s.author = "Adam Wiggins"
10
- s.email = "rest.client@librelist.com"
11
- s.homepage = "http://github.com/archiloque/rest-client"
12
- s.rubyforge_project = "rest-client"
13
- s.has_rdoc = true
14
- s.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
15
- s.executables = %w(restclient)
16
- end
17
-
18
- Jeweler::RubyforgeTasks.new
19
-
20
- ############################
21
-
22
- require 'spec/rake/spectask'
23
-
24
- desc "Run all specs"
25
- Spec::Rake::SpecTask.new('spec') do |t|
26
- t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
27
- t.spec_files = FileList['spec/*_spec.rb']
28
- end
29
-
30
- desc "Print specdocs"
31
- Spec::Rake::SpecTask.new(:doc) do |t|
32
- t.spec_opts = ["--format", "specdoc", "--dry-run"]
33
- t.spec_files = FileList['spec/*_spec.rb']
34
- end
35
-
36
- desc "Run all examples with RCov"
37
- Spec::Rake::SpecTask.new('rcov') do |t|
38
- t.spec_files = FileList['spec/*_spec.rb']
39
- t.rcov = true
40
- t.rcov_opts = ['--exclude', 'examples']
41
- end
42
-
43
- task :default => :spec
44
-
45
- ############################
46
-
47
- require 'rake/rdoctask'
48
-
49
- Rake::RDocTask.new do |t|
50
- t.rdoc_dir = 'rdoc'
51
- t.title = "rest-client, fetch RESTful resources effortlessly"
52
- t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
53
- t.options << '--charset' << 'utf-8'
54
- t.rdoc_files.include('README.rdoc')
55
- t.rdoc_files.include('lib/*.rb')
56
- end
57
-