bimble 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +3 -1
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +10 -2
  5. data/Rakefile +4 -0
  6. data/bimble.gemspec +5 -2
  7. data/bin/bimble +11 -0
  8. data/bin/{generate_oauth_token.rb → generate_github_oauth_token} +0 -0
  9. data/lib/bimble.rb +16 -3
  10. data/lib/bimble/bundler.rb +9 -0
  11. data/lib/bimble/factory.rb +12 -0
  12. data/lib/bimble/git_strategy/clone.rb +40 -0
  13. data/lib/bimble/git_strategy/github_api.rb +57 -0
  14. data/lib/bimble/helpers/github.rb +99 -0
  15. data/lib/bimble/helpers/strings.rb +19 -0
  16. data/lib/bimble/helpers/updater.rb +14 -0
  17. data/lib/bimble/version.rb +1 -1
  18. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_blob.yml +73 -0
  19. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_branch_for_a_commit.yml +73 -0
  20. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_commit_from_a_tree.yml +215 -0
  21. 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
  22. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_fetch_the_default_branch_for_a_repo.yml +72 -0
  23. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_a_file_on_a_branch.yml +72 -0
  24. 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
  25. 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
  26. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_latest_commit_SHA_on_a_branch.yml +73 -0
  27. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_the_content_of_the_Gemfile_blob.yml +70 -0
  28. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_open_a_pull_request_back_to_the_default_branch.yml +76 -0
  29. data/spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_update_Gemfile_lock_and_open_PR_all_in_one_go.yml +567 -0
  30. data/spec/cassettes/github_api_strategy/should_get_all_appropriate_files.yml +342 -0
  31. data/spec/git_strategy_spec.rb +26 -0
  32. data/spec/github_api_spec.rb +70 -0
  33. data/spec/spec_helper.rb +15 -6
  34. metadata +88 -8
  35. data/bin/bimble.rb +0 -52
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bimble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-11 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: memoist
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: travis
126
+ name: coveralls
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ! '>='
@@ -123,7 +137,35 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: coveralls
140
+ name: vcr
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
127
169
  requirement: !ruby/object:Gem::Requirement
128
170
  requirements:
129
171
  - - ! '>='
@@ -140,24 +182,47 @@ description: Keep your bundles up to date
140
182
  email:
141
183
  - james@floppy.org.uk
142
184
  executables:
143
- - bimble.rb
144
- - generate_oauth_token.rb
185
+ - bimble
186
+ - generate_github_oauth_token
145
187
  extensions: []
146
188
  extra_rdoc_files: []
147
189
  files:
148
190
  - .gitignore
149
191
  - .rspec
150
192
  - .travis.yml
193
+ - CHANGELOG.md
151
194
  - Gemfile
152
195
  - Gemfile.lock
153
196
  - LICENSE.md
154
197
  - README.md
155
198
  - Rakefile
156
199
  - bimble.gemspec
157
- - bin/bimble.rb
158
- - bin/generate_oauth_token.rb
200
+ - bin/bimble
201
+ - bin/generate_github_oauth_token
159
202
  - lib/bimble.rb
203
+ - lib/bimble/bundler.rb
204
+ - lib/bimble/factory.rb
205
+ - lib/bimble/git_strategy/clone.rb
206
+ - lib/bimble/git_strategy/github_api.rb
207
+ - lib/bimble/helpers/github.rb
208
+ - lib/bimble/helpers/strings.rb
209
+ - lib/bimble/helpers/updater.rb
160
210
  - lib/bimble/version.rb
211
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_blob.yml
212
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_branch_for_a_commit.yml
213
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_commit_from_a_tree.yml
214
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_tree_with_the_new_blob_in_it_given_a_filename.yml
215
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_fetch_the_default_branch_for_a_repo.yml
216
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_a_file_on_a_branch.yml
217
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regex_on_a_branch.yml
218
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regexp_on_a_branch.yml
219
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_latest_commit_SHA_on_a_branch.yml
220
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_the_content_of_the_Gemfile_blob.yml
221
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_open_a_pull_request_back_to_the_default_branch.yml
222
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_update_Gemfile_lock_and_open_PR_all_in_one_go.yml
223
+ - spec/cassettes/github_api_strategy/should_get_all_appropriate_files.yml
224
+ - spec/git_strategy_spec.rb
225
+ - spec/github_api_spec.rb
161
226
  - spec/spec_helper.rb
162
227
  homepage: ''
163
228
  licenses:
@@ -185,4 +250,19 @@ specification_version: 4
185
250
  summary: A gem and executable to check out a repo, run bundle update, then commit
186
251
  and open a PR
187
252
  test_files:
253
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_blob.yml
254
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_branch_for_a_commit.yml
255
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_new_commit_from_a_tree.yml
256
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_create_a_tree_with_the_new_blob_in_it_given_a_filename.yml
257
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_fetch_the_default_branch_for_a_repo.yml
258
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_a_file_on_a_branch.yml
259
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regex_on_a_branch.yml
260
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_a_blob_sha_for_files_matching_a_regexp_on_a_branch.yml
261
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_latest_commit_SHA_on_a_branch.yml
262
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_get_the_content_of_the_Gemfile_blob.yml
263
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_open_a_pull_request_back_to_the_default_branch.yml
264
+ - spec/cassettes/Bimble_GitStrategy_GithubApi/should_be_able_to_update_Gemfile_lock_and_open_PR_all_in_one_go.yml
265
+ - spec/cassettes/github_api_strategy/should_get_all_appropriate_files.yml
266
+ - spec/git_strategy_spec.rb
267
+ - spec/github_api_spec.rb
188
268
  - spec/spec_helper.rb
data/bin/bimble.rb DELETED
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'git'
4
- require 'date'
5
- require 'dotenv'
6
- require 'github_api'
7
-
8
- Dotenv.load
9
-
10
- def do_update(repo)
11
- if File.exists?("Gemfile")
12
- `bundle update`
13
- branch = commit_to_new_branch(repo)
14
- open_pull_request(repo, branch) if branch
15
- end
16
- end
17
-
18
- def commit_to_new_branch(repo)
19
- if repo.status.changed.keys.include? "Gemfile.lock"
20
- branch = "update-dependencies-#{Date.today.to_s}"
21
- repo.branch(branch).create
22
- repo.checkout(branch)
23
- repo.add("Gemfile.lock")
24
- repo.commit("automatically updated dependencies")
25
- repo.push("origin", branch)
26
- branch
27
- else
28
- nil
29
- end
30
- end
31
-
32
- def open_pull_request(repo, branch)
33
- if ENV['GITHUB_OAUTH_TOKEN']
34
- github = Github.new oauth_token: ENV['GITHUB_OAUTH_TOKEN']
35
-
36
- matches = repo.remote("origin").url.match(/\A.+:(.+?)\/([^\.]+).*\Z/)
37
- if matches
38
- user, repo_name = matches[1], matches[2]
39
- github.pull_requests.create user, repo_name,
40
- title: "automatically updated dependencies",
41
- head: "#{user}:#{branch}",
42
- base: "master"
43
- end
44
- end
45
- end
46
-
47
- Dir.mktmpdir do |tmpdir|
48
- repo = Git.clone(ARGV[0], tmpdir)
49
- Dir.chdir(tmpdir) do
50
- do_update(repo)
51
- end
52
- end