Class: Radius::Toolbelt::ReleaseGithub
- Inherits:
-
Object
- Object
- Radius::Toolbelt::ReleaseGithub
- Defined in:
- lib/radius/toolbelt/release_github.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#filenames ⇒ Object
readonly
Returns the value of attribute filenames.
-
#release_name ⇒ Object
readonly
Returns the value of attribute release_name.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#tag_name ⇒ Object
readonly
Returns the value of attribute tag_name.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(repo, token, tag_name, release_name, body, filenames) ⇒ ReleaseGithub
constructor
A new instance of ReleaseGithub.
- #run ⇒ Object
Constructor Details
#initialize(repo, token, tag_name, release_name, body, filenames) ⇒ ReleaseGithub
Returns a new instance of ReleaseGithub.
11 12 13 14 15 16 17 18 |
# File 'lib/radius/toolbelt/release_github.rb', line 11 def initialize(repo, token, tag_name, release_name, body, filenames) @repo = repo @tag_name = tag_name @release_name = release_name @body = body @filenames = filenames @token = token end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def body @body end |
#filenames ⇒ Object (readonly)
Returns the value of attribute filenames.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def filenames @filenames end |
#release_name ⇒ Object (readonly)
Returns the value of attribute release_name.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def release_name @release_name end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def repo @repo end |
#tag_name ⇒ Object (readonly)
Returns the value of attribute tag_name.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def tag_name @tag_name end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
10 11 12 |
# File 'lib/radius/toolbelt/release_github.rb', line 10 def token @token end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/radius/toolbelt/release_github.rb', line 20 def run puts "\nCreating draft release \"#{release_name}\" for repo \"#{repo}\"..." # create the release client = Octokit::Client.new(access_token: token) release = client.create_release( repo, tag_name, #target_commitish: tag_name, name: release_name, body: body, draft: true ) # upload the files filenames.each do |filename| puts "Uploading #{filename}..." client.upload_asset release.url, filename end puts "\nRelease URL: #{release.html_url}" edit_url = release.html_url.gsub("/tag/", "/edit/") if block_given? yield({edit_url: edit_url}) end end |