Antwrap 0.5.3-java → 0.5.4-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/antwrap.rb +10 -6
  2. data/test/tc_antwrap.rb +7 -0
  3. metadata +1 -1
data/lib/antwrap.rb CHANGED
@@ -35,6 +35,7 @@ class AntTask
35
35
  end
36
36
  }
37
37
  proc.instance_eval &proc
38
+
38
39
  @@task_stack.pop
39
40
  end
40
41
 
@@ -65,7 +66,7 @@ class AntTask
65
66
 
66
67
  end
67
68
 
68
- def method_missing(sym, *args)
69
+ def send(sym, *args)
69
70
  begin
70
71
  @logger.debug("AntTask.method_missing sym[#{sym.to_s}]")
71
72
  task = AntTask.new(sym.to_s, @project_wrapper, args[0], block_given? ? Proc.new : nil)
@@ -85,27 +86,30 @@ class AntTask
85
86
 
86
87
  if(@project_wrapper.ant_version >= 1.6)
87
88
  attributes.each do |key, val|
88
- apply_to_wrapper(wrapper, key.to_s, val.to_s){ |k,v| wrapper.setAttribute(k, v)}
89
+ apply_to_wrapper(wrapper, key.to_s, val){ |k,v| wrapper.setAttribute(k, v)}
89
90
  end
90
91
  else
91
92
  @unknown_element.setRuntimeConfigurableWrapper(wrapper)
92
93
  attribute_list = XmlSax::AttributeListImpl.new()
93
94
  attributes.each do |key, val|
94
- apply_to_wrapper(wrapper, key.to_s, val.to_s){ |k,v| attribute_list.addAttribute(k, 'CDATA', v)}
95
+ apply_to_wrapper(wrapper, key.to_s, val){ |k,v| attribute_list.addAttribute(k, 'CDATA', v)}
95
96
  end
96
97
  wrapper.setAttributes(attribute_list)
97
98
  end
98
99
  end
99
100
 
100
101
  def apply_to_wrapper(wrapper, key, value)
102
+
103
+ 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)
104
+
101
105
  begin
102
106
  if(key == 'pcdata')
103
- wrapper.addText(value)
107
+ wrapper.addText(value.to_s)
104
108
  else
105
- yield key, value
109
+ yield key, value.to_s
106
110
  end
107
111
  rescue StandardError
108
- raise ArgumentError, "Unable to set :#{key} attribute with value => '#{value}'"
112
+ raise ArgumentError, "ArgumentError: Unable to set :#{key} attribute with value => '#{value}'"
109
113
  end
110
114
  end
111
115
 
data/test/tc_antwrap.rb CHANGED
@@ -227,6 +227,13 @@ class TestAntwrap < Test::Unit::TestCase
227
227
  @ant.tstamp
228
228
  end
229
229
 
230
+ def test_array_argument
231
+ begin
232
+ @ant.echo(:message => ['This', 'should', 'fail', 'because', 'Arrays', 'are', 'not', 'supported'])
233
+ add_failure "Arrays not permitted"
234
+ rescue ArgumentError
235
+ end
236
+ end
230
237
  # def test_open_pja
231
238
  # @ant.taskdef(:name=>"mappingtool", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask")
232
239
  #
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: Antwrap
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.3
6
+ version: 0.5.4
7
7
  date: 2007-06-13
8
8
  summary: "A Ruby module that wraps the Apache Ant build tool, enabling Ant Tasks to be
9
9
  invoked from a Ruby/JRuby scripts."