buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +149 -133
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -22,7 +22,7 @@ module Buildr
22
22
  # Search best artifact version from remote repositories
23
23
  module ArtifactSearch
24
24
  extend self
25
-
25
+
26
26
  def include(method = nil)
27
27
  (@includes ||= []).tap { push method if method }
28
28
  end
@@ -61,11 +61,11 @@ module Buildr
61
61
  "\n You may need to use an specific version instead of a requirement" unless result
62
62
  spec.merge :version => result
63
63
  end
64
-
64
+
65
65
  def requirement?(spec)
66
66
  VersionRequirement.requirement?(spec[:version])
67
67
  end
68
-
68
+
69
69
  private
70
70
  def search_methods
71
71
  [].tap do
@@ -90,7 +90,7 @@ module Buildr
90
90
  in_memory
91
91
  end
92
92
  end
93
-
93
+
94
94
  def local_versions(spec, repo)
95
95
  path = (spec[:group].split(/\./) + [spec[:id]]).flatten.join('/')
96
96
  Dir[File.expand_path(path + "/*", repo)].map { |d| d.pathmap("%f") }.sort.reverse
@@ -119,7 +119,7 @@ module Buildr
119
119
  vers << a.innerHTML.chop if a.innerHTML[-1..-1] == '/'
120
120
  vers
121
121
  }.sort.reverse
122
- else
122
+ else
123
123
  fail "Don't know how to parse #{from}: \n#{xml.inspect}"
124
124
  end
125
125
  end
@@ -59,13 +59,17 @@ module Buildr
59
59
  def create_from(file_map)
60
60
  spec.mark_version
61
61
  spec.validate
62
- Gem::Package.open(name, 'w', nil) do |pkg|
63
- pkg.metadata = spec.to_yaml
64
- file_map.each do |path, content|
65
- next if content.nil? || File.directory?(content.to_s)
66
- pkg.add_file_simple(path, File.stat(name).mode & 0777, File.size(content.to_s)) do |os|
67
- File.open(content.to_s, "rb") do |file|
68
- os.write file.read(4096) until file.eof?
62
+
63
+ File.open(name, 'w') do |io|
64
+ Gem::Package.open(io, 'w', nil) do |pkg|
65
+ pkg.metadata = spec.to_yaml
66
+ file_map.each do |path, content|
67
+ p "path #{path} content #{content}"
68
+ next if content.nil? || File.directory?(content.to_s)
69
+ pkg.add_file_simple(path, File.stat(content.to_s).mode & 0777, File.size(content.to_s)) do |os|
70
+ File.open(content.to_s, "rb") do |file|
71
+ os.write file.read(4096) until file.eof?
72
+ end
69
73
  end
70
74
  end
71
75
  end
@@ -43,7 +43,7 @@ module Buildr
43
43
  end
44
44
  end
45
45
 
46
- before_define do |project|
46
+ before_define(:package => :build) do |project|
47
47
  [ :package, :install, :uninstall, :upload ].each { |name| project.recursive_task name }
48
48
  # Need to run build before package, since package is often used as a dependency by tasks that
49
49
  # expect build to happen.
@@ -52,6 +52,8 @@ module Buildr
52
52
  project.version ||= project.parent && project.parent.version
53
53
  end
54
54
 
55
+ after_define(:package)
56
+
55
57
  # The project's identifier. Same as the project name, with colons replaced by dashes.
56
58
  # The ID for project foo:bar is foo-bar.
57
59
  def id
@@ -123,16 +125,17 @@ module Buildr
123
125
  # The file name is determined from the specification passed to the package method, however, some
124
126
  # packagers need to override this. For example, package(:sources) produces a file with the extension
125
127
  # 'zip' and the classifier 'sources'. If you need to overwrite the default implementation, you should
126
- # also include a method named package_as_[type]_respec. For example:
128
+ # also include a method named package_as_[type]_spec. For example:
127
129
  # def package_as_sources_spec(spec) #:nodoc:
128
- # { :type=>:zip, :classifier=>'sources' }.merge(spec)
130
+ # # Change the source distribution to .jar extension
131
+ # spec.merge({ :type=>:jar, :classifier=>'sources' })
129
132
  # end
