github.com/pquerna/agent@v2.1.8+incompatible/scripts/utils/update-homebrew-formula.rb (about)

     1  #!/usr/bin/env ruby
     2  
     3  # Reads the formula from STDIN and prints an updated version
     4  
     5  # The formula has these sections, which need to be updated:
     6  #
     7  #   stable do
     8  #     version "..."
     9  #     url     "..."
    10  #     sha1    "..."
    11  #   end
    12  #
    13  #   devel do
    14  #     version "..."
    15  #     url     "..."
    16  #     sha1    "..."
    17  #   end
    18  
    19  release, version, url, sha1 = ARGV
    20  
    21  print $stdin.read.sub(%r{
    22    (
    23      #{release} \s+ do      .*?
    24        version \s+ ").*?("  .*?
    25        url     \s+ ").*?("  .*?
    26        sha1    \s+ ").*?("  .*?
    27      end
    28    )
    29  }xm, "\\1#{version}\\2#{url}\\3#{sha1}\\4")