lib/core/artifact.rb in buildr-0.14.0 vs lib/core/artifact.rb in buildr-0.15.0

- old
+ new

@@ -350,13 +350,13 @@ def group(*args) hash = args.pop args.flatten.map { |id| artifact :group=>hash[:under], :version=>hash[:version], :id=>id } end - # Creates and return a task that will deploy all the specified - # artifacts and files. Specify the deployment server by passing it - # as the last argument (must be a hash). + # Deploys all the specified artifacts/files. Specify the deployment + # server by passing a hash as the last argument, or have it use + # repositories.deploy_to. # # For example: # deploy(*process.packages, :url=>"sftp://example.com/var/www/maven") def deploy(*args) # Where do we release to? @@ -366,27 +366,25 @@ options = repositories.deploy_to options = { :url=>options.to_s } unless Hash === options end url = options[:url] options = options.reject { |k,v| k === :url } - fail "Don't know where to release, specify a URL or use repositories.deploy_to = url|hash" if url.blank? + fail "Don't know where to deploy, perhaps you forgot to set repositories.deploy_to" if url.blank? - # Arguments are artifacts and types so we depend on them. - task(url=>args).enhance do |task| - Transports.perform url, options do |session| - args.each do |artifact| - if artifact.respond_to?(:to_spec) - # Upload artifact relative to base URL, need to create path before uploading. - puts "Deploying #{artifact.to_spec}" if verbose - spec = artifact.to_spec_hash - path = spec[:group].gsub(".", "/") + "/#{spec[:id]}/#{spec[:version]}/" - session.mkpath path - session.upload artifact.to_s, path + Artifact.hash_to_file_name(spec) - else - # Upload artifact to URL. - puts "Deploying #{artifact}" if verbose - session.upload artifact, File.basename(artifact) - end + args.each { |arg| arg.invoke if arg.respond_to?(:invoke) } + Transports.perform url, options do |session| + args.each do |artifact| + if artifact.respond_to?(:to_spec) + # Upload artifact relative to base URL, need to create path before uploading. + puts "Deploying #{artifact.to_spec}" if verbose + spec = artifact.to_spec_hash + path = spec[:group].gsub(".", "/") + "/#{spec[:id]}/#{spec[:version]}/" + session.mkpath path + session.upload artifact.to_s, path + Artifact.hash_to_file_name(spec) + else + # Upload artifact to URL. + puts "Deploying #{artifact}" if verbose + session.upload artifact, File.basename(artifact) end end end end