Class: Releasinator::Publisher
- Inherits:
-
Object
- Object
- Releasinator::Publisher
- Defined in:
- lib/publisher.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish_draft(repo_url, release) ⇒ Object
- #publish_pull_request(repo_url, release, product_name, base, head) ⇒ Object
Constructor Details
#initialize(config) ⇒ Publisher
Returns a new instance of Publisher.
8 9 10 |
# File 'lib/publisher.rb', line 8 def initialize(config) @config = config end |
Instance Method Details
#publish_draft(repo_url, release) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/publisher.rb', line 12 def publish_draft(repo_url, release) github_repo = GitHubRepo.new(repo_url) begin # https://github.com/octokit/octokit.rb/blob/master/spec/octokit/client/releases_spec.rb#L18 github_release = github_repo.client.create_release "#{github_repo.org}/#{github_repo.repo}", release.version, :name => release.version, :body => release.changelog, :draft => true, :prerelease => false puts github_release.inspect if @config[:trace] rescue => error #This will fail if the user does not have push permissions. Printer.fail(error.inspect) abort() end end |
#publish_pull_request(repo_url, release, product_name, base, head) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/publisher.rb', line 31 def publish_pull_request(repo_url, release, product_name, base, head) begin github_repo = GitHubRepo.new(repo_url) github_pull_request = github_repo.client.create_pull_request "#{github_repo.org}/#{github_repo.repo}", base, head, "Update #{product_name} to #{release.version}", release.changelog puts github_pull_request.inspect if @config[:trace] rescue => error #This will fail if there's already a pull request Printer.fail(error.inspect) abort() end end |