jraw 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ === 0.8.1 / 2009-08-10
2
+
3
+ * Initial release
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README
4
+ Rakefile
5
+ bin/jraw
data/README ADDED
@@ -0,0 +1,29 @@
1
+ = About JRAW
2
+
3
+ JRAW is a gem that provides a wrapper for ant.
4
+ You can use JRAW to write ant scripts in Ruby instead of XML.
5
+
6
+ More information will be provided asap.
7
+ You can get initial support via malagant1969@googlemail.com (Michael Johann)
8
+
9
+ == REQUIREMENTS
10
+
11
+ To use JRAW you need JRuby oder the gem RJB (Ruby Java Bridge)
12
+
13
+ == INSTALL
14
+
15
+ gem install malagant-jraw
16
+
17
+ == LICENSE
18
+
19
+ Licensed under the Apache License, Version 2.0 (the "License");
20
+ you may not use this file except in compliance with the License.
21
+ You may obtain a copy of the License at
22
+
23
+ http://www.apache.org/licenses/LICENSE-2.0
24
+
25
+ Unless required by applicable law or agreed to in writing, software
26
+ distributed under the License is distributed on an "AS IS" BASIS,
27
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ See the License for the specific language governing permissions and limitations
29
+ under the License.
@@ -0,0 +1,44 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ $LOAD_PATH.push(FileUtils::pwd + '/lib')
14
+ require 'rubygems'
15
+ require 'hoe'
16
+ require 'lib/jraw'
17
+ require 'rake/testtask'
18
+
19
+ def apply_default_hoe_properties(hoe)
20
+ hoe.remote_rdoc_dir = ''
21
+ hoe.rubyforge_name = 'jraw'
22
+ hoe.author = 'Michael Johann'
23
+ hoe.email = 'mjohann@rails-experts.com'
24
+ hoe.url = 'http://kenai.com/projects/raw/'
25
+ hoe.summary = 'A Ruby module that wraps the Apache Ant build tool.
26
+ JRAW can be used to invoke Ant Tasks from a Ruby or a JRuby script.'
27
+ hoe.description = hoe.paragraphs_of('README', 2..5).join("\n\n")
28
+ # hoe.changes = hoe.paragraphs_of('HISTORY', 0..1).join("\n\n")
29
+ puts "Current changes in this release_______________ "
30
+ puts "#{hoe.changes}"
31
+ puts "----------------------------------------------"
32
+ end
33
+
34
+ # builds the MRI Gem
35
+ Hoe.new('jraw', JRAW::VERSION) do |hoe|
36
+ apply_default_hoe_properties hoe
37
+ hoe.extra_deps << ["rjb", ">= 1.0.3"]
38
+ end
39
+
40
+ #builds the JRuby Gem
41
+ Hoe.new('jraw', JRAW::VERSION) do |hoe|
42
+ apply_default_hoe_properties hoe
43
+ hoe.spec_extras = { :platform => 'java' }
44
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env jruby
2
+ require 'lib/jraw_runner'
3
+
@@ -0,0 +1,36 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ require 'rjb_adapter'
14
+
15
+ module JRAW
16
+ # Defining some Java classes for building the ant tasks etc
17
+ module ApacheAnt
18
+ # The default logger
19
+ DefaultLogger = RjbAdapter.import_class("org.apache.tools.ant.DefaultLogger")
20
+ # The main class from Apache ANT
21
+ Main = RjbAdapter.import_class("org.apache.tools.ant.Main")
22
+ # The ANT project class
23
+ Project = RjbAdapter.import_class("org.apache.tools.ant.Project")
24
+ # The ANT RuntimeConfigurable
25
+ RuntimeConfigurable = RjbAdapter.import_class("org.apache.tools.ant.RuntimeConfigurable")
26
+ # The ANT target class
27
+ Target = RjbAdapter.import_class("org.apache.tools.ant.Target")
28
+ # ANT's class for dynamically wrapping taks
29
+ UnknownElement = RjbAdapter.import_class("org.apache.tools.ant.UnknownElement")
30
+ end
31
+
32
+ module JavaLang
33
+ # Java's System class for access to System.out and System.err
34
+ System = RjbAdapter.import_class("java.lang.System")
35
+ end
36
+ end
@@ -0,0 +1,182 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ module JRAW
14
+ class AntProject
15
+ require 'logger'
16
+ require 'ant_task'
17
+
18
+ @@classes_loaded = false
19
+
20
+ # Here we go: Let's define some attributes
21
+ public
22
+ # getter and setter for the project instance,
23
+ # the logger, the declarative and the attribute ant_version
24
+ attr_accessor :project, :logger, :ant_version, :declarative, :default_target
25
+
26
+ # Create an AntProject. Parameters are specified via a hash:
27
+ # :ant_home => <em>Ant basedir</em>
28
+ # -A String indicating the location of the ANT_HOME directory. If provided, JRAW will
29
+ # load the classes from the ANT_HOME/lib dir. If ant_home is not provided, the ANT jar files
30
+ # must be available on the CLASSPATH.
31
+ # :name => <em>project_name</em>
32
+ # -A String indicating the name of this project.
33
+ # :basedir => <em>project_basedir</em>
34
+ # -A String indicating the basedir of this project. Corresponds to the 'basedir' attribute
35
+ # on an Ant project.
36
+ # :declarative => <em>declarative_mode</em>
37
+ # -A boolean value indicating wether ANT tasks created by this project instance should
38
+ # have their execute() method invoked during their creation. For example, with
39
+ # the option :declarative => <em>true</em> the following task would execute;
40
+ # @antProject.echo(:message => "An Echo Task")
41
+ # However, with the option :declarative => false, the programmer is required to execute the
42
+ # task explicitly;
43
+ # echoTask = @antProject.echo(:message => "An Echo Task")
44
+ # echoTask.execute()
45
+ # Default value is <em>true</em>.
46
+ # :logger => <em>Logger</em>
47
+ # -A Logger instance. Defaults to Logger.new(STDOUT)
48
+ # :loglevel => <em>The level to set the logger to</em>
49
+ # -Defaults to Logger::ERROR
50
+ # This is for further initializations inside the constructor
51
+ # and must be called once from the users ANT script
52
+ # Example usage:
53
+ # init_project :basedir => '/Users/mjohann/projects/jruby_jraw',
54
+ # :name => 'JRuby',
55
+ # :default => 'jar',
56
+ # :anthome => ANT_HOME
57
+ def init_project(options)
58
+ # The ANT version used
59
+ logger.info JRAW::ApacheAnt::Main.ant_version
60
+ @ant_version = JRAW::ApacheAnt::Main.ant_version[/\d\.\d\.\d/].to_f
61
+ # instance of ANT project
62
+ @project = JRAW::ApacheAnt::Project.new
63
+ # The default project name taken from the options hash or left blank
64
+ @project.name = options[:name] || ''
65
+ # The default ANT target taken from the options hash or left blank
66
+ @project.default = ''
67
+ # The project's base directory taken from the options hash or the current working directory
68
+ @project.basedir = options[:basedir] || FileUtils::pwd
69
+ # intializing the ANT project
70
+ @default_target = options[:default] if options[:default]
71
+ logger.debug "Default == #{options[:default]}"
72
+ @project.init
73
+
74
+ # Sets the task definitions to be declared only or they get executed directly
75
+ # Default is true
76
+ unless options[:declarative]
77
+ logger.debug("declarative is nil")
78
+ self.declarative = true
79
+ else
80
+ logger.debug("declarative is #{options[:declarative]}")
81
+ self.declarative = options[:declarative]
82
+ end
83
+
84
+ # Here we setup the default logger instance
85
+ default_logger = ApacheAnt::DefaultLogger.new
86
+ default_logger.message_output_level = Logger::INFO
87
+ # Output is either Standard out or the stream in options hash
88
+ default_logger.output_print_stream = options[:outputstr] || JavaLang::System.out
89
+ default_logger.error_print_stream = options[:errorstr] || JavaLang::System.err
90
+ # Output will be like in log4j.properties configured
91
+ default_logger.emacs_mode = false
92
+ # Set the default logger as the build listener
93
+ @project.add_build_listener(default_logger)
94
+ end
95
+
96
+ # Constructor will be called internally and consumes
97
+ # the options hash which can contain infos about a logger
98
+ def initialize(options)
99
+ @logger = options[:logger] || Logger.new(STDOUT)
100
+ logger.level = options[:loglevel] || Logger::INFO
101
+
102
+ @task_stack = Array.new
103
+ end
104
+
105
+ def property_value(name)
106
+ project.get_property(name)
107
+ end
108
+
109
+ def build_instance_variable(prop)
110
+ begin
111
+ instance_variable = "@#{instvar(prop[0])} = '#{prop[1]}'"
112
+ self.instance_eval instance_variable
113
+ logger.debug instance_variable
114
+ rescue SyntaxError => e
115
+ logger.error "Problem with #{instance_variable}. Cannot create valid instance variable."
116
+ raise e
117
+ end
118
+ end
119
+
120
+ def build_properties
121
+ project.properties.each do |prop|
122
+ build_instance_variable(prop)
123
+ end
124
+ logger.debug instance_variables
125
+ # TODO: Hack
126
+ @ant_version = JRAW::ApacheAnt::Main.ant_version[/\d\.\d\.\d/].to_f
127
+ end
128
+
129
+ def instvar(name)
130
+ name = name.gsub('.', '_')
131
+ name.gsub('-', '_')
132
+ end
133
+
134
+
135
+ def method_missing(sym, *args)
136
+ begin
137
+ task = AntTask.new(sym.to_s, self, args[0])
138
+
139
+ parent_task = @task_stack.last
140
+ @task_stack << task
141
+
142
+ yield self if block_given?
143
+
144
+ parent_task.add(task) if parent_task
145
+
146
+ if @task_stack.nitems == 1
147
+ if declarative == true
148
+ @logger.debug("Executing #{task}")
149
+ task.execute
150
+ else
151
+ @logger.debug("Returning #{task}")
152
+ return task
153
+ end
154
+ end
155
+
156
+ rescue
157
+ @logger.error("Error instantiating '#{sym.to_s}' task: " + $!)
158
+ raise
159
+ ensure
160
+ @task_stack.pop
161
+ end
162
+
163
+ end
164
+
165
+ #The Ant AntProject's name. Default is ''
166
+ def name
167
+ return @project.getName
168
+ end
169
+
170
+ #The Ant AntProject's basedir. Default is '.'
171
+ def basedir
172
+ return @project.base_dir.absolute_path;
173
+ end
174
+
175
+ #Displays the Class name followed by the AntProject name
176
+ # -e.g. AntProject[BigCoProject]
177
+ def to_s
178
+ return self.class.name + "[#{name}]"
179
+ end
180
+
181
+ end
182
+ end
@@ -0,0 +1,141 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ module JRAW
14
+ class AntTask
15
+ attr_accessor :unknown_element, :project, :taskname, :logger, :executed
16
+
17
+ public
18
+ # Creates an AntTask
19
+ # taskname
20
+ # -A String representing the name of an Ant Task. This name should correspond to
21
+ # the element name of the Ant xml task (e.g. javac, jar, war, etc).
22
+ # antProject
23
+ # -An instance of an AntProject
24
+ # attributes
25
+ # -A Hash of task name/values to be applied to the task.
26
+ #
27
+ # For example:
28
+ # antProject = AntProject.new()
29
+ # antTask = AntTask.new('javac', antProject, {:debug => 'on', :verbose => 'no', :fork => 'no'})
30
+ def initialize(taskname, antProject, attributes)
31
+
32
+ taskname = taskname[1, taskname.length-1] if taskname[0, 1] == "_"
33
+ @logger = antProject.logger
34
+ @taskname = taskname
35
+ @project_wrapper = antProject
36
+ @project = antProject.project
37
+ @logger.debug(antProject.to_s)
38
+ @unknown_element = create_unknown_element(@project, taskname)
39
+ @logger.debug(to_s)
40
+
41
+ add_attributes(attributes)
42
+
43
+ end
44
+
45
+ # Displays the Class name followed by the Task name
46
+ # -e.g. AntTask[javac]
47
+ def to_s
48
+ return self.class.name + "[#{@taskname}]"
49
+ end
50
+
51
+ def create_unknown_element(project, taskname)
52
+
53
+ element = ApacheAnt::UnknownElement.new(taskname)
54
+ element.project = project
55
+ element.owning_target = ApacheAnt::Target.new
56
+ element.task_name = taskname
57
+
58
+ #DNR. This initializes the Task's Wrapper object and prevents NullPointerExeption upon execution of the task
59
+ element.runtime_configurable_wrapper
60
+
61
+ if (@project_wrapper.ant_version >= 1.6)
62
+ element.task_type = taskname
63
+ element.namespace = ''
64
+ element.qname = taskname
65
+ end
66
+
67
+ return element
68
+
69
+ end
70
+
71
+ # Sets each attribute on the AntTask instance.
72
+ # :attributes - is a Hash.
73
+ def add_attributes(attributes)
74
+
75
+ return if attributes == nil
76
+
77
+ wrapper = ApacheAnt::RuntimeConfigurable.new(@unknown_element, @unknown_element.task_name)
78
+
79
+ if (@project_wrapper.ant_version >= 1.6)
80
+ attributes.each do |key, val|
81
+ apply_to_wrapper(wrapper, key.to_s, val){ |k, v| wrapper.set_attribute(k, v)}
82
+ end
83
+ else
84
+ @unknown_element.runtime_configurable_wrapper = wrapper
85
+ attribute_list = XmlSax::AttributeListImpl.new()
86
+ attributes.each do |key, val|
87
+ apply_to_wrapper(wrapper, key.to_s, val){ |k, v| attribute_list.add_attribute(k, 'CDATA', v)}
88
+ end
89
+ wrapper.set_attributes(attribute_list)
90
+ end
91
+
92
+ end
93
+
94
+ def apply_to_wrapper(wrapper, key, value)
95
+
96
+ raise ArgumentError, "ArgumentError: You cannot use an Array as an argument. Use the :join method instead; i.e ['file1', 'file2'].join(File::PATH_SEPARATOR)." if value.is_a?(Array)
97
+
98
+ begin
99
+ if (key == 'pcdata')
100
+ wrapper.add_text(value.to_s)
101
+ else
102
+ yield key, value.to_s
103
+ end
104
+ rescue StandardError
105
+ raise ArgumentError, "ArgumentError: Unable to set :#{key} attribute with value => '#{value}'"
106
+ end
107
+
108
+ end
109
+
110
+ # Add <em>child</em> as a child of this task.
111
+ def add(child)
112
+ @unknown_element.add_child(child.unknown_element())
113
+ @unknown_element.runtime_configurable_wrapper.add_child(child.unknown_element().runtime_configurable_wrapper)
114
+ end
115
+
116
+ # Invokes the AntTask.
117
+ def execute
118
+ @unknown_element.maybe_configure
119
+ @unknown_element.execute
120
+ build_instance_variable(@unknown_element.wrapper)
121
+ @executed = true
122
+ return nil
123
+ end
124
+
125
+ private
126
+
127
+ def build_instance_variable(wrapper)
128
+ variable = wrapper.attributeMap.get('property')
129
+
130
+ if variable
131
+ logger.debug "creating variable = @#{variable} with value #{@project_wrapper.property_value(variable.to_s)}"
132
+ unless @project_wrapper.instance_variable_defined? "@#{variable.to_s}".to_sym
133
+ instance_eval <<-END
134
+ @project_wrapper.instance_variable_set(:@#{@project_wrapper.instvar(variable)}, @project_wrapper.property_value(variable.to_s))
135
+ END
136
+ end
137
+ end
138
+ end
139
+
140
+ end
141
+ end
@@ -0,0 +1,28 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ require 'rubygems'
14
+ require 'jraw_utilities'
15
+ require 'ant_project'
16
+ require 'fileutils'
17
+ require 'target'
18
+
19
+ module JRAW
20
+ # Loading modules of apache ant
21
+ autoload :ApacheAnt, 'ant_libraries.rb'
22
+ # Loads the class java.lang.System
23
+ autoload :JavaLang, 'ant_libraries.rb'
24
+ # loads the XML-Sax parser
25
+ autoload :XmlSax, 'ant_libraries.rb'
26
+ # version of our gem
27
+ VERSION = "0.8.2"
28
+ end
@@ -0,0 +1,198 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ $LOAD_PATH.push(File.dirname(__FILE__) + '/../lib')
14
+
15
+ require 'open-uri'
16
+ require 'fileutils'
17
+ require 'optparse'
18
+ require 'jraw'
19
+
20
+ module JRAW
21
+ class JRawRunner < JRAW::AntProject
22
+ attr_reader :root, :targets
23
+
24
+ def initialize(template, root = '', options = {})
25
+ super(options)
26
+ @targets = Hash.new
27
+ @root = File.expand_path(File.directory?(root) ? root : File.join(Dir.pwd, root))
28
+
29
+ if template
30
+ logger.info("Applying script #{template}")
31
+
32
+ load_script(template)
33
+
34
+ # Execute the given target
35
+ if options[:target]
36
+ build options[:target]
37
+ # or find the default and call that
38
+ elsif @default_target
39
+ build @default_target.to_sym
40
+ end
41
+
42
+ logger.info"Applied script #{template}"
43
+ else
44
+ logger.info"No script #{template} applied."
45
+ end
46
+ end
47
+
48
+ # defines a property in ant and also an instance variable
49
+ def property(options)
50
+ name = options[:name]
51
+ file = options[:file]
52
+ environment = options[:environment]
53
+
54
+ method_missing(:property, options)
55
+
56
+ if name
57
+ build_instance_variable([name, options[:location] || options[:value]])
58
+ elsif file || environment
59
+ build_properties
60
+ else
61
+ logger.debug options.inspect
62
+ raise "No name or file attribute given for property!"
63
+ end
64
+ end
65
+
66
+ def condition(options)
67
+ property = options[:property]
68
+ environment = options[:value]
69
+
70
+
71
+ if name
72
+ build_instance_variable([name, options[:location] || options[:value]])
73
+ elsif file || environment
74
+ build_properties
75
+ else
76
+ logger.debug options.inspect
77
+ raise "No name or file attribute given for property!"
78
+ end
79
+ method_missing(:property, options)
80
+ end
81
+
82
+
83
+ def load_script(template)
84
+ begin
85
+ code = open(template).read
86
+
87
+ self.instance_eval(code)
88
+ rescue LoadError, Errno::ENOENT => e
89
+ raise "The script #{template} could not be loaded. Error: #{e}"
90
+ end
91
+ end
92
+
93
+ def target(name, options = {}, &block)
94
+ target = Target.new(name)
95
+ logger.debug("adding target #{name}")
96
+ if options[:depends]
97
+ if options[:depends].is_a? Symbol
98
+ options[:depends] = [options[:depends]]
99
+ end
100
+ options[:depends].each do |dependancy|
101
+ logger.debug "adding dependancy #{dependancy} to target #{name}"
102
+ target.dependencies << dependancy
103
+ end
104
+ end
105
+ target.block = block
106
+ targets[name] = target
107
+ end
108
+
109
+ def build(task)
110
+ block = nil
111
+ block = targets[task].block if targets[task]
112
+ raise "No target named #{task} found." unless block
113
+ targets[task].dependencies.each do |dependency|
114
+ logger.debug("But calling target #{dependency} before")
115
+ build dependency
116
+ end
117
+ logger.info("Calling target #{task}")
118
+ block.call
119
+ end
120
+ end
121
+
122
+ # Handles the startup of JRAW with parsing options etc.
123
+ class JRawTool
124
+ def parse!(args)
125
+ if args.length == 0
126
+ puts options
127
+ elsif args.length == 1 && args[0] == ('-h' || '--help')
128
+ options.parse!(args)
129
+ else
130
+ general, sub = split_args(args)
131
+ options.parse!(args)
132
+
133
+ if general.empty?
134
+ puts options
135
+ else
136
+ @root_dir = '.' if @root_dir.nil?
137
+ JRawRunner.new(general[0], @root_dir, {:loglevel => @loglevel, :target => @target})
138
+ end
139
+ end
140
+ end
141
+
142
+ def split_args(args)
143
+ left = []
144
+ while args[0] and args[0] =~ /^-/ do
145
+ left << args.shift
146
+ end
147
+ left << args.shift if args[0]
148
+ return [left, args]
149
+ end
150
+
151
+ def self.parse!(args = ARGV)
152
+ JRawTool.new.parse!(args)
153
+ end
154
+
155
+ def loglevel(level)
156
+ case level
157
+ when 'debug'
158
+ Logger::DEBUG
159
+ when 'info'
160
+ Logger::INFO
161
+ when 'warn'
162
+ Logger::WARN
163
+ when 'error'
164
+ Logger::ERROR
165
+ when 'fatal'
166
+ Logger::FATAL
167
+ end
168
+ end
169
+
170
+ # Options and how they are used
171
+ def options
172
+ OptionParser.new do |o|
173
+ o.set_summary_indent(' ')
174
+ o.banner = "Usage: jraw jraw-script-url [OPTIONS]"
175
+ o.define_head "Ruby ANT Wrapper (JRAW)."
176
+
177
+ o.separator ""
178
+ o.separator "GENERAL OPTIONS"
179
+
180
+ o.on("-v", "--verbose", "Turn on verbose ant output.") { |verbose| $verbose = verbose }
181
+ o.on("-h", "--help", "Show this help message.") { puts o; exit }
182
+ o.on("-r", "--root directory", "Set the root path of the script. Defaults to '.'") { |root| $root_dir = root}
183
+ o.on("-l", "--loglevel level", "Set the log level. Default is info. Possible values are: error, warn, info, debug") { |level| @loglevel = loglevel(level)}
184
+ o.on("-t", "--target target", "Target to execute with ANT") { |target| @target = target.to_sym}
185
+ o.separator ""
186
+ o.separator "EXAMPLES"
187
+ o.separator " run example script:"
188
+ o.separator " jraw scripts/ant.rb -r ../.. -v \n"
189
+ o.separator " Run a jraw-script from a pastie URL:"
190
+ o.separator " jraw http://www.pastie.org/508302 -r ../.. -v -l debug \n"
191
+ o.separator " Run a script without parameters:"
192
+ o.separator " jraw ant.rb\n"
193
+ end
194
+ end
195
+ end
196
+ end
197
+
198
+ JRAW::JRawTool.parse!
@@ -0,0 +1,33 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ require 'rjb_adapter'
14
+
15
+ module JRAW
16
+ module JRAWClassLoader
17
+ require 'find'
18
+
19
+ def match(*paths)
20
+ matched = Array.new
21
+ Find.find(*paths){ |path| matched << path if yield path }
22
+ return matched
23
+ end
24
+
25
+ def load_ant_libs(ant_home)
26
+ jars = match(ant_home + File::SEPARATOR + 'lib') {|p| ext = p[-4...p.size]; ext && ext.downcase == '.jar'}
27
+ JRAW::RjbAdapter.load(jars)
28
+ end
29
+
30
+ module_function :match, :load_ant_libs
31
+
32
+ end
33
+ end
@@ -0,0 +1,63 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and limitations
11
+ # under the License.
12
+
13
+ module JRAW
14
+ module RjbAdapter
15
+ # We test if the RUBY_PLATFORM is 'java'
16
+ # If true we will use JRuby
17
+ # If false we will use Rjb gem
18
+ def is_jruby?
19
+ return Gem.ruby =~ /jruby/
20
+ end
21
+
22
+ # Wrapper for import_class from JRuby
23
+ # If we're on JRuby we use normal import_class
24
+ # Otherwise we use Rjb::import
25
+ def import_class(name)
26
+ if is_jruby?
27
+ return import_using_jruby(name)
28
+ else
29
+ return Rjb::import(name)
30
+ end
31
+ end
32
+ # Here we extract the class name from a given String
33
+ # e.g. str = "java.lang.String" -> class_name = "String"
34
+ def extract_class_name(str)
35
+ class_name = str.split(".").last
36
+ end
37
+ # Here we load the files we need
38
+ # When in JRuby, we do a require for each jar in files argument
39
+ # Otherwise we use Rjb::load to load all jars from a path build from files parameter
40
+ def load(files=[], args=[])
41
+ if is_jruby?
42
+ files.each {|jar| require jar }
43
+ else
44
+ Rjb::load(files.join(File::PATH_SEPARATOR), [])
45
+ end
46
+ end
47
+
48
+ module_function :import_class, :load, :is_jruby?, :extract_class_name
49
+
50
+ if is_jruby?
51
+ require 'java'
52
+ else
53
+ require 'rubygems'
54
+ require 'rjb'
55
+ end
56
+
57
+ private
58
+ def RjbAdapter.import_using_jruby(name)
59
+ include_class(name)
60
+ return remove_const(name.scan(/[_a-zA-Z0-9$]+/).last)
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe JRAW::RjbAdapter do
4
+
5
+ it "should extract the Java class name from a string" do
6
+ JRAW::RjbAdapter.extract_class_name("java.lang.String").should eql("String")
7
+ JRAW::RjbAdapter.extract_class_name("Foo").should eql("Foo")
8
+ JRAW::RjbAdapter.extract_class_name("java.lang.__String").should eql("__String")
9
+ JRAW::RjbAdapter.extract_class_name("java.lang.Outer$Inner").should eql("Outer$Inner")
10
+ end
11
+
12
+ it "should import a class" do
13
+ result = JRAW::RjbAdapter.import_class("java.lang.String")
14
+ result.should_not be_nil
15
+ result.should respond_to(:new)
16
+ end
17
+ end
@@ -0,0 +1,219 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe JRAW::JRawRunner, 'initialized' do
4
+ before(:each) do
5
+ # Defining the output directory for our specs
6
+ @output_dir = File.join(FileUtils::pwd, 'tmp', 'output')
7
+
8
+ # the resource directory with the sources we like to build
9
+ @resource_dir = File.join(FileUtils::pwd, 'resources')
10
+
11
+ # The current ant_home of this project
12
+ @ant_home = File.join(@resource_dir, 'apache-ant-1.7.1')
13
+
14
+ # The properties for the new AntProject instance
15
+ @ant_proj_props = {
16
+ :name => "jrawTest",
17
+ :basedir => FileUtils::pwd,
18
+ :declarative => true,
19
+ :logger => Logger.new(STDOUT),
20
+ :loglevel => Logger::DEBUG,
21
+ :ant_home => @ant_home
22
+ }
23
+
24
+ # Creating the new instance of JRAW::AntProject
25
+ @ant = JRAW::JRawRunner.new(nil, '.', @ant_proj_props)
26
+
27
+ if File.exists?(@output_dir)
28
+ FileUtils.remove_dir(@output_dir)
29
+ end
30
+ FileUtils.mkdir_p(@output_dir, :mode => 0775)
31
+ end
32
+
33
+ it "should be proper initialized" do
34
+ @ant_proj_props[:name].should eql @ant.name
35
+ FileUtils::pwd.should eql @ant.basedir
36
+ @ant_proj_props[:declarative].should eql @ant.declarative
37
+ @ant_proj_props[:logger].should eql @ant.logger
38
+ end
39
+
40
+ it "should be declarative" do
41
+ @ant = JRAW::JRawRunner.new({ :declarative => false,
42
+ :loglevel => Logger::DEBUG,
43
+ :ant_home => @ant_home })
44
+ echo = @ant.echo :message => "JRAW is really cool"
45
+ echo.should_not be_nil
46
+
47
+ @ant = JRAW::JRawRunner.new({ :declarative => true,
48
+ :loglevel => Logger::DEBUG,
49
+ :ant_home => @ant_home })
50
+
51
+ echo = @ant.echo :message => "JRAW is really cool"
52
+ echo.should be_nil
53
+ end
54
+
55
+ it "should not accept arrays as argument to echo target" do
56
+ begin
57
+ @ant.echo( :message => ['This', 'should', 'fail', 'because', 'Arrays', 'are', 'not', 'supported'] )
58
+ add_failure "Arrays not permitted"
59
+ rescue ArgumentError
60
+ end
61
+ end
62
+
63
+ it "should return a valid timestamp" do
64
+ tstamp = @ant.tstamp#.create_format({ :property => "TSTAMP_DE", :pattern => "dd.MM.yyyy hh:mm:ss"})
65
+ puts "*** #{tstamp}"
66
+ end
67
+
68
+ it "should copy and remove files" do
69
+ file = @output_dir + '/build.xml'
70
+ File.exists?(file).should be_false
71
+
72
+ @ant.copy( :file => @resource_dir + '/build.xml',
73
+ :todir => @output_dir)
74
+ File.exists?(file).should be_true
75
+
76
+ @ant.delete( :file => file )
77
+ File.exists?(file).should be_false
78
+ end
79
+
80
+ it "should unzip antlr" do
81
+ File.directory?(@output_dir + '/ant-antlr').should be_false
82
+ @ant.unzip(:src => @resource_dir + '/apache-ant-1.7.1/lib/ant-antlr.jar', :dest => @output_dir + '/ant-antlr')
83
+ File.exists?(@output_dir + '/ant-antlr/META-INF/MANIFEST.MF').should be_true
84
+ end
85
+
86
+ it "should create as jar" do
87
+ File.exists?(@output_dir + '/archive.jar').should be_false
88
+ @ant.property(:name => 'outputdir', :value => @output_dir)
89
+ @ant.property(:name => 'destfile', :value => '${outputdir}/archive.jar')
90
+ @ant.jar( :destfile => "${destfile}",
91
+ :basedir => @resource_dir + '/src',
92
+ :duplicate => 'preserve')
93
+
94
+ File.exists?(@output_dir + '/archive.jar').should be_true
95
+ end
96
+
97
+ it "should handle pcdata" do
98
+ @ant.echo(:pcdata => "Foobar &amp; <><><>")
99
+ end
100
+
101
+ it "should work with makrodef tasks" do
102
+
103
+ return if @ant.ant_version < 1.6
104
+
105
+ dir = @output_dir + '/foo'
106
+
107
+ File.directory?(dir).should be_false
108
+
109
+ @ant.macrodef(:name => 'testmacrodef') do |ant|
110
+ ant.attribute(:name => 'destination')
111
+ ant.sequential do
112
+ ant.echo(:message => "Creating @{destination}")
113
+ ant._mkdir(:dir => "@{destination}")
114
+ end
115
+ end
116
+ @ant.testmacrodef(:destination => dir)
117
+ File.directory?(dir).should be_true
118
+ end
119
+
120
+ it "should make dir with property" do
121
+ dir = @output_dir + '/foo'
122
+
123
+ File.directory?(dir).should be_false
124
+
125
+ @ant.property(:name => 'outputProperty', :value => dir)
126
+ @ant.mkdir(:dir => "${outputProperty}")
127
+
128
+ File.directory?(dir).should be_true
129
+ end
130
+
131
+ it "should make dir with mkdir task" do
132
+ dir = @output_dir + '/foo'
133
+
134
+ File.directory?(dir).should be_false
135
+
136
+ @ant.mkdir(:dir => dir)
137
+
138
+ File.directory?(dir).should be_true
139
+ end
140
+
141
+ it "should echo properly" do
142
+ msg = "JRAW is running an echo task"
143
+ @ant.echo(:message => msg, :level => 'info')
144
+ @ant.echo(:message => 100000, :level => 'info')
145
+ @ant.echo(:pcdata => 1000)
146
+ end
147
+
148
+ it "should run sucessfully a javac task" do
149
+ FileUtils.mkdir(@output_dir + '/classes', :mode => 0775)
150
+
151
+ File.exists?(@output_dir + '/classes/foo/bar/FooBar.class').should be_false
152
+
153
+ @ant.javac(:srcdir => @resource_dir + '/src',
154
+ :destdir => @output_dir + '/classes',
155
+ :debug => 'on',
156
+ :verbose => 'no',
157
+ :fork => 'no',
158
+ :failonerror => 'yes',
159
+ :includes => 'foo/bar/**',
160
+ :excludes => 'foo/bar/baz/**',
161
+ :classpath => @resource_dir + '/parent.jar')
162
+
163
+ File.exists?(@output_dir + '/classes/foo/bar/FooBar.class').should be_true
164
+ File.exists?(@output_dir + '/classes/foo/bar/baz/FooBarBaz.class').should be_false
165
+ end
166
+
167
+ it "should run successfully a javac task with property" do
168
+ FileUtils.mkdir(@output_dir + '/classes', :mode => 0775)
169
+
170
+ File.exists?(@output_dir + '/classes/foo/bar/FooBar.class').should be_false
171
+ @ant.property(:name => 'pattern', :value => '**/*.jar')
172
+ @ant.property(:name => 'resource_dir', :value => @resource_dir)
173
+ @ant.path(:id => 'common.class.path') do
174
+ @ant.fileset(:dir => '${resource_dir}') do
175
+ @ant.include(:name => '${pattern}')
176
+ end
177
+ end
178
+ puts "Resource dir: #{@resource_dir}"
179
+ @ant.javac(:srcdir => @resource_dir + '/src',
180
+ :destdir => @output_dir + '/classes',
181
+ :debug => true,
182
+ :verbose => true,
183
+ :fork => 'no',
184
+ :failonerror => 'blahblahblah',
185
+ :includes => 'foo/bar/**',
186
+ :excludes => 'foo/bar/baz/**',
187
+ :classpathref => 'common.class.path')
188
+
189
+ File.exists?(@output_dir + '/classes/foo/bar/FooBar.class').should be_true
190
+ File.exists?(@output_dir + '/classes/foo/bar/baz/FooBarBaz.class').should be_false
191
+ end
192
+
193
+ it "should define a tasdef with custom classpath" do
194
+ @ant.taskdef(:name => 'retro', :classname => 'foo.bar.Parent', :classpath => @resource_dir)
195
+ end
196
+
197
+ it "should define property basedir" do
198
+ @ant.property(:name => 'bla', :value => "Hallo")
199
+ project.getProperty('bla').should == "Hallo"
200
+ end
201
+
202
+ it "should read and handle build.properties correctly" do
203
+ @ant.property(:file => '../default.build.properties')
204
+ project.get_property("jruby.classes.dir").should == '512M'
205
+ end
206
+
207
+ it "should have proper instance variables available" do
208
+ @ant.property(:file => '../default.build.properties')
209
+ @ant.instance_variable_defined?(:@jruby_classes_dir).should be_true
210
+ end
211
+
212
+ # private methods
213
+ private
214
+
215
+ def project
216
+ @ant.project
217
+ end
218
+ end
219
+
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'spec'
3
+ require 'fileutils'
4
+ require 'jraw'
5
+ require 'logger'
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jraw
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.2
5
+ platform: ruby
6
+ authors:
7
+ - Michael Johann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-10 00:00:00 +02:00
13
+ default_executable: jraw
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.7.3
24
+ version:
25
+ description: JRAW is a Ruby ANT Wrapper for describing Apache ANT tasks in ruby instead of XML.
26
+ email: mjohann@rails-experts.com
27
+ executables:
28
+ - jraw
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - History.txt
33
+ - Manifest.txt
34
+ - README
35
+ - LICENSE
36
+ files:
37
+ - History.txt
38
+ - Manifest.txt
39
+ - README
40
+ - LICENSE
41
+ - Rakefile
42
+ - bin/jraw
43
+ - lib/ant_libraries.rb
44
+ - lib/ant_project.rb
45
+ - lib/ant_task.rb
46
+ - lib/jraw.rb
47
+ - lib/jraw_runner.rb
48
+ - lib/rjb_adapter.rb
49
+ - lib/jraw_utilities.rb
50
+ - spec/javaadapter_spec.rb
51
+ - spec/jraw_antproject_spec.rb
52
+ - spec/spec_helper.rb
53
+ has_rdoc: true
54
+ homepage: http://kenai.com/projects/raw
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options:
59
+ - --main
60
+ - README
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.3.5
79
+ signing_key:
80
+ specification_version: 2
81
+ summary: JRAW is a Ruby ANT Wrapper for describing Apache ANT tasks in ruby instead of XML.
82
+ test_files:
83
+ - spec/javaadapter_spec.rb
84
+ - spec/jraw_antproject_spec.rb