kbaum-munger 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/README +90 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/examples/column_add.rb +30 -0
- data/examples/development.log +2 -0
- data/examples/example_helper.rb +23 -0
- data/examples/sinatra_app.rb +100 -0
- data/examples/test.html +0 -0
- data/lib/munger.rb +16 -0
- data/lib/munger/data.rb +232 -0
- data/lib/munger/item.rb +50 -0
- data/lib/munger/render.rb +22 -0
- data/lib/munger/render/csv.rb +31 -0
- data/lib/munger/render/html.rb +89 -0
- data/lib/munger/render/sortable_html.rb +133 -0
- data/lib/munger/render/text.rb +54 -0
- data/lib/munger/report.rb +349 -0
- data/spec/munger/data/new_spec.rb +18 -0
- data/spec/munger/data_spec.rb +140 -0
- data/spec/munger/item_spec.rb +37 -0
- data/spec/munger/render/csv_spec.rb +21 -0
- data/spec/munger/render/html_spec.rb +75 -0
- data/spec/munger/render/text_spec.rb +22 -0
- data/spec/munger/render_spec.rb +28 -0
- data/spec/munger/report_spec.rb +148 -0
- data/spec/spec_helper.rb +76 -0
- metadata +92 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/munger")
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'spec'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'logger'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
require 'rspec_hpricot_matchers'
|
10
|
+
Spec::Runner.configure do |config|
|
11
|
+
config.include(RspecHpricotMatchers)
|
12
|
+
end
|
13
|
+
|
14
|
+
module MungerSpecHelper
|
15
|
+
def test_data
|
16
|
+
[{:name => 'Scott', :age => 23, :day => 1, :score => 12},
|
17
|
+
{:name => 'Chaz', :age => 28, :day => 1, :score => 12},
|
18
|
+
{:name => 'Scott', :age => 23, :day => 2, :score => 1},
|
19
|
+
{:name => 'Janet', :age => 32, :day => 2, :score => 24},
|
20
|
+
{:name => 'Rich', :age => 32, :day => 2, :score => 14},
|
21
|
+
{:name => 'Gordon', :age => 33, :day => 1, :score => 21},
|
22
|
+
{:name => 'Scott', :age => 23, :day => 1, :score => 31},
|
23
|
+
{:name => 'Alice', :age => 33, :day => 1, :score => 12},
|
24
|
+
{:name => 'Alice', :age => 34, :day => 2, :score => 12},
|
25
|
+
{:name => 'Alice', :age => 33, :day => 2, :score => 12},
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
def invalid_test_data
|
30
|
+
['one', 'two', 'three']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
##
|
37
|
+
# rSpec Hash additions.
|
38
|
+
#
|
39
|
+
# From
|
40
|
+
# * http://wincent.com/knowledge-base/Fixtures_considered_harmful%3F
|
41
|
+
# * Neil Rahilly
|
42
|
+
|
43
|
+
class Hash
|
44
|
+
|
45
|
+
##
|
46
|
+
# Filter keys out of a Hash.
|
47
|
+
#
|
48
|
+
# { :a => 1, :b => 2, :c => 3 }.except(:a)
|
49
|
+
# => { :b => 2, :c => 3 }
|
50
|
+
|
51
|
+
def except(*keys)
|
52
|
+
self.reject { |k,v| keys.include?(k || k.to_sym) }
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Override some keys.
|
57
|
+
#
|
58
|
+
# { :a => 1, :b => 2, :c => 3 }.with(:a => 4)
|
59
|
+
# => { :a => 4, :b => 2, :c => 3 }
|
60
|
+
|
61
|
+
def with(overrides = {})
|
62
|
+
self.merge overrides
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Returns a Hash with only the pairs identified by +keys+.
|
67
|
+
#
|
68
|
+
# { :a => 1, :b => 2, :c => 3 }.only(:a)
|
69
|
+
# => { :a => 1 }
|
70
|
+
|
71
|
+
def only(*keys)
|
72
|
+
self.reject { |k,v| !keys.include?(k || k.to_sym) }
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kbaum-munger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Karl Baum
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-06 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A different and possibly longer explanation of
|
17
|
+
email: karl@weshopnetwork.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- examples/column_add.rb
|
30
|
+
- examples/development.log
|
31
|
+
- examples/example_helper.rb
|
32
|
+
- examples/sinatra_app.rb
|
33
|
+
- examples/test.html
|
34
|
+
- lib/munger.rb
|
35
|
+
- lib/munger/data.rb
|
36
|
+
- lib/munger/item.rb
|
37
|
+
- lib/munger/render.rb
|
38
|
+
- lib/munger/render/csv.rb
|
39
|
+
- lib/munger/render/html.rb
|
40
|
+
- lib/munger/render/sortable_html.rb
|
41
|
+
- lib/munger/render/text.rb
|
42
|
+
- lib/munger/report.rb
|
43
|
+
- spec/munger/data/new_spec.rb
|
44
|
+
- spec/munger/data_spec.rb
|
45
|
+
- spec/munger/item_spec.rb
|
46
|
+
- spec/munger/render/csv_spec.rb
|
47
|
+
- spec/munger/render/html_spec.rb
|
48
|
+
- spec/munger/render/text_spec.rb
|
49
|
+
- spec/munger/render_spec.rb
|
50
|
+
- spec/munger/report_spec.rb
|
51
|
+
- spec/spec_helper.rb
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://github.com/kbaum/munger
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --charset=UTF-8
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.3.4
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: fork of munger reporting to create a gem
|
80
|
+
test_files:
|
81
|
+
- spec/munger/data/new_spec.rb
|
82
|
+
- spec/munger/data_spec.rb
|
83
|
+
- spec/munger/item_spec.rb
|
84
|
+
- spec/munger/render/csv_spec.rb
|
85
|
+
- spec/munger/render/html_spec.rb
|
86
|
+
- spec/munger/render/text_spec.rb
|
87
|
+
- spec/munger/render_spec.rb
|
88
|
+
- spec/munger/report_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
- examples/column_add.rb
|
91
|
+
- examples/example_helper.rb
|
92
|
+
- examples/sinatra_app.rb
|