lib/heirloom/archive/builder.rb in heirloom-0.5.0rc2 vs lib/heirloom/archive/builder.rb in heirloom-0.5.0rc3

- old
+ new

@@ -16,16 +16,19 @@ sdb.create_domain @domain end def build(args) @source = args[:directory] ||= '.' + @secret = args[:secret] directory = Directory.new :path => @source, :exclude => args[:exclude], :config => @config - return false unless directory.build_artifact_from_directory + unless directory.build_artifact_from_directory :secret => @secret + return false + end @local_build = directory.local_build create_artifact_record @@ -34,57 +37,57 @@ @logger.info "Build complete." @local_build end - def cleanup - @logger.info "Cleaning up local build #{@local_build}." - File.delete @local_build - end - private def add_git_commit git = GitDirectory.new(:path => @source) commit = git.commit @id if commit add_git_commit_to_artifact_record commit else - @logger.warn "Could not find Git sha: #{@id}." + @logger.warn "Could not load Git sha '#{@id}' in '#{@source}'." end end def add_git_commit_to_artifact_record(commit) attributes = { 'sha' => @id, 'abbreviated_sha' => commit.id_abbrev, - 'message' => commit.message, + 'message' => commit.message.gsub("\n"," "), 'author' => commit.author.name } attributes.each_pair do |k, v| @logger.info "Git #{k}: #{v}" end sdb.put_attributes @domain, @id, attributes end def create_artifact_record - attributes = { 'built_by' => "#{user}@#{hostname}", - 'built_at' => Time.now.utc.iso8601, - 'id' => @id } + attributes = { 'built_by' => "#{user}@#{hostname}", + 'built_at' => Time.now.utc.iso8601, + 'encrypted' => encrypted?, + 'id' => @id } @logger.info "Create artifact record #{@id}." sdb.put_attributes @domain, @id, attributes end - def sdb - @sdb ||= AWS::SimpleDB.new :config => @config + def encrypted? + @secret != nil end def user ENV['USER'] end def hostname Socket.gethostname + end + + def sdb + @sdb ||= AWS::SimpleDB.new :config => @config end end end