Empact-roxml 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,145 @@
1
+ == 2.4.0 (January 15, 2009)
2
+
3
+ * 1 major enhancement
4
+
5
+ * Add xml_convention to enable easy defaulting to common naming formats, such as camel-case and
6
+ underscored [Ben Woosley]
7
+
8
+ * 6 minor enhancements
9
+
10
+ * Add :frozen option for freezing values on parse [Ben Woosley]
11
+ * Attempt to minimize node creation by better matching wrappers [Ben Woosley]
12
+ * Preserve hash values where a single key maps to multiple values, return them as an array rather
13
+ any single one of them at random (as in group_by rather than index_by) [Ben Woosley]
14
+ * Deprecate #xml_name? as it's only used for triggering the xml_name warning [Ben Woosley]
15
+ * REXML parser ignores whitespace, which doesn't matter to us anyway [Ben Woosley]
16
+ * xml_name is inherited by default [Ben Woosley]
17
+
18
+ * 2 bug fixes
19
+
20
+ * Don't detect objects which define their own empty? as being absent for the purposes
21
+ of :default and :required [Ben Woosley]
22
+ * Sub-objects pick up their parent's attributes, even if they're added after
23
+ the child's use [Ben Woosley]
24
+
25
+ == 2.3.2 (December 11, 2008)
26
+
27
+ * Fix that both false and nil values were excluded from to_xml output, when only nil values should be [Ben Woosley]
28
+
29
+ == 2.3.1 (December 9, 2008)
30
+
31
+ * Add missing dependencies to extensions/enumerable and Symbol.to_proc,
32
+ which are as-yet inexplicably pre-included on my system... [Ben Woosley, Per Melin]
33
+
34
+ == 2.3 (December 7, 2008)
35
+
36
+ * Fix a bug in the application of blocks to array types [Ben Woosley]
37
+
38
+ * Objects now inherit xml attributes from their parents, as they should [Ben Woosley, Per Melin]
39
+
40
+ * Add #xml_initialize, which is called at the end of #from_xml, after the xml attributes
41
+ are set. Deprecate the half-baked xml_construct in it's favor. [Ben Woosley]
42
+
43
+ * Fix a bug in the handling of empty Hash types [Ben Woosley]
44
+
45
+ * Implement automatic bool-ification when the accessor name ends with ?. [Ben Woosley]
46
+
47
+ * Add missing dependency ActiveSupport [Ben Woosley]
48
+
49
+ * Remove support for installing as a rails plugin [Ben Woosley]
50
+
51
+ * Fix a bug where xml_construct was using the refs' names rather than their accessor names for comparison [Ben Woosley]
52
+
53
+ * Significantly reduce our footprint by selectively including smaller parts of ActiveSupport and Extensions.
54
+ This avoids problems such as the conflict between ActiveSupport's #to_json and the JSON gem's #to_json.
55
+ Thanks to Per Melin for reporting this problem. [Ben Woosley]
56
+
57
+ * Rationalize sub-element xml naming by enforcing the following precedence for the containing xml of an object:
58
+ :from of parent, xml_name of child, parent's accessor name. The previous fallback did not include xml_name.
59
+ This new behavior is more consistent, explicit, predictable, and DRY, but it is a breaking change, so a warning
60
+ is printed to alert others of this behavior change. ROXML::SILENCE_XML_NAME_WARNING may be used to deactivate this
61
+ warning. [Ben Woosley, James W. Thompson, Delynn Berry]
62
+
63
+ == 2.2 (November 2, 2008)
64
+
65
+ * fix gem dependencies [James Healy]
66
+
67
+ * Add block shorthands for Float and Integer, which precede the block argume if present [Ben Woosley]
68
+
69
+ * Add :required option to throw on absence [Ben Woosley]
70
+
71
+ * Deprecate the non-specific #parse in favor of #from_xml [Ben Woosley]
72
+
73
+ * Fix a bug whereby the default value was carrying over information from one object to another [James Healy, Ben Woosley]
74
+
75
+ * Fix support for :in on :attr elements [Ben Woosley]
76
+
77
+ * Deprecate Array#to_h in favor of Array#to_hash [Ben Woosley]
78
+
79
+ * Deprecate Object#to_latin and Object#to_utf in favor of the same methods on String [Ben Woosley]
80
+
81
+ == 2.1 (October 3, 2008)
82
+
83
+ * rake test now uses the default parser selection [Ben Woosley]
84
+
85
+ * Added rcov code coverage for tests [Anders Engström]
86
+
87
+ * Accommodate that libxml requires you to name the default namespace when available [Ben Woosley]
88
+
89
+ * Enable optional selection of a parser through the early definition of ROXML::XML_PARSER
90
+ [Ben Woosley]
91
+
92
+ * Enable fallback to the REXML parser if LibXML is unavailable [Ben Woosley]
93
+
94
+ == 2.0 (September 20, 2008)
95
+
96
+ * :text_content becomes simply :content, and is joined by :name [Ben Woosley]
97
+
98
+ * Allow hash mapping from node names and contents: [Ben Woosley]
99
+
100
+ xml_reader :name, {:key => :name,
101
+ :value => :content}, :in => 'container'
102
+
103
+ * Allow supplying a default via the :else option [Ben Woosley]
104
+
105
+ * Allow hash mapping of text and attr elements: [Ben Woosley]
106
+
107
+ xml_reader :name, {:key => {:text => 'key_name'},
108
+ :value => {:attr => 'attr_name'}}, :in => 'container'
109
+
110
+ * Allow 'xml_reader :name, [Type]' as an alternative to 'xml_reader :name, Type, :as => :array'
111
+ [Ben Woosley]
112
+
113
+ * Allow attaching a block for manipulating a value on fetch: [Ben Woosley]
114
+
115
+ xml_accessor :count, :attr => 'my_int' do |val|
116
+ Integer(val)
117
+ end
118
+
119
+ * Collapse xml_attr, xml_text and xml_object into a single api: xml, patterned after the standard
120
+ attr, and offer xml_reader and xml_accessor as well. Remove the :readonly arg in the process
121
+ [Ben Woosley]
122
+
123
+ * Attach string extensions (#to_latin, #to_utf) to Object rather than String, so we don't have to
124
+ call #to_s first every time [Ben Woosley]
125
+
126
+ * Allow a ROXML object to call its constructor on initialization with the xml_construct function
127
+ [Ben Woosley]
128
+
129
+ * Use symbols (e.g. :text_content) rather than TAG_CONSTANTS (e.g. TEXT_CONTENT) for readability
130
+ [Ben Woosley]
131
+
132
+ * Use named arguments (e.g. :as, :in) rather than positional for clarity,
133
+ position-independence, and invisible exclusion [Ben Woosley]
134
+
135
+ * Split out rails_plugin_package_task_gem [Ben Woosley]
136
+
137
+ * Increase testing significantly, particularly on new functionality & to_xml [Ben Woosley]
138
+
139
+ == 1.2 (October 10, 2007)
140
+
141
+ * Fix a bug such that the TEXT_CONTENT tag is no longer also READ_ONLY [Russ Olsen]
142
+
143
+ == 1.1 (September 24, 2006)
144
+
145
+ * Initial design & development [Zak Mandhro & Anders Engstrom]
data/Manifest.txt ADDED
@@ -0,0 +1,81 @@
1
+ History.txt
2
+ MIT-LICENSE
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ TODO
7
+ html/index.html
8
+ html/style.css
9
+ lib/roxml.rb
10
+ lib/roxml/extensions/active_support.rb
11
+ lib/roxml/extensions/array.rb
12
+ lib/roxml/extensions/array/conversions.rb
13
+ lib/roxml/extensions/deprecation.rb
14
+ lib/roxml/extensions/string.rb
15
+ lib/roxml/extensions/string/conversions.rb
16
+ lib/roxml/extensions/string/iterators.rb
17
+ lib/roxml/options.rb
18
+ lib/roxml/xml.rb
19
+ lib/roxml/xml/libxml.rb
20
+ lib/roxml/xml/rexml.rb
21
+ roxml.gemspec
22
+ tasks/test.rake
23
+ test/bugs/rexml_bugs.rb
24
+ test/fixtures/book_malformed.xml
25
+ test/fixtures/book_pair.xml
26
+ test/fixtures/book_text_with_attribute.xml
27
+ test/fixtures/book_valid.xml
28
+ test/fixtures/book_with_authors.xml
29
+ test/fixtures/book_with_contributions.xml
30
+ test/fixtures/book_with_contributors.xml
31
+ test/fixtures/book_with_contributors_attrs.xml
32
+ test/fixtures/book_with_default_namespace.xml
33
+ test/fixtures/book_with_depth.xml
34
+ test/fixtures/book_with_octal_pages.xml
35
+ test/fixtures/book_with_publisher.xml
36
+ test/fixtures/book_with_wrapped_attr.xml
37
+ test/fixtures/dictionary_of_attr_name_clashes.xml
38
+ test/fixtures/dictionary_of_attrs.xml
39
+ test/fixtures/dictionary_of_guarded_names.xml
40
+ test/fixtures/dictionary_of_mixeds.xml
41
+ test/fixtures/dictionary_of_name_clashes.xml
42
+ test/fixtures/dictionary_of_names.xml
43
+ test/fixtures/dictionary_of_texts.xml
44
+ test/fixtures/library.xml
45
+ test/fixtures/library_uppercase.xml
46
+ test/fixtures/muffins.xml
47
+ test/fixtures/nameless_ageless_youth.xml
48
+ test/fixtures/node_with_attr_name_conflicts.xml
49
+ test/fixtures/node_with_name_conflicts.xml
50
+ test/fixtures/numerology.xml
51
+ test/fixtures/person.xml
52
+ test/fixtures/person_with_guarded_mothers.xml
53
+ test/fixtures/person_with_mothers.xml
54
+ test/mocks/dictionaries.rb
55
+ test/mocks/mocks.rb
56
+ test/release/dependencies_test.rb
57
+ test/test_helper.rb
58
+ test/unit/array_test.rb
59
+ test/unit/freeze_test.rb
60
+ test/unit/inheritance_test.rb
61
+ test/unit/options_test.rb
62
+ test/unit/overriden_output_test.rb
63
+ test/unit/roxml_test.rb
64
+ test/unit/string_test.rb
65
+ test/unit/to_xml_test.rb
66
+ test/unit/xml_attribute_test.rb
67
+ test/unit/xml_block_test.rb
68
+ test/unit/xml_bool_test.rb
69
+ test/unit/xml_construct_test.rb
70
+ test/unit/xml_convention_test.rb
71
+ test/unit/xml_hash_test.rb
72
+ test/unit/xml_initialize_test.rb
73
+ test/unit/xml_name_test.rb
74
+ test/unit/xml_namespace_test.rb
75
+ test/unit/xml_object_test.rb
76
+ test/unit/xml_required_test.rb
77
+ test/unit/xml_text_test.rb
78
+ vendor/override_rake_task/README
79
+ vendor/override_rake_task/init.rb
80
+ vendor/override_rake_task/install.rb
81
+ vendor/override_rake_task/lib/override_rake_task.rb
data/Rakefile CHANGED
@@ -1,100 +1,90 @@
1
- # Rake libraries used
2
- require "rubygems"
3
- require "rake/rdoctask"
4
- require "rake/contrib/rubyforgepublisher"
5
- require "rake/contrib/publisher"
6
- require 'rake/gempackagetask'
7
- require 'rake/testtask'
8
-
9
- # load settings
10
- spec = eval(IO.read("roxml.gemspec"))
11
-
12
- # Provide the username used to upload website etc.
13
- RubyForgeConfig = {
14
- :unix_name=>"roxml",
15
- :user_name=>"zakmandhro"
16
- }
17
-
18
- task :default => :test
19
-
20
- Rake::RDocTask.new do |rd|
21
- rd.rdoc_dir = "doc"
22
- rd.rdoc_files.include('MIT-LICENSE', 'README.rdoc', "lib/**/*.rb")
23
- rd.options << '--main' << 'README.rdoc' << '--title' << 'ROXML Documentation'
1
+ ENV['RUBY_FLAGS'] = '-W1'
2
+
3
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
4
+ require File.join(File.dirname(__FILE__), 'lib/roxml')
5
+
6
+ # Generate all the Rake tasks
7
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
8
+ $hoe = Hoe.new('roxml', ROXML::VERSION) do |p|
9
+ p.author = ["Ben Woosley", "Zak Mandhro", "Anders Engstrom", "Russ Olsen"]
10
+ p.email = "ben.woosley@gmail.com"
11
+ p.url = "http://roxml.rubyforge.org"
12
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
13
+ p.rubyforge_name = p.name
14
+ p.extra_deps = [
15
+ ['activesupport','>= 2.1.0'],
16
+ ['extensions', '>= 0.6.0']
17
+ ]
18
+ p.extra_dev_deps = [
19
+ ['newgem', ">= #{::Newgem::VERSION}"]
20
+ ]
21
+
22
+ p.summary = "Ruby Object to XML mapping library"
23
+ p.description = <<EOF
24
+ ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML.
25
+ Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes care
26
+ of the marshalling and unmarshalling of mapped attributes so that developers can focus on
27
+ building first-class Ruby classes. As a result, ROXML simplifies the development of
28
+ RESTful applications, Web Services, and XML-RPC.
29
+ EOF
30
+
31
+ p.test_globs = 'test/unit/*_test.rb'
32
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
33
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
34
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
35
+ p.rsync_args = '-av --delete --ignore-errors'
24
36
  end
25
37
 
26
- desc "Publish Ruby on Rails plug-in on RubyForge"
27
- task :release_plugin=>:rails_plugin do |task|
28
- pub = Rake::SshDirPublisher.new("#{RubyForgeConfig[:user_name]}@rubyforge.org",
29
- "/var/www/gforge-projects/#{RubyForgeConfig[:unix_name]}",
30
- "pkg/rails_plugin")
31
- pub.upload()
32
- end
38
+ require 'newgem/tasks' # load /tasks/*.rake
33
39
 
34
- desc "Publish and plugin site on RubyForge"
35
- task :publish do |task|
36
- pub = Rake::RubyForgePublisher.new(RubyForgeConfig[:unix_name], RubyForgeConfig[:user_name])
37
- pub.upload()
38
- end
39
-
40
- desc "Install the gem"
41
- task :install => [:package] do
42
- sh %{sudo gem install pkg/#{spec.name}-#{spec.version}}
43
- end
44
-
45
- Rake::TestTask.new(:bugs) do |t|
46
- t.libs << 'test'
47
- t.test_files = FileList['test/bugs/*_bugs.rb']
48
- t.verbose = true
49
- end
40
+ Dir['tasks/**/*.rake'].each { |t| load t }
50
41
 
51
- @test_files = 'test/unit/*_test.rb'
52
- desc "Test ROXML using the default parser selection behavior"
53
- task :test do
54
- module ROXML
55
- SILENCE_XML_NAME_WARNING = true
56
- end
57
- require 'lib/roxml'
58
- require 'rake/runtest'
59
- Rake.run_tests @test_files
60
- end
61
-
62
- namespace :test do
63
- desc "Test ROXML under the LibXML parser"
64
- task :libxml do
65
- module ROXML
66
- XML_PARSER = 'libxml'
67
- end
68
- Rake::Task["test"].invoke
69
- end
70
-
71
- desc "Test ROXML under the REXML parser"
72
- task :rexml do
73
- module ROXML
74
- XML_PARSER = 'rexml'
75
- end
76
- Rake::Task["test"].invoke
77
- end
78
-
79
- desc "Runs tests under RCOV"
80
- task :rcov do
81
- system "rcov -T --no-html -x '^/' #{FileList[@test_files]}"
82
- end
83
- end
84
-
85
- desc "Create the ZIP package"
86
- Rake::PackageTask.new(spec.name, spec.version) do |p|
87
- p.need_zip = true
88
- p.package_files = FileList[
89
- "lib/**/*.rb", "*.txt", "README.rdoc", "Rakefile",
90
- "rake/**/*","test/**/*.rb", "test/**/*.xml", "html/**/*"]
91
- end
92
-
93
- task :package=>:rdoc
94
- task :rdoc=>:test
95
-
96
- desc "Create a RubyGem project"
97
- Rake::GemPackageTask.new(spec).define
42
+ task :default => :test
98
43
 
99
- desc "Clobber generated files"
100
- task :clobber=>[:clobber_package, :clobber_rdoc]
44
+ ## Provide the username used to upload website etc.
45
+ #RubyForgeConfig = {
46
+ # :unix_name=>"roxml",
47
+ # :user_name=>"zakmandhro"
48
+ #}
49
+
50
+ #Rake::RDocTask.new do |rd|
51
+ # rd.rdoc_dir = "doc"
52
+ # rd.rdoc_files.include('MIT-LICENSE', 'README.rdoc', "lib/**/*.rb")
53
+ # rd.options << '--main' << 'README.rdoc' << '--title' << 'ROXML Documentation'
54
+ #end
55
+ #
56
+ #desc "Publish Ruby on Rails plug-in on RubyForge"
57
+ #task :release_plugin=>:rails_plugin do |task|
58
+ # pub = Rake::SshDirPublisher.new("#{RubyForgeConfig[:user_name]}@rubyforge.org",
59
+ # "/var/www/gforge-projects/#{RubyForgeConfig[:unix_name]}",
60
+ # "pkg/rails_plugin")
61
+ # pub.upload()
62
+ #end
63
+ #
64
+ #desc "Publish and plugin site on RubyForge"
65
+ #task :publish do |task|
66
+ # pub = Rake::RubyForgePublisher.new(RubyForgeConfig[:unix_name], RubyForgeConfig[:user_name])
67
+ # pub.upload()
68
+ #end
69
+ #
70
+ #desc "Install the gem"
71
+ #task :install => [:package] do
72
+ # sh %{sudo gem install pkg/#{spec.name}-#{spec.version}}
73
+ #end
74
+
75
+ #desc "Create the ZIP package"
76
+ #Rake::PackageTask.new(spec.name, spec.version) do |p|
77
+ # p.need_zip = true
78
+ # p.package_files = FileList[
79
+ # "lib/**/*.rb", "*.txt", "README.rdoc", "Rakefile",
80
+ # "rake/**/*","test/**/*.rb", "test/**/*.xml", "html/**/*"]
81
+ #end
82
+ #
83
+ #task :package=>:rdoc
84
+ #task :rdoc=>:test
85
+ #
86
+ #desc "Create a RubyGem project"
87
+ #Rake::GemPackageTask.new(spec).define
88
+ #
89
+ #desc "Clobber generated files"
90
+ #task :clobber=>[:clobber_package, :clobber_rdoc]
data/TODO ADDED
@@ -0,0 +1,42 @@
1
+ Planned:
2
+
3
+ v 2.5
4
+ * Test out compatibility with ActiveRecord such that it's easy
5
+ to have both xml & database-sourced objects
6
+
7
+ * provide an overridable extension point for the #to_xml-ing of
8
+ values. This would enable easy accommodation of non-standard formats.
9
+ For example, formatting a number with leading zeros.
10
+
11
+ * Ensure (perhaps optionally) that references are unambiguous. That is error/warn
12
+ a singular specification has multiple possible node references
13
+
14
+ * Ensure support for nodes which aren't merely children, which hang out deep
15
+ in the file, but are accessible via xpath
16
+
17
+ v 3.0
18
+ * remove deprecated functionality
19
+
20
+ * Perhaps provide cleaner separation between the specification
21
+ of type vs its source in the XML. For example,
22
+
23
+ xml_reader :count, :from => 'Count, :in => 'Attributes', :as => Integer
24
+ xml_reader :count, :attr => 'Count, :in => 'Attributes', :as => Integer
25
+
26
+ become:
27
+
28
+ xml_reader :count, Integer, 'Atributes/Count'
29
+ xml_reader :count, Integer, 'Atributes/@Count'
30
+
31
+ potentially backward-incompatible change. Needs some thought...
32
+
33
+ * Back with XmlSimple/FasterXmlSimple to minimize need for specifications
34
+
35
+ * Use lazy evaluation to minimize parsing time for large files
36
+
37
+ Potential:
38
+
39
+ * Add shorthand support to hash declaration
40
+
41
+ * :as => :self for sending method_missing to this attribute
42
+