cid 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +13 -0
- data/Gemfile +3 -0
- data/Rakefile +16 -0
- data/bin/cid +18 -0
- data/cid.gemspec +11 -0
- data/features/publish.feature +29 -0
- data/features/step_definitions/cid.rb +7 -0
- data/features/support/env.rb +28 -0
- data/features/validate.feature +30 -0
- data/lib/cid/datapackage.rb +57 -0
- data/lib/cid/helpers/github.rb +91 -0
- data/lib/cid/publish.rb +28 -0
- data/lib/cid/validation.rb +1 -1
- data/lib/cid/version.rb +1 -1
- data/lib/cid.rb +11 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_create_a_new_blob.yml +81 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_create_a_new_commit_from_a_tree.yml +244 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_create_a_tree_with_the_new_blob_in_it_given_a_filename.yml +240 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_fetch_the_default_branch_for_a_repo.yml +83 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_get_a_blob_sha_for_a_file_on_a_branch.yml +82 -0
- data/spec/cassettes/Cid_Publish/should_be_able_to_get_latest_commit_SHA_on_a_branch.yml +83 -0
- data/spec/cassettes/Cid_Publish/should_push_to_the_default_branch.yml +583 -0
- data/spec/datapackage_spec.rb +27 -0
- data/spec/fixtures/multiple_files/datapackage.json +71 -0
- data/spec/fixtures/no_schema/votes/votes-1.csv +13 -0
- data/spec/fixtures/valid/datapackage.json +71 -0
- data/spec/publish_spec.rb +45 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/validate_spec.rb +9 -0
- metadata +209 -35
@@ -0,0 +1,583 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.github.com/repos/theodi/cid-test/git/blobs?access_token=<GITHUB_OAUTH_TOKEN>
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"content":"{\n \"name\": \"euro-elections\",\n \"title\": \"\",\n \"homepage\":
|
9
|
+
\"\",\n \"version\": \"0.1.0\",\n \"license\": \"PDDL-1.0\",\n \"resources\":
|
10
|
+
[\n {\n \"name\": \"votes-1\",\n \"path\": \"votes/votes-1.csv\",\n \"format\":
|
11
|
+
\"csv\",\n \"mediatype\": \"text/csv\",\n \"bytes\":
|
12
|
+
1752,\n \"schema\": {\n \"fields\": [\n {\n \"name\":
|
13
|
+
\"Poll Date\",\n \"type\": \"date\",\n \"description\":
|
14
|
+
\"Date the poll took place\",\n \"format\": \"yyyy-mm-dd\"\n },\n {\n \"name\":
|
15
|
+
\"Area\",\n \"type\": \"string\",\n \"description\":
|
16
|
+
\"The name of the area which the result is for\",\n \"required\":
|
17
|
+
true\n },\n {\n \"name\":
|
18
|
+
\"Area Code\",\n \"type\": \"number\",\n \"description\":
|
19
|
+
\"The Office of National Statistics code for the area\",\n \"pattern\":
|
20
|
+
\"E1500000(0-9)\",\n \"required\": true\n },\n {\n \"name\":
|
21
|
+
\"Area URL\",\n \"type\": \"string\",\n \"description\":
|
22
|
+
\"\",\n \"required\": true,\n \"pattern\":
|
23
|
+
\"http://statistics.data.gov.uk/doc/statistical-geography/E1500000(0-9)\"\n },\n {\n \"name\":
|
24
|
+
\"Party\",\n \"type\": \"string\",\n \"description\":
|
25
|
+
\"\",\n \"required\": true\n },\n {\n \"name\":
|
26
|
+
\"Party ID\",\n \"type\": \"string\",\n \"description\":
|
27
|
+
\"\",\n \"required\": true,\n \"pattern\":
|
28
|
+
\"PPm? [0-9]+\"\n },\n {\n \"name\":
|
29
|
+
\"Votes\",\n \"type\": \"integer\",\n \"description\":
|
30
|
+
\"\"\n },\n {\n \"name\":
|
31
|
+
\"Ballots Rejected\",\n \"type\": \"integer\",\n \"description\":
|
32
|
+
\"\"\n }\n ]\n }\n }\n ],\n \"description\":
|
33
|
+
\"\",\n \"repository\": \"git://github.com/theodi/euro-elections.git\"\n}\n","encoding":"utf-8"}'
|
34
|
+
headers:
|
35
|
+
Accept:
|
36
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
37
|
+
Accept-Charset:
|
38
|
+
- utf-8
|
39
|
+
User-Agent:
|
40
|
+
- Github Ruby Gem 0.11.3
|
41
|
+
Content-Type:
|
42
|
+
- application/json
|
43
|
+
Authorization:
|
44
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
response:
|
48
|
+
status:
|
49
|
+
code: 201
|
50
|
+
message: Created
|
51
|
+
headers:
|
52
|
+
Server:
|
53
|
+
- GitHub.com
|
54
|
+
Date:
|
55
|
+
- Thu, 22 May 2014 14:09:06 GMT
|
56
|
+
Content-Type:
|
57
|
+
- application/json; charset=utf-8
|
58
|
+
Status:
|
59
|
+
- 201 Created
|
60
|
+
X-Ratelimit-Limit:
|
61
|
+
- '5000'
|
62
|
+
X-Ratelimit-Remaining:
|
63
|
+
- '4997'
|
64
|
+
X-Ratelimit-Reset:
|
65
|
+
- '1400771341'
|
66
|
+
Cache-Control:
|
67
|
+
- private, max-age=60, s-maxage=60
|
68
|
+
Etag:
|
69
|
+
- '"4e9598f53ce92c56cbffee520ac04a07"'
|
70
|
+
X-Oauth-Scopes:
|
71
|
+
- gist, repo, user
|
72
|
+
X-Accepted-Oauth-Scopes:
|
73
|
+
- ''
|
74
|
+
Location:
|
75
|
+
- https://api.github.com/repos/theodi/cid-test/git/blobs/c22d8945fac6a4ce4be188002dcd09656bd85898
|
76
|
+
Vary:
|
77
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
78
|
+
X-Github-Media-Type:
|
79
|
+
- github.v3; format=json
|
80
|
+
X-Xss-Protection:
|
81
|
+
- 1; mode=block
|
82
|
+
X-Frame-Options:
|
83
|
+
- deny
|
84
|
+
Content-Security-Policy:
|
85
|
+
- default-src 'none'
|
86
|
+
Content-Length:
|
87
|
+
- '154'
|
88
|
+
Access-Control-Allow-Credentials:
|
89
|
+
- 'true'
|
90
|
+
Access-Control-Expose-Headers:
|
91
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
92
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
93
|
+
Access-Control-Allow-Origin:
|
94
|
+
- '*'
|
95
|
+
X-Github-Request-Id:
|
96
|
+
- 4F4C59B3:0FEA:14A31FF:537E0502
|
97
|
+
Strict-Transport-Security:
|
98
|
+
- max-age=31536000
|
99
|
+
X-Content-Type-Options:
|
100
|
+
- nosniff
|
101
|
+
body:
|
102
|
+
encoding: UTF-8
|
103
|
+
string: '{"sha":"c22d8945fac6a4ce4be188002dcd09656bd85898","url":"https://api.github.com/repos/theodi/cid-test/git/blobs/c22d8945fac6a4ce4be188002dcd09656bd85898"}'
|
104
|
+
http_version:
|
105
|
+
recorded_at: Thu, 22 May 2014 14:09:12 GMT
|
106
|
+
- request:
|
107
|
+
method: get
|
108
|
+
uri: https://api.github.com/repos/theodi/cid-test?access_token=<GITHUB_OAUTH_TOKEN>
|
109
|
+
body:
|
110
|
+
encoding: US-ASCII
|
111
|
+
string: ''
|
112
|
+
headers:
|
113
|
+
Accept:
|
114
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
115
|
+
Accept-Charset:
|
116
|
+
- utf-8
|
117
|
+
User-Agent:
|
118
|
+
- Github Ruby Gem 0.11.3
|
119
|
+
Authorization:
|
120
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
121
|
+
Accept-Encoding:
|
122
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
123
|
+
response:
|
124
|
+
status:
|
125
|
+
code: 200
|
126
|
+
message: OK
|
127
|
+
headers:
|
128
|
+
Server:
|
129
|
+
- GitHub.com
|
130
|
+
Date:
|
131
|
+
- Thu, 22 May 2014 14:09:53 GMT
|
132
|
+
Content-Type:
|
133
|
+
- application/json; charset=utf-8
|
134
|
+
Transfer-Encoding:
|
135
|
+
- chunked
|
136
|
+
Status:
|
137
|
+
- 200 OK
|
138
|
+
X-Ratelimit-Limit:
|
139
|
+
- '5000'
|
140
|
+
X-Ratelimit-Remaining:
|
141
|
+
- '4996'
|
142
|
+
X-Ratelimit-Reset:
|
143
|
+
- '1400771341'
|
144
|
+
Cache-Control:
|
145
|
+
- private, max-age=60, s-maxage=60
|
146
|
+
Last-Modified:
|
147
|
+
- Thu, 22 May 2014 13:14:36 GMT
|
148
|
+
Etag:
|
149
|
+
- '"3fbf105ac3450cfa9074f2556dda2739"'
|
150
|
+
X-Oauth-Scopes:
|
151
|
+
- gist, repo, user
|
152
|
+
X-Accepted-Oauth-Scopes:
|
153
|
+
- repo
|
154
|
+
Vary:
|
155
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
156
|
+
- Accept-Encoding
|
157
|
+
X-Github-Media-Type:
|
158
|
+
- github.v3; format=json
|
159
|
+
X-Xss-Protection:
|
160
|
+
- 1; mode=block
|
161
|
+
X-Frame-Options:
|
162
|
+
- deny
|
163
|
+
Content-Security-Policy:
|
164
|
+
- default-src 'none'
|
165
|
+
Access-Control-Allow-Credentials:
|
166
|
+
- 'true'
|
167
|
+
Access-Control-Expose-Headers:
|
168
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
169
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
170
|
+
Access-Control-Allow-Origin:
|
171
|
+
- '*'
|
172
|
+
X-Github-Request-Id:
|
173
|
+
- 4F4C59B3:3037:1B4D8A0:537E0530
|
174
|
+
Strict-Transport-Security:
|
175
|
+
- max-age=31536000
|
176
|
+
X-Content-Type-Options:
|
177
|
+
- nosniff
|
178
|
+
X-Served-By:
|
179
|
+
- 3061975e1f37121b3751604ad153c687
|
180
|
+
body:
|
181
|
+
encoding: UTF-8
|
182
|
+
string: '{"id":20057973,"name":"cid-test","full_name":"theodi/cid-test","owner":{"login":"theodi","id":2492770,"avatar_url":"https://avatars.githubusercontent.com/u/2492770?","gravatar_id":"07ab537732bae0cb3167a3bd8f42f885","url":"https://api.github.com/users/theodi","html_url":"https://github.com/theodi","followers_url":"https://api.github.com/users/theodi/followers","following_url":"https://api.github.com/users/theodi/following{/other_user}","gists_url":"https://api.github.com/users/theodi/gists{/gist_id}","starred_url":"https://api.github.com/users/theodi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theodi/subscriptions","organizations_url":"https://api.github.com/users/theodi/orgs","repos_url":"https://api.github.com/users/theodi/repos","events_url":"https://api.github.com/users/theodi/events{/privacy}","received_events_url":"https://api.github.com/users/theodi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/theodi/cid-test","description":"A
|
183
|
+
test repo for http://github.com/theodi/cid","fork":false,"url":"https://api.github.com/repos/theodi/cid-test","forks_url":"https://api.github.com/repos/theodi/cid-test/forks","keys_url":"https://api.github.com/repos/theodi/cid-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theodi/cid-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theodi/cid-test/teams","hooks_url":"https://api.github.com/repos/theodi/cid-test/hooks","issue_events_url":"https://api.github.com/repos/theodi/cid-test/issues/events{/number}","events_url":"https://api.github.com/repos/theodi/cid-test/events","assignees_url":"https://api.github.com/repos/theodi/cid-test/assignees{/user}","branches_url":"https://api.github.com/repos/theodi/cid-test/branches{/branch}","tags_url":"https://api.github.com/repos/theodi/cid-test/tags","blobs_url":"https://api.github.com/repos/theodi/cid-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theodi/cid-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theodi/cid-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/theodi/cid-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theodi/cid-test/statuses/{sha}","languages_url":"https://api.github.com/repos/theodi/cid-test/languages","stargazers_url":"https://api.github.com/repos/theodi/cid-test/stargazers","contributors_url":"https://api.github.com/repos/theodi/cid-test/contributors","subscribers_url":"https://api.github.com/repos/theodi/cid-test/subscribers","subscription_url":"https://api.github.com/repos/theodi/cid-test/subscription","commits_url":"https://api.github.com/repos/theodi/cid-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/theodi/cid-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/theodi/cid-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/theodi/cid-test/issues/comments/{number}","contents_url":"https://api.github.com/repos/theodi/cid-test/contents/{+path}","compare_url":"https://api.github.com/repos/theodi/cid-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theodi/cid-test/merges","archive_url":"https://api.github.com/repos/theodi/cid-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theodi/cid-test/downloads","issues_url":"https://api.github.com/repos/theodi/cid-test/issues{/number}","pulls_url":"https://api.github.com/repos/theodi/cid-test/pulls{/number}","milestones_url":"https://api.github.com/repos/theodi/cid-test/milestones{/number}","notifications_url":"https://api.github.com/repos/theodi/cid-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theodi/cid-test/labels{/name}","releases_url":"https://api.github.com/repos/theodi/cid-test/releases{/id}","created_at":"2014-05-22T11:02:18Z","updated_at":"2014-05-22T13:14:36Z","pushed_at":"2014-05-22T13:14:37Z","git_url":"git://github.com/theodi/cid-test.git","ssh_url":"git@github.com:theodi/cid-test.git","clone_url":"https://github.com/theodi/cid-test.git","svn_url":"https://github.com/theodi/cid-test","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":false,"push":true,"pull":true},"organization":{"login":"theodi","id":2492770,"avatar_url":"https://avatars.githubusercontent.com/u/2492770?","gravatar_id":"07ab537732bae0cb3167a3bd8f42f885","url":"https://api.github.com/users/theodi","html_url":"https://github.com/theodi","followers_url":"https://api.github.com/users/theodi/followers","following_url":"https://api.github.com/users/theodi/following{/other_user}","gists_url":"https://api.github.com/users/theodi/gists{/gist_id}","starred_url":"https://api.github.com/users/theodi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theodi/subscriptions","organizations_url":"https://api.github.com/users/theodi/orgs","repos_url":"https://api.github.com/users/theodi/repos","events_url":"https://api.github.com/users/theodi/events{/privacy}","received_events_url":"https://api.github.com/users/theodi/received_events","type":"Organization","site_admin":false},"network_count":0,"subscribers_count":12}'
|
184
|
+
http_version:
|
185
|
+
recorded_at: Thu, 22 May 2014 14:09:58 GMT
|
186
|
+
- request:
|
187
|
+
method: get
|
188
|
+
uri: https://api.github.com/repos/theodi/cid-test/git/trees/master?access_token=<GITHUB_OAUTH_TOKEN>
|
189
|
+
body:
|
190
|
+
encoding: US-ASCII
|
191
|
+
string: ''
|
192
|
+
headers:
|
193
|
+
Accept:
|
194
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
195
|
+
Accept-Charset:
|
196
|
+
- utf-8
|
197
|
+
User-Agent:
|
198
|
+
- Github Ruby Gem 0.11.3
|
199
|
+
Authorization:
|
200
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
201
|
+
Accept-Encoding:
|
202
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
203
|
+
response:
|
204
|
+
status:
|
205
|
+
code: 200
|
206
|
+
message: OK
|
207
|
+
headers:
|
208
|
+
Server:
|
209
|
+
- GitHub.com
|
210
|
+
Date:
|
211
|
+
- Thu, 22 May 2014 14:09:53 GMT
|
212
|
+
Content-Type:
|
213
|
+
- application/json; charset=utf-8
|
214
|
+
Transfer-Encoding:
|
215
|
+
- chunked
|
216
|
+
Status:
|
217
|
+
- 200 OK
|
218
|
+
X-Ratelimit-Limit:
|
219
|
+
- '5000'
|
220
|
+
X-Ratelimit-Remaining:
|
221
|
+
- '4995'
|
222
|
+
X-Ratelimit-Reset:
|
223
|
+
- '1400771341'
|
224
|
+
Cache-Control:
|
225
|
+
- private, max-age=60, s-maxage=60
|
226
|
+
Last-Modified:
|
227
|
+
- Thu, 22 May 2014 13:14:36 GMT
|
228
|
+
Etag:
|
229
|
+
- '"3fbf105ac3450cfa9074f2556dda2739"'
|
230
|
+
X-Oauth-Scopes:
|
231
|
+
- gist, repo, user
|
232
|
+
X-Accepted-Oauth-Scopes:
|
233
|
+
- ''
|
234
|
+
Vary:
|
235
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
236
|
+
- Accept-Encoding
|
237
|
+
X-Github-Media-Type:
|
238
|
+
- github.v3; format=json
|
239
|
+
X-Xss-Protection:
|
240
|
+
- 1; mode=block
|
241
|
+
X-Frame-Options:
|
242
|
+
- deny
|
243
|
+
Content-Security-Policy:
|
244
|
+
- default-src 'none'
|
245
|
+
Access-Control-Allow-Credentials:
|
246
|
+
- 'true'
|
247
|
+
Access-Control-Expose-Headers:
|
248
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
249
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
250
|
+
Access-Control-Allow-Origin:
|
251
|
+
- '*'
|
252
|
+
X-Github-Request-Id:
|
253
|
+
- 4F4C59B3:303A:419D95D:537E0531
|
254
|
+
Strict-Transport-Security:
|
255
|
+
- max-age=31536000
|
256
|
+
X-Content-Type-Options:
|
257
|
+
- nosniff
|
258
|
+
X-Served-By:
|
259
|
+
- 3061975e1f37121b3751604ad153c687
|
260
|
+
body:
|
261
|
+
encoding: UTF-8
|
262
|
+
string: '{"sha":"master","url":"https://api.github.com/repos/theodi/cid-test/git/trees/master","tree":[{"mode":"100644","type":"blob","sha":"c22d8945fac6a4ce4be188002dcd09656bd85898","path":"datapackage.json","size":2473,"url":"https://api.github.com/repos/theodi/cid-test/git/blobs/c22d8945fac6a4ce4be188002dcd09656bd85898"},{"mode":"040000","type":"tree","sha":"d649696e0f04601419e691387e8c8cb8a218521e","path":"votes","url":"https://api.github.com/repos/theodi/cid-test/git/trees/d649696e0f04601419e691387e8c8cb8a218521e"}]}'
|
263
|
+
http_version:
|
264
|
+
recorded_at: Thu, 22 May 2014 14:09:58 GMT
|
265
|
+
- request:
|
266
|
+
method: post
|
267
|
+
uri: https://api.github.com/repos/theodi/cid-test/git/trees?access_token=<GITHUB_OAUTH_TOKEN>
|
268
|
+
body:
|
269
|
+
encoding: UTF-8
|
270
|
+
string: '{"base_tree":"master","tree":[{"path":"datapackage.json","mode":"100644","type":"blob","sha":"c22d8945fac6a4ce4be188002dcd09656bd85898"}]}'
|
271
|
+
headers:
|
272
|
+
Accept:
|
273
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
274
|
+
Accept-Charset:
|
275
|
+
- utf-8
|
276
|
+
User-Agent:
|
277
|
+
- Github Ruby Gem 0.11.3
|
278
|
+
Content-Type:
|
279
|
+
- application/json
|
280
|
+
Authorization:
|
281
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
282
|
+
Accept-Encoding:
|
283
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
284
|
+
response:
|
285
|
+
status:
|
286
|
+
code: 201
|
287
|
+
message: Created
|
288
|
+
headers:
|
289
|
+
Server:
|
290
|
+
- GitHub.com
|
291
|
+
Date:
|
292
|
+
- Thu, 22 May 2014 14:09:54 GMT
|
293
|
+
Content-Type:
|
294
|
+
- application/json; charset=utf-8
|
295
|
+
Status:
|
296
|
+
- 201 Created
|
297
|
+
X-Ratelimit-Limit:
|
298
|
+
- '5000'
|
299
|
+
X-Ratelimit-Remaining:
|
300
|
+
- '4994'
|
301
|
+
X-Ratelimit-Reset:
|
302
|
+
- '1400771341'
|
303
|
+
Cache-Control:
|
304
|
+
- private, max-age=60, s-maxage=60
|
305
|
+
Etag:
|
306
|
+
- '"96c4cb682a1a513097bc8fe04d0c38f4"'
|
307
|
+
X-Oauth-Scopes:
|
308
|
+
- gist, repo, user
|
309
|
+
X-Accepted-Oauth-Scopes:
|
310
|
+
- ''
|
311
|
+
Location:
|
312
|
+
- https://api.github.com/repos/theodi/cid-test/git/trees/f93721ec813957d3df629ddc68b3e3c1397d02de
|
313
|
+
Vary:
|
314
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
315
|
+
X-Github-Media-Type:
|
316
|
+
- github.v3; format=json
|
317
|
+
X-Xss-Protection:
|
318
|
+
- 1; mode=block
|
319
|
+
X-Frame-Options:
|
320
|
+
- deny
|
321
|
+
Content-Security-Policy:
|
322
|
+
- default-src 'none'
|
323
|
+
Content-Length:
|
324
|
+
- '586'
|
325
|
+
Access-Control-Allow-Credentials:
|
326
|
+
- 'true'
|
327
|
+
Access-Control-Expose-Headers:
|
328
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
329
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
330
|
+
Access-Control-Allow-Origin:
|
331
|
+
- '*'
|
332
|
+
X-Github-Request-Id:
|
333
|
+
- 4F4C59B3:3039:36E1B43:537E0531
|
334
|
+
Strict-Transport-Security:
|
335
|
+
- max-age=31536000
|
336
|
+
X-Content-Type-Options:
|
337
|
+
- nosniff
|
338
|
+
body:
|
339
|
+
encoding: UTF-8
|
340
|
+
string: '{"sha":"f93721ec813957d3df629ddc68b3e3c1397d02de","url":"https://api.github.com/repos/theodi/cid-test/git/trees/f93721ec813957d3df629ddc68b3e3c1397d02de","tree":[{"mode":"100644","type":"blob","sha":"c22d8945fac6a4ce4be188002dcd09656bd85898","path":"datapackage.json","size":2473,"url":"https://api.github.com/repos/theodi/cid-test/git/blobs/c22d8945fac6a4ce4be188002dcd09656bd85898"},{"mode":"040000","type":"tree","sha":"d649696e0f04601419e691387e8c8cb8a218521e","path":"votes","url":"https://api.github.com/repos/theodi/cid-test/git/trees/d649696e0f04601419e691387e8c8cb8a218521e"}]}'
|
341
|
+
http_version:
|
342
|
+
recorded_at: Thu, 22 May 2014 14:09:59 GMT
|
343
|
+
- request:
|
344
|
+
method: get
|
345
|
+
uri: https://api.github.com/repos/theodi/cid-test/branches/master?access_token=<GITHUB_OAUTH_TOKEN>
|
346
|
+
body:
|
347
|
+
encoding: US-ASCII
|
348
|
+
string: ''
|
349
|
+
headers:
|
350
|
+
Accept:
|
351
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
352
|
+
Accept-Charset:
|
353
|
+
- utf-8
|
354
|
+
User-Agent:
|
355
|
+
- Github Ruby Gem 0.11.3
|
356
|
+
Authorization:
|
357
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
358
|
+
Accept-Encoding:
|
359
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
360
|
+
response:
|
361
|
+
status:
|
362
|
+
code: 200
|
363
|
+
message: OK
|
364
|
+
headers:
|
365
|
+
Server:
|
366
|
+
- GitHub.com
|
367
|
+
Date:
|
368
|
+
- Thu, 22 May 2014 14:09:54 GMT
|
369
|
+
Content-Type:
|
370
|
+
- application/json; charset=utf-8
|
371
|
+
Transfer-Encoding:
|
372
|
+
- chunked
|
373
|
+
Status:
|
374
|
+
- 200 OK
|
375
|
+
X-Ratelimit-Limit:
|
376
|
+
- '5000'
|
377
|
+
X-Ratelimit-Remaining:
|
378
|
+
- '4993'
|
379
|
+
X-Ratelimit-Reset:
|
380
|
+
- '1400771341'
|
381
|
+
Cache-Control:
|
382
|
+
- private, max-age=60, s-maxage=60
|
383
|
+
Etag:
|
384
|
+
- '"6ea4f47ed3c6fc9925b43d64b90ab049"'
|
385
|
+
X-Oauth-Scopes:
|
386
|
+
- gist, repo, user
|
387
|
+
X-Accepted-Oauth-Scopes:
|
388
|
+
- ''
|
389
|
+
Vary:
|
390
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
391
|
+
- Accept-Encoding
|
392
|
+
X-Github-Media-Type:
|
393
|
+
- github.v3; format=json
|
394
|
+
X-Xss-Protection:
|
395
|
+
- 1; mode=block
|
396
|
+
X-Frame-Options:
|
397
|
+
- deny
|
398
|
+
Content-Security-Policy:
|
399
|
+
- default-src 'none'
|
400
|
+
Access-Control-Allow-Credentials:
|
401
|
+
- 'true'
|
402
|
+
Access-Control-Expose-Headers:
|
403
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
404
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
405
|
+
Access-Control-Allow-Origin:
|
406
|
+
- '*'
|
407
|
+
X-Github-Request-Id:
|
408
|
+
- 4F4C59B3:3039:36E1C18:537E0532
|
409
|
+
Strict-Transport-Security:
|
410
|
+
- max-age=31536000
|
411
|
+
X-Content-Type-Options:
|
412
|
+
- nosniff
|
413
|
+
X-Served-By:
|
414
|
+
- 88d924ed861736d2749ce1a55766cb53
|
415
|
+
body:
|
416
|
+
encoding: UTF-8
|
417
|
+
string: '{"name":"master","commit":{"sha":"e55df79f1a47c2175e0857ffeff1e2f84ad76071","commit":{"author":{"name":"ODI
|
418
|
+
Robot","email":"odi-jenkins@users.noreply.github.com","date":"2014-05-22T13:14:37Z"},"committer":{"name":"ODI
|
419
|
+
Robot","email":"odi-jenkins@users.noreply.github.com","date":"2014-05-22T13:14:37Z"},"message":"Updated
|
420
|
+
datapackage.json","tree":{"sha":"f93721ec813957d3df629ddc68b3e3c1397d02de","url":"https://api.github.com/repos/theodi/cid-test/git/trees/f93721ec813957d3df629ddc68b3e3c1397d02de"},"url":"https://api.github.com/repos/theodi/cid-test/git/commits/e55df79f1a47c2175e0857ffeff1e2f84ad76071","comment_count":0},"url":"https://api.github.com/repos/theodi/cid-test/commits/e55df79f1a47c2175e0857ffeff1e2f84ad76071","html_url":"https://github.com/theodi/cid-test/commit/e55df79f1a47c2175e0857ffeff1e2f84ad76071","comments_url":"https://api.github.com/repos/theodi/cid-test/commits/e55df79f1a47c2175e0857ffeff1e2f84ad76071/comments","author":{"login":"odi-robot","id":3439860,"avatar_url":"https://avatars.githubusercontent.com/u/3439860?","gravatar_id":"b96a794974d7bd76d161ebe533f2a9d0","url":"https://api.github.com/users/odi-robot","html_url":"https://github.com/odi-robot","followers_url":"https://api.github.com/users/odi-robot/followers","following_url":"https://api.github.com/users/odi-robot/following{/other_user}","gists_url":"https://api.github.com/users/odi-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/odi-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odi-robot/subscriptions","organizations_url":"https://api.github.com/users/odi-robot/orgs","repos_url":"https://api.github.com/users/odi-robot/repos","events_url":"https://api.github.com/users/odi-robot/events{/privacy}","received_events_url":"https://api.github.com/users/odi-robot/received_events","type":"User","site_admin":false},"committer":{"login":"odi-robot","id":3439860,"avatar_url":"https://avatars.githubusercontent.com/u/3439860?","gravatar_id":"b96a794974d7bd76d161ebe533f2a9d0","url":"https://api.github.com/users/odi-robot","html_url":"https://github.com/odi-robot","followers_url":"https://api.github.com/users/odi-robot/followers","following_url":"https://api.github.com/users/odi-robot/following{/other_user}","gists_url":"https://api.github.com/users/odi-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/odi-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odi-robot/subscriptions","organizations_url":"https://api.github.com/users/odi-robot/orgs","repos_url":"https://api.github.com/users/odi-robot/repos","events_url":"https://api.github.com/users/odi-robot/events{/privacy}","received_events_url":"https://api.github.com/users/odi-robot/received_events","type":"User","site_admin":false},"parents":[{"sha":"48f7c50b7bdd52dca3f9415ec0724ab9e89a89c5","url":"https://api.github.com/repos/theodi/cid-test/commits/48f7c50b7bdd52dca3f9415ec0724ab9e89a89c5","html_url":"https://github.com/theodi/cid-test/commit/48f7c50b7bdd52dca3f9415ec0724ab9e89a89c5"}]},"_links":{"self":"https://api.github.com/repos/theodi/cid-test/branches/master","html":"https://github.com/theodi/cid-test/tree/master"}}'
|
421
|
+
http_version:
|
422
|
+
recorded_at: Thu, 22 May 2014 14:10:00 GMT
|
423
|
+
- request:
|
424
|
+
method: post
|
425
|
+
uri: https://api.github.com/repos/theodi/cid-test/git/commits?access_token=<GITHUB_OAUTH_TOKEN>
|
426
|
+
body:
|
427
|
+
encoding: UTF-8
|
428
|
+
string: '{"message":"Updated datapackage.json","parents":["e55df79f1a47c2175e0857ffeff1e2f84ad76071"],"tree":"f93721ec813957d3df629ddc68b3e3c1397d02de"}'
|
429
|
+
headers:
|
430
|
+
Accept:
|
431
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
432
|
+
Accept-Charset:
|
433
|
+
- utf-8
|
434
|
+
User-Agent:
|
435
|
+
- Github Ruby Gem 0.11.3
|
436
|
+
Content-Type:
|
437
|
+
- application/json
|
438
|
+
Authorization:
|
439
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
440
|
+
Accept-Encoding:
|
441
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
442
|
+
response:
|
443
|
+
status:
|
444
|
+
code: 201
|
445
|
+
message: Created
|
446
|
+
headers:
|
447
|
+
Server:
|
448
|
+
- GitHub.com
|
449
|
+
Date:
|
450
|
+
- Thu, 22 May 2014 14:09:55 GMT
|
451
|
+
Content-Type:
|
452
|
+
- application/json; charset=utf-8
|
453
|
+
Status:
|
454
|
+
- 201 Created
|
455
|
+
X-Ratelimit-Limit:
|
456
|
+
- '5000'
|
457
|
+
X-Ratelimit-Remaining:
|
458
|
+
- '4992'
|
459
|
+
X-Ratelimit-Reset:
|
460
|
+
- '1400771341'
|
461
|
+
Cache-Control:
|
462
|
+
- private, max-age=60, s-maxage=60
|
463
|
+
Etag:
|
464
|
+
- '"351b4294c49085a869ce39268184d75d"'
|
465
|
+
X-Oauth-Scopes:
|
466
|
+
- gist, repo, user
|
467
|
+
X-Accepted-Oauth-Scopes:
|
468
|
+
- ''
|
469
|
+
Location:
|
470
|
+
- https://api.github.com/repos/theodi/cid-test/git/commits/357b6cbb632a533bf20657975b6100a0b837b15c
|
471
|
+
Vary:
|
472
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
473
|
+
X-Github-Media-Type:
|
474
|
+
- github.v3; format=json
|
475
|
+
X-Xss-Protection:
|
476
|
+
- 1; mode=block
|
477
|
+
X-Frame-Options:
|
478
|
+
- deny
|
479
|
+
Content-Security-Policy:
|
480
|
+
- default-src 'none'
|
481
|
+
Content-Length:
|
482
|
+
- '933'
|
483
|
+
Access-Control-Allow-Credentials:
|
484
|
+
- 'true'
|
485
|
+
Access-Control-Expose-Headers:
|
486
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
487
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
488
|
+
Access-Control-Allow-Origin:
|
489
|
+
- '*'
|
490
|
+
X-Github-Request-Id:
|
491
|
+
- 4F4C59B3:3039:36E1CCF:537E0533
|
492
|
+
Strict-Transport-Security:
|
493
|
+
- max-age=31536000
|
494
|
+
X-Content-Type-Options:
|
495
|
+
- nosniff
|
496
|
+
body:
|
497
|
+
encoding: UTF-8
|
498
|
+
string: '{"sha":"357b6cbb632a533bf20657975b6100a0b837b15c","url":"https://api.github.com/repos/theodi/cid-test/git/commits/357b6cbb632a533bf20657975b6100a0b837b15c","html_url":"https://github.com/theodi/cid-test/commit/357b6cbb632a533bf20657975b6100a0b837b15c","author":{"name":"ODI
|
499
|
+
Robot","email":"odi-jenkins@users.noreply.github.com","date":"2014-05-22T14:09:55Z"},"committer":{"name":"ODI
|
500
|
+
Robot","email":"odi-jenkins@users.noreply.github.com","date":"2014-05-22T14:09:55Z"},"tree":{"sha":"f93721ec813957d3df629ddc68b3e3c1397d02de","url":"https://api.github.com/repos/theodi/cid-test/git/trees/f93721ec813957d3df629ddc68b3e3c1397d02de"},"message":"Updated
|
501
|
+
datapackage.json","parents":[{"sha":"e55df79f1a47c2175e0857ffeff1e2f84ad76071","url":"https://api.github.com/repos/theodi/cid-test/git/commits/e55df79f1a47c2175e0857ffeff1e2f84ad76071","html_url":"https://github.com/theodi/cid-test/commit/e55df79f1a47c2175e0857ffeff1e2f84ad76071"}]}'
|
502
|
+
http_version:
|
503
|
+
recorded_at: Thu, 22 May 2014 14:10:00 GMT
|
504
|
+
- request:
|
505
|
+
method: patch
|
506
|
+
uri: https://api.github.com/repos/theodi/cid-test/git/refs/heads/master?access_token=<GITHUB_OAUTH_TOKEN>
|
507
|
+
body:
|
508
|
+
encoding: UTF-8
|
509
|
+
string: '{"sha":"357b6cbb632a533bf20657975b6100a0b837b15c"}'
|
510
|
+
headers:
|
511
|
+
Accept:
|
512
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
513
|
+
Accept-Charset:
|
514
|
+
- utf-8
|
515
|
+
User-Agent:
|
516
|
+
- Github Ruby Gem 0.11.3
|
517
|
+
Content-Type:
|
518
|
+
- application/json
|
519
|
+
Authorization:
|
520
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
521
|
+
Accept-Encoding:
|
522
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
523
|
+
response:
|
524
|
+
status:
|
525
|
+
code: 200
|
526
|
+
message: OK
|
527
|
+
headers:
|
528
|
+
Server:
|
529
|
+
- GitHub.com
|
530
|
+
Date:
|
531
|
+
- Thu, 22 May 2014 14:09:56 GMT
|
532
|
+
Content-Type:
|
533
|
+
- application/json; charset=utf-8
|
534
|
+
Transfer-Encoding:
|
535
|
+
- chunked
|
536
|
+
Status:
|
537
|
+
- 200 OK
|
538
|
+
X-Ratelimit-Limit:
|
539
|
+
- '5000'
|
540
|
+
X-Ratelimit-Remaining:
|
541
|
+
- '4991'
|
542
|
+
X-Ratelimit-Reset:
|
543
|
+
- '1400771341'
|
544
|
+
Cache-Control:
|
545
|
+
- private, max-age=60, s-maxage=60
|
546
|
+
Etag:
|
547
|
+
- '"31ca39a3b2b3e0d0b99839163ae1e4f5"'
|
548
|
+
X-Oauth-Scopes:
|
549
|
+
- gist, repo, user
|
550
|
+
X-Accepted-Oauth-Scopes:
|
551
|
+
- ''
|
552
|
+
Vary:
|
553
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
554
|
+
- Accept-Encoding
|
555
|
+
X-Github-Media-Type:
|
556
|
+
- github.v3; format=json
|
557
|
+
X-Xss-Protection:
|
558
|
+
- 1; mode=block
|
559
|
+
X-Frame-Options:
|
560
|
+
- deny
|
561
|
+
Content-Security-Policy:
|
562
|
+
- default-src 'none'
|
563
|
+
Access-Control-Allow-Credentials:
|
564
|
+
- 'true'
|
565
|
+
Access-Control-Expose-Headers:
|
566
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
567
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
568
|
+
Access-Control-Allow-Origin:
|
569
|
+
- '*'
|
570
|
+
X-Github-Request-Id:
|
571
|
+
- 4F4C59B3:303A:419DDC5:537E0533
|
572
|
+
Strict-Transport-Security:
|
573
|
+
- max-age=31536000
|
574
|
+
X-Content-Type-Options:
|
575
|
+
- nosniff
|
576
|
+
X-Served-By:
|
577
|
+
- 132026e9262a0093e437f99db5f1e499
|
578
|
+
body:
|
579
|
+
encoding: UTF-8
|
580
|
+
string: '{"ref":"refs/heads/master","url":"https://api.github.com/repos/theodi/cid-test/git/refs/heads/master","object":{"sha":"357b6cbb632a533bf20657975b6100a0b837b15c","type":"commit","url":"https://api.github.com/repos/theodi/cid-test/git/commits/357b6cbb632a533bf20657975b6100a0b837b15c"}}'
|
581
|
+
http_version:
|
582
|
+
recorded_at: Thu, 22 May 2014 14:10:01 GMT
|
583
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cid::Datapackage do
|
4
|
+
|
5
|
+
it "recrates the original datapackage.rb" do
|
6
|
+
datapackage = Cid::Datapackage.new(File.join(File.dirname(__FILE__), 'fixtures', 'valid'))
|
7
|
+
datapackage.create
|
8
|
+
|
9
|
+
JSON.parse(datapackage.json).should == JSON.parse(File.read(File.join(File.dirname(__FILE__), 'fixtures', 'valid', 'datapackage.json')))
|
10
|
+
end
|
11
|
+
|
12
|
+
it "creates a datapackage.rb with a new file" do
|
13
|
+
datapackage = Cid::Datapackage.new(File.join(File.dirname(__FILE__), 'fixtures', 'multiple_files'))
|
14
|
+
datapackage.create
|
15
|
+
|
16
|
+
package = JSON.parse(datapackage.json)
|
17
|
+
|
18
|
+
package["resources"].count.should == 2
|
19
|
+
package["resources"][1]["name"].should == "votes-2"
|
20
|
+
package["resources"][1]["path"].should == "votes/votes-2.csv"
|
21
|
+
package["resources"][1]["format"].should == "csv"
|
22
|
+
package["resources"][1]["mediatype"].should == "text/csv"
|
23
|
+
package["resources"][1]["bytes"].should == 1752
|
24
|
+
package["resources"][1]["schema"]["fields"].should == JSON.parse(File.new(File.join(File.dirname(__FILE__), 'fixtures', 'multiple_files', 'votes', 'schema.json')).read)["fields"]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|