sporkmonger-sax-machine 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/LICENSE +20 -0
- data/README.md +56 -0
- data/Rakefile +53 -0
- data/lib/sax-machine.rb +17 -0
- data/lib/sax-machine/ns_stack.rb +41 -0
- data/lib/sax-machine/sax_collection_config.rb +56 -0
- data/lib/sax-machine/sax_config.rb +57 -0
- data/lib/sax-machine/sax_document.rb +107 -0
- data/lib/sax-machine/sax_element_config.rb +80 -0
- data/lib/sax-machine/sax_event_recorder.rb +35 -0
- data/lib/sax-machine/sax_handler.rb +118 -0
- data/lib/sax-machine/version.rb +33 -0
- data/spec/benchmarks/amazon.xml +40 -0
- data/spec/benchmarks/benchmark.rb +158 -0
- data/spec/benchmarks/public_timeline.xml +411 -0
- data/spec/sax-machine/atom.xml +165 -0
- data/spec/sax-machine/sax_document_spec.rb +667 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +7 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +69 -0
- data/tasks/git.rake +40 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +26 -0
- data/tasks/spec.rake +70 -0
- data/tasks/yard.rake +26 -0
- metadata +175 -0
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
data/tasks/clobber.rake
ADDED
data/tasks/gem.rake
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
GEM_SPEC = Gem::Specification.new do |s|
|
5
|
+
unless s.respond_to?(:add_development_dependency)
|
6
|
+
puts 'The gem spec requires a newer version of RubyGems.'
|
7
|
+
exit(1)
|
8
|
+
end
|
9
|
+
|
10
|
+
s.name = PKG_NAME
|
11
|
+
s.version = PKG_VERSION
|
12
|
+
s.author = PKG_AUTHOR
|
13
|
+
s.email = PKG_AUTHOR_EMAIL
|
14
|
+
s.homepage = PKG_HOMEPAGE
|
15
|
+
s.summary = PKG_SUMMARY
|
16
|
+
s.description = PKG_DESCRIPTION
|
17
|
+
|
18
|
+
s.files = PKG_FILES.to_a
|
19
|
+
|
20
|
+
s.has_rdoc = true
|
21
|
+
s.extra_rdoc_files = %w( README.md )
|
22
|
+
s.rdoc_options.concat ['--main', 'README.md']
|
23
|
+
|
24
|
+
s.add_runtime_dependency('nokogiri', '~> 1.4.4')
|
25
|
+
|
26
|
+
s.add_development_dependency('rake', '~> 0.8.3')
|
27
|
+
s.add_development_dependency('rspec', '~> 1.1.11')
|
28
|
+
s.add_development_dependency('launchy', '~> 0.3.2')
|
29
|
+
s.add_development_dependency('diff-lcs', '~> 1.1.2')
|
30
|
+
|
31
|
+
s.require_path = 'lib'
|
32
|
+
end
|
33
|
+
|
34
|
+
Rake::GemPackageTask.new(GEM_SPEC) do |p|
|
35
|
+
p.gem_spec = GEM_SPEC
|
36
|
+
p.need_tar = true
|
37
|
+
p.need_zip = true
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Show information about the gem'
|
41
|
+
task :debug do
|
42
|
+
puts GEM_SPEC.to_ruby
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Install the gem'
|
46
|
+
task :install => ['clobber', 'gem:package'] do
|
47
|
+
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Uninstall the gem'
|
51
|
+
task :uninstall do
|
52
|
+
installed_list = Gem.source_index.find_name(PKG_NAME)
|
53
|
+
if installed_list &&
|
54
|
+
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
55
|
+
sh(
|
56
|
+
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
57
|
+
"--ignore-dependencies --executables #{PKG_NAME}"
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'Reinstall the gem'
|
63
|
+
task :reinstall => [:uninstall, :install]
|
64
|
+
end
|
65
|
+
|
66
|
+
desc 'Alias to gem:package'
|
67
|
+
task 'gem' => 'gem:package'
|
68
|
+
|
69
|
+
task 'clobber' => ['gem:clobber_package']
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
namespace :git do
|
2
|
+
namespace :tag do
|
3
|
+
desc 'List tags from the Git repository'
|
4
|
+
task :list do
|
5
|
+
tags = `git tag -l`
|
6
|
+
tags.gsub!("\r", '')
|
7
|
+
tags = tags.split("\n").sort {|a, b| b <=> a }
|
8
|
+
puts tags.join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Create a new tag in the Git repository'
|
12
|
+
task :create do
|
13
|
+
changelog = File.open('CHANGELOG', 'r') { |file| file.read }
|
14
|
+
puts '-' * 80
|
15
|
+
puts changelog
|
16
|
+
puts '-' * 80
|
17
|
+
puts
|
18
|
+
|
19
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
20
|
+
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
21
|
+
|
22
|
+
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
|
+
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
|
+
|
25
|
+
existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n")
|
26
|
+
if existing_tags.include?(tag)
|
27
|
+
warn('Tag already exists, deleting...')
|
28
|
+
unless system "git tag -d #{tag}"
|
29
|
+
abort 'Tag deletion failed.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
puts "Creating git tag '#{tag}'..."
|
33
|
+
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
34
|
+
abort 'Tag creation failed.'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task 'gem:release' => 'git:tag:create'
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :metrics do
|
2
|
+
task :lines do
|
3
|
+
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
4
|
+
for file_name in FileList['lib/**/*.rb']
|
5
|
+
f = File.open(file_name)
|
6
|
+
while line = f.gets
|
7
|
+
lines += 1
|
8
|
+
next if line =~ /^\s*$/
|
9
|
+
next if line =~ /^\s*#/
|
10
|
+
codelines += 1
|
11
|
+
end
|
12
|
+
puts "L: #{sprintf('%4d', lines)}, " +
|
13
|
+
"LOC #{sprintf('%4d', codelines)} | #{file_name}"
|
14
|
+
total_lines += lines
|
15
|
+
total_codelines += codelines
|
16
|
+
|
17
|
+
lines, codelines = 0, 0
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
21
|
+
end
|
22
|
+
end
|
data/tasks/rdoc.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake/rdoctask'
|
2
|
+
|
3
|
+
namespace :doc do
|
4
|
+
desc 'Generate RDoc documentation'
|
5
|
+
Rake::RDocTask.new do |rdoc|
|
6
|
+
rdoc.rdoc_dir = 'doc'
|
7
|
+
rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
|
8
|
+
rdoc.options << '--line-numbers' << '--inline-source' <<
|
9
|
+
'--accessor' << 'cattr_accessor=object' << '--charset' << 'utf-8'
|
10
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
11
|
+
rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE')
|
12
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate ri locally for testing'
|
16
|
+
task :ri do
|
17
|
+
sh 'rdoc --ri -o ri .'
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Remove ri products'
|
21
|
+
task :clobber_ri do
|
22
|
+
rm_r 'ri' rescue nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
task 'clobber' => ['doc:clobber_rdoc', 'doc:clobber_ri']
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec/rake/verify_rcov'
|
2
|
+
|
3
|
+
namespace :spec do
|
4
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
5
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
6
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
7
|
+
if RCOV_ENABLED
|
8
|
+
if `which rcov`.strip == ''
|
9
|
+
STDERR.puts 'Please install rcov:'
|
10
|
+
STDERR.puts 'sudo gem install relevance-rcov'
|
11
|
+
exit(1)
|
12
|
+
end
|
13
|
+
t.rcov = true
|
14
|
+
else
|
15
|
+
t.rcov = false
|
16
|
+
end
|
17
|
+
t.rcov_opts = [
|
18
|
+
'--exclude', 'spec',
|
19
|
+
'--exclude', '\\.rvm\\/gems',
|
20
|
+
'--exclude', '1\\.8\\/gems',
|
21
|
+
'--exclude', '1\\.9\\/gems',
|
22
|
+
'--exclude', '\\.rvm'
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
Spec::Rake::SpecTask.new(:normal) do |t|
|
27
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
29
|
+
t.rcov = false
|
30
|
+
end
|
31
|
+
|
32
|
+
if RCOV_ENABLED
|
33
|
+
RCov::VerifyTask.new(:verify) do |t|
|
34
|
+
t.threshold = 100.0
|
35
|
+
t.index_html = 'coverage/index.html'
|
36
|
+
end
|
37
|
+
|
38
|
+
task :verify => :rcov
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Generate HTML Specdocs for all specs'
|
42
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
43
|
+
specdoc_path = File.expand_path(
|
44
|
+
File.join(File.dirname(__FILE__), '../specdoc/'))
|
45
|
+
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
46
|
+
|
47
|
+
output_file = File.join(specdoc_path, 'index.html')
|
48
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
49
|
+
t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
|
50
|
+
t.fail_on_error = false
|
51
|
+
end
|
52
|
+
|
53
|
+
namespace :rcov do
|
54
|
+
desc 'Browse the code coverage report.'
|
55
|
+
task :browse => 'spec:rcov' do
|
56
|
+
require 'launchy'
|
57
|
+
Launchy::Browser.run('coverage/index.html')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
if RCOV_ENABLED
|
63
|
+
desc 'Alias to spec:verify'
|
64
|
+
task 'spec' => 'spec:verify'
|
65
|
+
else
|
66
|
+
desc 'Alias to spec:normal'
|
67
|
+
task 'spec' => 'spec:normal'
|
68
|
+
end
|
69
|
+
|
70
|
+
task 'clobber' => ['spec:clobber_rcov']
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'yard'
|
5
|
+
require 'yard/rake/yardoc_task'
|
6
|
+
|
7
|
+
namespace :doc do
|
8
|
+
desc 'Generate Yardoc documentation'
|
9
|
+
YARD::Rake::YardocTask.new do |yardoc|
|
10
|
+
yardoc.name = 'yard'
|
11
|
+
yardoc.options = ['--verbose']
|
12
|
+
yardoc.files = [
|
13
|
+
'lib/**/*.rb', 'ext/**/*.c', 'README', 'CHANGELOG', 'LICENSE'
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
task 'clobber' => ['doc:clobber_yard']
|
19
|
+
|
20
|
+
desc 'Alias to doc:yard'
|
21
|
+
task 'doc' => 'doc:yard'
|
22
|
+
rescue LoadError
|
23
|
+
# If yard isn't available, it's not the end of the world
|
24
|
+
desc 'Alias to doc:rdoc'
|
25
|
+
task 'doc' => 'doc:rdoc'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sporkmonger-sax-machine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Paul Dix
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-07 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: nokogiri
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
- 4
|
34
|
+
version: 1.4.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 57
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 8
|
49
|
+
- 3
|
50
|
+
version: 0.8.3
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 5
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 1
|
65
|
+
- 11
|
66
|
+
version: 1.1.11
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: launchy
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 23
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
- 3
|
81
|
+
- 2
|
82
|
+
version: 0.3.2
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: diff-lcs
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 23
|
94
|
+
segments:
|
95
|
+
- 1
|
96
|
+
- 1
|
97
|
+
- 2
|
98
|
+
version: 1.1.2
|
99
|
+
type: :development
|
100
|
+
version_requirements: *id005
|
101
|
+
description: |
|
102
|
+
A declarative sax parsing library backed by Nokogiri.
|
103
|
+
|
104
|
+
email: paul@pauldix.net
|
105
|
+
executables: []
|
106
|
+
|
107
|
+
extensions: []
|
108
|
+
|
109
|
+
extra_rdoc_files:
|
110
|
+
- README.md
|
111
|
+
files:
|
112
|
+
- lib/sax-machine/ns_stack.rb
|
113
|
+
- lib/sax-machine/sax_collection_config.rb
|
114
|
+
- lib/sax-machine/sax_config.rb
|
115
|
+
- lib/sax-machine/sax_document.rb
|
116
|
+
- lib/sax-machine/sax_element_config.rb
|
117
|
+
- lib/sax-machine/sax_event_recorder.rb
|
118
|
+
- lib/sax-machine/sax_handler.rb
|
119
|
+
- lib/sax-machine/version.rb
|
120
|
+
- lib/sax-machine.rb
|
121
|
+
- spec/benchmarks/amazon.xml
|
122
|
+
- spec/benchmarks/benchmark.rb
|
123
|
+
- spec/benchmarks/public_timeline.xml
|
124
|
+
- spec/sax-machine/atom.xml
|
125
|
+
- spec/sax-machine/sax_document_spec.rb
|
126
|
+
- spec/spec.opts
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
- tasks/clobber.rake
|
129
|
+
- tasks/gem.rake
|
130
|
+
- tasks/git.rake
|
131
|
+
- tasks/metrics.rake
|
132
|
+
- tasks/rdoc.rake
|
133
|
+
- tasks/spec.rake
|
134
|
+
- tasks/yard.rake
|
135
|
+
- CHANGELOG
|
136
|
+
- LICENSE
|
137
|
+
- Rakefile
|
138
|
+
- README.md
|
139
|
+
has_rdoc: true
|
140
|
+
homepage: https://github.com/sporkmonger/sax-machine
|
141
|
+
licenses: []
|
142
|
+
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options:
|
145
|
+
- --main
|
146
|
+
- README.md
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
version: "0"
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 3
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
version: "0"
|
167
|
+
requirements: []
|
168
|
+
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 1.4.1
|
171
|
+
signing_key:
|
172
|
+
specification_version: 3
|
173
|
+
summary: A declarative sax parsing library backed by Nokogiri.
|
174
|
+
test_files: []
|
175
|
+
|