inversion 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data.tar.gz.sig +2 -0
  2. data/.gemtest +0 -0
  3. data/ChangeLog +836 -0
  4. data/History.md +4 -0
  5. data/Manifest.txt +74 -0
  6. data/README.rdoc +171 -0
  7. data/Rakefile +55 -0
  8. data/bin/inversion +276 -0
  9. data/lib/inversion.rb +98 -0
  10. data/lib/inversion/exceptions.rb +21 -0
  11. data/lib/inversion/mixins.rb +236 -0
  12. data/lib/inversion/monkeypatches.rb +20 -0
  13. data/lib/inversion/renderstate.rb +337 -0
  14. data/lib/inversion/sinatra.rb +35 -0
  15. data/lib/inversion/template.rb +250 -0
  16. data/lib/inversion/template/attrtag.rb +120 -0
  17. data/lib/inversion/template/calltag.rb +16 -0
  18. data/lib/inversion/template/codetag.rb +164 -0
  19. data/lib/inversion/template/commenttag.rb +54 -0
  20. data/lib/inversion/template/conditionaltag.rb +49 -0
  21. data/lib/inversion/template/configtag.rb +60 -0
  22. data/lib/inversion/template/containertag.rb +45 -0
  23. data/lib/inversion/template/elsetag.rb +62 -0
  24. data/lib/inversion/template/elsiftag.rb +49 -0
  25. data/lib/inversion/template/endtag.rb +55 -0
  26. data/lib/inversion/template/escapetag.rb +26 -0
  27. data/lib/inversion/template/fortag.rb +120 -0
  28. data/lib/inversion/template/iftag.rb +69 -0
  29. data/lib/inversion/template/importtag.rb +70 -0
  30. data/lib/inversion/template/includetag.rb +51 -0
  31. data/lib/inversion/template/node.rb +102 -0
  32. data/lib/inversion/template/parser.rb +297 -0
  33. data/lib/inversion/template/pptag.rb +28 -0
  34. data/lib/inversion/template/publishtag.rb +72 -0
  35. data/lib/inversion/template/subscribetag.rb +88 -0
  36. data/lib/inversion/template/tag.rb +150 -0
  37. data/lib/inversion/template/textnode.rb +43 -0
  38. data/lib/inversion/template/unlesstag.rb +60 -0
  39. data/lib/inversion/template/uriencodetag.rb +30 -0
  40. data/lib/inversion/template/yieldtag.rb +51 -0
  41. data/lib/inversion/tilt.rb +82 -0
  42. data/lib/inversion/utils.rb +235 -0
  43. data/spec/data/sinatra/hello.inversion +1 -0
  44. data/spec/inversion/mixins_spec.rb +177 -0
  45. data/spec/inversion/monkeypatches_spec.rb +35 -0
  46. data/spec/inversion/renderstate_spec.rb +291 -0
  47. data/spec/inversion/sinatra_spec.rb +59 -0
  48. data/spec/inversion/template/attrtag_spec.rb +216 -0
  49. data/spec/inversion/template/calltag_spec.rb +30 -0
  50. data/spec/inversion/template/codetag_spec.rb +51 -0
  51. data/spec/inversion/template/commenttag_spec.rb +84 -0
  52. data/spec/inversion/template/configtag_spec.rb +105 -0
  53. data/spec/inversion/template/containertag_spec.rb +54 -0
  54. data/spec/inversion/template/elsetag_spec.rb +105 -0
  55. data/spec/inversion/template/elsiftag_spec.rb +87 -0
  56. data/spec/inversion/template/endtag_spec.rb +78 -0
  57. data/spec/inversion/template/escapetag_spec.rb +59 -0
  58. data/spec/inversion/template/fortag_spec.rb +98 -0
  59. data/spec/inversion/template/iftag_spec.rb +241 -0
  60. data/spec/inversion/template/importtag_spec.rb +106 -0
  61. data/spec/inversion/template/includetag_spec.rb +108 -0
  62. data/spec/inversion/template/node_spec.rb +81 -0
  63. data/spec/inversion/template/parser_spec.rb +170 -0
  64. data/spec/inversion/template/pptag_spec.rb +51 -0
  65. data/spec/inversion/template/publishtag_spec.rb +69 -0
  66. data/spec/inversion/template/subscribetag_spec.rb +60 -0
  67. data/spec/inversion/template/tag_spec.rb +97 -0
  68. data/spec/inversion/template/textnode_spec.rb +86 -0
  69. data/spec/inversion/template/unlesstag_spec.rb +84 -0
  70. data/spec/inversion/template/uriencodetag_spec.rb +49 -0
  71. data/spec/inversion/template/yieldtag_spec.rb +54 -0
  72. data/spec/inversion/template_spec.rb +269 -0
  73. data/spec/inversion/tilt_spec.rb +47 -0
  74. data/spec/inversion_spec.rb +95 -0
  75. data/spec/lib/constants.rb +9 -0
  76. data/spec/lib/helpers.rb +160 -0
  77. metadata +316 -0
  78. metadata.gz.sig +0 -0
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ ### A collection of constants used in testing
5
+ module Inversion::TestConstants # :nodoc:all
6
+
7
+ end # module Inversion::TestConstants
8
+
9
+
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/ruby
2
+ # coding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent
7
+
8
+ libdir = basedir + "lib"
9
+
10
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
11
+ }
12
+
13
+ # SimpleCov test coverage reporting; enable this using the :coverage rake task
14
+ if ENV['COVERAGE']
15
+ require 'simplecov'
16
+ SimpleCov.start do
17
+ add_filter 'spec'
18
+ add_group "Tags" do |file|
19
+ file.filename =~ /tag.rb$/
20
+ end
21
+ add_group "Needing tests" do |file|
22
+ file.covered_percent < 90
23
+ end
24
+ end
25
+ end
26
+
27
+ require 'rspec'
28
+
29
+ require 'inversion'
30
+ require 'spec/lib/constants'
31
+
32
+ ### IRb.start_session, courtesy of Joel VanderWerf in [ruby-talk:42437].
33
+ require 'irb'
34
+ require 'irb/completion'
35
+
36
+
37
+ module IRB # :nodoc:
38
+ def self.start_session( obj )
39
+ unless @__initialized
40
+ args = ARGV
41
+ ARGV.replace( ARGV.dup )
42
+ IRB.setup( nil )
43
+ ARGV.replace( args )
44
+ @__initialized = true
45
+ end
46
+
47
+ workspace = WorkSpace.new( obj )
48
+ irb = Irb.new( workspace )
49
+
50
+ @CONF[:IRB_RC].call( irb.context ) if @CONF[:IRB_RC]
51
+ @CONF[:MAIN_CONTEXT] = irb.context
52
+
53
+ begin
54
+ prevhandler = Signal.trap( 'INT' ) do
55
+ irb.signal_handle
56
+ end
57
+
58
+ catch( :IRB_EXIT ) do
59
+ irb.eval_input
60
+ end
61
+ ensure
62
+ Signal.trap( 'INT', prevhandler )
63
+ end
64
+
65
+ end
66
+ end
67
+
68
+
69
+ ### RSpec helper functions.
70
+ module Inversion::SpecHelpers
71
+ include Inversion::TestConstants
72
+
73
+ class ArrayLogger
74
+ ### Create a new ArrayLogger that will append content to +array+.
75
+ def initialize( array )
76
+ @array = array
77
+ end
78
+
79
+ ### Write the specified +message+ to the array.
80
+ def write( message )
81
+ @array << message
82
+ end
83
+
84
+ ### No-op -- this is here just so Logger doesn't complain
85
+ def close; end
86
+
87
+ end # class ArrayLogger
88
+
89
+
90
+ unless defined?( LEVEL )
91
+ LEVEL = {
92
+ :debug => Logger::DEBUG,
93
+ :info => Logger::INFO,
94
+ :warn => Logger::WARN,
95
+ :error => Logger::ERROR,
96
+ :fatal => Logger::FATAL,
97
+ }
98
+ end
99
+
100
+ ###############
101
+ module_function
102
+ ###############
103
+
104
+ ### Make an easily-comparable version vector out of +ver+ and return it.
105
+ def vvec( ver )
106
+ return ver.split('.').collect {|char| char.to_i }.pack('N*')
107
+ end
108
+
109
+
110
+ ### Reset the logging subsystem to its default state.
111
+ def reset_logging
112
+ Inversion.reset_logger
113
+ end
114
+
115
+
116
+ ### Alter the output of the default log formatter to be pretty in SpecMate output
117
+ def setup_logging( level=Logger::FATAL )
118
+
119
+ # Turn symbol-style level config into Logger's expected Fixnum level
120
+ if Inversion::LOG_LEVELS.key?( level.to_s )
121
+ level = Inversion::LOG_LEVELS[ level.to_s ]
122
+ end
123
+
124
+ logger = Logger.new( $stderr )
125
+ Inversion.logger = logger
126
+ Inversion.logger.level = level
127
+
128
+ # Only do this when executing from a spec in TextMate
129
+ if ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
130
+ Thread.current['logger-output'] = []
131
+ logdevice = ArrayLogger.new( Thread.current['logger-output'] )
132
+ Inversion.logger = Logger.new( logdevice )
133
+ # Inversion.logger.level = level
134
+ Inversion.logger.formatter = Inversion::HtmlLogFormatter.new( logger )
135
+ end
136
+ end
137
+
138
+
139
+ ### Create a string containing an XML Processing Instruction with the given +name+
140
+ ### and +data+.
141
+ def create_pi( name, data )
142
+ return "<?#{name} #{data} ?>"
143
+ end
144
+
145
+
146
+ end
147
+
148
+
149
+ ### Mock with RSpec
150
+ RSpec.configure do |c|
151
+ include Inversion::TestConstants
152
+
153
+ c.mock_with :rspec
154
+ c.include( Inversion::SpecHelpers )
155
+ c.filter_run_excluding( :ruby_1_9_only => true ) if
156
+ Inversion::SpecHelpers.vvec( RUBY_VERSION ) < Inversion::SpecHelpers.vvec('1.9.0')
157
+ end
158
+
159
+ # vim: set nosta noet ts=4 sw=4:
160
+
metadata ADDED
@@ -0,0 +1,316 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inversion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Granger
9
+ - Mahlon E. Smith
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain:
13
+ - ! '-----BEGIN CERTIFICATE-----
14
+
15
+ MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
16
+
17
+ FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
18
+
19
+ DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
20
+
21
+ FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
22
+
23
+ DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
24
+
25
+ h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
26
+
27
+ vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
28
+
29
+ KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
30
+
31
+ BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
32
+
33
+ TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
34
+
35
+ AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
36
+
37
+ +saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
38
+
39
+ vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
40
+
41
+ HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
42
+
43
+ aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
44
+
45
+ U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
46
+
47
+ cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
48
+
49
+ -----END CERTIFICATE-----
50
+
51
+ '
52
+ date: 2011-08-15 00:00:00.000000000Z
53
+ dependencies:
54
+ - !ruby/object:Gem::Dependency
55
+ name: hoe-mercurial
56
+ requirement: &70158657785360 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: *70158657785360
65
+ - !ruby/object:Gem::Dependency
66
+ name: hoe-manualgen
67
+ requirement: &70158657784900 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: 0.2.0
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: *70158657784900
76
+ - !ruby/object:Gem::Dependency
77
+ name: hoe-highline
78
+ requirement: &70158657784480 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 0.0.1
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: *70158657784480
87
+ - !ruby/object:Gem::Dependency
88
+ name: rspec
89
+ requirement: &70158657784020 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 2.6.0
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: *70158657784020
98
+ - !ruby/object:Gem::Dependency
99
+ name: tilt
100
+ requirement: &70158657783600 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ~>
104
+ - !ruby/object:Gem::Version
105
+ version: 1.3.2
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: *70158657783600
109
+ - !ruby/object:Gem::Dependency
110
+ name: sinatra
111
+ requirement: &70158657783180 !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: 1.2.6
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: *70158657783180
120
+ - !ruby/object:Gem::Dependency
121
+ name: rack-test
122
+ requirement: &70158657782760 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: 0.6.0
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: *70158657782760
131
+ - !ruby/object:Gem::Dependency
132
+ name: simplecov
133
+ requirement: &70158657782340 !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 0.4.2
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: *70158657782340
142
+ - !ruby/object:Gem::Dependency
143
+ name: hoe-manualgen
144
+ requirement: &70158657781920 !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 0.2.0
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: *70158657781920
153
+ - !ruby/object:Gem::Dependency
154
+ name: trollop
155
+ requirement: &70158657781500 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ~>
159
+ - !ruby/object:Gem::Version
160
+ version: 0.16.2
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: *70158657781500
164
+ - !ruby/object:Gem::Dependency
165
+ name: highline
166
+ requirement: &70158657781060 !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ~>
170
+ - !ruby/object:Gem::Version
171
+ version: 1.6.2
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: *70158657781060
175
+ - !ruby/object:Gem::Dependency
176
+ name: sysexits
177
+ requirement: &70158657780640 !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ~>
181
+ - !ruby/object:Gem::Version
182
+ version: 1.0.2
183
+ type: :development
184
+ prerelease: false
185
+ version_requirements: *70158657780640
186
+ - !ruby/object:Gem::Dependency
187
+ name: hoe
188
+ requirement: &70158657780220 !ruby/object:Gem::Requirement
189
+ none: false
190
+ requirements:
191
+ - - ~>
192
+ - !ruby/object:Gem::Version
193
+ version: '2.10'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: *70158657780220
197
+ description: ! 'Inversion is a templating system for Ruby. It uses the "Inversion
198
+ of Control" principle to decouple
199
+
200
+ the contents and structure of the template from the code that uses it, making it
201
+ easier to use,
202
+
203
+ test-friendly, and clean.'
204
+ email:
205
+ - ged@FaerieMUD.org
206
+ - mahlon@martini.nu
207
+ executables:
208
+ - inversion
209
+ extensions: []
210
+ extra_rdoc_files:
211
+ - Manifest.txt
212
+ - README.rdoc
213
+ files:
214
+ - ChangeLog
215
+ - History.md
216
+ - Manifest.txt
217
+ - README.rdoc
218
+ - Rakefile
219
+ - bin/inversion
220
+ - lib/inversion.rb
221
+ - lib/inversion/exceptions.rb
222
+ - lib/inversion/mixins.rb
223
+ - lib/inversion/monkeypatches.rb
224
+ - lib/inversion/renderstate.rb
225
+ - lib/inversion/sinatra.rb
226
+ - lib/inversion/template.rb
227
+ - lib/inversion/template/attrtag.rb
228
+ - lib/inversion/template/calltag.rb
229
+ - lib/inversion/template/codetag.rb
230
+ - lib/inversion/template/commenttag.rb
231
+ - lib/inversion/template/conditionaltag.rb
232
+ - lib/inversion/template/configtag.rb
233
+ - lib/inversion/template/containertag.rb
234
+ - lib/inversion/template/elsetag.rb
235
+ - lib/inversion/template/elsiftag.rb
236
+ - lib/inversion/template/endtag.rb
237
+ - lib/inversion/template/escapetag.rb
238
+ - lib/inversion/template/fortag.rb
239
+ - lib/inversion/template/iftag.rb
240
+ - lib/inversion/template/importtag.rb
241
+ - lib/inversion/template/includetag.rb
242
+ - lib/inversion/template/node.rb
243
+ - lib/inversion/template/parser.rb
244
+ - lib/inversion/template/pptag.rb
245
+ - lib/inversion/template/publishtag.rb
246
+ - lib/inversion/template/subscribetag.rb
247
+ - lib/inversion/template/tag.rb
248
+ - lib/inversion/template/textnode.rb
249
+ - lib/inversion/template/unlesstag.rb
250
+ - lib/inversion/template/uriencodetag.rb
251
+ - lib/inversion/template/yieldtag.rb
252
+ - lib/inversion/tilt.rb
253
+ - lib/inversion/utils.rb
254
+ - spec/data/sinatra/hello.inversion
255
+ - spec/inversion/mixins_spec.rb
256
+ - spec/inversion/monkeypatches_spec.rb
257
+ - spec/inversion/renderstate_spec.rb
258
+ - spec/inversion/sinatra_spec.rb
259
+ - spec/inversion/template/attrtag_spec.rb
260
+ - spec/inversion/template/calltag_spec.rb
261
+ - spec/inversion/template/codetag_spec.rb
262
+ - spec/inversion/template/commenttag_spec.rb
263
+ - spec/inversion/template/configtag_spec.rb
264
+ - spec/inversion/template/containertag_spec.rb
265
+ - spec/inversion/template/elsetag_spec.rb
266
+ - spec/inversion/template/elsiftag_spec.rb
267
+ - spec/inversion/template/endtag_spec.rb
268
+ - spec/inversion/template/escapetag_spec.rb
269
+ - spec/inversion/template/fortag_spec.rb
270
+ - spec/inversion/template/iftag_spec.rb
271
+ - spec/inversion/template/importtag_spec.rb
272
+ - spec/inversion/template/includetag_spec.rb
273
+ - spec/inversion/template/node_spec.rb
274
+ - spec/inversion/template/parser_spec.rb
275
+ - spec/inversion/template/pptag_spec.rb
276
+ - spec/inversion/template/publishtag_spec.rb
277
+ - spec/inversion/template/subscribetag_spec.rb
278
+ - spec/inversion/template/tag_spec.rb
279
+ - spec/inversion/template/textnode_spec.rb
280
+ - spec/inversion/template/unlesstag_spec.rb
281
+ - spec/inversion/template/uriencodetag_spec.rb
282
+ - spec/inversion/template/yieldtag_spec.rb
283
+ - spec/inversion/template_spec.rb
284
+ - spec/inversion/tilt_spec.rb
285
+ - spec/inversion_spec.rb
286
+ - spec/lib/constants.rb
287
+ - spec/lib/helpers.rb
288
+ - .gemtest
289
+ homepage: http://deveiate.org/projects/Inversion
290
+ licenses:
291
+ - BSD
292
+ post_install_message:
293
+ rdoc_options:
294
+ - --main
295
+ - README.rdoc
296
+ require_paths:
297
+ - lib
298
+ required_ruby_version: !ruby/object:Gem::Requirement
299
+ none: false
300
+ requirements:
301
+ - - ! '>='
302
+ - !ruby/object:Gem::Version
303
+ version: 1.9.2
304
+ required_rubygems_version: !ruby/object:Gem::Requirement
305
+ none: false
306
+ requirements:
307
+ - - ! '>='
308
+ - !ruby/object:Gem::Version
309
+ version: '0'
310
+ requirements: []
311
+ rubyforge_project: inversion
312
+ rubygems_version: 1.8.6
313
+ signing_key:
314
+ specification_version: 3
315
+ summary: Inversion is a templating system for Ruby
316
+ test_files: []