130
133
  def package(*args)
131
134
  spec = Hash === args.last ? args.pop.dup : {}
132
135
  no_options = spec.empty? # since spec is mutated
133
136
  if spec[:file]
134
137
  rake_check_options spec, :file, :type
135
- spec[:type] = args.shift || spec[:type] || spec[:file].split('.').last
138
+ spec[:type] = args.shift || spec[:type] || spec[:file].split('.').last.to_sym
136
139
  file_name = spec[:file]
137
140
  else
138
141
  rake_check_options spec, *ActsAsArtifact::ARTIFACT_ATTRIBUTES
@@ -148,9 +151,9 @@ module Buildr
148
151
  spec = send("package_as_#{spec[:type]}_spec", spec) if respond_to?("package_as_#{spec[:type]}_spec")
149
152
  file_name = path_to(:target, Artifact.hash_to_file_name(spec))
150
153
  end
151
- package = (no_options && packages.detect { |pkg| pkg.type == spec[:type] &&
152
- (spec[:classifier].nil? || pkg.classifier == spec[:classifier])}) ||
153
- packages.find { |pkg| pkg.name == file_name } ||
154
+ package = (no_options && packages.detect { |pkg| pkg.type == spec[:type] &&
155
+ (pkg.respond_to?(:classifier) ? pkg.classifier : nil) == spec[:classifier]}) ||
156
+ packages.find { |pkg| pkg.name == file_name } ||
154
157
  packager.call(file_name)
155
158
  else
156
159
  Buildr.application.deprecated "We changed the way package_as methods are implemented. See the package method documentation for more details."
@@ -41,7 +41,7 @@ module Buildr
41
41
 
42
42
  def initialize(*args, &block) #:nodoc:
43
43
  super
44
- self.gzip = name =~ /\.[t?]gz$/
44
+ self.gzip = name =~ /\.t?gz$/
45
45
  self.mode = '0755'
46
46
  end
47
47
 
@@ -54,13 +54,13 @@ module Buildr
54
54
  def entry(entry_name)
55
55
  Buildr::TarEntry.new(self, entry_name)
56
56
  end
57
-
57
+
58
58
  def entries() #:nodoc:
59
59
  tar_entries = nil
60
60
  with_uncompressed_tar { |tar| tar_entries = tar.entries }
61
61
  tar_entries
62
62
  end
63
-
63
+
64
64
  # :call-seq:
65
65
  # with_uncompressed_tar { |tar_entries| ... }
66
66
  #
@@ -73,7 +73,7 @@ module Buildr
73
73
  Archive::Tar::Minitar.open(name, &block)
74
74
  end
75
75
  end
76
-
76
+
77
77
  private
78
78
 
79
79
  def create_from(file_map)
@@ -110,15 +110,15 @@ module Buildr
110
110
  end
111
111
 
112
112
  end
113
-
114
-
113
+
114
+
115
115
  class TarEntry #:nodoc:
116
-
116
+
117
117
  def initialize(tar_task, entry_name)
118
118
  @tar_task = tar_task
119
119
  @entry_name = entry_name
120
120
  end
121
-
121
+
122
122
  # :call-seq:
123
123
  # contain?(*patterns) => boolean
124
124
  #
@@ -129,7 +129,7 @@ module Buildr
129
129
  patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
130
130
  all? { |pattern| content =~ pattern }
131
131
  end
132
-
132
+
133
133
  # :call-seq:
134
134
  # empty?() => boolean
135
135
  #
@@ -137,7 +137,7 @@ module Buildr
137
137
  def empty?()
138
138
  read_content_from_tar.nil?
139
139
  end
140
-
140
+
141
141
  # :call-seq:
142
142
  # exist() => boolean
143
143
  #
@@ -147,13 +147,13 @@ module Buildr
147
147
  @tar_task.with_uncompressed_tar { |tar| exist = tar.any? { |entry| entry.name == @entry_name } }
148
148
  exist
149
149
  end
150
-
150
+
151
151
  def to_s #:nodoc:
152
152
  @entry_name
153
153
  end
154
-
154
+
155
155
  private
