table_print 0.2.3 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.rvmrc +1 -1
- data/.travis.yml +5 -0
- data/Gemfile +11 -10
- data/README.rdoc +85 -32
- data/Rakefile +13 -13
- data/VERSION +1 -1
- data/features/adding_columns.feature +48 -0
- data/features/configuring_output.feature +57 -0
- data/features/excluding_columns.feature +28 -0
- data/features/sensible_defaults.feature +86 -0
- data/features/support/step_definitions/before.rb +3 -0
- data/features/support/step_definitions/steps.rb +77 -0
- data/lib/cattr.rb +46 -0
- data/lib/column.rb +45 -0
- data/lib/config.rb +36 -0
- data/lib/config_resolver.rb +91 -0
- data/lib/fingerprinter.rb +85 -0
- data/lib/formatter.rb +45 -0
- data/lib/hash_extensions.rb +37 -0
- data/lib/kernel_extensions.rb +12 -0
- data/lib/printable.rb +22 -0
- data/lib/returnable.rb +21 -0
- data/lib/row_group.rb +227 -0
- data/lib/table_print.rb +33 -389
- data/spec/column_spec.rb +71 -0
- data/spec/config_resolver_spec.rb +236 -0
- data/spec/config_spec.rb +52 -0
- data/spec/fingerprinter_spec.rb +151 -0
- data/spec/formatter_spec.rb +78 -0
- data/spec/hash_extensions_spec.rb +21 -0
- data/spec/printable_spec.rb +51 -0
- data/spec/returnable_spec.rb +23 -0
- data/spec/row_group_spec.rb +466 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/table_print_spec.rb +59 -0
- data/table_print.gemspec +50 -26
- metadata +147 -68
- data/Gemfile.lock +0 -20
- data/test/helper.rb +0 -56
- data/test/test_column.rb +0 -379
- data/test/test_table_print.rb +0 -162
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'table_print'
|
3
|
+
|
4
|
+
include TablePrint
|
5
|
+
|
6
|
+
describe TablePrint::Printer do
|
7
|
+
before(:each) do
|
8
|
+
Sandbox.cleanup!
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "printing an empty array" do
|
12
|
+
it "returns the string 'no data'" do
|
13
|
+
p = Printer.new([])
|
14
|
+
p.table_print.should == 'No data.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "printing an object where there are only association columns with no data" do
|
19
|
+
it "returns the string 'no data'" do
|
20
|
+
Sandbox.add_class("Blog")
|
21
|
+
Sandbox.add_attributes("Blog", :author)
|
22
|
+
p = Printer.new(Sandbox::Blog.new, "author.name")
|
23
|
+
p.table_print.should == 'No data.'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#columns" do
|
28
|
+
it "pulls the column names off the data object" do
|
29
|
+
Sandbox.add_class("Post")
|
30
|
+
Sandbox.add_attributes("Post", :title)
|
31
|
+
|
32
|
+
p = Printer.new(Sandbox::Post.new)
|
33
|
+
cols = p.columns
|
34
|
+
cols.length.should == 1
|
35
|
+
cols.first.name.should == 'title'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "pulls out excepted columns" do
|
39
|
+
Sandbox.add_class("Post")
|
40
|
+
Sandbox.add_attributes("Post", :title, :author)
|
41
|
+
|
42
|
+
p = Printer.new(Sandbox::Post.new, :except => :title)
|
43
|
+
cols = p.columns
|
44
|
+
cols.length.should == 1
|
45
|
+
cols.first.name.should == 'author'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "adds included columns" do
|
49
|
+
Sandbox.add_class("Post")
|
50
|
+
Sandbox.add_attributes("Post", :title)
|
51
|
+
|
52
|
+
p = Printer.new(Sandbox::Post.new, :include => :author)
|
53
|
+
cols = p.columns
|
54
|
+
cols.length.should == 2
|
55
|
+
cols.first.name.should == 'title'
|
56
|
+
cols.last.name.should == 'author'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/table_print.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "table_print"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "1.0.0.rc3"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chris Doyle"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-06-25"
|
13
13
|
s.description = "TablePrint formats an object or array of objects into columns for easy reading. To do this, it assumes the objects in your array all respond to the same methods (vs pretty_print or awesome_print, who can't create columns because your objects could be entirely different)."
|
14
14
|
s.email = "archslide@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,50 +18,74 @@ Gem::Specification.new do |s|
|
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
+
".rspec",
|
21
22
|
".rvmrc",
|
22
23
|
".travis.yml",
|
23
24
|
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
25
|
"LICENSE.txt",
|
26
26
|
"README.rdoc",
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
|
+
"features/adding_columns.feature",
|
30
|
+
"features/configuring_output.feature",
|
31
|
+
"features/excluding_columns.feature",
|
32
|
+
"features/sensible_defaults.feature",
|
33
|
+
"features/support/step_definitions/before.rb",
|
34
|
+
"features/support/step_definitions/steps.rb",
|
35
|
+
"lib/cattr.rb",
|
36
|
+
"lib/column.rb",
|
37
|
+
"lib/config.rb",
|
38
|
+
"lib/config_resolver.rb",
|
39
|
+
"lib/fingerprinter.rb",
|
40
|
+
"lib/formatter.rb",
|
41
|
+
"lib/hash_extensions.rb",
|
42
|
+
"lib/kernel_extensions.rb",
|
43
|
+
"lib/printable.rb",
|
44
|
+
"lib/returnable.rb",
|
45
|
+
"lib/row_group.rb",
|
29
46
|
"lib/table_print.rb",
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
47
|
+
"spec/column_spec.rb",
|
48
|
+
"spec/config_resolver_spec.rb",
|
49
|
+
"spec/config_spec.rb",
|
50
|
+
"spec/fingerprinter_spec.rb",
|
51
|
+
"spec/formatter_spec.rb",
|
52
|
+
"spec/hash_extensions_spec.rb",
|
53
|
+
"spec/printable_spec.rb",
|
54
|
+
"spec/returnable_spec.rb",
|
55
|
+
"spec/row_group_spec.rb",
|
56
|
+
"spec/spec_helper.rb",
|
57
|
+
"spec/table_print_spec.rb",
|
58
|
+
"table_print.gemspec"
|
34
59
|
]
|
35
60
|
s.homepage = "http://github.com/arches/table_print"
|
36
61
|
s.licenses = ["MIT"]
|
37
62
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = "1.8.
|
63
|
+
s.rubygems_version = "1.8.19"
|
39
64
|
s.summary = "Turn objects into nicely formatted columns for easy reading"
|
40
|
-
s.test_files = [
|
41
|
-
"test/helper.rb",
|
42
|
-
"test/test_column.rb",
|
43
|
-
"test/test_table_print.rb"
|
44
|
-
]
|
45
65
|
|
46
66
|
if s.respond_to? :specification_version then
|
47
67
|
s.specification_version = 3
|
48
68
|
|
49
69
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.
|
51
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.
|
52
|
-
s.add_development_dependency(%q<jeweler>, ["
|
53
|
-
s.add_development_dependency(%q<
|
70
|
+
s.add_runtime_dependency(%q<bundler>, ["~> 1.1"])
|
71
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1"])
|
72
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
74
|
+
s.add_development_dependency(%q<relish>, [">= 0"])
|
75
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
54
76
|
else
|
55
|
-
s.add_dependency(%q<
|
56
|
-
s.add_dependency(%q<
|
57
|
-
s.add_dependency(%q<
|
58
|
-
s.add_dependency(%q<
|
77
|
+
s.add_dependency(%q<bundler>, ["~> 1.1"])
|
78
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
79
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
80
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
81
|
+
s.add_dependency(%q<relish>, [">= 0"])
|
59
82
|
end
|
60
83
|
else
|
61
|
-
s.add_dependency(%q<
|
62
|
-
s.add_dependency(%q<
|
63
|
-
s.add_dependency(%q<
|
64
|
-
s.add_dependency(%q<
|
84
|
+
s.add_dependency(%q<bundler>, ["~> 1.1"])
|
85
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
87
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
88
|
+
s.add_dependency(%q<relish>, [">= 0"])
|
65
89
|
end
|
66
90
|
end
|
67
91
|
|
metadata
CHANGED
@@ -1,114 +1,193 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_print
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 614046837
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 3
|
12
|
+
version: 1.0.0.rc3
|
6
13
|
platform: ruby
|
7
|
-
authors:
|
14
|
+
authors:
|
8
15
|
- Chris Doyle
|
9
16
|
autorequire:
|
10
17
|
bindir: bin
|
11
18
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
19
|
+
|
20
|
+
date: 2012-06-25 00:00:00 Z
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: bundler
|
23
24
|
prerelease: false
|
24
|
-
|
25
|
-
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 13
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 1
|
34
|
+
version: "1.1"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
26
38
|
name: bundler
|
27
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
41
|
none: false
|
29
|
-
requirements:
|
42
|
+
requirements:
|
30
43
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 1
|
49
|
+
version: "1.1"
|
33
50
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
37
53
|
name: jeweler
|
38
|
-
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
56
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
44
64
|
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rspec
|
45
68
|
prerelease: false
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rcov
|
49
|
-
requirement: &70118587967600 !ruby/object:Gem::Requirement
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
70
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
55
78
|
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: relish
|
56
82
|
prerelease: false
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
type: :development
|
93
|
+
version_requirements: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: cucumber
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
type: :development
|
107
|
+
version_requirements: *id006
|
108
|
+
description: TablePrint formats an object or array of objects into columns for easy reading. To do this, it assumes the objects in your array all respond to the same methods (vs pretty_print or awesome_print, who can't create columns because your objects could be entirely different).
|
62
109
|
email: archslide@gmail.com
|
63
110
|
executables: []
|
111
|
+
|
64
112
|
extensions: []
|
65
|
-
|
113
|
+
|
114
|
+
extra_rdoc_files:
|
66
115
|
- LICENSE.txt
|
67
116
|
- README.rdoc
|
68
|
-
files:
|
117
|
+
files:
|
69
118
|
- .document
|
119
|
+
- .rspec
|
70
120
|
- .rvmrc
|
71
121
|
- .travis.yml
|
72
122
|
- Gemfile
|
73
|
-
- Gemfile.lock
|
74
123
|
- LICENSE.txt
|
75
124
|
- README.rdoc
|
76
125
|
- Rakefile
|
77
126
|
- VERSION
|
127
|
+
- features/adding_columns.feature
|
128
|
+
- features/configuring_output.feature
|
129
|
+
- features/excluding_columns.feature
|
130
|
+
- features/sensible_defaults.feature
|
131
|
+
- features/support/step_definitions/before.rb
|
132
|
+
- features/support/step_definitions/steps.rb
|
133
|
+
- lib/cattr.rb
|
134
|
+
- lib/column.rb
|
135
|
+
- lib/config.rb
|
136
|
+
- lib/config_resolver.rb
|
137
|
+
- lib/fingerprinter.rb
|
138
|
+
- lib/formatter.rb
|
139
|
+
- lib/hash_extensions.rb
|
140
|
+
- lib/kernel_extensions.rb
|
141
|
+
- lib/printable.rb
|
142
|
+
- lib/returnable.rb
|
143
|
+
- lib/row_group.rb
|
78
144
|
- lib/table_print.rb
|
145
|
+
- spec/column_spec.rb
|
146
|
+
- spec/config_resolver_spec.rb
|
147
|
+
- spec/config_spec.rb
|
148
|
+
- spec/fingerprinter_spec.rb
|
149
|
+
- spec/formatter_spec.rb
|
150
|
+
- spec/hash_extensions_spec.rb
|
151
|
+
- spec/printable_spec.rb
|
152
|
+
- spec/returnable_spec.rb
|
153
|
+
- spec/row_group_spec.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/table_print_spec.rb
|
79
156
|
- table_print.gemspec
|
80
|
-
- test/helper.rb
|
81
|
-
- test/test_column.rb
|
82
|
-
- test/test_table_print.rb
|
83
157
|
homepage: http://github.com/arches/table_print
|
84
|
-
licenses:
|
158
|
+
licenses:
|
85
159
|
- MIT
|
86
160
|
post_install_message:
|
87
161
|
rdoc_options: []
|
88
|
-
|
162
|
+
|
163
|
+
require_paths:
|
89
164
|
- lib
|
90
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
166
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
97
172
|
- 0
|
98
|
-
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
version: "0"
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
175
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
176
|
+
requirements:
|
177
|
+
- - ">"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 25
|
180
|
+
segments:
|
181
|
+
- 1
|
182
|
+
- 3
|
183
|
+
- 1
|
184
|
+
version: 1.3.1
|
105
185
|
requirements: []
|
186
|
+
|
106
187
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.8.
|
188
|
+
rubygems_version: 1.8.19
|
108
189
|
signing_key:
|
109
190
|
specification_version: 3
|
110
191
|
summary: Turn objects into nicely formatted columns for easy reading
|
111
|
-
test_files:
|
112
|
-
|
113
|
-
- test/test_column.rb
|
114
|
-
- test/test_table_print.rb
|
192
|
+
test_files: []
|
193
|
+
|
data/Gemfile.lock
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
git (1.2.5)
|
5
|
-
jeweler (1.5.2)
|
6
|
-
bundler (~> 1.0.0)
|
7
|
-
git (>= 1.2.5)
|
8
|
-
rake
|
9
|
-
rake (0.9.2)
|
10
|
-
rcov (0.9.9)
|
11
|
-
shoulda (2.11.3)
|
12
|
-
|
13
|
-
PLATFORMS
|
14
|
-
ruby
|
15
|
-
|
16
|
-
DEPENDENCIES
|
17
|
-
bundler (~> 1.0.0)
|
18
|
-
jeweler (~> 1.5.2)
|
19
|
-
rcov
|
20
|
-
shoulda
|