Class: GemXray::Editors::GithubPr
- Inherits:
-
Object
- Object
- GemXray::Editors::GithubPr
- Defined in:
- lib/gemxray/editors/github_pr.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #create(results, per_gem: config.github_per_gem?, bundle_install: config.github_bundle_install?, comment: false) ⇒ Object
-
#initialize(config) ⇒ GithubPr
constructor
A new instance of GithubPr.
Constructor Details
#initialize(config) ⇒ GithubPr
Returns a new instance of GithubPr.
11 12 13 |
# File 'lib/gemxray/editors/github_pr.rb', line 11 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/gemxray/editors/github_pr.rb', line 9 def config @config end |
Instance Method Details
#create(results, per_gem: config.github_per_gem?, bundle_install: config.github_bundle_install?, comment: false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gemxray/editors/github_pr.rb', line 15 def create(results, per_gem: config.github_per_gem?, bundle_install: config.github_bundle_install?, comment: false) ensure_git_repository! ensure_clean_worktree! pull_requests = if per_gem create_per_gem_pull_requests(results, bundle_install: bundle_install, comment: comment) else [create_single_pull_request(results, bundle_install: bundle_install, comment: comment)] end raise Error, "no Gemfile changes were created" if pull_requests.empty? primary = pull_requests.first { branch: primary[:branch], commits: primary[:commits], pr_url: primary[:pr_url], pull_requests: pull_requests } end |