class SparkleAppcast::Cli
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/sparkle_appcast/cli.rb, line 8 def self.exit_on_failure? true end
Public Instance Methods
appcast(file)
click to toggle source
# File lib/sparkle_appcast/cli.rb, line 22 def appcast(file) params = {} [ :title, :publish_date, :channel_title, :channel_description, :channel_language ].each do |key| params[key] = options[key] if options[key] && !options[key].empty? end appcast = Appcast.new( Archive.new(file), Signer.new(options[:key]), options[:url], ReleaseNote.new(options[:release_note]), params ) rss = appcast.rss.to_s if options[:output] File.open(options[:output], "w") do |output| output.puts(rss) end else STDOUT.puts(rss) end end
info(file)
click to toggle source
# File lib/sparkle_appcast/cli.rb, line 56 def info(file) bundle_info = if File.file?(file) Archive.new(file).bundle_info else Bundle.new(file).info end include_keys = [] exclude_keys = [] Bundle::INFO_KEYS.each do |key| case options[key] when true include_keys << key when false exclude_keys << key end end keys = if include_keys.empty? Bundle::INFO_KEYS else include_keys end keys = keys - exclude_keys if keys.count > 1 info = {} keys.each do |key| info[key] = bundle_info[key] end puts info.map{|key, value| "#{key} #{value}"}.join("\n") else keys.each do |key| puts bundle_info[key] end end end
markdown(file = nil)
click to toggle source
# File lib/sparkle_appcast/cli.rb, line 106 def markdown(file = nil) text = if file File.read(file) else STDIN.read end puts ReleaseNote.markdown(text) end
sign(file = nil)
click to toggle source
# File lib/sparkle_appcast/cli.rb, line 96 def sign(file = nil) source = if file File.binread(file) else STDIN.read end puts Signer.new(options[:key]).sign(source) end