You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by la...@apache.org on 2008/09/14 21:27:46 UTC
svn commit: r695270 - in /incubator/buildr/trunk: lib/buildr/core/build.rb
spec/build_spec.rb
Author: lacton
Date: Sun Sep 14 12:27:45 2008
New Revision: 695270
URL: http://svn.apache.org/viewvc?rev=695270&view=rev
Log:
More consistent user messages
Modified:
incubator/buildr/trunk/lib/buildr/core/build.rb
incubator/buildr/trunk/spec/build_spec.rb
Modified: incubator/buildr/trunk/lib/buildr/core/build.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/build.rb?rev=695270&r1=695269&r2=695270&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/build.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/build.rb Sun Sep 14 12:27:45 2008
@@ -140,7 +140,7 @@
# Executes SVN command and returns the output.
def svn(*args)
cmd = 'svn ' + args.map { |arg| arg[' '] ? %Q{"#{arg}"} : arg }.join(' ')
- info cmd
+ trace cmd
`#{cmd}`.tap { fail 'SVN command failed' unless $?.exitstatus == 0 }
end
end
@@ -260,11 +260,6 @@
new_version = this_version.split('.')
yield(new_version)
new_version = new_version.join('.')
- if verbose
- puts 'Upgrading version numbers:' # TODO Add tests on this
- puts " This: #{this_version}"
- puts " Next: #{new_version}"
- end
buildfile = File.read(Buildr.application.buildfile.to_s)
buildfile.gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/, %Q{"#{new_version}"}) }
end
@@ -275,6 +270,7 @@
# Tags the current working copy with the release version number.
def tag_release
version = extract_version
+ info "Tagging release #{version}"
url = tag_url Svn.repo_url, version
Svn.remove url, 'Removing old copy' rescue nil
Svn.copy Dir.pwd, url, "Release #{version}"
@@ -288,6 +284,7 @@
buildfile = change_version { |version| version[-1] = (version[-1].to_i + 1).to_s + '-SNAPSHOT' }
File.open(Buildr.application.buildfile.to_s, 'w') { |file| file.write buildfile }
Svn.commit Buildr.application.buildfile.to_s, "Changed version number to #{extract_version}"
+ info "Current version is now #{extract_version}"
end
end
end
Modified: incubator/buildr/trunk/spec/build_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/build_spec.rb?rev=695270&r1=695269&r2=695270&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/build_spec.rb (original)
+++ incubator/buildr/trunk/spec/build_spec.rb Sun Sep 14 12:27:45 2008
@@ -354,10 +354,10 @@
write 'buildfile', "THIS_VERSION = '1.0.1'"
Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
Svn.stub!(:copy)
+ Svn.stub!(:remove)
end
it 'should tag the working copy' do
- Svn.stub!(:remove)
Svn.should_receive(:copy).with(Dir.pwd, 'http://my.repo.org/foo/tags/1.0.1', 'Release 1.0.1')
Release.send :tag_release
end
@@ -371,16 +371,20 @@
Svn.stub!(:remove).and_raise(RuntimeError)
Release.send :tag_release
end
+
+ it 'should inform the user' do
+ lambda { Release.send :tag_release }.should show_info('Tagging release 1.0.1')
+ end
end
describe Buildr::Release, '#commit_new_snapshot' do
before do
write 'buildfile', 'THIS_VERSION = "1.0.0"'
+ Svn.stub!(:commit)
end
it 'should update the buildfile with a new version number' do
- Svn.stub!(:commit)
Release.send :commit_new_snapshot
file('buildfile').should contain('THIS_VERSION = "1.0.1-SNAPSHOT"')
end
@@ -389,4 +393,8 @@
Svn.should_receive(:commit).with(File.expand_path('buildfile'), 'Changed version number to 1.0.1-SNAPSHOT')
Release.send :commit_new_snapshot
end
+
+ it 'should inform the user of the new version' do
+ lambda { Release.send :commit_new_snapshot }.should show_info('Current version is now 1.0.1-SNAPSHOT')
+ end
end
\ No newline at end of file