diff options
| author | Markus Reiter | 2017-01-23 17:17:50 +0100 |
|---|---|---|
| committer | GitHub | 2017-01-23 17:17:50 +0100 |
| commit | e59ada508727f11464595893783beb914c26f60b (patch) | |
| tree | 795520e45d29052df65c56503c4a6d2983334ef1 /Library/Homebrew/cask/lib/hbc/dsl | |
| parent | 44596696175bef38f3cde07e4f45285c322996b8 (diff) | |
| parent | 2076b494a6233630025acd45d9a5766bd6bb785d (diff) | |
| download | brew-1.1.8.tar.bz2 | |
Merge pull request #1894 from reitermarkus/appcast-checkpoint1.1.8
Add internal command to calculate appcast checkpoint.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/dsl')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/dsl/appcast.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb b/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb index 2f1245d3d..e27870622 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb @@ -1,3 +1,5 @@ +require "hbc/system_command" + module Hbc class DSL class Appcast @@ -9,6 +11,20 @@ module Hbc @checkpoint = @parameters[:checkpoint] end + def calculate_checkpoint + result = SystemCommand.run("/usr/bin/curl", args: ["--compressed", "--location", "--user-agent", URL::FAKE_USER_AGENT, @uri], print_stderr: false) + + checkpoint = if result.success? + processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}m, "") + Digest::SHA2.hexdigest(processed_appcast_text) + end + + { + checkpoint: checkpoint, + command_result: result, + } + end + def to_yaml [@uri, @parameters].to_yaml end |
