Class: Stove::GitHub
- Inherits:
-
Object
- Object
- Stove::GitHub
- Defined in:
- lib/stove/github.rb
Instance Attribute Summary collapse
-
#cookbook ⇒ Object
readonly
Returns the value of attribute cookbook.
Instance Method Summary collapse
-
#initialize(cookbook) ⇒ GitHub
constructor
A new instance of GitHub.
- #publish_release! ⇒ Object
Constructor Details
#initialize(cookbook) ⇒ GitHub
Returns a new instance of GitHub.
7 8 9 10 11 12 13 |
# File 'lib/stove/github.rb', line 7 def initialize(cookbook) @cookbook = cookbook Octokit.configure do |config| config.access_token = Stove::Config['github_access_token'] end end |
Instance Attribute Details
#cookbook ⇒ Object (readonly)
Returns the value of attribute cookbook.
5 6 7 |
# File 'lib/stove/github.rb', line 5 def cookbook @cookbook end |
Instance Method Details
#publish_release! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stove/github.rb', line 15 def publish_release! release = Octokit.create_release(repository, cookbook.tag_version, name: cookbook.tag_version, body: changeset, ) asset = Octokit.upload_asset("repos/#{repository}/releases/#{release.id}", cookbook.tarball, content_type: 'application/x-gzip', name: filename, ) Octokit.update_release_asset("repos/#{repository}/releases/assets/#{asset.id}", name: filename, label: 'Download Cookbook', ) end |