You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/03/05 06:48:51 UTC
svn commit: r919303 [2/3] - in /buildr/trunk: addon/buildr/ doc/scripts/
lib/buildr/ lib/buildr/core/ lib/buildr/groovy/ lib/buildr/ide/
lib/buildr/java/ lib/buildr/packaging/ lib/buildr/scala/ rakelib/ spec/
spec/addon/ spec/core/ spec/groovy/ spec/id...
Modified: buildr/trunk/lib/buildr/packaging/archive.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/archive.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/archive.rb (original)
+++ buildr/trunk/lib/buildr/packaging/archive.rb Fri Mar 5 05:48:49 2010
@@ -25,7 +25,7 @@
# Returns the archive from this path.
attr_reader :root
-
+
def initialize(root, path)
@root = root
@path = path.empty? ? path : "#{path}/"
@@ -62,7 +62,7 @@
def include(*args)
options = args.pop if Hash === args.last
files = args.flatten
- raise 'AchiveTask.include() values should not include nil' if files.include? nil
+ raise 'AchiveTask.include() values should not include nil' if files.include? nil
if options.nil? || options.empty?
@includes.include *files.flatten
@@ -76,7 +76,7 @@
elsif options[:from]
raise 'You can only use the :from option in combination with the :path option' unless options.size == 1
raise 'You cannot use the :from option with file names' unless files.empty?
- fail 'AchiveTask.include() :from value should not be nil' if [options[:from]].flatten.include? nil
+ fail 'AchiveTask.include() :from value should not be nil' if [options[:from]].flatten.include? nil
[options[:from]].flatten.each { |path| include_as path.to_s, '.' }
elsif options[:merge]
raise 'You can only use the :merge option in combination with the :path option' unless options.size == 1
@@ -92,7 +92,7 @@
# :call-seq:
# exclude(*files) => self
def exclude(*files)
- files = files.flatten.map(&:to_s)
+ files = files.flatten.map(&:to_s)
@excludes |= files
@excludes |= files.reject { |f| f =~ /\*$/ }.map { |f| "#{f}/*" }
self
@@ -301,13 +301,13 @@
# :call-seq:
# clean => self
- #
- # Removes all previously added content from this archive.
+ #
+ # Removes all previously added content from this archive.
# Use this method if you want to remove default content from a package.
# For example, package(:jar) by default includes compiled classes and resources,
# using this method, you can create an empty jar and afterwards add the
# desired content to it.
- #
+ #
# package(:jar).clean.include path_to('desired/content')
def clean
@paths = { '' => Path.new(self, '') }
@@ -351,18 +351,18 @@
fail "AchiveTask.include() called with nil values" if files.include? nil
@paths[''].include *files if files.compact.size > 0
self
- end
+ end
alias :add :include
alias :<< :include
-
+
# :call-seq:
# exclude(*files) => self
- #
+ #
# Excludes files and returns self. Can be used in combination with include to prevent some files from being included.
def exclude(*files)
@paths[''].exclude *files
self
- end
+ end
# :call-seq:
# merge(*files) => Merge
@@ -375,7 +375,7 @@
# zip(..).merge('src.zip').include('module1/*')
def merge(*files)
@paths[''].merge *files
- end
+ end
# :call-seq:
# path(name) => Path
@@ -436,7 +436,7 @@
@prerequisites |= @paths.collect { |name, path| path.sources }.flatten
super
end
-
+
def needed? #:nodoc:
return true unless File.exist?(name)
# You can do something like:
Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Fri Mar 5 05:48:49 2010
@@ -44,14 +44,14 @@
def included(mod)
mod.extend self
end
-
+
def extend_object(base)
base.instance_eval { alias :install_old :install } if base.respond_to? :install
base.instance_eval { alias :uninstall_old :uninstall } if base.respond_to? :uninstall
base.instance_eval { alias :upload_old :upload } if base.respond_to? :upload
super
end
-
+
def extended(base)
#We try to keep the previous instance methods defined on the base instance if there were ones.
base.instance_eval { alias :install :install_old } if base.respond_to? :install_old
Modified: buildr/trunk/lib/buildr/packaging/artifact_search.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact_search.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact_search.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact_search.rb Fri Mar 5 05:48:49 2010
@@ -22,7 +22,7 @@
# Search best artifact version from remote repositories
module ArtifactSearch
extend self
-
+
def include(method = nil)
(@includes ||= []).tap { push method if method }
end
@@ -61,11 +61,11 @@
"\n You may need to use an specific version instead of a requirement" unless result
spec.merge :version => result
end
-
+
def requirement?(spec)
VersionRequirement.requirement?(spec[:version])
end
-
+
private
def search_methods
[].tap do
@@ -90,7 +90,7 @@
in_memory
end
end
-
+
def local_versions(spec, repo)
path = (spec[:group].split(/\./) + [spec[:id]]).flatten.join('/')
Dir[File.expand_path(path + "/*", repo)].map { |d| d.pathmap("%f") }.sort.reverse
@@ -119,7 +119,7 @@
vers << a.innerHTML.chop if a.innerHTML[-1..-1] == '/'
vers
}.sort.reverse
- else
+ else
fail "Don't know how to parse #{from}: \n#{xml.inspect}"
end
end
Modified: buildr/trunk/lib/buildr/packaging/gems.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/gems.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/gems.rb (original)
+++ buildr/trunk/lib/buildr/packaging/gems.rb Fri Mar 5 05:48:49 2010
@@ -59,7 +59,7 @@
def create_from(file_map)
spec.mark_version
spec.validate
-
+
File.open(name, 'w') do |io|
Gem::Package.open(io, 'w', nil) do |pkg|
pkg.metadata = spec.to_yaml
Modified: buildr/trunk/lib/buildr/packaging/tar.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/tar.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/tar.rb (original)
+++ buildr/trunk/lib/buildr/packaging/tar.rb Fri Mar 5 05:48:49 2010
@@ -54,13 +54,13 @@
def entry(entry_name)
Buildr::TarEntry.new(self, entry_name)
end
-
+
def entries() #:nodoc:
tar_entries = nil
with_uncompressed_tar { |tar| tar_entries = tar.entries }
tar_entries
end
-
+
# :call-seq:
# with_uncompressed_tar { |tar_entries| ... }
#
@@ -73,7 +73,7 @@
Archive::Tar::Minitar.open(name, &block)
end
end
-
+
private
def create_from(file_map)
@@ -110,15 +110,15 @@
end
end
-
-
+
+
class TarEntry #:nodoc:
-
+
def initialize(tar_task, entry_name)
@tar_task = tar_task
@entry_name = entry_name
end
-
+
# :call-seq:
# contain?(*patterns) => boolean
#
@@ -129,7 +129,7 @@
patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
all? { |pattern| content =~ pattern }
end
-
+
# :call-seq:
# empty?() => boolean
#
@@ -137,7 +137,7 @@
def empty?()
read_content_from_tar.nil?
end
-
+
# :call-seq:
# exist() => boolean
#
@@ -147,13 +147,13 @@
@tar_task.with_uncompressed_tar { |tar| exist = tar.any? { |entry| entry.name == @entry_name } }
exist
end
-
+
def to_s #:nodoc:
@entry_name
end
-
+
private
-
+
def read_content_from_tar
content = Errno::ENOENT.new("No such file or directory - #{@entry_name}")
@tar_task.with_uncompressed_tar do |tar|
@@ -163,7 +163,7 @@
content
end
end
-
+
end
Modified: buildr/trunk/lib/buildr/scala/doc.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/doc.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/doc.rb (original)
+++ buildr/trunk/lib/buildr/scala/doc.rb Fri Mar 5 05:48:49 2010
@@ -5,7 +5,7 @@
module Doc
class Scaladoc < Base
specify :language => :scala, :source_ext => 'scala'
-
+
def generate(sources, target, options = {})
cmd_args = [ '-d', target, Buildr.application.options.trace ? '-verbose' : '' ]
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
@@ -37,21 +37,21 @@
end
end
end
-
+
class VScaladoc < Base
VERSION = '1.2-SNAPSHOT'
Buildr.repositories.remote << 'http://scala-tools.org/repo-snapshots'
-
+
class << self
def dependencies
[ "org.scala-tools:vscaladoc:jar:#{VERSION}" ]
end
end
-
+
Java.classpath << dependencies
-
+
specify :language => :scala, :source_ext => 'scala'
-
+
def generate(sources, target, options = {})
cmd_args = [ '-d', target, (Buildr.application.options.trace ? '-verbose' : ''),
'-sourcepath', project.compile.sources.join(File::PATH_SEPARATOR) ]
Modified: buildr/trunk/lib/buildr/shell.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/shell.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/shell.rb (original)
+++ buildr/trunk/lib/buildr/shell.rb Fri Mar 5 05:48:49 2010
@@ -19,7 +19,7 @@
class << self
def add(p)
@providers ||= {}
-
+
if p.lang == :none
@providers[:none] ||= []
@providers[:none] << p
@@ -28,11 +28,11 @@
end
end
alias :<< :add
-
+
def providers
@providers ||= {}
end
-
+
def each
providers.each do |lang, p|
if lang == :none
@@ -46,51 +46,51 @@
end
end
end
-
+
module Shell
class Base
attr_reader :project
-
+
class << self
def lang
:none
end
-
+
def to_sym
@symbol ||= name.split('::').last.downcase.to_sym
end
end
-
+
def initialize(project)
@project = project
end
-
+
def build?
true
end
-
+
def launch
fail 'Not implemented'
end
end
-
+
module JavaRebel
def rebel_home
unless @rebel_home
@rebel_home = ENV['REBEL_HOME'] or ENV['JREBEL'] or ENV['JREBEL_HOME']
-
+
if @rebel_home and File.directory? @rebel_home
@rebel_home += File::SEPARATOR + 'jrebel.jar'
end
end
-
+
if @rebel_home and File.exists? @rebel_home
@rebel_home
else
nil
end
end
-
+
def rebel_args
if rebel_home
[
@@ -101,44 +101,44 @@
[]
end
end
-
+
def rebel_props(project)
{}
end
end
end
-
+
module ShellExtension
include Extension
-
+
first_time do
Project.local_task 'shell'
-
+
ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
end
-
+
before_define(:shell => :compile) do |project|
ShellProviders.each do |p|
name = p.to_sym
-
+
trace "Defining task #{project.name}:shell:#{name}"
-
+
p_inst = p.new project
deps = if p_inst.build? then [:compile] else [] end
-
+
project.task "shell:#{name}" => deps do
trace "Launching #{name} shell"
p_inst.launch
end
end
end
-
+
after_define(:shell => :compile) do |project|
default_shell = project.shell.using
-
+
if default_shell
dep = "shell:#{default_shell.to_sym}"
-
+
trace "Defining task shell based on #{dep}"
project.task :shell => dep
else
@@ -147,12 +147,12 @@
end
end
end
-
+
class ShellConfig
def initialize(project)
@project = project
end
-
+
def using(*args)
if args.size > 0
@using ||= args.first
@@ -160,20 +160,20 @@
@using ||= find_shell_task
end
end
-
+
private
def find_shell_task
lang = @project.compile.language
ShellProviders.providers[lang]
end
end
-
+
# TODO temporary hack
def shell
@shell ||= ShellConfig.new self
end
end
-
+
class Project
include ShellExtension
end
Modified: buildr/trunk/rakelib/all-in-one.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/all-in-one.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/all-in-one.rake (original)
+++ buildr/trunk/rakelib/all-in-one.rake Fri Mar 5 05:48:49 2010
@@ -55,7 +55,7 @@
# Install Buildr gem and dependencies
lambda do
puts "Install Buildr gem ..."
- sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
+ sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
'--no-rdoc', '--no-ri'
puts "[X] Install Buildr gem"
end.call
Modified: buildr/trunk/rakelib/checks.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/checks.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/checks.rake (original)
+++ buildr/trunk/rakelib/checks.rake Fri Mar 5 05:48:49 2010
@@ -18,7 +18,7 @@
task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
puts "Checking that files contain the Apache license ... "
required = task.prerequisites.select { |fn| File.file?(fn) }
- missing = required.reject { |fn|
+ missing = required.reject { |fn|
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
map { |match| match.compact }.flatten.join("\n")
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
Modified: buildr/trunk/rakelib/package.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/package.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/package.rake (original)
+++ buildr/trunk/rakelib/package.rake Fri Mar 5 05:48:49 2010
@@ -67,7 +67,7 @@
cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
puts "Generating gem index ..."
sh 'gem', 'generate_index', '--directory', '_snapshot'
- puts "Copying gem and index back to Apache"
+ puts "Copying gem and index back to Apache"
sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
end
task(:clobber) { rm_rf '_snapshot' }
Modified: buildr/trunk/rakelib/release.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/release.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/release.rake (original)
+++ buildr/trunk/rakelib/release.rake Fri Mar 5 05:48:49 2010
@@ -66,7 +66,7 @@
# Create an SVN tag for this release.
lambda do
info = `svn info` + `git svn info` # Using either svn or git-svn
- if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
+ if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
unless url == new_url
sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
@@ -83,7 +83,7 @@
# Update CHANGELOG to next release number.
- lambda do
+ lambda do
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
@@ -92,7 +92,7 @@
end
puts "[X] Updated CHANGELOG and added entry for next release"
end.call
-
+
# Update source files to next release number.
lambda do
@@ -101,7 +101,7 @@
ver_file = "lib/#{spec.name}.rb"
if File.exist?(ver_file)
- modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
+ modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
File.open ver_file, 'w' do |file|
file.write modified
end
@@ -110,7 +110,7 @@
spec_file = "#{spec.name}.gemspec"
if File.exist?(spec_file)
- modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
+ modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
File.open spec_file, 'w' do |file|
file.write modified
end
@@ -118,7 +118,7 @@
end
end.call
-
+
# Prepare release announcement email.
lambda do
changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
Modified: buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/rspec.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/rspec.rake (original)
+++ buildr/trunk/rakelib/rspec.rake Fri Mar 5 05:48:49 2010
@@ -22,7 +22,7 @@
Spec::Rake::SpecTask.new :spec=>['_reports', :compile] do |task|
task.spec_files = FileList['spec/**/*_spec.rb']
task.spec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
- task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
+ task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
task.spec_opts << '--colour' if $stdout.isatty
end
file('_reports/specs.html') { task(:spec).invoke }
@@ -30,14 +30,14 @@
desc 'Run all failed examples from previous run'
Spec::Rake::SpecTask.new :failed do |task|
task.spec_files = FileList['spec/**/*_spec.rb']
- task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
+ task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
task.spec_opts << '--colour' if $stdout.isatty
end
desc 'Run RSpec and generate Spec and coverage reports (slow)'
Spec::Rake::SpecTask.new :coverage=>['_reports', :compile] do |task|
task.spec_files = FileList['spec/**/*_spec.rb']
- task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
+ task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
task.spec_opts << '--colour' if $stdout.isatty
task.rcov = true
task.rcov_dir = '_reports/coverage'
Modified: buildr/trunk/rakelib/stage.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/stage.rake?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/rakelib/stage.rake (original)
+++ buildr/trunk/rakelib/stage.rake Fri Mar 5 05:48:49 2010
@@ -73,7 +73,7 @@
lambda do
puts "[!] Make sure you have admin privileges to make a release on RubyForge"
rubyforge = RubyForge.new.configure
- rubyforge.login
+ rubyforge.login
rubyforge.scrape_project(spec.name)
end.call
@@ -106,7 +106,7 @@
task(:package).invoke
mkpath '_staged/dist'
FileList['pkg/*.{gem,zip,tgz}'].each do |source|
- pkg = source.pathmap('_staged/dist/%n%x')
+ pkg = source.pathmap('_staged/dist/%n%x')
cp source, pkg
bytes = File.open(pkg, 'rb') { |file| file.read }
File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
@@ -162,7 +162,7 @@
sh 'rsync', '--progress', '--recursive', '_staged/', url
puts "[X] Uploaded _staged directory to #{url}"
end.call
-
+
# Prepare a release vote email. In the distant future this will also send the
# email for you and vote on it.
Modified: buildr/trunk/spec/addon/drb_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/addon/drb_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/addon/drb_spec.rb (original)
+++ buildr/trunk/spec/addon/drb_spec.rb Fri Mar 5 05:48:49 2010
@@ -12,16 +12,16 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
-
-
+
+
require File.expand_path('../spec_helpers', File.dirname(__FILE__))
require 'stringio'
Sandbox.require_optional_extension 'buildr/drb'
-describe Buildr::DRbApplication do
+describe Buildr::DRbApplication do
- module DRbHelper
+ module DRbHelper
attr_accessor :app, :drb, :cfg
def use_stdio(stdin = nil, stdout = nil, stderr = nil)
@@ -30,7 +30,7 @@
stderr ||= StringIO.new
cfg.update :in => stdin, :out => stdout, :err => stderr
end
-
+
def remote_run(*argv)
cfg.update :argv => argv
drb.remote_run(cfg)
@@ -48,7 +48,7 @@
$stdout.puts "#{t.name} from #{t.source}"
end
- task('hello') do
+ task('hello') do
$stdout.puts 'hi'
end
@@ -81,7 +81,7 @@
end
include DRbHelper
-
+
before(:each) do
@in, @out, @err = $stdin, $stdout, $stderr
@cfg = {
@@ -96,7 +96,7 @@
after(:each) do
$stdin, $stdout, $stderr = @in, @out, @err
end
-
+
describe '.run' do
it 'starts server if no server is running' do
drb.should_receive(:connect).and_raise DRb::DRbConnError
@@ -114,11 +114,11 @@
end
describe '.remote_run' do
-
+
describe 'stdout' do
- it 'is redirected to client' do
+ it 'is redirected to client' do
use_stdio
- Buildr.application.should_receive(:remote_run) do
+ Buildr.application.should_receive(:remote_run) do
$stdout.puts "HELLO"
end
remote_run
@@ -126,10 +126,10 @@
end
end
- describe 'stderr' do
+ describe 'stderr' do
it 'is redirected to client' do
use_stdio
- Buildr.application.should_receive(:remote_run) do
+ Buildr.application.should_receive(:remote_run) do
$stderr.puts "HELLO"
end
remote_run
@@ -142,7 +142,7 @@
use_stdio
cfg[:in].should_receive(:gets).and_return("HELLO\n")
result = nil
- Buildr.application.should_receive(:remote_run) do
+ Buildr.application.should_receive(:remote_run) do
result = $stdin.gets
end
remote_run
@@ -152,7 +152,7 @@
describe 'server ARGV' do
it 'is replaced with client argv' do
- Buildr.application.should_receive(:remote_run) do
+ Buildr.application.should_receive(:remote_run) do
ARGV.should eql(['hello'])
end
remote_run 'hello'
@@ -164,7 +164,7 @@
app.instance_eval { @rakefile = nil }
write_buildfile
end
-
+
it 'should load the buildfile' do
app.should_receive(:top_level)
lambda { remote_run }.should run_task('foo')
@@ -172,14 +172,14 @@
end
describe 'with unmodified buildfile' do
-
- before(:each) do
+
+ before(:each) do
write_buildfile
app.options.rakelib = []
app.send :load_buildfile
drb.save_snapshot(app)
end
-
+
it 'should not reload the buildfile' do
app.should_not_receive(:reload_buildfile)
app.should_receive(:top_level)
@@ -235,12 +235,12 @@
remote_run 'foo:empty'
app.instance_eval { @rules.size }.should eql(orig)
end
-
+
end
describe 'with modified buildfile' do
-
- before(:each) do
+
+ before(:each) do
write_buildfile
app.options.rakelib = []
app.send :load_buildfile
@@ -251,12 +251,12 @@
$stdout.puts "#{t.name} from #{t.source}"
end
define('foo') do
- task('hello') do
+ task('hello') do
$stdout.puts 'bye'
end
task('empty')
define('bar') do
-
+
end
end
}
@@ -277,7 +277,7 @@
remote_run
app.lookup('foo:delete_me').should be_nil
end
-
+
it 'should redefine tasks actions' do
actions = app.lookup('foo:empty').instance_eval { @actions }
actions.should be_empty # no action
Modified: buildr/trunk/spec/core/build_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/build_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/build_spec.rb (original)
+++ buildr/trunk/spec/core/build_spec.rb Fri Mar 5 05:48:49 2010
@@ -169,7 +169,7 @@
@project.layout[:target] = 'baz'
@project.target.should eql('baz')
end
-
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
Buildr::VERSION.should < '1.5'
end
@@ -194,7 +194,7 @@
@project.layout[:reports] = 'baz'
@project.reports.should eql('baz')
end
-
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
Buildr::VERSION.should < '1.5'
end
@@ -221,7 +221,7 @@
#
# modified: lib/buildr.rb
# modified: spec/buildr_spec.rb
-#
+#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
@@ -232,7 +232,7 @@
it 'should reject a dirty repository, Git 1.4.3 or higher' do
Git.should_receive(:`).with('git status').and_return <<-EOF
-# On branch master
+# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
@@ -381,7 +381,7 @@
@release.should_receive(:ruby).with('-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', File.expand_path('buildfile.next'),
'--environment', 'development', 'clean', 'upload', 'DEBUG=no')
end
-
+
it 'should tag a release with the release version' do
@release.stub!(:update_version_to_next)
@release.should_receive(:tag_release).with('1.0.0')
@@ -412,7 +412,7 @@
@release.stub!(:tag_release)
@release.make
file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
- end
+ end
end
describe '#resolve_tag' do
@@ -424,7 +424,7 @@
Release.tag_name = 'first'
@release.send(:resolve_tag).should == 'first'
end
-
+
it 'should use tag returned by tag_name if tag_name is a proc' do
Release.tag_name = lambda { |version| "buildr-#{version}" }
@release.send(:resolve_tag).should == 'buildr-1.0.0'
@@ -505,9 +505,9 @@
@release.should_receive(:message).and_return('Here is my custom message')
@release.update_version_to_next
end
-
+
it 'should use the commit message returned by commit_message if commit_message is a proc' do
- Release.commit_message = lambda { |new_version|
+ Release.commit_message = lambda { |new_version|
new_version.should == '1.0.1-SNAPSHOT'
"increment version number to #{new_version}"
}
@@ -543,7 +543,7 @@
it 'should accept a git repo' do
FileUtils.mkdir '.git'
FileUtils.touch File.join('.git', 'config')
- GitRelease.applies_to?.should be_true
+ GitRelease.applies_to?.should be_true
end
end
@@ -637,7 +637,7 @@
it 'should accept a git repo' do
FileUtils.touch '.svn'
- SvnRelease.applies_to?.should be_true
+ SvnRelease.applies_to?.should be_true
end
end
Modified: buildr/trunk/spec/core/cc_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/cc_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/cc_spec.rb (original)
+++ buildr/trunk/spec/core/cc_spec.rb Fri Mar 5 05:48:49 2010
@@ -19,32 +19,32 @@
module CCHelper
def setup_cc
project = define('foo')
-
+
cc = project.cc
project.stub!(:task).with(:cc).and_return(cc)
-
+
compile = mock 'compile'
project.stub!(:task).with(:compile).and_return(compile)
-
+
test_compile = mock 'test:compile'
project.stub!(:task).with('test:compile').and_return(test_compile)
-
+
filter = mock('resources').tap do |resources|
project.stub!(:task).with(:resources).and_return(resources)
-
+
back = mock 'filter'
resources.stub!(:filter).and_return(back)
-
+
back
end
-
+
sources
tests
resources
-
+
[ project, compile, test_compile, filter ]
end
-
+
def sources
@sources ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
@@ -63,47 +63,47 @@
describe Buildr::CCTask do
include CCHelper
-
+
it 'should default to a delay of 0.2' do
define('foo').cc.delay.should == 0.2
end
-
+
it 'should compile and test:compile on initial start' do
project, compile, test_compile, filter = setup_cc
-
+
compile.should_receive :invoke
test_compile.should_receive :invoke
filter.should_not_receive :run
-
+
thread = Thread.new do
project.cc.invoke
end
-
+
sleep 0.5
-
+
thread.exit
end
-
+
it 'should detect change to a file' do
project, compile, test_compile, filter = setup_cc
-
+
thread = Thread.new do
project.cc.invoke
end
-
+
sleep 0.5
-
+
compile.should_receive :reenable
compile.should_receive :invoke
-
+
test_compile.should_not_receive :reenable
test_compile.should_not_receive :invoke
-
+
filter.should_not_receive :run
-
+
touch sources.first
sleep(project.cc.delay * 5)
-
+
thread.exit
end
end
Modified: buildr/trunk/spec/core/checks_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/checks_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/checks_spec.rb (original)
+++ buildr/trunk/spec/core/checks_spec.rb Fri Mar 5 05:48:49 2010
@@ -31,7 +31,7 @@
it "should execute all project's expectations" do
task 'expectation'
define 'foo', :version=>'1.0' do
- check { task('expectation').invoke }
+ check { task('expectation').invoke }
end
lambda { project('foo').task('package').invoke }.should run_task('expectation')
end
@@ -52,7 +52,7 @@
it "should fail if any expectation failed" do
define 'foo', :version=>'1.0' do
check
- check { fail 'sorry' }
+ check { fail 'sorry' }
check
end
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
@@ -342,132 +342,132 @@
describe Buildr::Checks::Expectation do
-
+
shared_examples_for 'all archive types' do
-
+
before do
archive = @archive
define 'foo', :version=>'1.0' do
package(archive).include('resources')
end
end
-
+
def check *args, &block
project('foo').check *args, &block
end
-
+
def package
project('foo').package(@archive)
end
-
+
describe '#exist' do
-
+
it "should pass if archive path exists" do
write 'resources/test'
check(package.path('resources')) { it.should exist }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail if archive path does not exist" do
mkpath 'resources'
check(package) { it.path('not-resources').should exist }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should pass if archive entry exists" do
write 'resources/test'
check(package.entry('resources/test')) { it.should exist }
check(package.path('resources').entry('test')) { it.should exist }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail if archive path does not exist" do
mkpath 'resources'
check(package.entry('resources/test')) { it.should exist }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
- end
+ end
end
-
+
describe '#be_empty' do
it "should pass if archive path is empty" do
mkpath 'resources'
check(package.path('resources')) { it.should be_empty }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail if archive path has any entries" do
write 'resources/test'
check(package.path('resources')) { it.should be_empty }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should pass if archive entry has no content" do
write 'resources/test'
check(package.entry('resources/test')) { it.should be_empty }
check(package.path('resources').entry('test')) { it.should be_empty }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail if archive entry has content" do
write 'resources/test', 'something'
check(package.entry('resources/test')) { it.should be_empty }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should fail if archive entry does not exist" do
mkpath 'resources'
check(package.entry('resources/test')) { it.should be_empty }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
end
-
+
describe '#contain(entry)' do
-
+
it "should pass if archive entry content matches string" do
write 'resources/test', 'something'
check(package.entry('resources/test')) { it.should contain('thing') }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should pass if archive entry content matches pattern" do
write 'resources/test', "something\nor\another"
check(package.entry('resources/test')) { it.should contain(/or/) }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should pass if archive entry content matches all arguments" do
write 'resources/test', "something\nor\nanother"
check(package.entry('resources/test')) { it.should contain(/or/, /other/) }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail unless archive path contains all arguments" do
write 'resources/test', 'something'
check(package.entry('resources/test')) { it.should contain(/some/, /other/) }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should fail if archive entry content does not match" do
write 'resources/test', 'something'
check(package.entry('resources/test')) { it.should contain(/other/) }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should fail if archive entry does not exist" do
mkpath 'resources'
check(package.entry('resources/test')) { it.should contain(/anything/) }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
end
-
+
describe '#contain(path)' do
-
+
it "should pass if archive path contains file" do
write 'resources/test'
check(package.path('resources')) { it.should contain('test') }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should handle deep nesting" do
write 'resources/test/test2.efx'
check(package) { it.should contain('resources/test/test2.efx') }
@@ -475,25 +475,25 @@
check(package.path('resources/test')) { it.should contain('test2.efx') }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should pass if archive path contains pattern" do
write 'resources/with/test'
check(package.path('resources')) { it.should contain('**/t*st') }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should pass if archive path contains all arguments" do
write 'resources/with/test'
check(package.path('resources')) { it.should contain('**/test', '**/*') }
lambda { project('foo').task('package').invoke }.should_not raise_error
end
-
+
it "should fail unless archive path contains all arguments" do
write 'resources/test'
check(package.path('resources')) { it.should contain('test', 'or-not') }
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
end
-
+
it "should fail if archive path is empty" do
mkpath 'resources'
check(package.path('resources')) { it.should contain('test') }
@@ -501,17 +501,17 @@
end
end
end
-
+
describe 'ZIP' do
before { @archive = :jar }
it_should_behave_like 'all archive types'
end
-
+
describe 'tar' do
before { @archive = :tar }
it_should_behave_like 'all archive types'
end
-
+
describe 'tgz' do
before { @archive = :tgz }
it_should_behave_like 'all archive types'
Modified: buildr/trunk/spec/core/common_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Fri Mar 5 05:48:49 2010
@@ -218,7 +218,7 @@
def source
File.expand_path('src')
end
-
+
it 'should return a Filter for the source' do
filter(source).should be_kind_of(Filter)
end
@@ -495,14 +495,14 @@
end
end
-describe Filter::Mapper do
-
+describe Filter::Mapper do
+
module MooMapper
def moo_config(*args, &block)
raise ArgumentError, "Expected moo block" unless block_given?
{ :moos => args, :callback => block }
end
-
+
def moo_transform(content, path = nil)
content.gsub(/moo+/i) do |str|
moos = yield :moos # same than config[:moos]
@@ -645,7 +645,7 @@
PROPS
hash.should == {'name1'=>"with\tand", 'name2'=>"with\nand\f", 'name3'=>'double\hash'}
end
-
+
it 'should ignore whitespace' do
hash = Hash.from_java_properties('name1 = value1')
hash.should == {'name1'=>'value1'}
Modified: buildr/trunk/spec/core/generate_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/generate_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/generate_spec.rb (original)
+++ buildr/trunk/spec/core/generate_spec.rb Fri Mar 5 05:48:49 2010
@@ -18,13 +18,13 @@
describe Buildr::Generate do
-
+
describe 'Generated buildfile' do
it 'should be a legal buildfile' do
File.open('buildfile', 'w') { |file| file.write Generate.from_directory(Dir.pwd).join("\n") }
lambda { Buildr.application.run }.should_not raise_error
end
-
+
it 'should not contain NEXT_VERSION because it was removed in buildr 1.3.3' do
buildfile = Generate.from_directory(Dir.pwd)
buildfile.each { |line| line.should_not include('NEXT_VERSION')}
Modified: buildr/trunk/spec/core/project_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/project_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/project_spec.rb (original)
+++ buildr/trunk/spec/core/project_spec.rb Fri Mar 5 05:48:49 2010
@@ -45,7 +45,7 @@
foo.should be(project('foo'))
bar.should be(project('bar'))
end
-
+
it 'should show up in projects list if defined' do
define('foo')
projects.map(&:name).should include('foo')
@@ -206,7 +206,7 @@
@layout.expand(:foo, nil, :bar).should eql('none')
@layout.expand(nil, :foo).should eql('foo')
end
-
+
it 'should return nil if path not mapped' do
@layout[:foo].should be_nil
end
@@ -368,7 +368,7 @@
define('foo') { define 'bar' }
scopes.should eql([['foo'], ['foo', 'bar']])
end
-
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
Buildr::VERSION.should < '1.5'
end
@@ -418,7 +418,7 @@
define 'foo' do
define 'bar'
define 'bar'
- end
+ end
end.should raise_error
end
@@ -456,7 +456,7 @@
ordered << self.name
define('bar') { ordered << self.name }
define('baz') { ordered << self.name }
- end
+ end
ordered.should eql(['foo', 'foo:bar', 'foo:baz'])
end
@@ -466,7 +466,7 @@
ordered << self.name
define('bar') { project('foo:baz') ; ordered << self.name }
define('baz') { ordered << self.name }
- end
+ end
ordered.should eql(['foo', 'foo:baz', 'foo:bar'])
end
@@ -475,7 +475,7 @@
define 'foo' do
define('bar') { project('foo:baz') }
define('baz') { project('foo:bar') }
- end
+ end
end.should raise_error(RuntimeError, /Circular dependency/)
end
end
@@ -645,7 +645,7 @@
it 'should create a regular task' do
define('foo') { task('bar') }
Buildr.application.lookup('foo:bar').should_not be_nil
- end
+ end
it 'should return a task defined in the project' do
define('foo') { task('bar') }
@@ -661,7 +661,7 @@
define('foo') { task('bar') }
project('foo').task('bar').name.should eql('foo:bar')
end
-
+
it 'should ignore namespace if starting with color' do
define 'foo' do
task(':bar').name.should == 'bar'
@@ -744,7 +744,7 @@
=begin
-describe Buildr::Generate do
+describe Buildr::Generate do
it 'should be able to create buildfile from directory structure' do
write 'src/main/java/Foo.java', ''
write 'one/two/src/main/java/Foo.java', ''
Modified: buildr/trunk/spec/core/transport_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/transport_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/transport_spec.rb (original)
+++ buildr/trunk/spec/core/transport_spec.rb Fri Mar 5 05:48:49 2010
@@ -240,7 +240,7 @@
@http.should_receive(:use_ssl=).with(true)
URI(@uri.to_s.sub(/http/, 'https')).read
end
-
+
it 'should use proxy from environment variable HTTP_PROXY when using http' do
ENV['HTTP_PROXY'] = @proxy
Net::HTTP.should_receive(:new).with(*@proxy_args).and_return(@http)
@@ -312,7 +312,7 @@
request.should_receive(:basic_auth).with('john', 'secret')
URI("http://john:secret@#{@host_domain}").read
end
-
+
it 'should preseve authentication information during a redirect' do
Net::HTTP.should_receive(:new).twice.and_return(@http)
@@ -324,7 +324,7 @@
Net::HTTP::Get.should_receive(:new).once.with('/', nil).and_return(request1)
request1.should_receive(:basic_auth).with('john', 'secret')
@http.should_receive(:request).with(request1).and_yield(redirect)
-
+
# The second request will be ok
ok = Net::HTTPOK.new(nil, nil, nil)
ok.stub!(:read_body)
@@ -503,7 +503,7 @@
end
it 'should close all opened directories' do
- @sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
+ @sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
@sftp_session.should_receive(:close).with(handle = Object.new)
handle
end
Modified: buildr/trunk/spec/core/util_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/util_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/core/util_spec.rb (original)
+++ buildr/trunk/spec/core/util_spec.rb Fri Mar 5 05:48:49 2010
@@ -21,7 +21,7 @@
it "should find value for one key" do
{:a => 1, :b => 2, :c => 3}.only(:a).should == {:a => 1}
end
-
+
it "should find values for multiple keys" do
{:a => 1, :b => 2, :c => 3}.only(:b, :c).should == {:b => 2, :c => 3}
end
@@ -36,19 +36,19 @@
it "should be kind of Hash" do
Hash.should === @obj
end
-
+
it "should accept block that supplies default value" do
obj = OpenObject.new { |hash, key| hash[key] = "New #{key}" }
obj[:foo].should == "New foo"
obj.keys.should == [:foo]
end
-
+
it "should combine initial values from hash argument and from block" do
obj = OpenObject.new(:a => 6, :b => 2) { |h, k| h[k] = k.to_s * 2 }
obj[:a].should == 6
obj[:c].should == 'cc'
end
-
+
it "should allow reading a value by calling its name method" do
@obj.b.should == 2
end
@@ -60,7 +60,7 @@
it "should allow changing a value by calling its name= method" do
lambda { @obj.c = 17 }.should change { @obj.c }.to(17)
end
-
+
it "should implement only method like a hash" do
@obj.only(:a).should == { :a => 1 }
end
Modified: buildr/trunk/spec/groovy/bdd_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/groovy/bdd_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/groovy/bdd_spec.rb (original)
+++ buildr/trunk/spec/groovy/bdd_spec.rb Fri Mar 5 05:48:49 2010
@@ -17,7 +17,7 @@
describe Buildr::Groovy::EasyB do
-
+
def foo(*args, &prc)
define('foo', *args) do
test.using :easyb
@@ -58,9 +58,9 @@
test.compile.language.should eql(:java)
end
end
-
+
it 'should include src/spec/groovy/*Specification.groovy' do
- foo do
+ foo do
spec = _('src/spec/groovy/SomeSpecification.groovy')
write spec, 'true'
test.invoke
@@ -69,12 +69,12 @@
end
it 'should include src/spec/groovy/*Story.groovy' do
- foo do
+ foo do
spec = _('src/spec/groovy/SomeStory.groovy')
write spec, 'true'
test.invoke
test.tests.should include(spec)
end
end
-
+
end # EasyB
Modified: buildr/trunk/spec/groovy/compiler_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/groovy/compiler_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/groovy/compiler_spec.rb (original)
+++ buildr/trunk/spec/groovy/compiler_spec.rb Fri Mar 5 05:48:49 2010
@@ -16,12 +16,12 @@
require File.join(File.dirname(__FILE__), '../spec_helpers')
-describe 'groovyc compiler' do
-
+describe 'groovyc compiler' do
+
it 'should identify itself from groovy source directories' do
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
- define('foo') do
+ define('foo') do
compile.compiler.should eql(:groovyc)
test.compile.compiler.should eql(:groovyc)
end
@@ -30,7 +30,7 @@
it 'should identify if groovy sources are found on java directories' do
write 'src/main/java/some/Hello.groovy', 'println "Hello Groovy"'
write 'src/test/java/some/Hello.groovy', 'println "Hello Groovy"'
- define('foo') do
+ define('foo') do
compile.compiler.should eql(:groovyc)
test.compile.compiler.should eql(:groovyc)
end
@@ -41,13 +41,13 @@
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
write 'src/test/java/some/Empty.java', 'package some; public interface Empty {}'
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
- define('foo') do
+ define('foo') do
compile.compiler.should eql(:groovyc)
test.compile.compiler.should eql(:groovyc)
end
end
- it 'should identify from custom layout' do
+ it 'should identify from custom layout' do
write 'groovy/Hello.groovy', 'println "Hello world"'
write 'testing/Hello.groovy', 'println "Hello world"'
custom = Layout.new
@@ -58,10 +58,10 @@
test.compile.compiler.should eql(:groovyc)
end
end
-
+
it 'should identify from compile source directories' do
- write 'src/com/example/Code.groovy', 'println "monkey code"'
- write 'testing/com/example/Test.groovy', 'println "some test"'
+ write 'src/com/example/Code.groovy', 'println "monkey code"'
+ write 'testing/com/example/Test.groovy', 'println "some test"'
define 'foo' do
lambda { compile.from 'src' }.should change { compile.compiler }.to(:groovyc)
lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:groovyc)
@@ -91,13 +91,13 @@
lambda { compile.using(:groovyc) }.should_not change { compile.sources }
end
end
-
+
it 'should compile groovy sources' do
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
define('foo').compile.invoke
file('target/classes/some/Example.class').should exist
end
-
+
it 'should compile test groovy sources that rely on junit' do
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
write 'src/test/groovy/some/ExampleTest.groovy', "package some\n import junit.framework.TestCase\n class ExampleTest extends TestCase { public testHello() { println \"Hello\" } }"
@@ -112,15 +112,15 @@
it 'should include as classpath dependency' do
write 'src/bar/groovy/some/Foo.groovy', 'package some; interface Foo {}'
write 'src/main/groovy/some/Example.groovy', 'package some; class Example implements Foo { }'
- define('bar', :version => '1.0') do
+ define('bar', :version => '1.0') do
compile.from('src/bar/groovy').into('target/bar')
package(:jar)
end
lambda { define('foo').compile.with(project('bar').package(:jar)).invoke }.should run_task('foo:compile')
file('target/classes/some/Example.class').should exist
end
-
- it 'should cross compile java sources' do
+
+ it 'should cross compile java sources' do
write 'src/main/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
write 'src/main/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
write 'src/main/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
@@ -128,7 +128,7 @@
%w{Foo Bar Baz}.each { |f| file("target/classes/some/#{f}.class").should exist }
end
- it 'should cross compile test java sources' do
+ it 'should cross compile test java sources' do
write 'src/test/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
write 'src/test/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
write 'src/test/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
@@ -148,7 +148,7 @@
end
describe 'groovyc compiler options' do
-
+
def groovyc(&prc)
define('foo') do
compile.using(:groovyc)
@@ -164,8 +164,8 @@
end
project('foo').compile
end
-
- it 'should set warning option to false by default' do
+
+ it 'should set warning option to false by default' do
groovyc do
compile.options.warnings.should be_false
@compiler.javac_options[:nowarn].should be_true
@@ -188,7 +188,7 @@
trace true
groovyc.options.verbose.should be_true
end
-
+
it 'should set debug option to false based on Buildr.options' do
Buildr.options.debug = false
groovyc.options.debug.should be_false
Modified: buildr/trunk/spec/ide/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/eclipse_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ buildr/trunk/spec/ide/eclipse_spec.rb Fri Mar 5 05:48:49 2010
@@ -90,7 +90,7 @@
write 'buildfile'
write 'src/main/nono/Main.nono'
end
-
+
it 'should not have natures' do
define('foo')
project_natures.should be_empty
@@ -100,21 +100,21 @@
define('foo')
build_commands.should be_empty
end
-
+
it 'should generate a .project file' do
define('foo')
task('eclipse').invoke
REXML::Document.new(File.open('.project')).root.
elements.collect("name") { |e| e.text }.should == ['foo']
end
-
+
it 'should not generate a .classpath file' do
define('foo')
task('eclipse').invoke
File.exists?('.classpath').should be_false
end
end
-
+
describe 'parent project' do
before do
write 'buildfile'
@@ -130,7 +130,7 @@
File.exists?(File.join('bar','.project')).should be_true
end
end
-
+
describe 'java project' do
before do
write 'buildfile'
@@ -573,7 +573,7 @@
project('foo:bar').eclipse.natures.should include('foo_nature')
project('foo:bar2').eclipse.natures.should include('bar2_nature')
end
-
+
it 'should handle arrays correctly' do
define('foo') do
eclipse.natures ['foo_nature', 'bar_nature']
@@ -604,14 +604,14 @@
project('foo:bar').eclipse.builders.should include('foo_builder')
project('foo:bar2').eclipse.builders.should include('bar2_builder')
end
-
+
it 'should handle arrays correctly' do
define('foo') do
eclipse.builders ['foo_builder', 'bar_builder']
end
project('foo').eclipse.builders.should == ['foo_builder', 'bar_builder']
end
- end
+ end
describe 'classpath_containers variable' do
it 'should be configurable' do
@@ -635,7 +635,7 @@
project('foo:bar').eclipse.classpath_containers.should include('foo_classpath_containers')
project('foo:bar2').eclipse.classpath_containers.should include('bar2_classpath_containers')
end
-
+
it 'should handle arrays correctly' do
define('foo') do
eclipse.classpath_containers ['foo_cc', 'bar_cc']
Modified: buildr/trunk/spec/ide/idea7x_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea7x_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea7x_spec.rb (original)
+++ buildr/trunk/spec/ide/idea7x_spec.rb Fri Mar 5 05:48:49 2010
@@ -22,15 +22,15 @@
task('idea7x').invoke
REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
end
-
+
def ipr_module_elements
ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
end
-
+
def ipr_module_filepaths
ipr_module_elements.collect { |m| m.attributes['filepath'] }
end
-
+
def ipr_module_fileurls
ipr_module_elements.collect { |m| m.attributes['fileurl'] }
end
@@ -39,20 +39,20 @@
describe Idea7x do
include Idea7xHelper
-
+
describe "the project file" do
before do
@project_name = 'alphabet'
end
-
+
it "includes a module for the root project" do
# Current behavior is to only generate IMLs for packaged projects
- define(@project_name) { project.version = '0.0.0'; package(:jar) }
+ define(@project_name) { project.version = '0.0.0'; package(:jar) }
ipr_module_elements.should have(1).element
ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
end
-
+
it "includes an IML for a subproject" do
mkpath 'h'
define(@project_name) do
@@ -61,12 +61,12 @@
package(:jar)
end
end
-
+
ipr_module_elements.should have(2).elements
ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
end
-
+
it "pays attention to the base_dir for a subproject" do
mkpath 'aitch'
define(@project_name) do
@@ -75,7 +75,7 @@
package(:jar)
end
end
-
+
ipr_module_elements.should have(2).elements
ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
Modified: buildr/trunk/spec/java/ant_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/ant_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/ant_spec.rb (original)
+++ buildr/trunk/spec/java/ant_spec.rb Fri Mar 5 05:48:49 2010
@@ -18,13 +18,13 @@
describe Buildr::Ant do
-
+
it 'should pick Ant version from ant build settings' do
Buildr::Ant.instance_eval { @dependencies = nil }
write 'build.yaml', 'ant: 1.2.3'
Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
end
-
+
it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do
Buildr::VERSION.should < '1.5'
lambda { Ant::REQUIRES }.should_not raise_error
Modified: buildr/trunk/spec/java/bdd_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/bdd_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/bdd_spec.rb (original)
+++ buildr/trunk/spec/java/bdd_spec.rb Fri Mar 5 05:48:49 2010
@@ -18,7 +18,7 @@
describe Buildr::RSpec do
def foo(*args, &prc)
- define('foo', *args) do
+ define('foo', *args) do
test.using :rspec, :output => false
if prc
instance_eval(&prc)
@@ -128,7 +128,7 @@
define('one', :base_dir => 'one') do
write _('src/test/java/example/OneTest.java', <<-JAVA)
package example;
- public class OneTest {
+ public class OneTest {
@org.testng.annotations.Test
public void testNothing() {}
}
@@ -145,7 +145,7 @@
end
it 'should load user jtestr_config.rb' do
- foo do
+ foo do
hello = _('hello')
write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
write('src/spec/ruby/some_spec.rb')
@@ -158,13 +158,13 @@
it 'should run junit tests' do
write('src/test/java/example/SuccessTest.java', <<-JAVA)
package example;
- public class SuccessTest extends junit.framework.TestCase {
+ public class SuccessTest extends junit.framework.TestCase {
public void testSuccess() { assertTrue(true); }
}
JAVA
write('src/test/java/example/FailureTest.java', <<-JAVA)
package example;
- public class FailureTest extends junit.framework.TestCase {
+ public class FailureTest extends junit.framework.TestCase {
public void testFailure() { assertTrue(false); }
}
JAVA
@@ -176,7 +176,7 @@
end
end
- it 'should run testng tests' do
+ it 'should run testng tests' do
write('src/test/java/example/Success.java', <<-JAVA)
package example;
public class Success {
@@ -199,7 +199,7 @@
end
end
- it 'should run test_unit' do
+ it 'should run test_unit' do
success = File.expand_path('src/spec/ruby/success_test.rb')
write(success, <<-TESTUNIT)
require 'test/unit'
@@ -278,7 +278,7 @@
describe Buildr::JBehave do
def foo(*args, &prc)
- define('foo', *args) do
+ define('foo', *args) do
test.using :jbehave
if prc
instance_eval(&prc)
@@ -311,7 +311,7 @@
foo { test.framework.should eql(:jbehave) }
end
- it 'should select a java compiler for its sources' do
+ it 'should select a java compiler for its sources' do
write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
foo do
test.compile.language.should eql(:java)
@@ -355,7 +355,7 @@
it 'should include classes implementing Behaviours' do
write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
package some;
- public class MyBehaviours implements
+ public class MyBehaviours implements
org.jbehave.core.behaviour.Behaviours {
public Class[] getBehaviours() {
return new Class[] { some.FooBehave.class };
Modified: buildr/trunk/spec/java/cobertura_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/cobertura_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/cobertura_spec.rb (original)
+++ buildr/trunk/spec/java/cobertura_spec.rb Fri Mar 5 05:48:49 2010
@@ -24,54 +24,54 @@
# Reloading the extension because the sandbox removes all its actions
Buildr.module_eval { remove_const :Cobertura }
load File.expand_path('../lib/buildr/java/cobertura.rb')
- @tool_module = Buildr::Cobertura
+ @tool_module = Buildr::Cobertura
end
-
+
it_should_behave_like 'test coverage tool'
-
+
describe 'project-specific' do
-
+
describe 'data file' do
it 'should have a default value' do
define('foo').cobertura.data_file.should point_to_path('reports/cobertura.ser')
end
-
+
it 'should be overridable' do
define('foo') { cobertura.data_file = path_to('target/data.cobertura') }
project('foo').cobertura.data_file.should point_to_path('target/data.cobertura')
end
-
+
it 'should be created during instrumentation' do
write 'src/main/java/Foo.java', 'public class Foo {}'
define('foo')
task('foo:cobertura:instrument').invoke
file(project('foo').cobertura.data_file).should exist
end
-
+
it 'should not instrument projects which have no sources' do
write 'bar/src/main/java/Baz.java', 'public class Baz {}'
define('foo') { define('bar') }
task('foo:bar:cobertura:instrument').invoke
end
end
-
+
describe 'instrumentation' do
before do
['Foo', 'Bar'].each { |cls| write File.join('src/main/java', "#{cls}.java"), "public class #{cls} {}" }
end
-
+
it 'should instrument only included classes' do
define('foo') { cobertura.include 'Foo' }
task("foo:cobertura:instrument").invoke
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Foo.class'] }
end
-
+
it 'should not instrument excluded classes' do
define('foo') { cobertura.exclude 'Foo' }
task("foo:cobertura:instrument").invoke
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
end
-
+
it 'should instrument classes that are included but not excluded' do
write 'src/main/java/Baz.java', 'public class Baz {}'
define('foo') { cobertura.include('Ba').exclude('ar') }
@@ -79,7 +79,7 @@
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
end
end
-
+
# TODO add specs for cobertura:check...somehow
end
end
Modified: buildr/trunk/spec/java/commands_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/commands_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/commands_spec.rb (original)
+++ buildr/trunk/spec/java/commands_spec.rb Fri Mar 5 05:48:49 2010
@@ -17,7 +17,7 @@
describe Java::Commands do
-
+
it "should not be verbose by default" do
write "build.xml", <<-BUILD
<project name="MyProject" default="dist" basedir=".">
@@ -30,5 +30,5 @@
lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies) }.should_not show_info(/java/)
lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies, :verbose => true) }.should show_info(/java/)
end
-
+
end
\ No newline at end of file
Modified: buildr/trunk/spec/java/compiler_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/compiler_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/compiler_spec.rb (original)
+++ buildr/trunk/spec/java/compiler_spec.rb Fri Mar 5 05:48:49 2010
@@ -19,13 +19,13 @@
describe 'javac compiler' do
it 'should identify itself from source directories' do
- write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
+ write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
define('foo').compile.compiler.should eql(:javac)
end
it 'should identify from source directories using custom layout' do
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
custom = Layout.new
custom[:source, :main, :java] = 'src'
custom[:source, :test, :java] = 'testing'
@@ -36,8 +36,8 @@
end
it 'should identify from compile source directories' do
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
define 'foo' do
lambda { compile.from 'src' }.should change { compile.compiler }.to(:javac)
lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:javac)
@@ -110,21 +110,21 @@
it 'should use -nowarn argument when warnings is false' do
compile_task.using(:warnings=>false)
- javac_args.should include('-nowarn')
+ javac_args.should include('-nowarn')
end
it 'should not use -nowarn argument when warnings is true' do
compile_task.using(:warnings=>true)
- javac_args.should_not include('-nowarn')
+ javac_args.should_not include('-nowarn')
end
it 'should not use -verbose argument by default' do
- javac_args.should_not include('-verbose')
+ javac_args.should_not include('-verbose')
end
it 'should use -verbose argument when running with --trace option' do
trace true
- javac_args.should include('-verbose')
+ javac_args.should include('-verbose')
end
it 'should set debug option to true by default' do
Modified: buildr/trunk/spec/java/emma_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/emma_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/emma_spec.rb (original)
+++ buildr/trunk/spec/java/emma_spec.rb Fri Mar 5 05:48:49 2010
@@ -28,18 +28,18 @@
end
it_should_behave_like 'test coverage tool'
-
+
describe 'project-specific' do
describe 'metadata file' do
it 'should have a default value' do
define('foo').emma.metadata_file.should point_to_path('reports/emma/coverage.em')
end
-
+
it 'should be overridable' do
define('foo') { emma.metadata_file = path_to('target/metadata.emma') }
project('foo').emma.metadata_file.should point_to_path('target/metadata.emma')
end
-
+
it 'should be created during instrumentation' do
write 'src/main/java/Foo.java', 'public class Foo {}'
define('foo')
@@ -47,17 +47,17 @@
file(project('foo').emma.metadata_file).should exist
end
end
-
+
describe 'coverage file' do
it 'should have a default value' do
define('foo').emma.coverage_file.should point_to_path('reports/emma/coverage.ec')
end
-
+
it 'should be overridable' do
define('foo') { emma.coverage_file = path_to('target/coverage.emma') }
project('foo').emma.coverage_file.should point_to_path('target/coverage.emma')
end
-
+
it 'should be created during test' do
write 'src/main/java/Foo.java', 'public class Foo {}'
write_test :for=>'Foo', :in=>'src/test/java'
@@ -83,7 +83,7 @@
task("foo:emma:instrument").invoke
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
end
-
+
it 'should instrument classes that are included but not excluded' do
write 'src/main/java/Baz.java', 'public class Baz {}'
define('foo') { emma.include('Ba*').exclude('*ar') }
@@ -91,13 +91,13 @@
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
end
end
-
+
describe 'reports' do
before do
write 'src/main/java/Foo.java', 'public class Foo {}'
write_test :for=>'Foo', :in=>'src/test/java'
end
-
+
describe 'in html' do
it 'should inform the user if no coverage data' do
rm 'src/test/java/FooTest.java'
@@ -106,14 +106,14 @@
should show_info(/No test coverage report for foo. Missing: #{project('foo').emma.coverage_file}/)
end
end
-
+
describe 'in xml' do
it 'should have an xml file' do
define('foo')
task('foo:emma:xml').invoke
file(File.join(project('foo').emma.report_dir, 'coverage.xml')).should exist
end
- end
+ end
end
end
end
Modified: buildr/trunk/spec/java/java_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/java_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/java_spec.rb (original)
+++ buildr/trunk/spec/java/java_spec.rb Fri Mar 5 05:48:49 2010
@@ -48,42 +48,42 @@
before do
@old_home = ENV['JAVA_HOME']
end
-
+
describe 'when JAVA_HOME points to a JDK' do
before do
Java.instance_eval { @tools_jar = nil }
write 'jdk/lib/tools.jar'
ENV['JAVA_HOME'] = File.expand_path('jdk')
end
-
+
it 'should return the path to tools.jar' do
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
end
end
-
+
describe 'when JAVA_HOME points to a JRE inside a JDK' do
before do
Java.instance_eval { @tools_jar = nil }
write 'jdk/lib/tools.jar'
ENV['JAVA_HOME'] = File.expand_path('jdk/jre')
end
-
+
it 'should return the path to tools.jar' do
Java.tools_jar.should point_to_path('jdk/lib/tools.jar')
end
end
-
+
describe 'when there is no tools.jar' do
before do
Java.instance_eval { @tools_jar = nil }
ENV['JAVA_HOME'] = File.expand_path('jdk')
end
-
+
it 'should return nil' do
Java.tools_jar.should be_nil
end
end
-
+
after do
ENV['JAVA_HOME'] = @old_home
end
@@ -93,13 +93,13 @@
before do
@old_home = ENV['JAVA_HOME']
end
-
+
describe 'when JAVA_HOME points to an invalid JRE/JDK installation' do
before do
write 'jdk'
ENV['JAVA_HOME'] = File.expand_path('jdk')
end
-
+
it 'should fail with an error message mentioning JAVA_HOME' do
begin
Java.java ['-version']
@@ -109,7 +109,7 @@
end
end
end
-
+
after do
ENV['JAVA_HOME'] = @old_home
end
Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Fri Mar 5 05:48:49 2010
@@ -241,7 +241,7 @@
define('foo', :version => '1.0') do
manifest['Foo'] = '1'
package(packaging)
- define('bar', :version => '1.0') do
+ define('bar', :version => '1.0') do
manifest['bar'] = 'Bar'
package(:jar)
package = packages.first
@@ -261,11 +261,11 @@
define('foo', :version => '1.0') do
manifest['Foo'] = '1'
package(packaging)
- define('bar', :version => '1.0') do
+ define('bar', :version => '1.0') do
manifest['bar'] = 'Bar'
package(:jar)
end
- define('baz', :version => '1.0') do
+ define('baz', :version => '1.0') do
manifest['baz'] = 'Baz'
package(:jar)
end
@@ -454,7 +454,7 @@
jar.entries.map(&:to_s).sort.should include('empty/')
end
end
-
+
it 'should raise error when calling with() with nil value' do
lambda {
define('foo', :version=>'1.0') { package(:jar).with(nil) }
@@ -707,31 +707,31 @@
end
it 'should not modify original artifact for its components' do
- define 'one', :version => '1.0' do
+ define 'one', :version => '1.0' do
write 'src/main/resources/one.txt', '1'
package(:jar)
end
-
- define 'two', :version => '1.0' do
+
+ define 'two', :version => '1.0' do
write 'src/main/resources/two.txt', '2'
package(:jar)
end
-
- define 'foo', :version => '1.0' do
+
+ define 'foo', :version => '1.0' do
package(:ear).add project(:one).package(:jar)
package(:ear).add :ejb => project(:two).package(:jar)
end
inspect_ear { |files| files.should include('lib/one-1.0.jar', 'ejb/two-1.0.jar') }
-
+
Buildr::Packaging::Java::Manifest.from_zip(project('one').package(:jar)).main['Class-Path'].should be_nil
Buildr::Packaging::Java::Manifest.from_zip(project('two').package(:jar)).main['Class-Path'].should be_nil
-
+
inspect_classpath 'ejb/two-1.0.jar' do |classpath|
classpath.should include('../lib/one-1.0.jar')
end
end
-
+
it 'should map JARs to /lib directory' do
define 'foo', :version=>'1.0' do
package(:ear) << package(:jar)
@@ -770,12 +770,12 @@
package(:jar, :id => 'one')
package(:jar, :id => 'two')
end
- define 'foo', :version => '1.0' do
+ define 'foo', :version => '1.0' do
package(:ear).add :lib => project('baz'),
:war => project('bar').package(:war),
:ejb => project('bar').package(:jar)
end
- inspect_ear do |files|
+ inspect_ear do |files|
files.should include(*%w{ lib/one-1.5.jar lib/two-1.5.jar war/bar-1.5.war ejb/bar-1.5.jar })
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
end
@@ -791,10 +791,10 @@
package(:war)
package(:jar)
end
- define 'foo', :version => '1.0' do
+ define 'foo', :version => '1.0' do
package(:ear).add projects(:bar, :baz)
end
- inspect_ear do |files|
+ inspect_ear do |files|
files.should include('war/bar-1.5.war', 'lib/bar-1.5.jar', 'lib/baz-1.5.jar', 'war/baz-1.5.war')
files.should_not satisfy { files.any? { |f| f =~ /\.zip$/ } }
end
@@ -975,7 +975,7 @@
end
- it 'should generate relative classpaths for top level EJB' do
+ it 'should generate relative classpaths for top level EJB' do
define 'foo', :version => '1.0' do
package(:ear).add package(:jar, :id => 'one'), :path => '.'
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
@@ -987,7 +987,7 @@
end
end
- it 'should generate relative classpaths for second level EJB' do
+ it 'should generate relative classpaths for second level EJB' do
define 'foo', :version => '1.0' do
package(:ear).add package(:jar, :id => 'one'), :path => '.'
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
@@ -999,7 +999,7 @@
end
end
- it 'should generate relative classpaths for nested EJB' do
+ it 'should generate relative classpaths for nested EJB' do
define 'foo', :version => '1.0' do
package(:ear).add package(:jar, :id => 'one'), :path => '.'
package(:ear).add package(:jar, :id => 'two'), :path => 'dos'
@@ -1080,7 +1080,7 @@
shared_examples_for 'package_with_' do
def prepare(options = {})
- packager = "package_with_#{@packaging}"
+ packager = "package_with_#{@packaging}"
write 'src/main/java/Source.java'
write 'baz/src/main/java/Source.java'
define 'foo', :version=>'1.0' do
Modified: buildr/trunk/spec/java/test_coverage_helper.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/test_coverage_helper.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/test_coverage_helper.rb (original)
+++ buildr/trunk/spec/java/test_coverage_helper.rb Fri Mar 5 05:48:49 2010
@@ -29,21 +29,21 @@
@expected_pattern = pattern
@pattern_matcher = lambda { |filename| File.fnmatch? pattern, filename }
end
-
+
def matches?(directory)
@actual_filenames = Dir[File.join(directory,'*')]
@actual_filenames.any? &@pattern_matcher
end
-
+
def failure_message
"Expected to find at least one element matching '#{@expected_pattern}' among #{@actual_filenames.inspect}, but found none"
end
-
+
def negative_failure_message
"Expected to find no element matching '#{@expected_pattern}' among #{@actual_filenames.inspect}, but found matching element(s) #{@actual_filenames.select(&@pattern_matcher).inspect}"
end
end
-
+
# Test if a directory contains at least one file matching a given glob pattern.
#
# For example, to check that a directory contains at least one HTML file:
@@ -63,7 +63,7 @@
def test_coverage_config
project('foo').send(toolname)
end
-
+
describe 'project-specific' do
before do
@@ -73,20 +73,20 @@
describe 'clean' do
before { define('foo') }
-
+
it 'should remove the instrumented directory' do
mkdir_p test_coverage_config.instrumented_dir.to_s
task('foo:clean').invoke
file(test_coverage_config.instrumented_dir).should_not exist
end
-
+
it 'should remove the reporting directory' do
mkdir_p test_coverage_config.report_dir
task('foo:clean').invoke
file(test_coverage_config.report_dir).should_not exist
end
end
-
+
describe 'instrumented directory' do
it 'should have a default value' do
define('foo')
@@ -98,7 +98,7 @@
define('foo') { send(toolname).instrumented_dir = path_to('target/coverage/classes') }
test_coverage_config.instrumented_dir.should point_to_path('target/coverage/classes')
end
-
+
it 'should be created during instrumentation' do
define('foo')
task("foo:#{toolname}:instrument").invoke
@@ -160,7 +160,7 @@
task("foo:#{toolname}:html").invoke
test_coverage_config.report_to(:html).should have_files_matching('*.html')
end
-
+
it 'should contain full source code, including comments' do
write 'src/main/java/Foo.java',
'public class Foo { /* This comment is a TOKEN to check that test coverage reports include the source code */ }'
@@ -199,7 +199,7 @@
task("#{toolname}:html").invoke
@tool_module.report_to(:html).should have_files_matching('*.html')
end
-
+
it 'should contain full source code, including comments' do
write 'bar/src/main/java/Bar.java',
'public class Bar { /* This comment is a TOKEN to check that test coverage reports include the source code */ }'
@@ -208,7 +208,7 @@
html_report_contents.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
html_report_contents.should =~ /TOKEN/
end
-
+
it 'should handle gracefully a project with no source' do
define 'baz', :base_dir=>'baz'
task("#{toolname}:html").invoke
@@ -216,7 +216,7 @@
end
end
end
-
+
describe 'clean' do
it 'should remove the report directory' do
define('foo')
@@ -224,31 +224,31 @@
task("#{toolname}:clean").invoke
file(@tool_module.report_to).should_not exist
end
-
+
it 'should be called when calling global clean' do
define('foo')
lambda { task('clean').invoke }.should run_task("#{toolname}:clean")
end
end
end
-
+
describe 'project with no source' do
it 'should not define an html report task' do
define 'foo'
Rake::Task.task_defined?("foo:#{toolname}:html").should be(false)
end
-
+
it 'should not raise an error when instrumenting' do
define('foo')
lambda { task("foo:#{toolname}:instrument").invoke }.should_not raise_error
end
-
+
it 'should not add the instrumented directory to the testing classpath' do
define 'foo'
depends = project('foo').test.dependencies
depends.should_not include(test_coverage_config.instrumented_dir)
end
-
+
it 'should not add the test coverage tools artifacts to the testing classpath' do
define('foo')
@tool_module.dependencies.each { |artifact| project('foo').test.dependencies.should_not include(artifact) }
Modified: buildr/trunk/spec/java/tests_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/tests_spec.rb?rev=919303&r1=919302&r2=919303&view=diff
==============================================================================
--- buildr/trunk/spec/java/tests_spec.rb (original)
+++ buildr/trunk/spec/java/tests_spec.rb Fri Mar 5 05:48:49 2010
@@ -39,19 +39,19 @@
project('foo').test.compile.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
end
-
+
it 'should have REQUIRES up to version 1.5 since it was deprecated in 1.3.3' do
Buildr::VERSION.should < '1.5'
lambda { JUnit::REQUIRES }.should_not raise_error
end
-
+
it 'should pick JUnit version from junit build settings' do
Buildr::JUnit.instance_eval { @dependencies = nil }
write 'build.yaml', 'junit: 1.2.3'
define('foo') { test.using(:junit) }
project('foo').test.compile.dependencies.should include(artifact("junit:junit:jar:1.2.3"))
end
-
+
it 'should include JMock dependencies' do
define('foo') { test.using(:junit) }
two_or_later = JMock.version[0,1].to_i >= 2
@@ -67,7 +67,7 @@
define('foo') { test.using(:junit) }
project('foo').test.compile.dependencies.should include(artifact("jmock:jmock:jar:1.2.3"))
end
-
+
it 'should include public classes extending junit.framework.TestCase' do
write 'src/test/java/com/example/FirstTest.java', <<-JAVA
package com.example;
@@ -289,7 +289,7 @@
fork_tests :each
project('foo').test.failed_tests.should be_empty
end
-
+
after do
# Yes, this is ugly. Better solution?
Buildr::JUnit.instance_eval { @dependencies = nil }