builder 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of builder might be problematic. Click here for more details.
- data/CHANGES +32 -0
- data/README +6 -6
- data/Rakefile +6 -2
- data/lib/builder/blankslate.rb +31 -1
- data/scripts/publish.rb +17 -0
- data/test/preload.rb +27 -0
- data/test/testblankslate.rb +43 -0
- data/test/testmarkupbuilder.rb +1 -0
- metadata +8 -2
data/CHANGES
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
= Change Log
|
2
|
+
|
3
|
+
== Version 1.2.1
|
4
|
+
|
5
|
+
BlankSlate now traps method definitions in Kernel and Object to avoid
|
6
|
+
late method definitions inadvertently becoming part of the definition
|
7
|
+
of BlankSlate as well.
|
8
|
+
|
9
|
+
== Version 1.2.0
|
10
|
+
|
11
|
+
Improved support for entity declarations by allowing nested
|
12
|
+
declarations and removal of the attribute processing.
|
13
|
+
|
14
|
+
Added namespace support.
|
15
|
+
|
16
|
+
== Version 1.1.0
|
17
|
+
|
18
|
+
Added support for comments, entity declarations and processing instructions.
|
19
|
+
|
20
|
+
== Version 1.0.0
|
21
|
+
|
22
|
+
Removed use of <tt>instace_eval</tt> making the use of XmlMarkup much
|
23
|
+
less prone to error.
|
24
|
+
|
25
|
+
== Version 0.1.1
|
26
|
+
|
27
|
+
Bug fix.
|
28
|
+
|
29
|
+
== Version 0.1.0
|
30
|
+
|
31
|
+
Initial version release.
|
32
|
+
|
data/README
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= Project: Builder
|
2
2
|
|
3
|
-
|
3
|
+
== Goal
|
4
4
|
|
5
5
|
Provide a simple way to create XML markup and data structures.
|
6
6
|
|
7
|
-
|
7
|
+
== Classes
|
8
8
|
|
9
9
|
Builder::XmlMarkup:: Generate XML markup notiation
|
10
10
|
Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
|
@@ -16,7 +16,7 @@ Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
|
|
16
16
|
Also, the events builder is currently lagging the markup builder in
|
17
17
|
features.
|
18
18
|
|
19
|
-
|
19
|
+
== Usage
|
20
20
|
|
21
21
|
require 'rubygems'
|
22
22
|
require_gem 'builder', '~> 1.2"
|
@@ -39,7 +39,7 @@ or
|
|
39
39
|
# <phone>555-1234</phone>
|
40
40
|
# </person
|
41
41
|
|
42
|
-
|
42
|
+
== Compatibility
|
43
43
|
|
44
44
|
Version 1.0.0 introduces some changes that are not backwards
|
45
45
|
compatible with earlier releases of builder. The main areas of
|
@@ -76,7 +76,7 @@ incompatibility are:
|
|
76
76
|
require_gem 'builder', "~> 0.0" # Gets the old version
|
77
77
|
require_gem 'builder', "~> 1.0" # Gets the new version
|
78
78
|
|
79
|
-
|
79
|
+
== New Features
|
80
80
|
|
81
81
|
* XML Comments are now supported ...
|
82
82
|
|
@@ -140,7 +140,7 @@ incompatibility are:
|
|
140
140
|
right form for builder (e.g. "<tt>SOAP:Envelope</tt>" =>
|
141
141
|
"<tt>xml.SOAP :Envelope</tt>")
|
142
142
|
|
143
|
-
|
143
|
+
== Contact
|
144
144
|
|
145
145
|
Author:: Jim Weirich
|
146
146
|
Email:: jim@weirichhouse.org
|
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ rescue Exception
|
|
17
17
|
nil
|
18
18
|
end
|
19
19
|
|
20
|
-
PKG_VERSION = "1.2.
|
20
|
+
PKG_VERSION = "1.2.1"
|
21
21
|
|
22
22
|
SRC_RB = FileList['lib/**/*.rb']
|
23
23
|
|
@@ -40,6 +40,7 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
|
40
40
|
rdoc.title = "Builder for Markup"
|
41
41
|
rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
|
42
42
|
rdoc.rdoc_files.include('lib/**/*.rb', '[A-Z]*')
|
43
|
+
rdoc.template = 'jamis'
|
43
44
|
}
|
44
45
|
|
45
46
|
# ====================================================================
|
@@ -49,6 +50,7 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
|
49
50
|
PKG_FILES = FileList[
|
50
51
|
'lib/**/*.rb',
|
51
52
|
'test/**/*.rb',
|
53
|
+
'scripts/**/*.rb'
|
52
54
|
]
|
53
55
|
|
54
56
|
if ! defined?(Gem)
|
@@ -82,5 +84,7 @@ else
|
|
82
84
|
s.homepage = "http://onestepback.org"
|
83
85
|
end
|
84
86
|
|
85
|
-
Rake::GemPackageTask.new(spec) do
|
87
|
+
Rake::GemPackageTask.new(spec) do end
|
86
88
|
end
|
89
|
+
|
90
|
+
require 'scripts/publish'
|
data/lib/builder/blankslate.rb
CHANGED
@@ -15,7 +15,37 @@ module Builder
|
|
15
15
|
# BlankSlate is useful as a base class when writing classes that
|
16
16
|
# depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
|
17
17
|
class BlankSlate
|
18
|
-
|
18
|
+
class << self
|
19
|
+
def hide(name)
|
20
|
+
undef_method name unless name =~ /^(__|instance_eval)/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
instance_methods.each { |m| hide(m) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Since Ruby is very dynamic, methods added to the ancestors of
|
29
|
+
# BlankSlate <em>after BlankSlate is defined</em> will show up in the
|
30
|
+
# list of available BlankSlate methods. We handle this by defining a hook in the Object and Kernel classes that will hide any defined
|
31
|
+
module Kernel
|
32
|
+
class << self
|
33
|
+
alias_method :blank_slate_method_added, :method_added
|
34
|
+
def method_added(name)
|
35
|
+
blank_slate_method_added(name)
|
36
|
+
return if self != Kernel
|
37
|
+
Builder::BlankSlate.hide(name)
|
38
|
+
end
|
19
39
|
end
|
40
|
+
end
|
20
41
|
|
42
|
+
class Object
|
43
|
+
class << self
|
44
|
+
alias_method :blank_slate_method_added, :method_added
|
45
|
+
def method_added(name)
|
46
|
+
blank_slate_method_added(name)
|
47
|
+
return if self != Object
|
48
|
+
Builder::BlankSlate.hide(name)
|
49
|
+
end
|
50
|
+
end
|
21
51
|
end
|
data/scripts/publish.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Optional publish task for Rake
|
2
|
+
|
3
|
+
require 'rake/contrib/sshpublisher'
|
4
|
+
require 'rake/contrib/rubyforgepublisher'
|
5
|
+
|
6
|
+
publisher = Rake::CompositePublisher.new
|
7
|
+
publisher.add Rake::RubyForgePublisher.new('builder', 'jimweirich')
|
8
|
+
publisher.add Rake::SshFilePublisher.new(
|
9
|
+
'umlcoop',
|
10
|
+
'htdocs/software/builder',
|
11
|
+
'.',
|
12
|
+
'builder.blurb')
|
13
|
+
|
14
|
+
desc "Publish the Documentation to RubyForge."
|
15
|
+
task :publish => [:rdoc] do
|
16
|
+
publisher.upload
|
17
|
+
end
|
data/test/preload.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# We are defining method_added in Kernel and Object so that when
|
4
|
+
# BlankSlate overrides them loater, we can verify that it correctly
|
5
|
+
# calls the older hooks.
|
6
|
+
|
7
|
+
module Kernel
|
8
|
+
class << self
|
9
|
+
attr_reader :k_added_name
|
10
|
+
alias_method :preload_method_added, :method_added
|
11
|
+
def method_added(name)
|
12
|
+
preload_method_added(name)
|
13
|
+
@k_added_name = name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Object
|
19
|
+
class << self
|
20
|
+
attr_reader :o_added_name
|
21
|
+
alias_method :preload_method_added, :method_added
|
22
|
+
def method_added(name)
|
23
|
+
preload_method_added(name)
|
24
|
+
@o_added_name = name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'test/preload'
|
5
|
+
require 'builder/blankslate'
|
6
|
+
|
7
|
+
module Kernel
|
8
|
+
def late_addition
|
9
|
+
1234
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Object
|
14
|
+
def another_late_addition
|
15
|
+
4321
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class TestBlankSlate < Test::Unit::TestCase
|
20
|
+
def setup
|
21
|
+
@bs = Builder::BlankSlate.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_create
|
25
|
+
assert nil != @bs
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_undefined
|
29
|
+
assert_raise(NoMethodError) { @bs.no_such_method }
|
30
|
+
assert_raise(NoMethodError) { @bs.nil? }
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_no_later_additions
|
34
|
+
assert_raise(NoMethodError) { @bs.late_addition }
|
35
|
+
assert_raise(NoMethodError) { @bs.another_late_addition }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_preload_method_added
|
39
|
+
assert_equal :late_addition, Kernel.k_added_name
|
40
|
+
assert_equal :another_late_addition, Object.o_added_name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/test/testmarkupbuilder.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: builder
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date: 2004-10-
|
6
|
+
version: 1.2.1
|
7
|
+
date: 2004-10-30
|
8
8
|
summary: Builders for MarkUp.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,10 +32,15 @@ files:
|
|
32
32
|
- lib/builder/blankslate.rb
|
33
33
|
- lib/builder/xmlevents.rb
|
34
34
|
- test/testmarkupbuilder.rb
|
35
|
+
- test/testblankslate.rb
|
36
|
+
- test/preload.rb
|
37
|
+
- scripts/publish.rb
|
35
38
|
- README
|
36
39
|
- Rakefile
|
40
|
+
- CHANGES
|
37
41
|
test_files:
|
38
42
|
- test/testmarkupbuilder.rb
|
43
|
+
- test/testblankslate.rb
|
39
44
|
rdoc_options:
|
40
45
|
- "--title"
|
41
46
|
- "Builder -- Easy XML Building"
|
@@ -45,6 +50,7 @@ rdoc_options:
|
|
45
50
|
extra_rdoc_files:
|
46
51
|
- README
|
47
52
|
- Rakefile
|
53
|
+
- CHANGES
|
48
54
|
executables: []
|
49
55
|
extensions: []
|
50
56
|
requirements: []
|