Class: HomebrewAutomation::Bottle
- Inherits:
-
Object
- Object
- HomebrewAutomation::Bottle
- Defined in:
- lib/homebrew_automation/bottle.rb
Overview
Metadata for building a Bottle for a Homebrew package
Defined Under Namespace
Classes: Error
Class Method Summary collapse
Instance Method Summary collapse
-
#build! {|filename, contents| ... } ⇒ NilClass
Build the bottle and get a binary tarball suitable for upload to Bintray.
-
#initialize(tap_name, tap_url, formula_name, os_name, keep_tmp: false, brew: Brew, bottle_finder: Bottle) ⇒ Bottle
constructor
A new instance of Bottle.
Constructor Details
#initialize(tap_name, tap_url, formula_name, os_name, keep_tmp: false, brew: Brew, bottle_finder: Bottle) ⇒ Bottle
Returns a new instance of Bottle.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/homebrew_automation/bottle.rb', line 29 def initialize( tap_name, tap_url, formula_name, os_name, keep_tmp: false, brew: Brew, bottle_finder: Bottle) @tap_name = tap_name @tap_url = tap_url @formula_name = formula_name @os_name = os_name @keep_tmp = keep_tmp @brew = brew @bottle_finder = bottle_finder end |
Class Method Details
.read_json! ⇒ Object
67 68 69 70 |
# File 'lib/homebrew_automation/bottle.rb', line 67 def self.read_json! json_filename = Dir['*.bottle.json'].first File.read(json_filename) end |
.read_tarball!(minus_minus) ⇒ Object
72 73 74 |
# File 'lib/homebrew_automation/bottle.rb', line 72 def self.read_tarball!(minus_minus) File.read(minus_minus) end |
Instance Method Details
#build! {|filename, contents| ... } ⇒ NilClass
Build the bottle and get a binary tarball suitable for upload to Bintray
Unless you’ve already run brew install –build-bottle on that Formula on your system before, the returned effect would take ages to run (looking at about 30-60 minutes).
57 58 59 60 61 62 63 64 65 |
# File 'lib/homebrew_automation/bottle.rb', line 57 def build!(&block) raise StandardError, "Bottle#build! expects a block" unless block call_brew! do json_str = @bottle_finder.read_json! (minus_minus, filename) = parse_for_tarball_path(json_str) contents = @bottle_finder.read_tarball! minus_minus block.call(filename, contents) end end |