lib/core/build.rb in buildr-1.2.5 vs lib/core/build.rb in buildr-1.2.6
- old
+ new
@@ -111,11 +111,13 @@
# make()
#
# Make a release.
def make()
check
- version = with_next_version { |filename, version| sh "#{command} clean upload DEBUG=no --buildfile #{filename}" }
+ options = ['--buildfile', filename, 'DEBUG=no']
+ options << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?
+ version = with_next_version { |filename, version| sh "#{command} clean upload #{option.join(' ')}" }
tag version
commit version + "-SNAPSHOT"
end
protected
@@ -128,10 +130,11 @@
# check()
#
# Check that we don't have any local changes in the working copy. Fails if it finds anything
# in the working copy that is not checked into source control.
def check()
+ fail "SVN URL must end with 'trunk' or 'branches/...'" unless svn_url =~ /(trunk)|(branches.*)$/
# Status check reveals modified file, but also SVN externals which we can safely ignore.
status = svn("status", "--ignore-externals").reject { |line| line =~ /^X\s/ }
fail "Uncommitted SVN files violate the First Principle Of Release!\n#{status}" unless
status.empty?
end
@@ -199,11 +202,11 @@
# :call-seq:
# tag(version)
#
# Tags the current working copy with the release version number.
def tag(version)
- url = svn("info").scan(/URL: (.*)/)[0][0].sub(/trunk$/, "tags/#{version}")
+ url = svn_url.sub(/(trunk$)|(branches.*)$/, "tags/#{version}")
svn "remove", url, "-m", "Removing old copy" rescue nil
svn "copy", Dir.pwd, url, "-m", "Release #{version}"
end
# :call-seq:
@@ -223,9 +226,14 @@
# Executes SVN command and returns the output.
def svn(*args)
cmd = "svn " + args.map { |arg| arg[" "] ? %Q{"#{arg}"} : arg }.join(" ")
puts cmd if verbose
`#{cmd}`.tap { fail "SVN command failed" unless $?.exitstatus == 0 }
+ end
+
+ # Return the current SVN URL
+ def svn_url
+ url = svn("info").scan(/URL: (.*)/)[0][0]
end
end
end