bimble 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +3 -1
- data/CHANGELOG.md +9 -0
- data/README.md +10 -2
- data/Rakefile +4 -0
- data/bimble.gemspec +5 -2
- data/bin/bimble +11 -0
- data/bin/{generate_oauth_token.rb → generate_github_oauth_token} +0 -0
- data/lib/bimble.rb +16 -3
- data/lib/bimble/bundler.rb +9 -0
- data/lib/bimble/factory.rb +12 -0
- data/lib/bimble/git_strategy/clone.rb +40 -0
- data/lib/bimble/git_strategy/github_api.rb +57 -0
- data/lib/bimble/helpers/github.rb +99 -0
- data/lib/bimble/helpers/strings.rb +19 -0
- data/lib/bimble/helpers/updater.rb +14 -0
- data/lib/bimble/version.rb +1 -1
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_blob.yml +73 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_branch_for_a_commit.yml +73 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_commit_from_a_tree.yml +215 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_tree_with_the_new_blob_in_it_given_a_filename.yml +211 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_fetch_the_default_branch_for_a_repo.yml +72 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_a_file_on_a_branch.yml +72 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regex_on_a_branch.yml +72 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regexp_on_a_branch.yml +72 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_latest_commit_SHA_on_a_branch.yml +73 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_the_content_of_the_Gemfile_blob.yml +70 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_open_a_pull_request_back_to_the_default_branch.yml +76 -0
- data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_update_Gemfile_lock_and_open_PR_all_in_one_go.yml +567 -0
- data/spec/cassettes/github_api_strategy/should_get_all_appropriate_files.yml +342 -0
- data/spec/git_strategy_spec.rb +26 -0
- data/spec/github_api_spec.rb +70 -0
- data/spec/spec_helper.rb +15 -6
- metadata +88 -8
- data/bin/bimble.rb +0 -52
@@ -0,0 +1,342 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/repos/Floppy/bimble-test?access_token=<GITHUB_OAUTH_TOKEN>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
12
|
+
Accept-Charset:
|
13
|
+
- utf-8
|
14
|
+
User-Agent:
|
15
|
+
- Github Ruby Gem 0.11.3
|
16
|
+
Authorization:
|
17
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- GitHub.com
|
27
|
+
Date:
|
28
|
+
- Fri, 14 Mar 2014 14:41:05 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Status:
|
34
|
+
- 200 OK
|
35
|
+
X-Ratelimit-Limit:
|
36
|
+
- '5000'
|
37
|
+
X-Ratelimit-Remaining:
|
38
|
+
- '4942'
|
39
|
+
X-Ratelimit-Reset:
|
40
|
+
- '1394811355'
|
41
|
+
Cache-Control:
|
42
|
+
- private, max-age=60, s-maxage=60
|
43
|
+
Last-Modified:
|
44
|
+
- Fri, 14 Mar 2014 14:40:47 GMT
|
45
|
+
Etag:
|
46
|
+
- "\"dbf340dfc40211ff7083098271697a52\""
|
47
|
+
X-Oauth-Scopes:
|
48
|
+
- repo
|
49
|
+
X-Accepted-Oauth-Scopes:
|
50
|
+
- repo
|
51
|
+
Vary:
|
52
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
53
|
+
- Accept-Encoding
|
54
|
+
X-Github-Media-Type:
|
55
|
+
- github.v3; format=json
|
56
|
+
X-Content-Type-Options:
|
57
|
+
- nosniff
|
58
|
+
Access-Control-Allow-Credentials:
|
59
|
+
- 'true'
|
60
|
+
Access-Control-Expose-Headers:
|
61
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
62
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- "*"
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- 519F8646:2EAF:AFBE7B:53231500
|
67
|
+
body:
|
68
|
+
encoding: UTF-8
|
69
|
+
string: "{\"id\":17630125,\"name\":\"bimble-test\",\"full_name\":\"Floppy/bimble-test\",\"owner\":{\"login\":\"Floppy\",\"id\":3565,\"avatar_url\":\"https://gravatar.com/avatar/c150a49c7709fa40bffca545ecf8942d?d=https%3A%2F%2Fidenticons.github.com%2Fe6e713296627dff6475085cc6a224464.png&r=x\",\"gravatar_id\":\"c150a49c7709fa40bffca545ecf8942d\",\"url\":\"https://api.github.com/users/Floppy\",\"html_url\":\"https://github.com/Floppy\",\"followers_url\":\"https://api.github.com/users/Floppy/followers\",\"following_url\":\"https://api.github.com/users/Floppy/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/Floppy/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/Floppy/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/Floppy/subscriptions\",\"organizations_url\":\"https://api.github.com/users/Floppy/orgs\",\"repos_url\":\"https://api.github.com/users/Floppy/repos\",\"events_url\":\"https://api.github.com/users/Floppy/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/Floppy/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/Floppy/bimble-test\",\"description\":\"\",\"fork\":false,\"url\":\"https://api.github.com/repos/Floppy/bimble-test\",\"forks_url\":\"https://api.github.com/repos/Floppy/bimble-test/forks\",\"keys_url\":\"https://api.github.com/repos/Floppy/bimble-test/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/Floppy/bimble-test/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/Floppy/bimble-test/teams\",\"hooks_url\":\"https://api.github.com/repos/Floppy/bimble-test/hooks\",\"issue_events_url\":\"https://api.github.com/repos/Floppy/bimble-test/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/Floppy/bimble-test/events\",\"assignees_url\":\"https://api.github.com/repos/Floppy/bimble-test/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/Floppy/bimble-test/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/Floppy/bimble-test/tags\",\"blobs_url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/Floppy/bimble-test/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/Floppy/bimble-test/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/Floppy/bimble-test/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/Floppy/bimble-test/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/Floppy/bimble-test/languages\",\"stargazers_url\":\"https://api.github.com/repos/Floppy/bimble-test/stargazers\",\"contributors_url\":\"https://api.github.com/repos/Floppy/bimble-test/contributors\",\"subscribers_url\":\"https://api.github.com/repos/Floppy/bimble-test/subscribers\",\"subscription_url\":\"https://api.github.com/repos/Floppy/bimble-test/subscription\",\"commits_url\":\"https://api.github.com/repos/Floppy/bimble-test/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/Floppy/bimble-test/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/Floppy/bimble-test/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/Floppy/bimble-test/issues/comments/{number}\",\"contents_url\":\"https://api.github.com/repos/Floppy/bimble-test/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/Floppy/bimble-test/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/Floppy/bimble-test/merges\",\"archive_url\":\"https://api.github.com/repos/Floppy/bimble-test/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/Floppy/bimble-test/downloads\",\"issues_url\":\"https://api.github.com/repos/Floppy/bimble-test/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/Floppy/bimble-test/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/Floppy/bimble-test/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/Floppy/bimble-test/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/Floppy/bimble-test/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/Floppy/bimble-test/releases{/id}\",\"created_at\":\"2014-03-11T12:49:15Z\",\"updated_at\":\"2014-03-14T14:40:47Z\",\"pushed_at\":\"2014-03-14T14:40:46Z\",\"git_url\":\"git://github.com/Floppy/bimble-test.git\",\"ssh_url\":\"git@github.com:Floppy/bimble-test.git\",\"clone_url\":\"https://github.com/Floppy/bimble-test.git\",\"svn_url\":\"https://github.com/Floppy/bimble-test\",\"homepage\":null,\"size\":0,\"stargazers_count\":0,\"watchers_count\":0,\"language\":\"Ruby\",\"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\":true,\"push\":true,\"pull\":true},\"network_count\":0,\"subscribers_count\":0}"
|
70
|
+
http_version:
|
71
|
+
recorded_at: Fri, 14 Mar 2014 14:41:07 GMT
|
72
|
+
- request:
|
73
|
+
method: get
|
74
|
+
uri: https://api.github.com/repos/Floppy/bimble-test/git/trees/master?access_token=<GITHUB_OAUTH_TOKEN>
|
75
|
+
body:
|
76
|
+
encoding: US-ASCII
|
77
|
+
string: ''
|
78
|
+
headers:
|
79
|
+
Accept:
|
80
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
81
|
+
Accept-Charset:
|
82
|
+
- utf-8
|
83
|
+
User-Agent:
|
84
|
+
- Github Ruby Gem 0.11.3
|
85
|
+
Authorization:
|
86
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
87
|
+
Accept-Encoding:
|
88
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
89
|
+
response:
|
90
|
+
status:
|
91
|
+
code: 200
|
92
|
+
message: OK
|
93
|
+
headers:
|
94
|
+
Server:
|
95
|
+
- GitHub.com
|
96
|
+
Date:
|
97
|
+
- Fri, 14 Mar 2014 14:41:05 GMT
|
98
|
+
Content-Type:
|
99
|
+
- application/json; charset=utf-8
|
100
|
+
Transfer-Encoding:
|
101
|
+
- chunked
|
102
|
+
Status:
|
103
|
+
- 200 OK
|
104
|
+
X-Ratelimit-Limit:
|
105
|
+
- '5000'
|
106
|
+
X-Ratelimit-Remaining:
|
107
|
+
- '4941'
|
108
|
+
X-Ratelimit-Reset:
|
109
|
+
- '1394811355'
|
110
|
+
Cache-Control:
|
111
|
+
- private, max-age=60, s-maxage=60
|
112
|
+
Last-Modified:
|
113
|
+
- Fri, 14 Mar 2014 14:40:47 GMT
|
114
|
+
Etag:
|
115
|
+
- "\"dbf340dfc40211ff7083098271697a52\""
|
116
|
+
X-Oauth-Scopes:
|
117
|
+
- repo
|
118
|
+
X-Accepted-Oauth-Scopes:
|
119
|
+
- ''
|
120
|
+
Vary:
|
121
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
122
|
+
- Accept-Encoding
|
123
|
+
X-Github-Media-Type:
|
124
|
+
- github.v3; format=json
|
125
|
+
X-Content-Type-Options:
|
126
|
+
- nosniff
|
127
|
+
Access-Control-Allow-Credentials:
|
128
|
+
- 'true'
|
129
|
+
Access-Control-Expose-Headers:
|
130
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
131
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
132
|
+
Access-Control-Allow-Origin:
|
133
|
+
- "*"
|
134
|
+
X-Github-Request-Id:
|
135
|
+
- 519F8646:2EAF:AFBF14:53231501
|
136
|
+
body:
|
137
|
+
encoding: UTF-8
|
138
|
+
string: "{\"sha\":\"master\",\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/trees/master\",\"tree\":[{\"mode\":\"100644\",\"type\":\"blob\",\"sha\":\"971ea446b4dd814d3e1a59f2df9f52d911e60168\",\"path\":\"Gemfile\",\"size\":79,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/971ea446b4dd814d3e1a59f2df9f52d911e60168\"},{\"mode\":\"100644\",\"type\":\"blob\",\"sha\":\"3d77996b4520655a4d90665c6825ede135b87751\",\"path\":\"Gemfile.lock\",\"size\":102,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/3d77996b4520655a4d90665c6825ede135b87751\"},{\"mode\":\"100644\",\"type\":\"blob\",\"sha\":\"035f2bfeceb12a574d6e9fc899974533c6420223\",\"path\":\"bimble-test.gemspec\",\"size\":10,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/035f2bfeceb12a574d6e9fc899974533c6420223\"}]}"
|
139
|
+
http_version:
|
140
|
+
recorded_at: Fri, 14 Mar 2014 14:41:08 GMT
|
141
|
+
- request:
|
142
|
+
method: get
|
143
|
+
uri: https://api.github.com/repos/Floppy/bimble-test/git/blobs/971ea446b4dd814d3e1a59f2df9f52d911e60168?access_token=<GITHUB_OAUTH_TOKEN>
|
144
|
+
body:
|
145
|
+
encoding: US-ASCII
|
146
|
+
string: ''
|
147
|
+
headers:
|
148
|
+
Accept:
|
149
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
150
|
+
Accept-Charset:
|
151
|
+
- utf-8
|
152
|
+
User-Agent:
|
153
|
+
- Github Ruby Gem 0.11.3
|
154
|
+
Authorization:
|
155
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
156
|
+
Accept-Encoding:
|
157
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
158
|
+
response:
|
159
|
+
status:
|
160
|
+
code: 200
|
161
|
+
message: OK
|
162
|
+
headers:
|
163
|
+
Server:
|
164
|
+
- GitHub.com
|
165
|
+
Date:
|
166
|
+
- Fri, 14 Mar 2014 14:41:06 GMT
|
167
|
+
Content-Type:
|
168
|
+
- application/json; charset=utf-8
|
169
|
+
Transfer-Encoding:
|
170
|
+
- chunked
|
171
|
+
Status:
|
172
|
+
- 200 OK
|
173
|
+
X-Ratelimit-Limit:
|
174
|
+
- '5000'
|
175
|
+
X-Ratelimit-Remaining:
|
176
|
+
- '4940'
|
177
|
+
X-Ratelimit-Reset:
|
178
|
+
- '1394811355'
|
179
|
+
Cache-Control:
|
180
|
+
- private, max-age=60, s-maxage=60
|
181
|
+
Etag:
|
182
|
+
- "\"086d5a47259b2ea86367784a005cf9b4\""
|
183
|
+
X-Oauth-Scopes:
|
184
|
+
- repo
|
185
|
+
X-Accepted-Oauth-Scopes:
|
186
|
+
- ''
|
187
|
+
Vary:
|
188
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
189
|
+
- Accept-Encoding
|
190
|
+
X-Github-Media-Type:
|
191
|
+
- github.v3; format=json
|
192
|
+
X-Content-Type-Options:
|
193
|
+
- nosniff
|
194
|
+
Access-Control-Allow-Credentials:
|
195
|
+
- 'true'
|
196
|
+
Access-Control-Expose-Headers:
|
197
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
198
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
199
|
+
Access-Control-Allow-Origin:
|
200
|
+
- "*"
|
201
|
+
X-Github-Request-Id:
|
202
|
+
- 519F8646:2EB1:16991E7:53231501
|
203
|
+
body:
|
204
|
+
encoding: UTF-8
|
205
|
+
string: "{\"sha\":\"971ea446b4dd814d3e1a59f2df9f52d911e60168\",\"size\":79,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/971ea446b4dd814d3e1a59f2df9f52d911e60168\",\"content\":\"c291cmNlICJodHRwczovL3J1YnlnZW1zLm9yZyIKCiNydWJ5PTIuMS4wCiNy\\ndWJ5LWdlbXNldD1iaW1ibGUtdGVzdAoKZ2VtICdyYWtlJw==\\n\",\"encoding\":\"base64\"}"
|
206
|
+
http_version:
|
207
|
+
recorded_at: Fri, 14 Mar 2014 14:41:08 GMT
|
208
|
+
- request:
|
209
|
+
method: get
|
210
|
+
uri: https://api.github.com/repos/Floppy/bimble-test/git/blobs/3d77996b4520655a4d90665c6825ede135b87751?access_token=<GITHUB_OAUTH_TOKEN>
|
211
|
+
body:
|
212
|
+
encoding: US-ASCII
|
213
|
+
string: ''
|
214
|
+
headers:
|
215
|
+
Accept:
|
216
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
217
|
+
Accept-Charset:
|
218
|
+
- utf-8
|
219
|
+
User-Agent:
|
220
|
+
- Github Ruby Gem 0.11.3
|
221
|
+
Authorization:
|
222
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
223
|
+
Accept-Encoding:
|
224
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
225
|
+
response:
|
226
|
+
status:
|
227
|
+
code: 200
|
228
|
+
message: OK
|
229
|
+
headers:
|
230
|
+
Server:
|
231
|
+
- GitHub.com
|
232
|
+
Date:
|
233
|
+
- Fri, 14 Mar 2014 14:41:06 GMT
|
234
|
+
Content-Type:
|
235
|
+
- application/json; charset=utf-8
|
236
|
+
Transfer-Encoding:
|
237
|
+
- chunked
|
238
|
+
Status:
|
239
|
+
- 200 OK
|
240
|
+
X-Ratelimit-Limit:
|
241
|
+
- '5000'
|
242
|
+
X-Ratelimit-Remaining:
|
243
|
+
- '4939'
|
244
|
+
X-Ratelimit-Reset:
|
245
|
+
- '1394811355'
|
246
|
+
Cache-Control:
|
247
|
+
- private, max-age=60, s-maxage=60
|
248
|
+
Etag:
|
249
|
+
- "\"0a03cc566d05024b58d9ff5578107924\""
|
250
|
+
X-Oauth-Scopes:
|
251
|
+
- repo
|
252
|
+
X-Accepted-Oauth-Scopes:
|
253
|
+
- ''
|
254
|
+
Vary:
|
255
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
256
|
+
- Accept-Encoding
|
257
|
+
X-Github-Media-Type:
|
258
|
+
- github.v3; format=json
|
259
|
+
X-Content-Type-Options:
|
260
|
+
- nosniff
|
261
|
+
Access-Control-Allow-Credentials:
|
262
|
+
- 'true'
|
263
|
+
Access-Control-Expose-Headers:
|
264
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
265
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
266
|
+
Access-Control-Allow-Origin:
|
267
|
+
- "*"
|
268
|
+
X-Github-Request-Id:
|
269
|
+
- 519F8646:2EB2:19D9D50:53231502
|
270
|
+
body:
|
271
|
+
encoding: UTF-8
|
272
|
+
string: "{\"sha\":\"3d77996b4520655a4d90665c6825ede135b87751\",\"size\":102,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/3d77996b4520655a4d90665c6825ede135b87751\",\"content\":\"R0VNCiAgcmVtb3RlOiBodHRwczovL3J1YnlnZW1zLm9yZy8KICBzcGVjczoK\\nICAgIHJha2UgKDEwLjAuMCkKClBMQVRGT1JNUwogIHJ1YnkKCkRFUEVOREVO\\nQ0lFUwogIHJha2UK\\n\",\"encoding\":\"base64\"}"
|
273
|
+
http_version:
|
274
|
+
recorded_at: Fri, 14 Mar 2014 14:41:09 GMT
|
275
|
+
- request:
|
276
|
+
method: get
|
277
|
+
uri: https://api.github.com/repos/Floppy/bimble-test/git/blobs/035f2bfeceb12a574d6e9fc899974533c6420223?access_token=<GITHUB_OAUTH_TOKEN>
|
278
|
+
body:
|
279
|
+
encoding: US-ASCII
|
280
|
+
string: ''
|
281
|
+
headers:
|
282
|
+
Accept:
|
283
|
+
- application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1
|
284
|
+
Accept-Charset:
|
285
|
+
- utf-8
|
286
|
+
User-Agent:
|
287
|
+
- Github Ruby Gem 0.11.3
|
288
|
+
Authorization:
|
289
|
+
- Token token="<GITHUB_OAUTH_TOKEN>"
|
290
|
+
Accept-Encoding:
|
291
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
292
|
+
response:
|
293
|
+
status:
|
294
|
+
code: 200
|
295
|
+
message: OK
|
296
|
+
headers:
|
297
|
+
Server:
|
298
|
+
- GitHub.com
|
299
|
+
Date:
|
300
|
+
- Fri, 14 Mar 2014 14:41:07 GMT
|
301
|
+
Content-Type:
|
302
|
+
- application/json; charset=utf-8
|
303
|
+
Transfer-Encoding:
|
304
|
+
- chunked
|
305
|
+
Status:
|
306
|
+
- 200 OK
|
307
|
+
X-Ratelimit-Limit:
|
308
|
+
- '5000'
|
309
|
+
X-Ratelimit-Remaining:
|
310
|
+
- '4938'
|
311
|
+
X-Ratelimit-Reset:
|
312
|
+
- '1394811355'
|
313
|
+
Cache-Control:
|
314
|
+
- private, max-age=60, s-maxage=60
|
315
|
+
Etag:
|
316
|
+
- "\"7b9933cf1beee436e9b56306b3a9bcd8\""
|
317
|
+
X-Oauth-Scopes:
|
318
|
+
- repo
|
319
|
+
X-Accepted-Oauth-Scopes:
|
320
|
+
- ''
|
321
|
+
Vary:
|
322
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
323
|
+
- Accept-Encoding
|
324
|
+
X-Github-Media-Type:
|
325
|
+
- github.v3; format=json
|
326
|
+
X-Content-Type-Options:
|
327
|
+
- nosniff
|
328
|
+
Access-Control-Allow-Credentials:
|
329
|
+
- 'true'
|
330
|
+
Access-Control-Expose-Headers:
|
331
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
332
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
333
|
+
Access-Control-Allow-Origin:
|
334
|
+
- "*"
|
335
|
+
X-Github-Request-Id:
|
336
|
+
- 519F8646:2EAE:5FDF63:53231502
|
337
|
+
body:
|
338
|
+
encoding: UTF-8
|
339
|
+
string: "{\"sha\":\"035f2bfeceb12a574d6e9fc899974533c6420223\",\"size\":10,\"url\":\"https://api.github.com/repos/Floppy/bimble-test/git/blobs/035f2bfeceb12a574d6e9fc899974533c6420223\",\"content\":\"bm90IHZhbGlkCg==\\n\",\"encoding\":\"base64\"}"
|
340
|
+
http_version:
|
341
|
+
recorded_at: Fri, 14 Mar 2014 14:41:09 GMT
|
342
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
[
|
4
|
+
#:clone,
|
5
|
+
:github_api,
|
6
|
+
].each do |strategy|
|
7
|
+
|
8
|
+
describe "#{strategy} strategy", :vcr do
|
9
|
+
|
10
|
+
before :all do
|
11
|
+
@bimble = Bimble.create(strategy,
|
12
|
+
git_url: 'git@github.com:Floppy/bimble-test.git',
|
13
|
+
github_oauth_token: ENV['GITHUB_OAUTH_TOKEN'])
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should get all appropriate files" do
|
17
|
+
@bimble.in_working_copy do
|
18
|
+
File.exists?('Gemfile').should be_true
|
19
|
+
File.exists?('Gemfile.lock').should be_true
|
20
|
+
File.exists?('bimble-test.gemspec').should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bimble::GitStrategy::GithubApi, :vcr do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@remote = Bimble.create(:github_api, git_url: 'git@github.com:Floppy/bimble-test.git',
|
7
|
+
github_oauth_token: ENV['GITHUB_OAUTH_TOKEN'])
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to fetch the default branch for a repo" do
|
11
|
+
@remote.default_branch.should == 'master'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be able to get latest commit SHA on a branch" do
|
15
|
+
@remote.latest_commit('master').should == '97376a25bcc2e403ed5b9c9f7eb35c0e8a36c01c'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to get a blob sha for a file on a branch" do
|
19
|
+
@remote.blob_shas('master', 'Gemfile').should == { "Gemfile" => '971ea446b4dd814d3e1a59f2df9f52d911e60168' }
|
20
|
+
@remote.blob_shas('master', 'Gemfile.lock').should == { "Gemfile.lock" => '3d77996b4520655a4d90665c6825ede135b87751' }
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to get a blob sha for files matching a regexp on a branch" do
|
24
|
+
@remote.blob_shas('master', 'Gemfile.*').should == {
|
25
|
+
"Gemfile" => '971ea446b4dd814d3e1a59f2df9f52d911e60168',
|
26
|
+
"Gemfile.lock" => '3d77996b4520655a4d90665c6825ede135b87751'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to get the content of the Gemfile blob" do
|
31
|
+
content = @remote.blob_content('971ea446b4dd814d3e1a59f2df9f52d911e60168')
|
32
|
+
content.should include('source "https://rubygems.org"')
|
33
|
+
content.should include("gem 'rake'")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to create a new blob" do
|
37
|
+
blob_sha = @remote.create_blob('new blob content')
|
38
|
+
blob_sha.should == '28b552e7359c5c3bbe947749aab70d18e3ea554b'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be able to create a tree with the new blob in it given a filename" do
|
42
|
+
# post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back
|
43
|
+
tree_sha = @remote.add_blob_to_tree('28b552e7359c5c3bbe947749aab70d18e3ea554b', 'Gemfile.lock')
|
44
|
+
tree_sha.should == 'e12209a3617bd2fd7a95755dc2808b75e239afa7'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to create a new commit from a tree" do
|
48
|
+
# create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back
|
49
|
+
commit_sha = @remote.commit('e12209a3617bd2fd7a95755dc2808b75e239afa7')
|
50
|
+
commit_sha.should == 'fe6e5861c26a3a61c918b9b4bcc82059e4c0c62b'
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to create a new branch for a commit" do
|
54
|
+
# update the reference of your branch to point to the new commit SHA
|
55
|
+
branch = @remote.create_branch('update-dependencies', 'fe6e5861c26a3a61c918b9b4bcc82059e4c0c62b')
|
56
|
+
branch.should == 'refs/heads/update-dependencies'
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should be able to open a pull request back to the default branch" do
|
60
|
+
pr = @remote.open_pr('update-dependencies', 'master')
|
61
|
+
pr.number.should == 1
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should be able to update Gemfile.lock and open PR all in one go" do
|
65
|
+
@remote.instance_eval { commit_file("Gemfile.lock", "new content") }
|
66
|
+
pr = @remote.instance_eval { open_pr(branch_name, default_branch) }
|
67
|
+
pr.number.should == 7
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
require 'coveralls'
|
2
2
|
Coveralls.wear!
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
require 'dotenv'
|
5
|
+
Dotenv.load
|
6
|
+
|
7
|
+
require 'vcr'
|
8
|
+
require 'bimble'
|
9
|
+
require 'pry'
|
10
|
+
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.cassette_library_dir = 'spec/cassettes'
|
13
|
+
c.hook_into :webmock
|
14
|
+
c.filter_sensitive_data('<GITHUB_OAUTH_TOKEN>') { ENV['GITHUB_OAUTH_TOKEN'] }
|
15
|
+
c.configure_rspec_metadata!
|
16
|
+
end
|
17
|
+
|
10
18
|
RSpec.configure do |config|
|
11
19
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
20
|
config.run_all_when_everything_filtered = true
|
@@ -18,3 +26,4 @@ RSpec.configure do |config|
|
|
18
26
|
# --seed 1234
|
19
27
|
config.order = 'random'
|
20
28
|
end
|
29
|
+
|