Class: Bimble::GitStrategy::Clone
- Inherits:
-
Object
- Object
- Bimble::GitStrategy::Clone
- Includes:
- Helpers::Github, Helpers::Strings, Helpers::Updater
- Defined in:
- lib/bimble/git_strategy/clone.rb
Constant Summary
Constants included from Helpers::Github
Helpers::Github::GITHUB_REPO_REGEX
Instance Method Summary collapse
- #commit_to_new_branch ⇒ Object
- #default_branch ⇒ Object
- #in_working_copy ⇒ Object
-
#initialize(git_url, oauth_token) ⇒ Clone
constructor
A new instance of Clone.
- #lockfile_changed? ⇒ Boolean
Methods included from Helpers::Updater
Methods included from Helpers::Github
#add_blob_to_tree, #blob_content, #blob_shas, #commit, #create_blob, #create_branch, #github, #latest_commit, #open_pr, #repo, #tree, #user
Methods included from Helpers::Strings
#branch_name, #commit_message, #pull_request_body, #pull_request_title
Constructor Details
#initialize(git_url, oauth_token) ⇒ Clone
Returns a new instance of Clone.
9 10 11 12 |
# File 'lib/bimble/git_strategy/clone.rb', line 9 def initialize(git_url, oauth_token) @git_url = git_url @oauth_token = oauth_token end |
Instance Method Details
#commit_to_new_branch ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/bimble/git_strategy/clone.rb', line 28 def commit_to_new_branch @repository.branch(branch_name).create @repository.checkout(branch_name) @repository.add("Gemfile.lock") @repository.commit() @repository.push("origin", branch_name) end |
#default_branch ⇒ Object
36 37 38 |
# File 'lib/bimble/git_strategy/clone.rb', line 36 def default_branch @default_branch end |
#in_working_copy ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/bimble/git_strategy/clone.rb', line 14 def in_working_copy Dir.mktmpdir do |tmpdir| @repository = Git.clone(@git_url, tmpdir) @default_branch = @repository.branch Dir.chdir(tmpdir) do yield end end end |
#lockfile_changed? ⇒ Boolean
24 25 26 |
# File 'lib/bimble/git_strategy/clone.rb', line 24 def lockfile_changed? @repository.status.changed.keys.include? "Gemfile.lock" end |