roxml 2.5.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/.gitmodules +3 -0
- data/History.txt +38 -1
- data/README.rdoc +8 -5
- data/Rakefile +35 -36
- data/TODO +12 -35
- data/VERSION +1 -0
- data/examples/amazon.rb +8 -6
- data/examples/posts.rb +1 -1
- data/examples/{active_record.rb → rails.rb} +2 -2
- data/examples/twitter.rb +1 -1
- data/lib/roxml.rb +86 -151
- data/lib/roxml/definition.rb +64 -152
- data/lib/roxml/hash_definition.rb +5 -40
- data/lib/roxml/xml.rb +12 -9
- data/lib/roxml/xml/parsers/libxml.rb +22 -17
- data/lib/roxml/xml/parsers/nokogiri.rb +77 -0
- data/lib/roxml/xml/references.rb +66 -57
- data/roxml.gemspec +170 -19
- data/spec/definition_spec.rb +121 -198
- data/spec/examples/active_record_spec.rb +2 -2
- data/spec/examples/amazon_spec.rb +3 -2
- data/spec/examples/current_weather_spec.rb +2 -2
- data/spec/examples/dashed_elements_spec.rb +2 -2
- data/spec/examples/library_spec.rb +11 -6
- data/spec/examples/post_spec.rb +3 -3
- data/spec/examples/twitter_spec.rb +2 -2
- data/spec/roxml_spec.rb +15 -15
- data/spec/shared_specs.rb +1 -1
- data/spec/spec_helper.rb +8 -27
- data/spec/support/libxml.rb +3 -0
- data/spec/support/nokogiri.rb +3 -0
- data/spec/xml/attributes_spec.rb +36 -0
- data/spec/xml/namespace_spec.rb +240 -0
- data/spec/xml/namespaces_spec.rb +32 -0
- data/spec/xml/parser_spec.rb +9 -30
- data/tasks/rdoc.rake +13 -0
- data/tasks/rspec.rake +21 -17
- data/tasks/test.rake +13 -20
- data/test/mocks/dictionaries.rb +8 -7
- data/test/mocks/mocks.rb +20 -20
- data/test/support/fixtures.rb +11 -0
- data/test/test_helper.rb +3 -14
- data/test/unit/definition_test.rb +21 -95
- data/test/unit/deprecations_test.rb +1 -74
- data/test/unit/to_xml_test.rb +3 -3
- data/test/unit/xml_attribute_test.rb +1 -1
- data/test/unit/xml_block_test.rb +3 -3
- data/test/unit/xml_bool_test.rb +4 -4
- data/test/unit/xml_convention_test.rb +3 -3
- data/test/unit/xml_hash_test.rb +5 -14
- data/test/unit/xml_initialize_test.rb +2 -6
- data/test/unit/xml_name_test.rb +5 -24
- data/test/unit/xml_namespace_test.rb +1 -46
- data/test/unit/xml_object_test.rb +6 -6
- data/test/unit/xml_required_test.rb +3 -2
- data/test/unit/xml_text_test.rb +2 -2
- data/website/index.html +1 -1
- metadata +68 -51
- data/Manifest.txt +0 -106
- data/lib/roxml/extensions.rb +0 -6
- data/lib/roxml/extensions/array.rb +0 -13
- data/lib/roxml/extensions/array/conversions.rb +0 -35
- data/lib/roxml/extensions/deprecation.rb +0 -33
- data/lib/roxml/extensions/string.rb +0 -21
- data/lib/roxml/extensions/string/conversions.rb +0 -43
- data/lib/roxml/extensions/string/iterators.rb +0 -12
- data/lib/roxml/xml/parsers/rexml.rb +0 -84
- data/spec/string_spec.rb +0 -15
- data/test/bugs/rexml_bugs.rb +0 -15
- data/test/release/dependencies_test.rb +0 -32
- data/test/unit/xml_construct_test.rb +0 -77
- data/vendor/override_rake_task/README +0 -30
- data/vendor/override_rake_task/init.rb +0 -1
- data/vendor/override_rake_task/install.rb +0 -46
- data/vendor/override_rake_task/lib/override_rake_task.rb +0 -16
@@ -1,30 +0,0 @@
|
|
1
|
-
OverrideRakeTask plugin by Eugene Bolshakov, eugene.bolshakov@gmail.com, http://www.taknado.com
|
2
|
-
|
3
|
-
This plugin is based on the Matthew Bass's idea described here:
|
4
|
-
http://matthewbass.com/2007/03/07/overriding-existing-rake-tasks/
|
5
|
-
|
6
|
-
The installation script is based on the one found in the app_config plugin
|
7
|
-
by Daniel Owsianski, http://jarmark.org/projects/app-config/
|
8
|
-
|
9
|
-
When using rake with rails it loads the task in the following order:
|
10
|
-
|
11
|
-
1. Default rails tasks (like db:migrate)
|
12
|
-
2. The tasks in your app's lib/tasks directory
|
13
|
-
3. The tasks in your vendor/plugins directory
|
14
|
-
|
15
|
-
This plugin will allow to override rake tasks that were defined earlier. It means that
|
16
|
-
you'll be able to override default rails tasks with lib/tasks & plugins tasks and
|
17
|
-
override the taksks in lib/tasks with the tasks defined in plugins.
|
18
|
-
|
19
|
-
In order to override a task you need to define it as usual, but using "override_task"
|
20
|
-
method instead of "task":
|
21
|
-
|
22
|
-
namespace :db do
|
23
|
-
override_task :migrate do
|
24
|
-
...
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
In order to make this work the plugin should be loaded before the tasks and the install script
|
29
|
-
supplied with the plugin adds a line to load itself to the Rakefile. If it won't be able to
|
30
|
-
modify your Rakefile, it will let you know and you'll have to modify it manually.
|
@@ -1 +0,0 @@
|
|
1
|
-
# Include hook code here
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# Insert line: [require "#{RAILS_ROOT}/vendor/plugins/override_rake_task/lib/override_rake_task.rb"]
|
2
|
-
# before "require 'rake'" in Rakefile
|
3
|
-
# stolen from app_confing plugin :) http://jarmark.org/projects/app-config/
|
4
|
-
|
5
|
-
file = File.join(File.dirname(__FILE__), '../../../Rakefile')
|
6
|
-
unless File.exists?(file)
|
7
|
-
STDERR.puts("ERROR: Could not locate Rakefile")
|
8
|
-
exit(1)
|
9
|
-
end
|
10
|
-
|
11
|
-
# Tip from http://pleac.sourceforge.net/pleac_ruby/fileaccess.html
|
12
|
-
# 'Modifying a File in Place Without a Temporary File'
|
13
|
-
output= ""
|
14
|
-
inserted = false
|
15
|
-
line_to_insert = %q{require "#{RAILS_ROOT}/vendor/plugins/override_rake_task/lib/override_rake_task.rb"}
|
16
|
-
line_to_find = "require 'rake'"
|
17
|
-
|
18
|
-
File.open(file, 'r+') do |f| # open file for update
|
19
|
-
# read into array of lines and iterate through lines
|
20
|
-
f.readlines.each do |line|
|
21
|
-
unless inserted
|
22
|
-
if line.gsub(/#.*/, '').include?(line_to_insert)
|
23
|
-
inserted = true
|
24
|
-
elsif line.gsub(/#.*/, '').include?(line_to_find)
|
25
|
-
output << line_to_insert
|
26
|
-
output << "\n\n"
|
27
|
-
inserted = true
|
28
|
-
end
|
29
|
-
end
|
30
|
-
output << line
|
31
|
-
end
|
32
|
-
f.pos = 0 # back to start
|
33
|
-
f.print output # write out modified lines
|
34
|
-
f.truncate(f.pos) # truncate to new length
|
35
|
-
end
|
36
|
-
|
37
|
-
unless inserted
|
38
|
-
STDERR.puts <<END
|
39
|
-
ERROR: Could not update Rakefile
|
40
|
-
To finish installation please add the following line to
|
41
|
-
Rakefile manually:
|
42
|
-
\t#{line_to_insert}
|
43
|
-
NOTE: line must be inserted before #{line_to_find}
|
44
|
-
END
|
45
|
-
exit(1)
|
46
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# OverrideRakeTask
|
2
|
-
Rake::TaskManager.class_eval do
|
3
|
-
def remove_task(task_name)
|
4
|
-
@tasks.delete(task_name.to_s)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def remove_task(task_name)
|
9
|
-
Rake.application.remove_task(task_name)
|
10
|
-
end
|
11
|
-
|
12
|
-
def override_task(*args, &block)
|
13
|
-
name, params, deps = Rake.application.resolve_args(args)
|
14
|
-
remove_task Rake.application[name].name
|
15
|
-
Rake::Task.define_task({name => deps}, &block)
|
16
|
-
end
|