156
-
156
+
157
157
  def read_content_from_tar
158
158
  content = Errno::ENOENT.new("No such file or directory - #{@entry_name}")
159
159
  @tar_task.with_uncompressed_tar do |tar|
@@ -163,7 +163,7 @@ module Buildr
163
163
  content
164
164
  end
165
165
  end
166
-
166
+
167
167
  end
168
168
 
169
169
 
@@ -14,14 +14,34 @@
14
14
  # the License.
15
15
 
16
16
 
17
+ # Rubygems 1.3.6 removed the 'version' accessor so monkey-patch it back to
18
+ # circumvent version validation. This is needed because Gem::Version doesn't
19
+ # accept version specs with dashes.
20
+ unless Gem::Version.new(0).respond_to?(:version=)
21
+ class Gem::Version
22
+ def version=(version)
23
+ @version = version.to_s
24
+ @version.strip!
25
+
26
+ # re-prime @segments
27
+ @segments = nil
28
+ segments
29
+ end
30
+ end
31
+ end
32
+
17
33
  module Buildr
18
-
34
+
19
35
  #
20
36
  # See ArtifactNamespace#need
21
37
  class VersionRequirement
22
-
38
+
23
39
  CMP_PROCS = Gem::Requirement::OPS.dup
24
- CMP_REGEX = Gem::Requirement::OP_RE.dup
40
+ CMP_REGEX = if defined?(Gem::Requirement::OP_RE)
41
+ Gem::Requirement::OP_RE
42
+ else
43
+ Gem::Requirement::OPS.keys.map { |k| Regexp.quote k }.join "|"
44
+ end
25
45
  CMP_CHARS = CMP_PROCS.keys.join
26
46
  BOOL_CHARS = '\|\&\!'
27
47
  VER_CHARS = '\w\.\-'
@@ -29,18 +49,18 @@ module Buildr
29
49
  class << self
30
50
  # is +str+ a version string?
31
51
  def version?(str)
