buildr 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +17 -0
- data/lib/buildr.rb +21 -7
- data/lib/buildr/javacc.rb +69 -0
- data/lib/{java → buildr}/jetty.rb +9 -3
- data/lib/{java → buildr}/jetty/JettyWrapper$1.class +0 -0
- data/lib/buildr/jetty/JettyWrapper$BuildrHandler.class +0 -0
- data/lib/buildr/jetty/JettyWrapper.class +0 -0
- data/lib/{java → buildr}/jetty/JettyWrapper.java +5 -39
- data/lib/buildr/openjpa.rb +74 -0
- data/lib/buildr/xmlbeans.rb +61 -0
- data/lib/core/common.rb +22 -6
- data/lib/core/project.rb +24 -23
- data/lib/core/rake_ext.rb +2 -15
- data/lib/core/transports.rb +19 -8
- data/lib/java/ant.rb +52 -53
- data/lib/java/artifact.rb +50 -9
- data/lib/java/compile.rb +3 -3
- data/lib/java/eclipse.rb +1 -1
- data/lib/java/java.rb +64 -61
- data/lib/java/packaging.rb +16 -11
- data/lib/java/test.rb +29 -4
- data/lib/tasks/concat.rb +1 -0
- data/lib/tasks/zip.rb +3 -7
- metadata +14 -13
- data/lib/java/javacc.rb +0 -72
- data/lib/java/jetty/JettyWrapper$BuildrHandler.class +0 -0
- data/lib/java/jetty/JettyWrapper.class +0 -0
- data/lib/java/openjpa.rb +0 -63
- data/lib/java/xmlbeans.rb +0 -72
data/CHANGELOG
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
0.22 (4/26/2007)
|
2
|
+
* Added: Calling projects(:in=>foo) returns only the sub-projects defined in foo.
|
3
|
+
* Added: _() as shortcut for path_to().
|
4
|
+
* Added: You can pass properties to java by setting the :properties options.
|
5
|
+
* Added: JUnit task has a way of setting options (options accessor and using method), which for now supports passing properties to java.
|
6
|
+
* Added: You can now use the struct method to create a Struct for structoring your multiple artifacts.
|
7
|
+
* Changed: Use rake artifacts to download all artifacts not already in the local repository, and also download modified artifacts (*cough*snapshots*cough*)
|
8
|
+
* Changed: Transport.download now uses timestamp on the destination file and If-Modified-Since header to skip downloads of unmodified files.
|
9
|
+
* Changed: Downloading artifact sets the time stamp from the repository.
|
10
|
+
* Changed: Use buildr.rake in the project's directory and your home directory, instead of buildr.rb.
|
11
|
+
* Changed: filter method accepts one argument, the source directory. Use filter(src).into(target).
|
12
|
+
* Changed: Running Javac/Apt/Javadoc in process.
|
13
|
+
* Changed: Using Ant for OpenJPA enhancer and XMLBeans schema compiler.
|
14
|
+
* Changed: Jetty, JavaCC, OpenJPA and XMLBeans are no longer included by default. You need to require them explicitly, e.g. require "buildr/jetty".
|
15
|
+
* Removed: Tasks no longer use a base directory, always map paths directly using file, path_to or _().
|
16
|
+
* Fixed: The artifacts task no longer downloads POMs for artifacts created by the Rakefile.
|
17
|
+
|
1
18
|
0.21 (4/20/2007)
|
2
19
|
* Added: Methods to read and write a file (shortcut for File.read/File.open.write).
|
3
20
|
* Changed: Filter task now takes a source directory and target directory, and copies all included (sans excluded) files between the two.
|
data/lib/buildr.rb
CHANGED
@@ -30,16 +30,24 @@ end
|
|
30
30
|
|
31
31
|
|
32
32
|
module Buildr
|
33
|
-
VERSION = "0.
|
33
|
+
VERSION = "0.22.0"
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Dir[File.expand_path("*/*.rb", __DIR__)].each { |file| require file.sub("#{here}/", "") }
|
36
|
+
$LOAD_PATH.unshift __DIR__
|
37
|
+
["core", "tasks", "java"].each do |dir|
|
38
|
+
Dir[File.join(__DIR__, dir, "*.rb")].map { |file| File.basename(file) }.each { |file| require "#{dir}/#{file}" }
|
40
39
|
end
|
41
40
|
|
42
|
-
|
41
|
+
|
42
|
+
# Methods defined in Buildr are both instance methods (e.g. when included in Project)
|
43
|
+
# and class methods when invoked like Buildr.artifacts().
|
44
|
+
module Buildr ; extend self ; end
|
45
|
+
# The Rakefile object (self) has access to all the Buildr methods and constants.
|
46
|
+
class << self ; include Buildr ; end
|
47
|
+
class Object ; Buildr.constants.each { |c| const_set c, Buildr.const_get(c) unless const_defined?(c) } ; end
|
48
|
+
# Project has visibility to everything in the Buildr namespace. (See above for constants)
|
49
|
+
class Project ; include Buildr ; end
|
50
|
+
|
43
51
|
|
44
52
|
# The greate method_missing/Object extend bug requires us to load
|
45
53
|
# XMLBuilder after we're done enhancing Object.
|
@@ -51,7 +59,13 @@ module Buildr
|
|
51
59
|
end
|
52
60
|
|
53
61
|
# Load the settings files.
|
54
|
-
[ File.expand_path("buildr.
|
62
|
+
[ File.expand_path("buildr.rake", ENV["HOME"] || "~"), File.expand_path("buildr.rake") ].each { |file| load file if File.exist?(file) }
|
63
|
+
[ File.expand_path("buildr.rb", ENV["HOME"] || "~"), File.expand_path("buildr.rb") ].each do |file|
|
64
|
+
if File.exist?(file)
|
65
|
+
warn "Please use #{file.ext('rake')} instead of #{file}"
|
66
|
+
require file
|
67
|
+
end
|
68
|
+
end
|
55
69
|
|
56
70
|
#Load local tasks that can be used in the Rakefile.
|
57
71
|
Dir["#{Dir.pwd}/tasks/*.rake"].each do |file|
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "java/java"
|
2
|
+
|
3
|
+
module Buildr
|
4
|
+
module JavaCC
|
5
|
+
|
6
|
+
REQUIRES = [ "net.java.dev.javacc:javacc:jar:4.0", "net.java.dev.javacc:javacc:jar:4.0" ]
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
def javacc(*args)
|
11
|
+
options = Hash === args.last ? args.pop.clone : {}
|
12
|
+
options[:verbose] ||= Rake.application.options.trace || false
|
13
|
+
fu_check_options options, *Java::JAVA_OPTIONS + [:output]
|
14
|
+
|
15
|
+
(options[:classpath] ||= []) << REQUIRES
|
16
|
+
java_args = ["javacc"]
|
17
|
+
java_args << "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
|
18
|
+
java_args += args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jj"] : f }.flatten
|
19
|
+
java_args << options.reject { |k, v| !Java::JAVA_OPTIONS.include?(k) }
|
20
|
+
Java.java(*java_args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def jjtree(*args)
|
24
|
+
options = Hash === args.last ? args.pop.clone : {}
|
25
|
+
options[:verbose] ||= Rake.application.options.trace || false
|
26
|
+
fu_check_options options, *Java::JAVA_OPTIONS + [:output, :build_node_files]
|
27
|
+
|
28
|
+
(options[:classpath] ||= []) << REQUIRES
|
29
|
+
java_args = ["jjtree"]
|
30
|
+
java_args << "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
|
31
|
+
java_args << "-BUILD_NODE_FILES=#{options[:build_node_files] || false}"
|
32
|
+
java_args += args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jjt"] : f }.flatten
|
33
|
+
java_args << options.reject { |k, v| !Java::JAVA_OPTIONS.include?(k) }
|
34
|
+
Java.java(*java_args)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def javacc(*args)
|
40
|
+
if Hash === args.last
|
41
|
+
options = args.pop
|
42
|
+
in_package = options[:in_package].split(".")
|
43
|
+
else
|
44
|
+
in_package = []
|
45
|
+
end
|
46
|
+
file(path_to("target/generated/javacc")=>args.flatten) do |task|
|
47
|
+
JavaCC.javacc task.prerequisites, :output=>File.join(task.name, in_package)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def jjtree(*args)
|
52
|
+
if Hash === args.last
|
53
|
+
options = args.pop
|
54
|
+
in_package = options[:in_package].split(".")
|
55
|
+
build_node_files = options[:build_node_files]
|
56
|
+
else
|
57
|
+
in_package = []
|
58
|
+
end
|
59
|
+
file(path_to("target/generated/jjtree")=>args.flatten) do |task|
|
60
|
+
JavaCC.jjtree task.prerequisites, :output=>File.join(task.name, in_package), :build_node_files=>build_node_files
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
class Project
|
67
|
+
include JavaCC
|
68
|
+
end
|
69
|
+
end
|
@@ -2,6 +2,7 @@ require "uri"
|
|
2
2
|
require "net/http"
|
3
3
|
require "core/project"
|
4
4
|
require "java/artifact"
|
5
|
+
require "java/java"
|
5
6
|
|
6
7
|
module Buildr
|
7
8
|
|
@@ -38,9 +39,14 @@ module Buildr
|
|
38
39
|
|
39
40
|
# Artifacts required to run Jetty.
|
40
41
|
REQUIRES = [ "org.mortbay.jetty:jetty:jar:6.1.1", "org.mortbay.jetty:jetty-util:jar:6.1.1",
|
41
|
-
"org.mortbay.jetty:
|
42
|
+
"org.mortbay.jetty:servlet-api-2.5:jar:6.1.1", "log4j:log4j:jar:1.2.13",
|
42
43
|
"commons-logging:commons-logging:jar:1.1" ]
|
43
44
|
|
45
|
+
Java.rjb.onload do
|
46
|
+
Java.rjb.classpath << REQUIRES
|
47
|
+
Java.rjb.classpath << File.join(__DIR__, "jetty")
|
48
|
+
end
|
49
|
+
|
44
50
|
# Default URL for Jetty.
|
45
51
|
URL = "http://localhost:8080"
|
46
52
|
|
@@ -65,8 +71,6 @@ module Buildr
|
|
65
71
|
# invoke the #use task instead.
|
66
72
|
def start(pipe = nil)
|
67
73
|
begin
|
68
|
-
Java.rjb.classpath += REQUIRES
|
69
|
-
Java.rjb.classpath << File.join(__DIR__, "jetty")
|
70
74
|
Java.rjb do
|
71
75
|
port = URI.parse(url).port
|
72
76
|
puts "Starting Jetty at http://localhost:#{port}"
|
@@ -78,6 +82,8 @@ module Buildr
|
|
78
82
|
sleep # Forever
|
79
83
|
end
|
80
84
|
rescue Interrupt # Stopped from console
|
85
|
+
rescue Exception=>error
|
86
|
+
puts "#{error.class}: #{error.message}"
|
81
87
|
end
|
82
88
|
exit! # No at_exit
|
83
89
|
end
|
File without changes
|
Binary file
|
Binary file
|
@@ -18,22 +18,10 @@ import java.util.HashMap;
|
|
18
18
|
public class JettyWrapper {
|
19
19
|
|
20
20
|
private Server _server;
|
21
|
-
private WebAppContext _webAppHandler;
|
22
21
|
private ContextHandlerCollection _handlerColl;
|
23
|
-
private String _webAppDir;
|
24
|
-
private String _contextPath;
|
25
22
|
|
26
|
-
public JettyWrapper(int port
|
23
|
+
public JettyWrapper(int port) throws Exception {
|
27
24
|
_server = new Server(port);
|
28
|
-
//_webAppDir = webAppDir;
|
29
|
-
//_contextPath = contextPath;
|
30
|
-
|
31
|
-
// Adding handler for the war to deploy
|
32
|
-
//_webAppHandler = new WebAppContext(_webAppDir, _contextPath);
|
33
|
-
//_webAppHandler.setConfigurationClasses(new String[] {
|
34
|
-
// "org.mortbay.jetty.webapp.WebInfConfiguration",
|
35
|
-
// "org.mortbay.jetty.webapp.WebXmlConfiguration"});
|
36
|
-
|
37
25
|
// Adding the buildr handler to control our server lifecycle
|
38
26
|
ContextHandler context = new ContextHandler();
|
39
27
|
context.setContextPath("/buildr");
|
@@ -41,30 +29,20 @@ public class JettyWrapper {
|
|
41
29
|
context.setHandler(handler);
|
42
30
|
|
43
31
|
_handlerColl = new ContextHandlerCollection();
|
44
|
-
_handlerColl.setHandlers(new Handler[] {
|
32
|
+
_handlerColl.setHandlers(new Handler[] {context});
|
45
33
|
|
46
34
|
_server.addHandler(_handlerColl);
|
47
35
|
_server.start();
|
48
36
|
}
|
49
37
|
|
50
|
-
|
38
|
+
/*
|
39
|
+
public void join() {
|
51
40
|
try {
|
52
|
-
//_server.start();
|
53
41
|
_server.join();
|
54
42
|
} catch (Exception e) {
|
55
43
|
e.printStackTrace();
|
56
44
|
}
|
57
45
|
}
|
58
|
-
/*
|
59
|
-
public static void main(String[] args) {
|
60
|
-
if (args.length != 2) {
|
61
|
-
System.out.println("Please provide the webapp directory and the context path.");
|
62
|
-
}
|
63
|
-
String webAppDir = args[0];
|
64
|
-
String contextPath = args[1];
|
65
|
-
JettyWrapper jetwrap = new JettyWrapper(webAppDir, contextPath);
|
66
|
-
jetwrap.start();
|
67
|
-
}
|
68
46
|
*/
|
69
47
|
|
70
48
|
private class BuildrHandler extends AbstractHandler {
|
@@ -99,14 +77,6 @@ public class JettyWrapper {
|
|
99
77
|
_handlerColl.addHandler(context);
|
100
78
|
context.start();
|
101
79
|
_apps.put(path, context);
|
102
|
-
//_webAppHandler.stop();
|
103
|
-
//_handlerColl.removeHandler(_webAppHandler);
|
104
|
-
//_webAppHandler = new WebAppContext(_webAppDir, _contextPath);
|
105
|
-
//_webAppHandler.setConfigurationClasses(new String[] {
|
106
|
-
// "org.mortbay.jetty.webapp.WebInfConfiguration",
|
107
|
-
// "org.mortbay.jetty.webapp.WebXmlConfiguration"});
|
108
|
-
//_handlerColl.addHandler(_webAppHandler);
|
109
|
-
//_webAppHandler.start();
|
110
80
|
response.getWriter().println("Deployed");
|
111
81
|
response.getWriter().println(context.getTempDirectory());
|
112
82
|
((Request)request).setHandled(true);
|
@@ -143,11 +113,7 @@ public class JettyWrapper {
|
|
143
113
|
} catch (Exception e) {
|
144
114
|
e.printStackTrace();
|
145
115
|
}
|
146
|
-
}
|
147
|
-
response.getWriter().println(_webAppHandler.getTempDirectory());
|
148
|
-
((Request)request).setHandled(true);
|
149
|
-
return;
|
150
|
-
}
|
116
|
+
}
|
151
117
|
response.getWriter().println("OK " + request.getPathInfo());
|
152
118
|
((Request)request).setHandled(true);
|
153
119
|
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "java/java"
|
2
|
+
|
3
|
+
module Buildr
|
4
|
+
module OpenJPA
|
5
|
+
|
6
|
+
VERSION = "0.9.7-incubating-SNAPSHOT"
|
7
|
+
|
8
|
+
REQUIRES = [ "org.apache.openjpa:openjpa-all:jar:#{VERSION}",
|
9
|
+
"commons-collections:commons-collections:jar:3.1",
|
10
|
+
"commons-dbcp:commons-dbcp:jar:1.2.1",
|
11
|
+
"commons-lang:commons-lang:jar:2.1",
|
12
|
+
"commons-pool:commons-pool:jar:1.2",
|
13
|
+
"javax.persistence:persistence-api:jar:1.0",
|
14
|
+
"org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.0",
|
15
|
+
"org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0",
|
16
|
+
"net.sourceforge.serp:serp:jar:1.11.0" ]
|
17
|
+
|
18
|
+
class << self
|
19
|
+
|
20
|
+
def enhance(options)
|
21
|
+
fu_check_options options, :classpath, :properties, :output
|
22
|
+
artifacts = Buildr.artifacts(options[:classpath] || []).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
|
23
|
+
properties = file(options[:properties]).tap { |task| task.invoke }.to_s
|
24
|
+
|
25
|
+
Ant.executable("openjpa") do |ant|
|
26
|
+
ant.taskdef :name=>"enhancer", :classname=>"org.apache.openjpa.ant.PCEnhancerTask",
|
27
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
28
|
+
ant.enhancer :directory=>options[:output].to_s do
|
29
|
+
config :propertiesFile=>properties
|
30
|
+
classpath :path=>artifacts.join(File::PATH_SEPARATOR)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def mapping_tool(options)
|
36
|
+
fu_check_options options, :classpath, :properties, :sql, :action
|
37
|
+
Java.java "org.apache.openjpa.jdbc.meta.MappingTool", "-p", options[:properties].to_s, "-sql", options[:sql],
|
38
|
+
"-sa", options[:action], :classpath=>Buildr.artifacts(options[:classpath], requires), :name=>"Mapping Tool"
|
39
|
+
=begin
|
40
|
+
# Hopefully this will work in a future release.
|
41
|
+
artifacts = Buildr.artifacts(options[:classpath] || []).each{ |a| a.invoke }.map(&:to_s) + requires
|
42
|
+
properties = file(options[:properties]).tap { |task| task.invoke }.to_s
|
43
|
+
|
44
|
+
Ant.executable("openjpa") do |ant|
|
45
|
+
ant.taskdef :name=>"mapping", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask",
|
46
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
47
|
+
ant.mapping :schemaAction=>options[:action], :sqlFile=>options[:sql].to_s do
|
48
|
+
config :propertiesFile=>properties
|
49
|
+
classpath :path=>artifacts.join(File::PATH_SEPARATOR)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
=end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def requires()
|
58
|
+
@required ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def open_jpa_enhance(options = nil)
|
64
|
+
jpa_options = { :output=>compile.target, :classpath=>compile.classpath,
|
65
|
+
:properties=>path_to("src/main/resources/META-INF/persistence.xml") }
|
66
|
+
OpenJPA.enhance jpa_options.merge(options || {})
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
class Project
|
72
|
+
include OpenJPA
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "java/java"
|
2
|
+
require "java/ant"
|
3
|
+
|
4
|
+
module Buildr
|
5
|
+
module XMLBeans
|
6
|
+
|
7
|
+
REQUIRES = [ "xmlbeans:xbean:jar:2.2.0", "stax:stax-api:jar:1.0" ]
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def compile(*args)
|
12
|
+
options = Hash === args.last ? args.pop : {}
|
13
|
+
options[:verbose] ||= Rake.application.options.trace || false
|
14
|
+
fu_check_options options, :verbose, :noop, :javasource, :jar, :compile, :output, :xsb
|
15
|
+
puts "Running XMLBeans schema compiler" if verbose
|
16
|
+
Ant.executable("xmlbeans") do |ant|
|
17
|
+
ant.taskdef :name=>"xmlbeans", :classname=>"org.apache.xmlbeans.impl.tool.XMLBean",
|
18
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
19
|
+
ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s, :classgendir=>options[:output].to_s,
|
20
|
+
:javasource=>options[:javasource] do
|
21
|
+
args.flatten.each { |file| fileset File.directory?(file) ? { :dir=>file } : { :file=>file } }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
# Touch paths to let other tasks know there's an update.
|
25
|
+
touch options[:output].to_s, :verbose=>false
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def requires()
|
31
|
+
@requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def compile_xml_beans(*args)
|
37
|
+
# Generate sources and add them to the compile task.
|
38
|
+
generated = file(path_to("target/generated/xmlbeans")=>FileList[args.flatten]) do |task|
|
39
|
+
XMLBeans.compile task.prerequisites, :output=>task.name,
|
40
|
+
:javasource=>compile.options.source, :xsb=>compile.target
|
41
|
+
end
|
42
|
+
compile.from(generated).with(JAVAX.stream, XMLBEANS)
|
43
|
+
# Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
|
44
|
+
# into the target directory, or the rest is useless.
|
45
|
+
compile do |task|
|
46
|
+
verbose(false) do
|
47
|
+
base = Pathname.new(generated.to_s)
|
48
|
+
FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file|
|
49
|
+
target = File.join(compile.target.to_s, Pathname.new(file).relative_path_from(base))
|
50
|
+
mkpath File.dirname(target) ; cp file, target
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
class Project
|
59
|
+
include XMLBeans
|
60
|
+
end
|
61
|
+
end
|
data/lib/core/common.rb
CHANGED
@@ -4,6 +4,23 @@ require "core/transports"
|
|
4
4
|
|
5
5
|
module Buildr
|
6
6
|
|
7
|
+
# :call-seq:
|
8
|
+
# struct(hash) => Struct
|
9
|
+
#
|
10
|
+
# Convenience method for creating an anonymous Struct.
|
11
|
+
#
|
12
|
+
# For example:
|
13
|
+
# COMMONS = struct(
|
14
|
+
# :collections =>"commons-collections:commons-collections:jar:3.1",
|
15
|
+
# :lang =>"commons-lang:commons-lang:jar:2.1",
|
16
|
+
# :logging =>"commons-logging:commons-logging:jar:1.0.3",
|
17
|
+
# )
|
18
|
+
#
|
19
|
+
# compile.with COMMONS.logging
|
20
|
+
def struct(hash)
|
21
|
+
Struct.new(nil, *hash.keys).new(*hash.values)
|
22
|
+
end
|
23
|
+
|
7
24
|
# :call-seq:
|
8
25
|
# write(name, content)
|
9
26
|
# write(name) { ... }
|
@@ -239,7 +256,7 @@ module Buildr
|
|
239
256
|
end
|
240
257
|
|
241
258
|
# :call-seq:
|
242
|
-
# filter(
|
259
|
+
# filter(source) => Filter
|
243
260
|
#
|
244
261
|
# Creates a filter that will copy files from the source directory into the target directory.
|
245
262
|
# You can extend the filter to modify files by mapping <tt>${key}</tt> into values in each
|
@@ -248,13 +265,12 @@ module Buildr
|
|
248
265
|
# A filter is not a task, you must call the Filter#run method to execute it.
|
249
266
|
#
|
250
267
|
# For example, to copy all files from one directory to another:
|
251
|
-
# filter("
|
268
|
+
# filter("src/files").into("target/classes").run
|
252
269
|
# To include only the text files, and replace each instance of <tt>${build}</tt> with the current
|
253
270
|
# date/time:
|
254
|
-
# filter("
|
255
|
-
def filter(
|
256
|
-
|
257
|
-
Filter.new.into(target).tap { |filter| filter.from(source) if source }
|
271
|
+
# filter("src/files").into("target/classes").include("*.txt").using("build"=>Time.now).run
|
272
|
+
def filter(source)
|
273
|
+
Filter.new.from(source)
|
258
274
|
end
|
259
275
|
|
260
276
|
end
|