fabulator 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/History.txt +20 -0
  2. data/Rakefile +1 -0
  3. data/VERSION +1 -1
  4. data/features/step_definitions/expression_steps.rb +1 -1
  5. data/features/step_definitions/xml_steps.rb +2 -1
  6. data/features/support/env.rb +1 -0
  7. data/lib/fabulator.rb +13 -5
  8. data/lib/fabulator/action.rb +86 -19
  9. data/lib/fabulator/core/actions.rb +21 -6
  10. data/lib/fabulator/core/actions/choose.rb +16 -35
  11. data/lib/fabulator/core/actions/for_each.rb +20 -30
  12. data/lib/fabulator/core/actions/variables.rb +6 -8
  13. data/lib/fabulator/core/constraint.rb +2 -2
  14. data/lib/fabulator/core/filter.rb +0 -13
  15. data/lib/fabulator/core/group.rb +21 -25
  16. data/lib/fabulator/core/parameter.rb +5 -17
  17. data/lib/fabulator/core/state.rb +4 -44
  18. data/lib/fabulator/core/state_machine.rb +10 -38
  19. data/lib/fabulator/core/transition.rb +6 -39
  20. data/lib/fabulator/expr/axis.rb +2 -2
  21. data/lib/fabulator/expr/bin_expr.rb +3 -3
  22. data/lib/fabulator/expr/context.rb +37 -6
  23. data/lib/fabulator/expr/function.rb +9 -3
  24. data/lib/fabulator/expr/literal.rb +1 -1
  25. data/lib/fabulator/expr/node.rb +1 -1
  26. data/lib/fabulator/expr/node_logic.rb +1 -1
  27. data/lib/fabulator/expr/parser.rb +1 -1
  28. data/lib/fabulator/expr/predicates.rb +1 -1
  29. data/lib/fabulator/expr/statement_list.rb +4 -0
  30. data/lib/fabulator/expr/union_expr.rb +1 -1
  31. data/lib/fabulator/lib.rb +69 -0
  32. data/lib/fabulator/lib/action.rb +13 -0
  33. data/lib/fabulator/lib/attribute.rb +9 -0
  34. data/lib/fabulator/lib/lib.rb +47 -0
  35. data/lib/fabulator/lib/structural.rb +13 -0
  36. data/lib/fabulator/structural.rb +92 -0
  37. data/lib/fabulator/{action_lib.rb → tag_lib.rb} +89 -51
  38. data/lib/fabulator/template/standard_tags.rb +4 -3
  39. data/xsm_expression_parser.racc +1 -1
  40. metadata +27 -8
  41. data/TODO +0 -7
  42. data/features/xsm-inheritance.feature +0 -46
@@ -31,7 +31,7 @@ module Fabulator::Template
31
31
  tag.locals.context = c.with_root(i)
32
32
  res = res + tag.expand
33
33
  end
34
- res
34
+ res.nil? ? '' : res
35
35
  end
36
36
 
