jordi-hanna 0.1.4

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.
Files changed (2) hide show
  1. data/Rakefile +112 -0
  2. metadata +129 -0
data/Rakefile ADDED
@@ -0,0 +1,112 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require File.join(File.dirname(__FILE__), 'lib', 'xml_struct')
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Run the unit tests.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation'
16
+ task :rdoc do
17
+ hanna = File.expand_path File.join(
18
+ File.dirname(__FILE__), 'vendor', 'hanna', 'bin', 'hanna')
19
+
20
+ options = %{ --inline-source
21
+ --main README.rdoc
22
+ --title "XMLStruct"
23
+ README.rdoc
24
+ lib/xml_struct.rb
25
+ lib/xml_struct/*.rb
26
+ lib/xml_struct/adapters/*.rb }.strip.gsub(/\s+/, ' ')
27
+
28
+ ruby_files = File.join File.dirname(__FILE__)
29
+
30
+ system "#{hanna} #{options}"
31
+ end
32
+
33
+ desc 'Measures test coverage using rcov'
34
+ task :rcov do
35
+ rm_f 'coverage'
36
+ rm_f 'coverage.data'
37
+
38
+ rcov = %{ rcov --aggregate coverage.data --text-summary
39
+ --include lib
40
+ --exclude /Library/Ruby
41
+ }.strip!.gsub! /\s+/, ' '
42
+
43
+ system("#{rcov} --html #{Dir.glob('test/**/*_test.rb').join(' ')}")
44
+ system('open coverage/index.html') if PLATFORM['darwin']
45
+ end
46
+
47
+ desc 'Profiling'
48
+ task :profile do
49
+ require 'ruby-prof'
50
+
51
+ xml_file = File.join(File.dirname(__FILE__),
52
+ 'test', 'samples', 'lorem.xml')
53
+
54
+ result = RubyProf.profile do
55
+ XMLStruct.new(File.open(xml_file))
56
+ end
57
+
58
+ printer = RubyProf::GraphHtmlPrinter.new(result)
59
+ printer.print(File.open('profile.html', 'w'), :min_percent=>0)
60
+ system('open profile.html') if PLATFORM['darwin']
61
+ end
62
+
63
+ desc 'Silly benchmarks'
64
+ task :benchmark do
65
+
66
+ require 'benchmark'
67
+
68
+ begin
69
+ require 'xmlsimple'
70
+ rescue LoadError
71
+ puts 'XmlSimple not found'
72
+ end
73
+
74
+ begin
75
+ require 'hpricot'
76
+ rescue LoadError
77
+ puts 'Hpricot not found'
78
+ end
79
+
80
+ xml_file = File.join(File.dirname(__FILE__),
81
+ 'test', 'samples', 'recipe.xml')
82
+
83
+ puts "Reading whole file:"
84
+ n = 500
85
+ Benchmark.bm(20) do |x|
86
+ x.report "REXML:" do
87
+ n.times { recipe = REXML::Document.new(File.open(xml_file)) }
88
+ end
89
+
90
+ require File.join(File.dirname(__FILE__), 'lib', 'xml_struct',
91
+ 'adapters', 'rexml')
92
+ XMLStruct.adapter = XMLStruct::Adapters::REXML
93
+ x.report("XMLStruct (REXML):") do
94
+ n.times { recipe = XMLStruct.new(File.open(xml_file)) }
95
+ end
96
+
97
+ if defined?(Hpricot)
98
+ require File.join(File.dirname(__FILE__), 'lib', 'xml_struct',
99
+ 'adapters', 'hpricot')
100
+ XMLStruct.adapter = XMLStruct::Adapters::Hpricot
101
+ x.report("XMLStruct (Hpricot):") do
102
+ n.times { recipe = XMLStruct.new(File.open(xml_file)) }
103
+ end
104
+ end
105
+
106
+ if defined?(XmlSimple)
107
+ x.report "XmlSimple:" do
108
+ n.times { recipe = XmlSimple.xml_in(File.open(xml_file)) }
109
+ end
110
+ end
111
+ end
112
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jordi-hanna
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - "Mislav Marohni\xC4\x87"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ date: 2008-09-21 21:00:00 -07:00
12
+ default_executable:
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ type: :runtime
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 2.2.0
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: haml
26
+ type: :runtime
27
+ version_requirement:
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: "2.0"
33
+ version:
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ type: :runtime
37
+ version_requirement:
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: 0.8.2
43
+ version:
44
+ - !ruby/object:Gem::Dependency
45
+ name: echoe
46
+ type: :development
47
+ version_requirement:
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ description: Hanna is an RDoc template that scales. It's implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.
55
+ email: mislav.marohnic@gmail.com
56
+ executables:
57
+ - hanna
58
+ extensions: []
59
+
60
+ extra_rdoc_files:
61
+ - bin/hanna
62
+ - lib/hanna/hanna.rb
63
+ - lib/hanna/rdoc_version.rb
64
+ - lib/hanna/rdoctask.rb
65
+ - lib/hanna/template_files/class_index.haml
66
+ - lib/hanna/template_files/file_index.haml
67
+ - lib/hanna/template_files/index.haml
68
+ - lib/hanna/template_files/layout.haml
69
+ - lib/hanna/template_files/method_list.haml
70
+ - lib/hanna/template_files/page.haml
71
+ - lib/hanna/template_files/sections.haml
72
+ - lib/hanna/template_files/styles.sass
73
+ - lib/hanna/template_helpers.rb
74
+ - lib/hanna/template_page_patch.rb
75
+ - lib/hanna.rb
76
+ - README.markdown
77
+ files:
78
+ - bin/hanna
79
+ - hanna.gemspec
80
+ - lib/hanna/hanna.rb
81
+ - lib/hanna/rdoc_version.rb
82
+ - lib/hanna/rdoctask.rb
83
+ - lib/hanna/template_files/class_index.haml
84
+ - lib/hanna/template_files/file_index.haml
85
+ - lib/hanna/template_files/index.haml
86
+ - lib/hanna/template_files/layout.haml
87
+ - lib/hanna/template_files/method_list.haml
88
+ - lib/hanna/template_files/page.haml
89
+ - lib/hanna/template_files/sections.haml
90
+ - lib/hanna/template_files/styles.sass
91
+ - lib/hanna/template_helpers.rb
92
+ - lib/hanna/template_page_patch.rb
93
+ - lib/hanna.rb
94
+ - Manifest
95
+ - Rakefile
96
+ - README.markdown
97
+ has_rdoc: false
98
+ homepage: http://github.com/mislav/hanna
99
+ post_install_message:
100
+ rdoc_options:
101
+ - --line-numbers
102
+ - --inline-source
103
+ - --title
104
+ - Hanna
105
+ - --main
106
+ - README.markdown
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: "0"
114
+ version:
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "="
118
+ - !ruby/object:Gem::Version
119
+ version: "1.2"
120
+ version:
121
+ requirements: []
122
+
123
+ rubyforge_project: hanna
124
+ rubygems_version: 1.2.0
125
+ signing_key:
126
+ specification_version: 2
127
+ summary: An RDoc template that rocks
128
+ test_files: []
129
+