gister 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/gister/middleware.rb +1 -1
- data/lib/gister/version.rb +1 -1
- data/spec/fetcher_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/gister.yml +87 -160
- data/spec/middleware_spec.rb +55 -31
- metadata +32 -12
data/.gitignore
CHANGED
data/lib/gister/middleware.rb
CHANGED
@@ -11,7 +11,7 @@ module Gister
|
|
11
11
|
|
12
12
|
def call(env)
|
13
13
|
request = Rack::Request.new env
|
14
|
-
if request.path =~ /^\/gist\/[0-9]+.json/
|
14
|
+
if request.path =~ /^\/gist\/([A-Za-z\-0-9]+\/)?[0-9]+.json/
|
15
15
|
respond_to_failures do
|
16
16
|
[200, {'Content-Type' => 'application/javascript'}, [get_body_content(request)]]
|
17
17
|
end
|
data/lib/gister/version.rb
CHANGED
data/spec/fetcher_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe Gister::Fetcher do
|
|
43
43
|
|
44
44
|
context "and there is a successful response from gist" do
|
45
45
|
let(:key) {
|
46
|
-
"https://gist.github.com/1996296.json?file=challenge-1-2.js"
|
46
|
+
"https://gist.github.com/codeschool-courses/1996296.json?file=challenge-1-2.js"
|
47
47
|
}
|
48
48
|
|
49
49
|
it "should return the response gist" do
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://gist.github.com/1996296.json?file=challenge-1-2.js
|
5
|
+
uri: https://gist.github.com/codeschool-courses/1996296.json?file=challenge-1-2.js
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,10 +21,10 @@ http_interactions:
|
|
21
21
|
headers:
|
22
22
|
!binary "U2VydmVy":
|
23
23
|
- !binary |-
|
24
|
-
|
24
|
+
R2l0SHViLmNvbQ==
|
25
25
|
!binary "RGF0ZQ==":
|
26
26
|
- !binary |-
|
27
|
-
|
27
|
+
V2VkLCAwNiBGZWIgMjAxMyAyMDo1NjoyMiBHTVQ=
|
28
28
|
!binary "Q29udGVudC1UeXBl":
|
29
29
|
- !binary |-
|
30
30
|
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
@@ -37,42 +37,61 @@ http_interactions:
|
|
37
37
|
!binary "U3RhdHVz":
|
38
38
|
- !binary |-
|
39
39
|
MjAwIE9L
|
40
|
-
!binary "
|
40
|
+
!binary "U3RyaWN0LVRyYW5zcG9ydC1TZWN1cml0eQ==":
|
41
41
|
- !binary |-
|
42
|
-
|
42
|
+
bWF4LWFnZT0zMTUzNjAwMA==
|
43
43
|
!binary "WC1GcmFtZS1PcHRpb25z":
|
44
44
|
- !binary |-
|
45
|
-
|
46
|
-
!binary "
|
45
|
+
U0FNRU9SSUdJTg==
|
46
|
+
!binary "WC1Yc3MtUHJvdGVjdGlvbg==":
|
47
|
+
- !binary |-
|
48
|
+
MTsgbW9kZT1ibG9jaw==
|
49
|
+
!binary "WC1Db250ZW50LVR5cGUtT3B0aW9ucw==":
|
50
|
+
- !binary |-
|
51
|
+
bm9zbmlmZg==
|
52
|
+
!binary "RXRhZw==":
|
53
|
+
- !binary |-
|
54
|
+
IjYxOWNlOGQ3Zjc2OGU1OWU0YjZlMWQxYmM4MjA4NWY0Ig==
|
55
|
+
!binary "WC1TZXJ2ZWQtQnk=":
|
47
56
|
- !binary |-
|
48
|
-
|
57
|
+
ZmUxOS5ycy5naXRodWIuY29t
|
49
58
|
!binary "Q2FjaGUtQ29udHJvbA==":
|
50
59
|
- !binary |-
|
51
|
-
|
52
|
-
!binary "
|
60
|
+
bWF4LWFnZT0wLCBwcml2YXRlLCBtdXN0LXJldmFsaWRhdGU=
|
61
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
62
|
+
- !binary |-
|
63
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
64
|
+
!binary "WC1SZXF1ZXN0LUlk":
|
65
|
+
- !binary |-
|
66
|
+
YTFkZmRkNTgtNTU0NC00ZTkwLWFlYjItMDY4ZjU5OWI2NGFm
|
67
|
+
!binary "WC1SdW50aW1l":
|
53
68
|
- !binary |-
|
54
|
-
|
69
|
+
MC4wMjYwOTc=
|
55
70
|
!binary "Q29udGVudC1FbmNvZGluZw==":
|
56
71
|
- !binary |-
|
57
72
|
Z3ppcA==
|
58
73
|
body:
|
59
74
|
encoding: ASCII-8BIT
|
60
75
|
string: !binary |-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
76
|
+
H4sIAAAAAAAAA7VW32/aMBD+V6z0ZZMI+QEJENSHrqq6h+2tTx3T5MQHcWvs
|
77
|
+
yHbaoqr/++z8gARCV20aCIHO9919d777wqtDQGWSFpoK7iTOFcdabHdIrNEX
|
78
|
+
nD2mggMK3NAZOUWZMpo5iZYljJxMAtZAfmFtQKEfhK4/cf3ZXRgkwTSJJvcG
|
79
|
+
saYMlJP8cLIcMwZ8A64JNX5Qzs+RI545SIPNhCWQC8HcTJRSGcTIIfTJHK1K
|
80
|
+
359cm9+IksuVs6FKB4tFHC7ilYMyhpVqrKva9WbFUfU6ALteruVz7HrWmWCN
|
81
|
+
kU3pqh3X+OUAXHH7HgLaBK4F9rPUdDROGaAMGCswIZRvDHnfFmIsqsBZx9KU
|
82
|
+
xigHhXK6yZn56GPqTVhZfe9rb3lpsm+RjePycpuCVMdBDu0yHPgQxFCs2l8V
|
83
|
+
17tJ90G53wJzLoG961AzDGrCnk00zNnTZPjguJjTHncvvpCmz50eusawr3s/
|
84
|
+
U12PP9R4bYpsiFXwXqseSXv4hOu7uO6U2MxiD8H3w3RVFIJyvQWuT5ozhBRt
|
85
|
+
qssPuR8Stbt8AqsNPXpFm2T8Ee9Dju9mk9lHIH+bAF408HpCui1+r4RPr2+f
|
86
|
+
l2c4eUZZqqObxsGOyeAuncxlA9C93WuNds8PcRrrIVelHd1x7fA4ObPi19Ow
|
87
|
+
LRyrSzcURrmEtdnFXOtCJZ5nBWy8oTov03Emtt6p2nqNpHoSP3s+WYQ4CnG6
|
88
|
+
WEOcTeJoSiYpDlM8j+YRrCGCWTqfzwLvWNHNAim9Y2BlgAmsE9lVrCcKz8jE
|
89
|
+
b3qBj7vcatY/0L8YlKdhWku0xXJDuVuRTAK/eFmiTDAhk4s4jpft/J8UWS2/
|
90
|
+
9z/otynvcqrQrbm0fqtQKkVpuCIt0E6UKN016tDrWHXf7VW3EW+p/lqm/XDj
|
91
|
+
90bw7GjW1XcG2Tyoq0tXOYD9G3Bu6MyDGrTywDyAiOvjdTif4WkaZYt5QNKJ
|
92
|
+
H/jTBUTx2o8hIpNxppTz9hvlurjFlwgAAA==
|
74
93
|
http_version:
|
75
|
-
recorded_at:
|
94
|
+
recorded_at: Wed, 06 Feb 2013 20:56:22 GMT
|
76
95
|
- request:
|
77
96
|
method: get
|
78
97
|
uri: https://gist.github.com/199629612981921.json?file=challenge-1-2.js
|
@@ -94,13 +113,13 @@ http_interactions:
|
|
94
113
|
headers:
|
95
114
|
!binary "U2VydmVy":
|
96
115
|
- !binary |-
|
97
|
-
|
116
|
+
R2l0SHViLmNvbQ==
|
98
117
|
!binary "RGF0ZQ==":
|
99
118
|
- !binary |-
|
100
|
-
|
119
|
+
V2VkLCAwNiBGZWIgMjAxMyAyMDo1NjoyMiBHTVQ=
|
101
120
|
!binary "Q29udGVudC1UeXBl":
|
102
121
|
- !binary |-
|
103
|
-
|
122
|
+
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
104
123
|
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
105
124
|
- !binary |-
|
106
125
|
Y2h1bmtlZA==
|
@@ -110,143 +129,39 @@ http_interactions:
|
|
110
129
|
!binary "U3RhdHVz":
|
111
130
|
- !binary |-
|
112
131
|
NDA0IE5vdCBGb3VuZA==
|
132
|
+
!binary "U3RyaWN0LVRyYW5zcG9ydC1TZWN1cml0eQ==":
|
133
|
+
- !binary |-
|
134
|
+
bWF4LWFnZT0zMTUzNjAwMA==
|
113
135
|
!binary "WC1GcmFtZS1PcHRpb25z":
|
114
136
|
- !binary |-
|
115
|
-
|
116
|
-
!binary "
|
137
|
+
U0FNRU9SSUdJTg==
|
138
|
+
!binary "WC1Yc3MtUHJvdGVjdGlvbg==":
|
139
|
+
- !binary |-
|
140
|
+
MTsgbW9kZT1ibG9jaw==
|
141
|
+
!binary "WC1Db250ZW50LVR5cGUtT3B0aW9ucw==":
|
117
142
|
- !binary |-
|
118
|
-
|
119
|
-
!binary "
|
143
|
+
bm9zbmlmZg==
|
144
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
120
145
|
- !binary |-
|
121
|
-
|
122
|
-
YUdoSGFGUmhlRzlQTTNJMlJVcHFZMnBQUVdKWFFtOWxNMVl4UjI1UGF6aFJV
|
123
|
-
RlU5T2c5elpYTnphVzl1WDJsa0lpVmhORFkyTkdOaFl6WTJNVFpoTWpoaU56
|
124
|
-
VTNOekZsWVdFMlpqSTFZVGhpT1ElM0QlM0QtLTdkMWYyNzlmOWQ1NDBjMmRl
|
125
|
-
MjhkZWFkZWU2YTI0Nzc5YmNjNDZlZmM7IHBhdGg9LzsgZXhwaXJlcz1TYXQs
|
126
|
-
IDAxLUphbi0yMDIyIDAwOjAwOjAwIEdNVDsgc2VjdXJlOyBIdHRwT25seQ==
|
146
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
127
147
|
!binary "Q2FjaGUtQ29udHJvbA==":
|
128
148
|
- !binary |-
|
129
149
|
bm8tY2FjaGU=
|
130
|
-
!binary "
|
150
|
+
!binary "WC1SZXF1ZXN0LUlk":
|
131
151
|
- !binary |-
|
132
|
-
|
152
|
+
OTJjNDk3MmYtNGJmNS00NTZhLTg3OGEtNTc3ZWQxNTU4ZjU3
|
153
|
+
!binary "WC1SdW50aW1l":
|
154
|
+
- !binary |-
|
155
|
+
MC4wMTE3MjU=
|
133
156
|
!binary "Q29udGVudC1FbmNvZGluZw==":
|
134
157
|
- !binary |-
|
135
158
|
Z3ppcA==
|
136
159
|
body:
|
137
160
|
encoding: ASCII-8BIT
|
138
161
|
string: !binary |-
|
139
|
-
|
140
|
-
5AbQJCGBAAcHSdzN3O71JnmY3OdR8iT5qxtHAqRIi87V+kIGgUZ1VXV1nRuj
|
141
|
-
Ry/fv/j4p4tXbBbN3XFjpP5jbDQT3GaLQEycu7OmPz3FgGhx2m7700VrLtpe
|
142
|
-
eMAmZvVue2IesKkTzWKz7iU8bqdPD5rjBsO/0VxEnFkzHoQiOjuMo4k2OCw+
|
143
|
-
opk18Vvs3Jw1/037dK698OcLHjmmK5rM8r1IeNFZ892rM2FPRQJUAo6cyBXj
|
144
|
-
XqfH/ue/2Rsnehubo7a6qWZ2He+aBcI9a4aCB9asyaLlQpw1+WLhOham8L22
|
145
|
-
vxCeemqL0AqcBd39w93cbbIZ2HPWLIxoydtyhrOmmrDJ2gkt+WQTN3ZszQHq
|
146
|
-
KQwiMQR3FW9alj9vy0E0prXwplsADWd+EFlxxIpw2xN+I2HgT0qcM+dT0b5L
|
147
|
-
5gd2khfqT3FBUsbyOJqBw47lRMvLyL8WwNrjc1BohcFEW/CAzyWVyUKm792+
|
148
|
-
ef7z8KX1h9nszewjv/Pfd4P+qx+urKv35+Yvz33R/Vf9jff+evAvF5/OShCT
|
149
|
-
OVLMRpJxitcpn7jRG7REi1/zOXdanojaPIT0hK0CA8No6YpwJnC7bcaejR8J
|
150
|
-
f7VOtzvoD4VuGN2J0RG2bpsT48TWe2LYM83JQLesfkf0+y0rDJtsLmyHQ0Ss
|
151
|
-
QBDtSl4y4ClbI3EXteX40oLvE29DM4b9Y2EO9e5xv3M80TvDjt6zeuZgMOxZ
|
152
|
-
xmAw6Jjm0LJF70GIK4EYKWFnYWCdNXfh+xW/4erdnO9Xv8UiWGrHpt7rDPqG
|
153
|
-
aQ/1nt3t60P9RLeFJYamGBpGf2gZpj4ReusKbFR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JbUANLeIycubiUPV90+XZITXcHHeOk3szNFOc
|
247
|
-
HaLt5jAlU3KQvqoBTdVWXzL6P/6KgBvhSAAA
|
162
|
+
H4sIAAAAAAAAA6uuBQBDv6ajAgAAAA==
|
248
163
|
http_version:
|
249
|
-
recorded_at:
|
164
|
+
recorded_at: Wed, 06 Feb 2013 20:56:22 GMT
|
250
165
|
- request:
|
251
166
|
method: get
|
252
167
|
uri: https://gist.github.com/client_error122.json?file=challenge-1-2.js
|
@@ -268,10 +183,10 @@ http_interactions:
|
|
268
183
|
headers:
|
269
184
|
!binary "U2VydmVy":
|
270
185
|
- !binary |-
|
271
|
-
|
186
|
+
R2l0SHViLmNvbQ==
|
272
187
|
!binary "RGF0ZQ==":
|
273
188
|
- !binary |-
|
274
|
-
|
189
|
+
V2VkLCAwNiBGZWIgMjAxMyAyMDo1NjoyMiBHTVQ=
|
275
190
|
!binary "Q29udGVudC1UeXBl":
|
276
191
|
- !binary |-
|
277
192
|
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
@@ -284,25 +199,37 @@ http_interactions:
|
|
284
199
|
!binary "U3RhdHVz":
|
285
200
|
- !binary |-
|
286
201
|
NDA0IE5vdCBGb3VuZA==
|
202
|
+
!binary "U3RyaWN0LVRyYW5zcG9ydC1TZWN1cml0eQ==":
|
203
|
+
- !binary |-
|
204
|
+
bWF4LWFnZT0zMTUzNjAwMA==
|
287
205
|
!binary "WC1GcmFtZS1PcHRpb25z":
|
288
206
|
- !binary |-
|
289
|
-
|
290
|
-
!binary "
|
207
|
+
U0FNRU9SSUdJTg==
|
208
|
+
!binary "WC1Yc3MtUHJvdGVjdGlvbg==":
|
209
|
+
- !binary |-
|
210
|
+
MTsgbW9kZT1ibG9jaw==
|
211
|
+
!binary "WC1Db250ZW50LVR5cGUtT3B0aW9ucw==":
|
212
|
+
- !binary |-
|
213
|
+
bm9zbmlmZg==
|
214
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
291
215
|
- !binary |-
|
292
|
-
|
216
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
293
217
|
!binary "Q2FjaGUtQ29udHJvbA==":
|
294
218
|
- !binary |-
|
295
219
|
bm8tY2FjaGU=
|
296
|
-
!binary "
|
220
|
+
!binary "WC1SZXF1ZXN0LUlk":
|
221
|
+
- !binary |-
|
222
|
+
ZDMyOTJkOTAtMzljMy00Mzk2LWEwNmMtZmM0NDAwODU2ODMw
|
223
|
+
!binary "WC1SdW50aW1l":
|
297
224
|
- !binary |-
|
298
|
-
|
225
|
+
MC4wMTA2OTU=
|
299
226
|
!binary "Q29udGVudC1FbmNvZGluZw==":
|
300
227
|
- !binary |-
|
301
228
|
Z3ppcA==
|
302
229
|
body:
|
303
230
|
encoding: ASCII-8BIT
|
304
231
|
string: !binary |-
|
305
|
-
|
232
|
+
H4sIAAAAAAAAA6uuBQBDv6ajAgAAAA==
|
306
233
|
http_version:
|
307
|
-
recorded_at:
|
308
|
-
recorded_with: VCR 2.0.
|
234
|
+
recorded_at: Wed, 06 Feb 2013 20:56:22 GMT
|
235
|
+
recorded_with: VCR 2.0.1
|
data/spec/middleware_spec.rb
CHANGED
@@ -9,49 +9,73 @@ describe Gister::Middleware do
|
|
9
9
|
subject { response }
|
10
10
|
|
11
11
|
describe "when responding to a request with a gist path" do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
context 'and getting content from the fetcher works' do
|
17
|
-
let(:response_body) {
|
18
|
-
"{hello:'world'}"
|
12
|
+
context "and the path has a github username in it" do
|
13
|
+
let(:path) {
|
14
|
+
"/gist/codeschool-courses/1111.json?file=app.js&callback=jQueryCallback&_=12012981921"
|
19
15
|
}
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
context 'and getting content from the fetcher works' do
|
18
|
+
let(:response_body) {
|
19
|
+
"{hello:'world'}"
|
20
|
+
}
|
24
21
|
|
25
|
-
|
26
|
-
|
22
|
+
before do
|
23
|
+
app.stub(:fetch_by_path).and_return(response_body)
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
26
|
+
it "should use the url as the key to fetcher with the callback or timestamp" do
|
27
|
+
app.should_receive(:fetch_by_path).with("https://gist.github.com/codeschool-courses/1111.json?file=app.js").and_return(response_body)
|
30
28
|
|
31
|
-
|
32
|
-
|
29
|
+
subject
|
30
|
+
end
|
33
31
|
end
|
32
|
+
end
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
context "and the path doesn't have a github username in it" do
|
35
|
+
let(:path) {
|
36
|
+
"/gist/1111.json?file=app.js&callback=jQueryCallback&_=12012981921"
|
37
|
+
}
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
context 'and getting content from the fetcher works' do
|
40
|
+
let(:response_body) {
|
41
|
+
"{hello:'world'}"
|
42
|
+
}
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
before do
|
45
|
+
app.stub(:fetch_by_path).and_return(response_body)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should use the url as the key to fetcher with the callback or timestamp" do
|
49
|
+
app.should_receive(:fetch_by_path).with("https://gist.github.com/1111.json?file=app.js").and_return(response_body)
|
50
|
+
|
51
|
+
subject
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should wrap the response from fetcher in the callback param" do
|
55
|
+
subject[2].should == ["jQueryCallback(#{response_body})"]
|
56
|
+
end
|
48
57
|
|
49
|
-
|
50
|
-
|
58
|
+
it "should return a 200" do
|
59
|
+
subject[0].should == 200
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have a content type of application/javascript" do
|
63
|
+
subject[1]['Content-Type'].should == "application/javascript"
|
64
|
+
end
|
51
65
|
end
|
52
66
|
|
53
|
-
|
54
|
-
|
67
|
+
context 'and getting content from the fetcher raises a ClientError' do
|
68
|
+
before do
|
69
|
+
app.stub(:fetch_by_path).and_raise(Gister::Fetcher::ClientError)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return a 404" do
|
73
|
+
subject[0].should == 404
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should have an empty body" do
|
77
|
+
subject[2].should == [""]
|
78
|
+
end
|
55
79
|
end
|
56
80
|
end
|
57
81
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gister
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: vcr
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 2.0.0
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.0.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: webmock
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,18 +53,28 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: faraday
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
|
-
- - =
|
67
|
+
- - '='
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: 0.6.1
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.6.1
|
58
78
|
description: Provides a Middleware to cache embedded gist content
|
59
79
|
email:
|
60
80
|
- rubymaverick@gmail.com
|
@@ -97,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
117
|
version: '0'
|
98
118
|
requirements: []
|
99
119
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.8.
|
120
|
+
rubygems_version: 1.8.24
|
101
121
|
signing_key:
|
102
122
|
specification_version: 3
|
103
123
|
summary: Provides a Middleware to cache embedded gist content
|