alexvollmer-httparty 0.1.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History +74 -0
- data/{License.txt → MIT-LICENSE} +0 -0
- data/{Manifest.txt → Manifest} +17 -16
- data/README +36 -0
- data/Rakefile +37 -5
- data/bin/httparty +103 -0
- data/examples/aaws.rb +3 -0
- data/examples/basic.rb +6 -0
- data/examples/delicious.rb +0 -1
- data/examples/rubyurl.rb +14 -0
- data/examples/twitter.rb +1 -1
- data/examples/whoismyrep.rb +2 -1
- data/httparty.gemspec +16 -14
- data/lib/core_extensions.rb +349 -0
- data/lib/httparty/exceptions.rb +4 -0
- data/lib/httparty/request.rb +76 -26
- data/lib/httparty/version.rb +1 -7
- data/lib/httparty.rb +49 -44
- data/lib/module_level_inheritable_attributes.rb +25 -0
- data/spec/as_buggery_spec.rb +16 -0
- data/spec/fixtures/delicious.xml +23 -0
- data/spec/fixtures/google.html +3 -0
- data/spec/fixtures/twitter.json +1 -0
- data/spec/fixtures/twitter.xml +403 -0
- data/spec/httparty/request_spec.rb +45 -35
- data/spec/httparty_spec.rb +77 -49
- data/spec/spec_helper.rb +22 -7
- data/website/index.html +2 -11
- metadata +42 -35
- data/History.txt +0 -32
- data/PostInstall.txt +0 -1
- data/README.txt +0 -66
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/tasks/deployment.rake +0 -43
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
data/spec/httparty_spec.rb
CHANGED
@@ -5,13 +5,20 @@ class Foo
|
|
5
5
|
base_uri 'api.foo.com/v1'
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class GRest
|
9
9
|
include HTTParty
|
10
|
-
base_uri
|
10
|
+
base_uri "grest.com"
|
11
|
+
default_params :one => 'two'
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
+
class HRest
|
15
|
+
include HTTParty
|
16
|
+
base_uri "hrest.com"
|
17
|
+
default_params :two => 'three'
|
18
|
+
end
|
14
19
|
|
20
|
+
describe HTTParty do
|
21
|
+
|
15
22
|
describe "base uri" do
|
16
23
|
before do
|
17
24
|
Foo.base_uri('api.foo.com/v1')
|
@@ -20,70 +27,72 @@ describe HTTParty do
|
|
20
27
|
it "should have reader" do
|
21
28
|
Foo.base_uri.should == 'http://api.foo.com/v1'
|
22
29
|
end
|
23
|
-
|
30
|
+
|
24
31
|
it 'should have writer' do
|
25
32
|
Foo.base_uri('http://api.foobar.com')
|
26
33
|
Foo.base_uri.should == 'http://api.foobar.com'
|
27
34
|
end
|
28
|
-
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#normalize_base_uri" do
|
29
38
|
it "should add http if not present for non ssl requests" do
|
30
|
-
|
31
|
-
|
39
|
+
uri = HTTParty.normalize_base_uri('api.foobar.com')
|
40
|
+
uri.should == 'http://api.foobar.com'
|
32
41
|
end
|
33
|
-
|
42
|
+
|
34
43
|
it "should add https if not present for ssl requests" do
|
35
|
-
|
36
|
-
|
44
|
+
uri = HTTParty.normalize_base_uri('api.foo.com/v1:443')
|
45
|
+
uri.should == 'https://api.foo.com/v1:443'
|
37
46
|
end
|
38
|
-
|
47
|
+
|
39
48
|
it "should not remove https for ssl requests" do
|
40
|
-
|
41
|
-
|
49
|
+
uri = HTTParty.normalize_base_uri('https://api.foo.com/v1:443')
|
50
|
+
uri.should == 'https://api.foo.com/v1:443'
|
42
51
|
end
|
43
52
|
end
|
44
|
-
|
53
|
+
|
45
54
|
describe "headers" do
|
46
55
|
it "should default to empty hash" do
|
47
56
|
Foo.headers.should == {}
|
48
57
|
end
|
49
|
-
|
58
|
+
|
50
59
|
it "should be able to be updated" do
|
51
60
|
init_headers = {:foo => 'bar', :baz => 'spax'}
|
52
61
|
Foo.headers init_headers
|
53
62
|
Foo.headers.should == init_headers
|
54
63
|
end
|
55
64
|
end
|
56
|
-
|
65
|
+
|
57
66
|
describe "default params" do
|
58
67
|
it "should default to empty hash" do
|
59
68
|
Foo.default_params.should == {}
|
60
69
|
end
|
61
|
-
|
70
|
+
|
62
71
|
it "should be able to be updated" do
|
63
72
|
new_defaults = {:foo => 'bar', :baz => 'spax'}
|
64
73
|
Foo.default_params new_defaults
|
65
74
|
Foo.default_params.should == new_defaults
|
66
75
|
end
|
67
76
|
end
|
68
|
-
|
77
|
+
|
69
78
|
describe "basic http authentication" do
|
70
79
|
it "should work" do
|
71
80
|
Foo.basic_auth 'foobar', 'secret'
|
72
81
|
Foo.default_options[:basic_auth].should == {:username => 'foobar', :password => 'secret'}
|
73
82
|
end
|
74
83
|
end
|
75
|
-
|
84
|
+
|
76
85
|
describe "format" do
|
77
86
|
it "should allow xml" do
|
78
87
|
Foo.format :xml
|
79
88
|
Foo.default_options[:format].should == :xml
|
80
89
|
end
|
81
|
-
|
90
|
+
|
82
91
|
it "should allow json" do
|
83
92
|
Foo.format :json
|
84
93
|
Foo.default_options[:format].should == :json
|
85
94
|
end
|
86
|
-
|
95
|
+
|
87
96
|
it 'should not allow funky format' do
|
88
97
|
lambda do
|
89
98
|
Foo.format :foobar
|
@@ -116,34 +125,53 @@ describe HTTParty do
|
|
116
125
|
Foo.put('/foo', :no_follow => true)
|
117
126
|
end.should raise_error(HTTParty::RedirectionTooDeep)
|
118
127
|
end
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "with multiple class definitions" do
|
131
|
+
it "should not run over each others options" do
|
132
|
+
HRest.default_options.should == {:base_uri => 'http://hrest.com', :default_params => {:two => 'three'}}
|
133
|
+
GRest.default_options.should == {:base_uri => 'http://grest.com', :default_params => {:one => 'two'}}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe "#get" do
|
138
|
+
it "should be able to get html" do
|
139
|
+
stub_http_response_with('google.html')
|
140
|
+
HTTParty.get('http://www.google.com').should == file_fixture('google.html')
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should be able parse response type json automatically" do
|
144
|
+
stub_http_response_with('twitter.json')
|
145
|
+
tweets = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
|
146
|
+
tweets.size.should == 20
|
147
|
+
tweets.first['user'].should == {
|
148
|
+
"name" => "Pyk",
|
149
|
+
"url" => nil,
|
150
|
+
"id" => "7694602",
|
151
|
+
"description" => nil,
|
152
|
+
"protected" => false,
|
153
|
+
"screen_name" => "Pyk",
|
154
|
+
"followers_count" => 1,
|
155
|
+
"location" => "Opera Plaza, California",
|
156
|
+
"profile_image_url" => "http://static.twitter.com/images/default_profile_normal.png"
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should be able parse response type xml automatically" do
|
161
|
+
stub_http_response_with('twitter.xml')
|
162
|
+
tweets = HTTParty.get('http://twitter.com/statuses/public_timeline.xml')
|
163
|
+
tweets['statuses'].size.should == 20
|
164
|
+
tweets['statuses'].first['user'].should == {
|
165
|
+
"name" => "Magic 8 Bot",
|
166
|
+
"url" => nil,
|
167
|
+
"id" => "17656026",
|
168
|
+
"description" => "ask me a question",
|
169
|
+
"protected" => "false",
|
170
|
+
"screen_name" => "magic8bot",
|
171
|
+
"followers_count" => "90",
|
172
|
+
"profile_image_url" => "http://s3.amazonaws.com/twitter_production/profile_images/65565851/8ball_large_normal.jpg",
|
173
|
+
"location" => nil
|
174
|
+
}
|
147
175
|
end
|
148
176
|
end
|
149
177
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'rspec'
|
3
|
+
require 'spec'
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'httparty')
|
5
|
+
|
6
|
+
def file_fixture(filename)
|
7
|
+
open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
|
7
8
|
end
|
8
9
|
|
9
|
-
|
10
|
+
def stub_http_response_with(filename)
|
11
|
+
format = filename.split('.').last.intern
|
12
|
+
data = file_fixture(filename)
|
13
|
+
http = Net::HTTP.new('localhost', 80)
|
14
|
+
|
15
|
+
response = Net::HTTPOK.new("1.1", 200, "Content for you")
|
16
|
+
response.stub!(:body).and_return(data)
|
17
|
+
http.stub!(:request).and_return(response)
|
18
|
+
|
19
|
+
http_request = HTTParty::Request.new(Net::HTTP::Get, '')
|
20
|
+
http_request.stub!(:get_response).and_return(response)
|
21
|
+
http_request.stub!(:format).and_return(format)
|
22
|
+
|
23
|
+
HTTParty::Request.should_receive(:new).and_return(http_request)
|
24
|
+
end
|
data/website/index.html
CHANGED
@@ -65,19 +65,10 @@ Twitter.new('username', 'password').post("It's an HTTParty and everyone is invit
|
|
65
65
|
</div>
|
66
66
|
|
67
67
|
<div id="footer">
|
68
|
-
<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a
|
68
|
+
<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a> |
|
69
|
+
<a href="http://orderedlist.com/">Hire Me at Ordered List</a></p>
|
69
70
|
</div>
|
70
71
|
</div>
|
71
|
-
|
72
|
-
<script type="text/javascript">
|
73
|
-
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
74
|
-
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
75
|
-
</script>
|
76
|
-
<script type="text/javascript">
|
77
|
-
var pageTracker = _gat._getTracker("UA-85301-19");
|
78
|
-
pageTracker._initData();
|
79
|
-
pageTracker._trackPageview();
|
80
|
-
</script>
|
81
72
|
|
82
73
|
</body>
|
83
74
|
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexvollmer-httparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -9,78 +9,85 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2009-01-05 00:00:00 -08:00
|
13
|
+
default_executable: httparty
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: json
|
17
17
|
version_requirement:
|
18
18
|
version_requirements: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: "
|
22
|
+
version: "1.1"
|
23
23
|
version:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
|
-
name:
|
25
|
+
name: echoe
|
26
26
|
version_requirement:
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
31
|
+
version: "0"
|
32
32
|
version:
|
33
33
|
description: Makes http fun! Also, makes consuming restful web services dead easy.
|
34
|
-
email:
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
email: nunemaker@gmail.com
|
35
|
+
executables:
|
36
|
+
- httparty
|
38
37
|
extensions: []
|
39
38
|
|
40
39
|
extra_rdoc_files:
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
40
|
+
- bin/httparty
|
41
|
+
- lib/core_extensions.rb
|
42
|
+
- lib/httparty/exceptions.rb
|
43
|
+
- lib/httparty/request.rb
|
44
|
+
- lib/httparty/version.rb
|
45
|
+
- lib/httparty.rb
|
46
|
+
- lib/module_level_inheritable_attributes.rb
|
47
|
+
- README
|
46
48
|
files:
|
47
|
-
-
|
48
|
-
- License.txt
|
49
|
-
- Manifest.txt
|
50
|
-
- PostInstall.txt
|
51
|
-
- README.txt
|
52
|
-
- Rakefile
|
53
|
-
- config/hoe.rb
|
54
|
-
- config/requirements.rb
|
49
|
+
- bin/httparty
|
55
50
|
- examples/aaws.rb
|
51
|
+
- examples/basic.rb
|
56
52
|
- examples/delicious.rb
|
57
53
|
- examples/google.rb
|
54
|
+
- examples/rubyurl.rb
|
58
55
|
- examples/twitter.rb
|
59
56
|
- examples/whoismyrep.rb
|
57
|
+
- History
|
60
58
|
- httparty.gemspec
|
61
|
-
- lib/
|
59
|
+
- lib/core_extensions.rb
|
60
|
+
- lib/httparty/exceptions.rb
|
62
61
|
- lib/httparty/request.rb
|
63
62
|
- lib/httparty/version.rb
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
63
|
+
- lib/httparty.rb
|
64
|
+
- lib/module_level_inheritable_attributes.rb
|
65
|
+
- Manifest
|
66
|
+
- MIT-LICENSE
|
67
|
+
- Rakefile
|
68
|
+
- README
|
68
69
|
- setup.rb
|
70
|
+
- spec/as_buggery_spec.rb
|
71
|
+
- spec/fixtures/delicious.xml
|
72
|
+
- spec/fixtures/google.html
|
73
|
+
- spec/fixtures/twitter.json
|
74
|
+
- spec/fixtures/twitter.xml
|
69
75
|
- spec/httparty/request_spec.rb
|
70
76
|
- spec/httparty_spec.rb
|
71
77
|
- spec/spec.opts
|
72
78
|
- spec/spec_helper.rb
|
73
|
-
- tasks/deployment.rake
|
74
|
-
- tasks/environment.rake
|
75
|
-
- tasks/website.rake
|
76
79
|
- website/css/common.css
|
77
80
|
- website/index.html
|
78
81
|
has_rdoc: true
|
79
82
|
homepage: http://httparty.rubyforge.org
|
80
83
|
post_install_message: When you HTTParty, you must party hard!
|
81
84
|
rdoc_options:
|
85
|
+
- --line-numbers
|
86
|
+
- --inline-source
|
87
|
+
- --title
|
88
|
+
- Httparty
|
82
89
|
- --main
|
83
|
-
- README
|
90
|
+
- README
|
84
91
|
require_paths:
|
85
92
|
- lib
|
86
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -93,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
100
|
requirements:
|
94
101
|
- - ">="
|
95
102
|
- !ruby/object:Gem::Version
|
96
|
-
version: "
|
103
|
+
version: "1.2"
|
97
104
|
version:
|
98
105
|
requirements: []
|
99
106
|
|
data/History.txt
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
== 0.1.5 2008-11-14
|
2
|
-
* 2 major enhancements
|
3
|
-
* Refactored send request method out into its own object.
|
4
|
-
* Added :html format if you just want to do that.
|
5
|
-
|
6
|
-
== 0.1.4 2008-11-08
|
7
|
-
* 3 major enhancements:
|
8
|
-
* Removed some cruft
|
9
|
-
* Added ability to follow redirects automatically and turn that off (Alex Vollmer)
|
10
|
-
|
11
|
-
== 0.1.3 2008-08-22
|
12
|
-
|
13
|
-
* 3 major enhancements:
|
14
|
-
* Added http_proxy key for setting proxy server and port (francxk@gmail.com)
|
15
|
-
* Now raises exception when http error occurs (francxk@gmail.com)
|
16
|
-
* Changed auto format detection from file extension to response content type (Jay Pignata)
|
17
|
-
|
18
|
-
== 0.1.2 2008-08-09
|
19
|
-
|
20
|
-
* 1 major enhancement:
|
21
|
-
* default_params were not being appended to query string if option[:query] was blank
|
22
|
-
|
23
|
-
== 0.1.1 2008-07-30
|
24
|
-
|
25
|
-
* 2 major enhancement:
|
26
|
-
* Added :basic_auth key for options when making a request
|
27
|
-
* :query and :body both now work with query string or hash
|
28
|
-
|
29
|
-
== 0.1.0 2008-07-27
|
30
|
-
|
31
|
-
* 1 major enhancement:
|
32
|
-
* Initial release
|
data/PostInstall.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
When you HTTParty, you must party hard!
|
data/README.txt
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
= httparty
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
|
5
|
-
Makes http fun again!
|
6
|
-
|
7
|
-
== FEATURES/PROBLEMS:
|
8
|
-
|
9
|
-
* Easy get, post, put, delete requests
|
10
|
-
* Basic http authentication
|
11
|
-
* Default request query string parameters (ie: for api keys that are needed on each request)
|
12
|
-
* Automatic parsing of JSON and XML into ruby hashes based on response content-type
|
13
|
-
|
14
|
-
== SYNOPSIS:
|
15
|
-
|
16
|
-
The following is a simple example of wrapping Twitter's API for posting updates.
|
17
|
-
|
18
|
-
class Twitter
|
19
|
-
include HTTParty
|
20
|
-
base_uri 'twitter.com'
|
21
|
-
basic_auth 'username', 'password'
|
22
|
-
end
|
23
|
-
|
24
|
-
Twitter.post('/statuses/update.json', :query => {:status => "It's an HTTParty and everyone is invited!"})
|
25
|
-
|
26
|
-
That is really it! The object returned is a ruby hash that is decoded from Twitter's json response. JSON parsing is used because of the .json extension in the path of the request. You can also explicitly set a format (see the examples).
|
27
|
-
|
28
|
-
That works and all but what if you don't want to embed your username and password in the class? Below is an example to fix that:
|
29
|
-
|
30
|
-
class Twitter
|
31
|
-
include HTTParty
|
32
|
-
base_uri 'twitter.com'
|
33
|
-
|
34
|
-
def initialize(u, p)
|
35
|
-
@auth = {:username => u, :password => p}
|
36
|
-
end
|
37
|
-
|
38
|
-
def post(text)
|
39
|
-
options = { :query => {:status => text}, :basic_auth => @auth }
|
40
|
-
self.class.post('/statuses/update.json', options)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
Twitter.new('username', 'password').post("It's an HTTParty and everyone is invited!")
|
45
|
-
|
46
|
-
=== REQUEST OPTIONS
|
47
|
-
|
48
|
-
Each of the HTTP method (get, post, put and delete) each take a hash of options.
|
49
|
-
The following keys can be specified in the options:
|
50
|
-
|
51
|
-
headers:: A <tt>Hash</tt> of header key/value pairs
|
52
|
-
query:: A <tt>Hash</tt> of query key/value pairs
|
53
|
-
body:: The body of the request. If it's a <tt>Hash</tt>, it is
|
54
|
-
converted into query-string format, otherwise it is sent
|
55
|
-
as-is.
|
56
|
-
basic_auth:: A <tt>Hash</tt> containing keys for <tt>:username</tt> and
|
57
|
-
<tt>:password</tt>.
|
58
|
-
no_follow:: Turns off automatic redirect following
|
59
|
-
|
60
|
-
== REQUIREMENTS:
|
61
|
-
|
62
|
-
* Active Support >= 2.1
|
63
|
-
|
64
|
-
== INSTALL:
|
65
|
-
|
66
|
-
* sudo gem install httparty
|
data/config/hoe.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'httparty/version'
|
2
|
-
|
3
|
-
AUTHOR = 'John Nunemaker' # can also be an array of Authors
|
4
|
-
EMAIL = "nunemaker@gmail.com"
|
5
|
-
DESCRIPTION = "Makes http fun! Also, makes consuming restful web services dead easy."
|
6
|
-
GEM_NAME = 'httparty' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'httparty' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
['activesupport', '>= 2.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = HTTParty::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'httparty documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
|
-
end
|
68
|
-
|
69
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
73
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/httparty.rb'}"
|
9
|
-
puts "Loading httparty gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|