lib/homebrew_automation/workflow.rb
# Gather and publish bottles.
#
# Look around on Bintray to see what Bottles we've already built and
# uploaded (as such "gathering" the bottles), then push new commits into
# the {#tap} repository to make an existing Formula aware of the Bottles
# we're gathered (as such "publishing" the bottles).
#
# @param sdist [SourceDist]
# @param tap [Tap]
# @param formula_name [String] the name of the formula in the Tap
# @param bversion [Bintray::Version]
# @param git [HomebrewAutomation::Git]
# @param logger [HomebrewAutomation::Logger]
# @return [NilClass]
Gather and publish bottles.
Look around on Bintray to see what Bottles we've already built and
uploaded (as such "gathering" the bottles), then push new commits into
the {#tap} repository to make an existing Formula aware of the Bottles
we're gathered (as such "publishing" the bottles).
Gather and publish bottles . Look around on Bintray to see what Bottles we ' ve already built and uploaded ( as such " gathering " the bottles ) then push new commits into the { #tap } repository to make an existing Formula aware of the Bottles we ' re gathered ( as such " publishing " the bottles ) .
def gather_and_publish_bottles!(sdist, tap, formula_name, bversion, git, logger)
      logger.info!(
        "Hello, this is HomebrewAutomation! I will browse through your Bintray to " \
        "see if there may be Bottles built earlier for your Formula, and update your " \
        "Tap to refer to them.")
      logger.info!(
        "I will also update the source tarball of your Formula in your Tap, " \
        "effectively releasing a new version of your Formula.")
      git.with_clone!(tap.url, tap.repo) do
        tap.on_formula! formula_name do |formula|
          logger.info!("Let's see if any files on your Bintray look like Bottles.")
          bottles = bversion.gather_bottles
          logger.info!("Found bottles: #{bottles}")
          new_formula = bottles.reduce(
            formula.
            put_sdist(sdist.url, sdist.sha256).
            rm_all_bottles
          ) do |f, (os, checksum)|
            f.put_bottle(os, checksum)
          end
          new_formula
        end
        git.config!
        git.commit_am! "Add bottles for #{formula_name}@#{bversion.version_name}"
        logger.info!("I've refered to the Bottles I found in this new commit. Let's push to your Tap!")
        git.push!
      end
      logger.info!("All done!")
    end
def gather_and_publish_bottles! ( sdist , tap , formula_name , bversion , git , logger ) logger . info! ( "Hello, this is HomebrewAutomation! I will browse through your Bintray to " "see if there may be Bottles built earlier for your Formula, and update your " "Tap to refer to them." ) logger . info! ( "I will also update the source tarball of your Formula in your Tap, " "effectively releasing a new version of your Formula." ) git . with_clone! ( tap . url , tap . repo ) do tap . on_formula! formula_name do | formula | logger . info! ( "Let's see if any files on your Bintray look like Bottles." ) bottles = bversion . gather_bottles logger . info! ( "Found bottles: #{bottles}" ) new_formula = bottles . reduce ( formula . put_sdist ( sdist . url , sdist . sha256 ) . rm_all_bottles ) do | f , ( os , checksum ) | f . put_bottle ( os , checksum ) end new_formula end git . config! git . commit_am! "Add bottles for #{formula_name}@#{bversion.version_name}" logger . info! ( "I've refered to the Bottles I found in this new commit. Let's push to your Tap!" ) git . push! end logger . info! ( "All done!" ) end
Gather and publish bottles.
Gather and publish bottles .
None
NilClass
sdist
tap
formula_name
the name of the formula in the Tap
the name of the formula in the Tap
bversion
git
logger
None