undies 3.0.0.rc.3 → 3.0.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 +17 -3
- data/Gemfile +7 -4
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +107 -105
- data/Rakefile +1 -8
- data/lib/undies/api.rb +2 -1
- data/lib/undies/element.rb +43 -81
- data/lib/undies/element_node.rb +6 -5
- data/lib/undies/io.rb +0 -1
- data/lib/undies/raw.rb +15 -0
- data/lib/undies/source.rb +0 -8
- data/lib/undies/version.rb +1 -1
- data/lib/undies.rb +4 -2
- data/test/helper.rb +5 -85
- data/test/support/element.rb +79 -0
- data/test/{templates → support/templates}/content.html.rb +0 -0
- data/test/{templates → support/templates}/index.html.rb +0 -0
- data/test/{templates → support/templates}/layout.html.rb +0 -0
- data/test/{templates → support/templates}/test.html.rb +0 -0
- data/test/{element_closed_test.rb → unit/element_closed_tests.rb} +2 -6
- data/test/{element_node_test.rb → unit/element_node_tests.rb} +5 -11
- data/test/{element_open_test.rb → unit/element_open_tests.rb} +2 -5
- data/test/{element_test.rb → unit/element_tests.rb} +1 -2
- data/test/{io_test.rb → unit/io_tests.rb} +3 -8
- data/test/{named_source_test.rb → unit/named_source_tests.rb} +4 -5
- data/test/{raw_test.rb → unit/raw_tests.rb} +6 -5
- data/test/{root_node_test.rb → unit/root_node_tests.rb} +4 -3
- data/test/{source_stack_test.rb → unit/source_stack_tests.rb} +2 -3
- data/test/{source_test.rb → unit/source_tests.rb} +5 -6
- data/test/{template_builder_render_test.rb → unit/template_builder_render_tests.rb} +3 -0
- data/test/{template_source_render_test.rb → unit/template_source_render_tests.rb} +5 -10
- data/test/{template_test.rb → unit/template_tests.rb} +12 -30
- data/undies.gemspec +16 -18
- metadata +58 -111
- data/Gemfile.lock +0 -48
- data/test/fixtures/write_thing.rb +0 -21
- data/test/irb.rb +0 -9
@@ -1,11 +1,12 @@
|
|
1
1
|
require "assert"
|
2
2
|
require "undies/template"
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'undies/io'
|
5
|
+
require 'undies/source'
|
6
6
|
|
7
|
+
class Undies::Template
|
7
8
|
|
8
|
-
class
|
9
|
+
class UnitTests < Assert::Context
|
9
10
|
desc 'a template'
|
10
11
|
before do
|
11
12
|
@src = Undies::Source.new(Proc.new {})
|
@@ -54,9 +55,7 @@ class Undies::Template
|
|
54
55
|
|
55
56
|
end
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
class PlainTextTests < BasicTests
|
58
|
+
class PlainTextTests < UnitTests
|
60
59
|
before do
|
61
60
|
@data = "stuff & <em>more stuff</em>"
|
62
61
|
end
|
@@ -73,9 +72,7 @@ class Undies::Template
|
|
73
72
|
|
74
73
|
end
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
class PlainTextTests < BasicTests
|
75
|
+
class PlainTextTests < UnitTests
|
79
76
|
desc "with text data"
|
80
77
|
before do
|
81
78
|
@data = "stuff & <em>more stuff</em>"
|
@@ -90,9 +87,7 @@ class Undies::Template
|
|
90
87
|
|
91
88
|
end
|
92
89
|
|
93
|
-
|
94
|
-
|
95
|
-
class CapturedElementTests < BasicTests
|
90
|
+
class CapturedElementTests < UnitTests
|
96
91
|
desc "using the captured element api methods"
|
97
92
|
|
98
93
|
should "capture `element` output as Raw output" do
|
@@ -118,9 +113,7 @@ class Undies::Template
|
|
118
113
|
|
119
114
|
end
|
120
115
|
|
121
|
-
|
122
|
-
|
123
|
-
class StreamedElementTests < BasicTests
|
116
|
+
class StreamedElementTests < UnitTests
|
124
117
|
desc "using the streamed element api methods"
|
125
118
|
|
126
119
|
should "stream `element` output" do
|
@@ -150,9 +143,7 @@ class Undies::Template
|
|
150
143
|
|
151
144
|
end
|
152
145
|
|
153
|
-
|
154
|
-
|
155
|
-
class BuildAttrsTests < BasicTests
|
146
|
+
class BuildAttrsTests < UnitTests
|
156
147
|
|
157
148
|
should "modify attributes during a build using the __attrs method" do
|
158
149
|
subject.__element(:div)
|
@@ -209,9 +200,7 @@ class Undies::Template
|
|
209
200
|
|
210
201
|
end
|
211
202
|
|
212
|
-
|
213
|
-
|
214
|
-
class LocalDataTests < BasicTests
|
203
|
+
class LocalDataTests < UnitTests
|
215
204
|
|
216
205
|
should "accept a hash of data and apply them to the template scope as instance variables" do
|
217
206
|
t = Undies::Template.new(Undies::Source.new(Proc.new {}), {:some => 'data'}, @io)
|
@@ -220,9 +209,7 @@ class Undies::Template
|
|
220
209
|
|
221
210
|
end
|
222
211
|
|
223
|
-
|
224
|
-
|
225
|
-
class StreamTests < BasicTests
|
212
|
+
class StreamTests < UnitTests
|
226
213
|
desc "that is streaming"
|
227
214
|
|
228
215
|
before do
|
@@ -257,9 +244,7 @@ class Undies::Template
|
|
257
244
|
|
258
245
|
end
|
259
246
|
|
260
|
-
|
261
|
-
|
262
|
-
class PrettyPrintTests < BasicTests
|
247
|
+
class PrettyPrintTests < UnitTests
|
263
248
|
|
264
249
|
should "generate pretty printed markup" do
|
265
250
|
output = Undies::IO.new(@out = "", :pp => 2)
|
@@ -287,7 +272,4 @@ class Undies::Template
|
|
287
272
|
|
288
273
|
end
|
289
274
|
|
290
|
-
|
291
|
-
|
292
275
|
end
|
293
|
-
|
data/undies.gemspec
CHANGED
@@ -1,25 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
require "undies/version"
|
4
5
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "undies"
|
8
|
+
gem.version = Undies::VERSION
|
9
|
+
gem.authors = ["Kelly Redding"]
|
10
|
+
gem.email = ["kelly@kellyredding.com"]
|
11
|
+
gem.description = %q{A pure-Ruby DSL for streaming templated HTML, XML, or plain text.}
|
12
|
+
gem.summary = %q{A pure-Ruby DSL for streaming templated HTML, XML, or plain text.}
|
13
|
+
gem.homepage = "http://github.com/kellyredding/undies"
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
19
20
|
|
20
|
-
|
21
|
-
s.add_development_dependency("assert", ["~> 0.7.3"])
|
22
|
-
s.add_development_dependency("assert-view", ["~> 0.6"])
|
23
|
-
s.add_development_dependency("whysoslow", ["~> 0.0"])
|
21
|
+
gem.add_development_dependency("assert")
|
24
22
|
|
25
23
|
end
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: undies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
|
11
|
-
- 3
|
12
|
-
version: 3.0.0.rc.3
|
10
|
+
version: 3.0.0
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Kelly Redding
|
@@ -17,72 +15,25 @@ autorequire:
|
|
17
15
|
bindir: bin
|
18
16
|
cert_chain: []
|
19
17
|
|
20
|
-
date:
|
18
|
+
date: 2013-07-20 00:00:00 Z
|
21
19
|
dependencies:
|
22
20
|
- !ruby/object:Gem::Dependency
|
23
|
-
type: :development
|
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
|
-
- 0
|
33
|
-
version: "1.0"
|
34
|
-
name: bundler
|
35
|
-
version_requirements: *id001
|
36
|
-
prerelease: false
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
type: :development
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 5
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 7
|
48
|
-
- 3
|
49
|
-
version: 0.7.3
|
50
21
|
name: assert
|
51
|
-
version_requirements: *id002
|
52
22
|
prerelease: false
|
53
|
-
|
54
|
-
type: :development
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
56
24
|
none: false
|
57
25
|
requirements:
|
58
|
-
- -
|
26
|
+
- - ">="
|
59
27
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
28
|
+
hash: 3
|
61
29
|
segments:
|
62
30
|
- 0
|
63
|
-
|
64
|
-
version: "0.6"
|
65
|
-
name: assert-view
|
66
|
-
version_requirements: *id003
|
67
|
-
prerelease: false
|
68
|
-
- !ruby/object:Gem::Dependency
|
31
|
+
version: "0"
|
69
32
|
type: :development
|
70
|
-
|
71
|
-
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 11
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
- 0
|
79
|
-
version: "0.0"
|
80
|
-
name: whysoslow
|
81
|
-
version_requirements: *id004
|
82
|
-
prerelease: false
|
83
|
-
description: A pure-Ruby DSL for streaming templated HTML, XML, or plain text. Named for its gratuitous use of the underscore.
|
33
|
+
version_requirements: *id001
|
34
|
+
description: A pure-Ruby DSL for streaming templated HTML, XML, or plain text.
|
84
35
|
email:
|
85
|
-
- kelly@
|
36
|
+
- kelly@kellyredding.com
|
86
37
|
executables: []
|
87
38
|
|
88
39
|
extensions: []
|
@@ -93,8 +44,7 @@ files:
|
|
93
44
|
- .gitignore
|
94
45
|
- ARCH.md
|
95
46
|
- Gemfile
|
96
|
-
-
|
97
|
-
- LICENSE
|
47
|
+
- LICENSE.txt
|
98
48
|
- README.md
|
99
49
|
- Rakefile
|
100
50
|
- bench/bench
|
@@ -116,34 +66,34 @@ files:
|
|
116
66
|
- lib/undies/element.rb
|
117
67
|
- lib/undies/element_node.rb
|
118
68
|
- lib/undies/io.rb
|
69
|
+
- lib/undies/raw.rb
|
119
70
|
- lib/undies/root_node.rb
|
120
71
|
- lib/undies/source.rb
|
121
72
|
- lib/undies/template.rb
|
122
73
|
- lib/undies/version.rb
|
123
|
-
- test/element_closed_test.rb
|
124
|
-
- test/element_node_test.rb
|
125
|
-
- test/element_open_test.rb
|
126
|
-
- test/element_test.rb
|
127
|
-
- test/fixtures/write_thing.rb
|
128
74
|
- test/helper.rb
|
129
|
-
- test/
|
130
|
-
- test/
|
131
|
-
- test/
|
132
|
-
- test/
|
133
|
-
- test/
|
134
|
-
- test/
|
135
|
-
- test/
|
136
|
-
- test/
|
137
|
-
- test/
|
138
|
-
- test/
|
139
|
-
- test/
|
140
|
-
- test/
|
141
|
-
- test/
|
142
|
-
- test/
|
75
|
+
- test/support/element.rb
|
76
|
+
- test/support/templates/content.html.rb
|
77
|
+
- test/support/templates/index.html.rb
|
78
|
+
- test/support/templates/layout.html.rb
|
79
|
+
- test/support/templates/test.html.rb
|
80
|
+
- test/unit/element_closed_tests.rb
|
81
|
+
- test/unit/element_node_tests.rb
|
82
|
+
- test/unit/element_open_tests.rb
|
83
|
+
- test/unit/element_tests.rb
|
84
|
+
- test/unit/io_tests.rb
|
85
|
+
- test/unit/named_source_tests.rb
|
86
|
+
- test/unit/raw_tests.rb
|
87
|
+
- test/unit/root_node_tests.rb
|
88
|
+
- test/unit/source_stack_tests.rb
|
89
|
+
- test/unit/source_tests.rb
|
90
|
+
- test/unit/template_builder_render_tests.rb
|
91
|
+
- test/unit/template_source_render_tests.rb
|
92
|
+
- test/unit/template_tests.rb
|
143
93
|
- undies.gemspec
|
144
|
-
homepage: http://github.com/
|
145
|
-
licenses:
|
146
|
-
|
94
|
+
homepage: http://github.com/kellyredding/undies
|
95
|
+
licenses:
|
96
|
+
- MIT
|
147
97
|
post_install_message:
|
148
98
|
rdoc_options: []
|
149
99
|
|
@@ -161,39 +111,36 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
112
|
none: false
|
163
113
|
requirements:
|
164
|
-
- - "
|
114
|
+
- - ">="
|
165
115
|
- !ruby/object:Gem::Version
|
166
|
-
hash:
|
116
|
+
hash: 3
|
167
117
|
segments:
|
168
|
-
-
|
169
|
-
|
170
|
-
- 1
|
171
|
-
version: 1.3.1
|
118
|
+
- 0
|
119
|
+
version: "0"
|
172
120
|
requirements: []
|
173
121
|
|
174
122
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
123
|
+
rubygems_version: 1.8.24
|
176
124
|
signing_key:
|
177
125
|
specification_version: 3
|
178
|
-
summary: A pure-Ruby DSL for streaming templated HTML, XML, or plain text.
|
126
|
+
summary: A pure-Ruby DSL for streaming templated HTML, XML, or plain text.
|
179
127
|
test_files:
|
180
|
-
- test/element_closed_test.rb
|
181
|
-
- test/element_node_test.rb
|
182
|
-
- test/element_open_test.rb
|
183
|
-
- test/element_test.rb
|
184
|
-
- test/fixtures/write_thing.rb
|
185
128
|
- test/helper.rb
|
186
|
-
- test/
|
187
|
-
- test/
|
188
|
-
- test/
|
189
|
-
- test/
|
190
|
-
- test/
|
191
|
-
- test/
|
192
|
-
- test/
|
193
|
-
- test/
|
194
|
-
- test/
|
195
|
-
- test/
|
196
|
-
- test/
|
197
|
-
- test/
|
198
|
-
- test/
|
199
|
-
- test/
|
129
|
+
- test/support/element.rb
|
130
|
+
- test/support/templates/content.html.rb
|
131
|
+
- test/support/templates/index.html.rb
|
132
|
+
- test/support/templates/layout.html.rb
|
133
|
+
- test/support/templates/test.html.rb
|
134
|
+
- test/unit/element_closed_tests.rb
|
135
|
+
- test/unit/element_node_tests.rb
|
136
|
+
- test/unit/element_open_tests.rb
|
137
|
+
- test/unit/element_tests.rb
|
138
|
+
- test/unit/io_tests.rb
|
139
|
+
- test/unit/named_source_tests.rb
|
140
|
+
- test/unit/raw_tests.rb
|
141
|
+
- test/unit/root_node_tests.rb
|
142
|
+
- test/unit/source_stack_tests.rb
|
143
|
+
- test/unit/source_tests.rb
|
144
|
+
- test/unit/template_builder_render_tests.rb
|
145
|
+
- test/unit/template_source_render_tests.rb
|
146
|
+
- test/unit/template_tests.rb
|
data/Gemfile.lock
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
undies (3.0.0.rc.3)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ansi (1.4.2)
|
10
|
-
assert (0.7.3)
|
11
|
-
assert-view (~> 0.5)
|
12
|
-
assert-view (0.6.0)
|
13
|
-
ansi (~> 1.3)
|
14
|
-
builder (3.0.0)
|
15
|
-
erector (0.8.3)
|
16
|
-
rake
|
17
|
-
rake
|
18
|
-
treetop
|
19
|
-
treetop (>= 1.2.3)
|
20
|
-
erubis (2.7.0)
|
21
|
-
haml (3.1.4)
|
22
|
-
markaby (0.7.2)
|
23
|
-
builder (>= 2.0.0)
|
24
|
-
polyglot (0.3.3)
|
25
|
-
rake (0.9.2)
|
26
|
-
ruby-prof (0.10.8)
|
27
|
-
treetop (1.4.10)
|
28
|
-
polyglot
|
29
|
-
polyglot (>= 0.3.1)
|
30
|
-
whysoslow (0.0.2)
|
31
|
-
ansi (~> 1.4)
|
32
|
-
|
33
|
-
PLATFORMS
|
34
|
-
ruby
|
35
|
-
|
36
|
-
DEPENDENCIES
|
37
|
-
ansi
|
38
|
-
assert (~> 0.7.3)
|
39
|
-
assert-view (~> 0.6)
|
40
|
-
bundler (~> 1.0)
|
41
|
-
erector
|
42
|
-
erubis
|
43
|
-
haml
|
44
|
-
markaby
|
45
|
-
rake (~> 0.9.2)
|
46
|
-
ruby-prof
|
47
|
-
undies!
|
48
|
-
whysoslow (~> 0.0)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class WriteThing
|
2
|
-
|
3
|
-
# this is used in testing the write buffer
|
4
|
-
|
5
|
-
def __hi
|
6
|
-
'hi'
|
7
|
-
end
|
8
|
-
|
9
|
-
def __hello
|
10
|
-
'hello'
|
11
|
-
end
|
12
|
-
|
13
|
-
def __hithere
|
14
|
-
'hithere'
|
15
|
-
end
|
16
|
-
|
17
|
-
def __prefix(meth, level, indent)
|
18
|
-
"#{level > 0 ? "\n": ''}#{' '*level*indent}"
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|