37
37
  desc %{
@@ -46,7 +46,8 @@ module Fabulator::Template
46
46
  selection = tag.attr['select']
47
47
  c = tag.locals.context || tag.globals.context
48
48
  items = c.nil? ? [] : c.eval_expression(selection)
49
- items.collect{|i| i.to([Fabulator::FAB_NS, 'html']).value }.join('')
49
+ res = items.collect{|i| i.to([Fabulator::FAB_NS, 'html']).value }.join('')
50
+ res.nil? ? '' : res
50
51
  end
51
52
 
52
53
  desc %{
@@ -58,7 +59,7 @@ module Fabulator::Template
58
59
  @chosen.unshift false
59
60
  ret = tag.expand
60
61
  @chosen.shift
61
- ret
62
+ ret.nil? ? '' : ret
62
63
  end
63
64
 
64
65
  desc %{
@@ -223,7 +223,7 @@ end
223
223
  @@regex[:qname] = %r{((?:#{@@regex[:ncname]}:)?#{@@regex[:ncname]})}
224
224
  @@regex[:dollar_qname] = %r{\$#{@@regex[:qname]}}
225
225
  @@regex[:dollar_int] = %r{\$([0-9]+)}
226
- @@regex[:function_name] = %r{#{@@regex[:qname]}\*?\s*(?=\([^:])}
226
+ @@regex[:function_name] = %r{#{@@regex[:qname]}\??\*?\s*(?=\([^:])}
227
227
 
228
228
  @@ops = {
229
229
  '..' => :DOT_DOT,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabulator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-27 00:00:00 +00:00
18
+ date: 2010-09-07 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -82,6 +82,22 @@ dependencies:
82
82
  version: 4.2.0
83
83
  type: :runtime
84
84
  version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: activesupport
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 2
96
+ - 3
97
+ - 0
98
+ version: 2.3.0
99
+ type: :runtime
100
+ version_requirements: *id005
85
101
  description: The fabulator library provides a state machine implementation of a core set of semantics for building data-driven applications using a simple XML language coupled with an XQuery-like expression language.
86
102
  email: jgsmith@tamu.edu
87
103
  executables: []
@@ -90,7 +106,6 @@ extensions: []
90
106
 
91
107
  extra_rdoc_files:
92
108
  - README.rdoc
93
- - TODO
94
109
  files:
95
110
  - History.txt
96
111
  - Manifest.txt
@@ -111,11 +126,9 @@ files:
111
126
  - features/support/env.rb
112
127
  - features/templates.feature
113
128
  - features/types.feature
114
- - features/xsm-inheritance.feature
115
129
  - init.rb
116
130
  - lib/fabulator.rb
117
131
  - lib/fabulator/action.rb
118
- - lib/fabulator/action_lib.rb
119
132
  - lib/fabulator/context.rb
120
133
  - lib/fabulator/core.rb
121
134
  - lib/fabulator/core/actions.rb
@@ -149,6 +162,13 @@ files:
149
162
  - lib/fabulator/expr/step.rb
150
163
  - lib/fabulator/expr/unary_expr.rb
151
164
  - lib/fabulator/expr/union_expr.rb
165
+ - lib/fabulator/lib.rb
166
+ - lib/fabulator/lib/action.rb
167
+ - lib/fabulator/lib/attribute.rb
168
+ - lib/fabulator/lib/lib.rb
169
+ - lib/fabulator/lib/structural.rb
170
+ - lib/fabulator/structural.rb
171
+ - lib/fabulator/tag_lib.rb
152
172
  - lib/fabulator/template.rb
153
173
  - lib/fabulator/template/context.rb
154
174
  - lib/fabulator/template/parse_result.rb
@@ -160,7 +180,6 @@ files:
160
180
  - test/test_helper.rb
161
181
  - xslt/form.xsl
162
182
  - xsm_expression_parser.racc
163
- - TODO
164
183
  - test/cucumber.rb
165
184
  has_rdoc: true
166
185
  homepage: http://github.com/jgsmith/ruby-fabulator
data/TODO DELETED
@@ -1,7 +0,0 @@
1
- Consolidation:
2
-
3
- take a series of elements and combine them, preserving attributes
4
-
5
- how do we know which elements are identical?
6
-
7
- use eq on type?
@@ -1,46 +0,0 @@
1
- @isa
2
- Feature: IS-A State machine inheritance
3
-
4
- Scenario: simple machine with just one state and no transitions
5
- Given the statemachine
6
- """
7
- <f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#" />
8
- """
9
- And the statemachine
10
- """
11
- <f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#">
12
- <f:view f:name="start">
13
- <f:goes-to f:view="stop">
14
- <f:params>
15
- <f:param f:name="foo"/>
16
- </f:params>
17
- </f:goes-to>
18
- </f:view>
19
- <f:view f:name="stop" />
20
- </f:application>
21
- """
22
- Then it should be in the 'start' state
23
- When I run it with the following params:
24
- | key | value |
25
- | foo | bar |
26
- Then it should be in the 'stop' state
27
- And the expression (/foo) should equal ['bar']
28
- When I run it with the following params:
29
- | key | value |
30
- | foo | bar |
31
- Then it should be in the 'stop' state
32
- And the expression (/foo) should equal ['bar']
33
-
34
- Scenario: simple machine with just one state and no transitions
35
- Given the statemachine
36
- """
37
- <f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#">
38
- <f:value f:path="/foo" f:select="'bar'" />
39
- </f:application>
40
- """
41
- And the statemachine
42
- """
43
- <f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#"/>
44
- """
45
- Then it should be in the 'start' state
46
- And the expression (/foo) should equal ['bar']