class Releasecop::ManifestItem
Constants
- OPTION_KEYS
Attributes
branch[R]
git[R]
name[R]
Public Class Methods
new(repo_name, item)
click to toggle source
# File lib/releasecop/manifest_item.rb, line 6 def initialize(repo_name, item) @repo_name = repo_name @git = item['git'] @name = item['name'] @branch = item['branch'] || 'master' @options = item.select { |k, _v| OPTION_KEYS.include?(k) } end
Public Instance Methods
bare_clone?()
click to toggle source
# File lib/releasecop/manifest_item.rb, line 20 def bare_clone? !@options.key?('hokusai') end
for_rev_range()
click to toggle source
# File lib/releasecop/manifest_item.rb, line 14 def for_rev_range @sha ||= find_tag_pattern_sha if @options['tag_pattern'] @sha ||= find_hokusai_sha if @options['hokusai'] @sha || [@name, @branch].join('/') end
Private Instance Methods
find_hokusai_sha()
click to toggle source
# File lib/releasecop/manifest_item.rb, line 26 def find_hokusai_sha images_output = with_aws_env { `hokusai registry images --limit 1000` } # list as many items as possible tags = images_output.lines.grep(/\d{4}.* \| .*/).map do |l| # lines listing images l.split(' | ').last.gsub(/\e\[(\d+)(\;\d+)*m/, '').split(',').map(&:strip) # tags end tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]} # first SHA-seeming tag matching environment end
find_tag_pattern_sha()
click to toggle source
# File lib/releasecop/manifest_item.rb, line 34 def find_tag_pattern_sha `git for-each-ref --format='%(objectname)' --count=1 --sort=-authordate --sort=-committerdate --sort=-creatordate 'refs/tags/#{@options['tag_pattern']}'`.strip end
with_aws_env() { || ... }
click to toggle source
not thread-safe
# File lib/releasecop/manifest_item.rb, line 39 def with_aws_env(&block) ENV.update( 'AWS_ACCESS_KEY_ID' => @options['aws_access_key_id'], 'AWS_SECRET_ACCESS_KEY' => @options['aws_secret_access_key'] ) yield ensure ENV.update('AWS_ACCESS_KEY_ID' => nil, 'AWS_SECRET_ACCESS_KEY' => nil) end