32
- /^\s*[#{VER_CHARS}]+\s*$/ === str
52
+ /^\s*\d[#{VER_CHARS}]*\s*$/ === str
33
53
  end
34
-
54
+
35
55
  # is +str+ a version requirement?
36
56
  def requirement?(str)
37
57
  /[#{BOOL_CHARS}#{CMP_CHARS}\(\)]/ === str
38
58
  end
39
-
59
+
40
60
  # :call-seq:
41
61
  # VersionRequirement.create(" >1 <2 !(1.5) ") -> requirement
42
62
  #
43
- # parse the +str+ requirement
63
+ # parse the +str+ requirement
44
64
  def create(str)
45
65
  instance_eval normalize(str)
46
66
  rescue StandardError => e
@@ -61,7 +81,7 @@ module Buildr
61
81
  vreq.negative = !vreq.negative
62
82
  vreq
63
83
  end
64
-
84
+
65
85
  def normalize(str)
66
86
  str = str.strip
67
87
  if str[/[^\s\(\)#{BOOL_CHARS + VER_CHARS + CMP_CHARS}]/]
@@ -147,7 +167,7 @@ module Buildr
147
167
  def &(other)
148
168
  operation(:&, other)
149
169
  end
150
-
170
+
151
171
  # return the parsed expression
152
172
  def to_s
153
173
  str = requirements.map(&:to_s).join(" " + @op.to_s + " ").to_s
@@ -160,7 +180,7 @@ module Buildr
160
180
  protected
161
181
  attr_reader :requirements, :op
162
182
  def operation(op, other)
163
- @op ||= op
183
+ @op ||= op
164
184
  if negative == other.negative && @op == op && other.requirements.size == 1
165
185
  @requirements << other.requirements.first
166
186
  self
@@ -106,7 +106,7 @@ module Buildr
106
106
  end
107
107
 
108
108
 
109
- # An object for unzipping a file into a target directory. You can tell it to include
109
+ # An object for unzipping/untarring a file into a target directory. You can tell it to include
110
110
  # or exclude only specific files and directories, and also to map files from particular
111
111
  # paths inside the zip file into the target directory. Once ready, call #extract.
112
112
  #
@@ -131,7 +131,7 @@ module Buildr
131
131
  # :call-seq:
132
132
  # extract
133
133
  #
134
- # Extract the zip file into the target directory.
134
+ # Extract the zip/tgz file into the target directory.
135
135
  #
136
136
  # You can call this method directly. However, if you are using the #unzip method,
137
137
  # it creates a file task for the target directory: use that task instead as a
@@ -148,16 +148,36 @@ module Buildr
148
148
 
149
149
  # Otherwise, empty unzip creates target as a file when touching.
150
150
  mkpath target.to_s
151
- Zip::ZipFile.open(zip_file.to_s) do |zip|
152
- entries = zip.collect
153
- @paths.each do |path, patterns|
154
- patterns.map(entries).each do |dest, entry|
155
- next if entry.directory?
156
- dest = File.expand_path(dest, target.to_s)
157
- trace "Extracting #{dest}"
158
- mkpath File.dirname(dest) rescue nil
159
- entry.restore_permissions = true
160
- entry.extract(dest) { true }
151
+ if zip_file.to_s.match /\.t?gz$/
152
+ #un-tar.gz
153
+ Zlib::GzipReader.open(zip_file.to_s) { |tar|
154
+ Archive::Tar::Minitar::Input.open(tar) do |inp|
155
+ inp.each do |tar_entry|
156
+ @paths.each do |path, patterns|
157
+ patterns.map([tar_entry]).each do |dest, entry|
158
+ next if entry.directory?
159
+ dest = File.expand_path(dest, target.to_s)
160
+ trace "Extracting #{dest}"
161
+ mkpath File.dirname(dest) rescue nil
162
+ #entry.restore_permissions = true
163
+ File.open(dest, 'w') {|f| f.write entry.read}
164
+ end
165
+ end
166
+ end
167
+ end
168
+ }
169
+ else
170
+ Zip::ZipFile.open(zip_file.to_s) do |zip|
171
+ entries = zip.collect
172
+ @paths.each do |path, patterns|
173
+ patterns.map(entries).each do |dest, entry|
174
+ next if entry.directory?
175
+ dest = File.expand_path(dest, target.to_s)
176
+ trace "Extracting #{dest}"
177
+ mkpath File.dirname(dest) rescue nil
178
+ entry.restore_permissions = true
179
+ entry.extract(dest) { true }
180
+ end
161
181
  end
162
182
  end
163
183
  end
@@ -165,6 +185,24 @@ module Buildr
165
185
  touch target.to_s
166
186
  end
167
187
 
188
+ #reads the includes/excludes and apply them to the entry_name
189
+ def included?(entry_name)
190
+ @paths.each do |path, patterns|
191
+ return true if path.nil?
192
+ if entry_name =~ /^#{path}/
193
+ short = entry_name.sub(path, '')
194
+ if patterns.include.any? { |pattern| File.fnmatch(pattern, entry_name) } &&
195
+ !patterns.exclude.any? { |pattern| File.fnmatch(pattern, entry_name) }
196
+ # trace "tar_entry.full_name " + entry_name + " is included"
197
+ return true
198
+ end
199
+ end
200
+ end
201
+ # trace "tar_entry.full_name " + entry_name + " is excluded"
202
+ return false
203
+ end
204
+
205
+
168
206
  # :call-seq:
169
207
  # include(*files) => self
170
208
  # include(*files, :path=>name) => self
@@ -303,7 +341,7 @@ module Buildr
303
341
  #
304
342
  # For example:
305
343
  # unzip('all'=>'test.zip')
306
- # unzip('src'=>'test.zip').include('README', 'LICENSE')
344
+ # unzip('src'=>'test.zip').include('README', 'LICENSE')
307
345
  # unzip('libs'=>'test.zip').from_path('libs')
308
346
  def unzip(args)
309
347
  target, arg_names, zip_file = Buildr.application.resolve_args([args])
data/lib/buildr/scala.rb CHANGED
@@ -20,6 +20,7 @@ Buildr.repositories.remote << 'http://scala-tools.org/repo-releases'
20
20
  require 'buildr/scala/compiler'
21
21
  require 'buildr/scala/tests'
22
22
  require 'buildr/scala/bdd'
23
+ require 'buildr/scala/doc'
23
24
  require 'buildr/scala/shell'
24
25
 
25
26
  Object::Scala = Buildr::Scala
@@ -20,29 +20,36 @@ require 'buildr/java/bdd'
20
20
  require 'buildr/scala/tests'
21
21
 
22
22
  module Buildr::Scala
23
-
23
+
24
24
  # Specs is a Scala based BDD framework.
25
25
  # To use in your project:
26
26
  #
27
27
  # test.using :specs
28
- #
28
+ #
29
29
  # This framework will search in your project for:
30
30
  # src/spec/scala/**/*.scala
31
31
  class Specs < Buildr::TestFramework::JavaBDD
32
32
  @lang = :scala
33
33
  @bdd_dir = :spec
34
34
 
35
- VERSION = '1.5.0'
36
-
35
+ VERSION = '1.6.2.1'
36
+
37
37
  class << self
38
38
  def version
39
39
  Buildr.settings.build['scala.specs'] || VERSION
40
40
  end
41
-
41
+
42
42
  def dependencies
43
- ["org.scala-tools.testing:specs:jar:#{version}"] + Check.dependencies + JUnit.dependencies
43
+ unless @dependencies
44
+ super
45
+ # Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
46
+ @dependencies |= [ File.join(File.dirname(__FILE__)) ] +
47
+ ["org.scala-tools.testing:specs:jar:#{version}"] +
48
+ Check.dependencies + JUnit.dependencies + Scalac.dependencies
49
+ end
50
+ @dependencies
44
51
  end
45
-
52
+
46
53
  def applies_to?(project) #:nodoc:
47
54
  !Dir[project.path_to(:source, bdd_dir, lang, '**/*.scala')].empty?
48
55
  end
@@ -57,39 +64,37 @@ module Buildr::Scala
57
64
 
58
65
  def initialize(task, options) #:nodoc:
59
66
  super
60
-
67
+
61
68
  specs = task.project.path_to(:source, :spec, :scala)
62
69
  task.compile.from specs if File.directory?(specs)
63
-
70
+
64
71
  resources = task.project.path_to(:source, :spec, :resources)
65
72
  task.resources.from resources if File.directory?(resources)
66
73
  end
67
-
74
+
68
75
  def tests(dependencies)
69
- dependencies += [task.compile.target.to_s]
70
76
  candidates = filter_classes(dependencies, :interfaces => ['org.specs.Specification'])
71
-
77
+
72
78
  Java.load # Java is already loaded, but just in case
73
-
79
+
74
80
  filter = Java.org.apache.buildr.JavaTestFilter.new(dependencies.to_java(Java.java.lang.String))
75
81
  filter.add_fields ['MODULE$'].to_java(Java.java.lang.String)
76
- filter.filter(candidates.to_java(Java.java.lang.String)) # we only want singletons
82
+ filter.filter(candidates.to_java(Java.java.lang.String)).map { |s| s[0..(s.size - 2)] }
77
83
  end
78
-
84
+
79
85
  def run(specs, dependencies) #:nodoc:
80
- dependencies += [task.compile.target.to_s, File.join(File.dirname(__FILE__))] + Scalac.dependencies
81
-
82
86
  cmd_options = { :properties => options[:properties],
83
87
  :java_args => options[:java_args],
84
- :classpath => dependencies}
88
+ :classpath => dependencies,
89
+ :name => false }
85
90
 
86
91
  runner = 'org.apache.buildr.SpecsSingletonRunner'
87
92
  specs.inject [] do |passed, spec|
88
93
  begin
89
94
  unless Util.win_os?
90
- Java::Commands.java(runner, task.compile.target.to_s, '-c', spec, cmd_options)
95
+ Java::Commands.java(runner, task.compile.target.to_s, '-c', spec + '$', cmd_options)
91
96
  else
92
- Java::Commands.java(runner, task.compile.target.to_s, spec, cmd_options)
97
+ Java::Commands.java(runner, task.compile.target.to_s, spec + '$', cmd_options)
93
98
  end
94
99
  rescue => e
95
100
  passed