hsume2-state_machine 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/CHANGELOG.rdoc +413 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +717 -0
  4. data/Rakefile +77 -0
  5. data/examples/AutoShop_state.png +0 -0
  6. data/examples/Car_state.png +0 -0
  7. data/examples/TrafficLight_state.png +0 -0
  8. data/examples/Vehicle_state.png +0 -0
  9. data/examples/auto_shop.rb +11 -0
  10. data/examples/car.rb +19 -0
  11. data/examples/merb-rest/controller.rb +51 -0
  12. data/examples/merb-rest/model.rb +28 -0
  13. data/examples/merb-rest/view_edit.html.erb +24 -0
  14. data/examples/merb-rest/view_index.html.erb +23 -0
  15. data/examples/merb-rest/view_new.html.erb +13 -0
  16. data/examples/merb-rest/view_show.html.erb +17 -0
  17. data/examples/rails-rest/controller.rb +43 -0
  18. data/examples/rails-rest/migration.rb +11 -0
  19. data/examples/rails-rest/model.rb +23 -0
  20. data/examples/rails-rest/view_edit.html.erb +25 -0
  21. data/examples/rails-rest/view_index.html.erb +23 -0
  22. data/examples/rails-rest/view_new.html.erb +14 -0
  23. data/examples/rails-rest/view_show.html.erb +17 -0
  24. data/examples/traffic_light.rb +7 -0
  25. data/examples/vehicle.rb +31 -0
  26. data/init.rb +1 -0
  27. data/lib/state_machine.rb +448 -0
  28. data/lib/state_machine/alternate_machine.rb +79 -0
  29. data/lib/state_machine/assertions.rb +36 -0
  30. data/lib/state_machine/branch.rb +224 -0
  31. data/lib/state_machine/callback.rb +236 -0
  32. data/lib/state_machine/condition_proxy.rb +94 -0
  33. data/lib/state_machine/error.rb +13 -0
  34. data/lib/state_machine/eval_helpers.rb +86 -0
  35. data/lib/state_machine/event.rb +304 -0
  36. data/lib/state_machine/event_collection.rb +139 -0
  37. data/lib/state_machine/extensions.rb +149 -0
  38. data/lib/state_machine/initializers.rb +4 -0
  39. data/lib/state_machine/initializers/merb.rb +1 -0
  40. data/lib/state_machine/initializers/rails.rb +25 -0
  41. data/lib/state_machine/integrations.rb +110 -0
  42. data/lib/state_machine/integrations/active_model.rb +502 -0
  43. data/lib/state_machine/integrations/active_model/locale.rb +11 -0
  44. data/lib/state_machine/integrations/active_model/observer.rb +45 -0
  45. data/lib/state_machine/integrations/active_model/versions.rb +31 -0
  46. data/lib/state_machine/integrations/active_record.rb +424 -0
  47. data/lib/state_machine/integrations/active_record/locale.rb +20 -0
  48. data/lib/state_machine/integrations/active_record/versions.rb +143 -0
  49. data/lib/state_machine/integrations/base.rb +91 -0
  50. data/lib/state_machine/integrations/data_mapper.rb +392 -0
  51. data/lib/state_machine/integrations/data_mapper/observer.rb +210 -0
  52. data/lib/state_machine/integrations/data_mapper/versions.rb +62 -0
  53. data/lib/state_machine/integrations/mongo_mapper.rb +272 -0
  54. data/lib/state_machine/integrations/mongo_mapper/locale.rb +4 -0
  55. data/lib/state_machine/integrations/mongo_mapper/versions.rb +110 -0
  56. data/lib/state_machine/integrations/mongoid.rb +357 -0
  57. data/lib/state_machine/integrations/mongoid/locale.rb +4 -0
  58. data/lib/state_machine/integrations/mongoid/versions.rb +18 -0
  59. data/lib/state_machine/integrations/sequel.rb +428 -0
  60. data/lib/state_machine/integrations/sequel/versions.rb +36 -0
  61. data/lib/state_machine/machine.rb +1873 -0
  62. data/lib/state_machine/machine_collection.rb +87 -0
  63. data/lib/state_machine/matcher.rb +123 -0
  64. data/lib/state_machine/matcher_helpers.rb +54 -0
  65. data/lib/state_machine/node_collection.rb +157 -0
  66. data/lib/state_machine/path.rb +120 -0
  67. data/lib/state_machine/path_collection.rb +90 -0
  68. data/lib/state_machine/state.rb +271 -0
  69. data/lib/state_machine/state_collection.rb +112 -0
  70. data/lib/state_machine/transition.rb +458 -0
  71. data/lib/state_machine/transition_collection.rb +244 -0
  72. data/lib/tasks/state_machine.rake +1 -0
  73. data/lib/tasks/state_machine.rb +27 -0
  74. data/test/files/en.yml +17 -0
  75. data/test/files/switch.rb +11 -0
  76. data/test/functional/alternate_state_machine_test.rb +122 -0
  77. data/test/functional/state_machine_test.rb +993 -0
  78. data/test/test_helper.rb +4 -0
  79. data/test/unit/assertions_test.rb +40 -0
  80. data/test/unit/branch_test.rb +890 -0
  81. data/test/unit/callback_test.rb +701 -0
  82. data/test/unit/condition_proxy_test.rb +328 -0
  83. data/test/unit/error_test.rb +43 -0
  84. data/test/unit/eval_helpers_test.rb +222 -0
  85. data/test/unit/event_collection_test.rb +358 -0
  86. data/test/unit/event_test.rb +985 -0
  87. data/test/unit/integrations/active_model_test.rb +1097 -0
  88. data/test/unit/integrations/active_record_test.rb +2021 -0
  89. data/test/unit/integrations/base_test.rb +99 -0
  90. data/test/unit/integrations/data_mapper_test.rb +1909 -0
  91. data/test/unit/integrations/mongo_mapper_test.rb +1611 -0
  92. data/test/unit/integrations/mongoid_test.rb +1591 -0
  93. data/test/unit/integrations/sequel_test.rb +1523 -0
  94. data/test/unit/integrations_test.rb +61 -0
  95. data/test/unit/invalid_event_test.rb +20 -0
  96. data/test/unit/invalid_parallel_transition_test.rb +18 -0
  97. data/test/unit/invalid_transition_test.rb +77 -0
  98. data/test/unit/machine_collection_test.rb +599 -0
  99. data/test/unit/machine_test.rb +3043 -0
  100. data/test/unit/matcher_helpers_test.rb +37 -0
  101. data/test/unit/matcher_test.rb +155 -0
  102. data/test/unit/node_collection_test.rb +217 -0
  103. data/test/unit/path_collection_test.rb +266 -0
  104. data/test/unit/path_test.rb +485 -0
  105. data/test/unit/state_collection_test.rb +310 -0
  106. data/test/unit/state_machine_test.rb +31 -0
  107. data/test/unit/state_test.rb +924 -0
  108. data/test/unit/transition_collection_test.rb +2102 -0
  109. data/test/unit/transition_test.rb +1541 -0
  110. metadata +207 -0
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hsume2-state_machine
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 1
10
+ version: 1.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Aaron Pfeifer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-26 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Adds support for creating state machines for attributes on any Ruby class
23
+ email: aaron@pluginaweek.org
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - examples/auto_shop.rb
32
+ - examples/AutoShop_state.png
33
+ - examples/car.rb
34
+ - examples/Car_state.png
35
+ - examples/merb-rest/controller.rb
36
+ - examples/merb-rest/model.rb
37
+ - examples/merb-rest/view_edit.html.erb
38
+ - examples/merb-rest/view_index.html.erb
39
+ - examples/merb-rest/view_new.html.erb
40
+ - examples/merb-rest/view_show.html.erb
41
+ - examples/rails-rest/controller.rb
42
+ - examples/rails-rest/migration.rb
43
+ - examples/rails-rest/model.rb
44
+ - examples/rails-rest/view_edit.html.erb
45
+ - examples/rails-rest/view_index.html.erb
46
+ - examples/rails-rest/view_new.html.erb
47
+ - examples/rails-rest/view_show.html.erb
48
+ - examples/traffic_light.rb
49
+ - examples/TrafficLight_state.png
50
+ - examples/vehicle.rb
51
+ - examples/Vehicle_state.png
52
+ - lib/state_machine/alternate_machine.rb
53
+ - lib/state_machine/assertions.rb
54
+ - lib/state_machine/branch.rb
55
+ - lib/state_machine/callback.rb
56
+ - lib/state_machine/condition_proxy.rb
57
+ - lib/state_machine/error.rb
58
+ - lib/state_machine/eval_helpers.rb
59
+ - lib/state_machine/event.rb
60
+ - lib/state_machine/event_collection.rb
61
+ - lib/state_machine/extensions.rb
62
+ - lib/state_machine/initializers/merb.rb
63
+ - lib/state_machine/initializers/rails.rb
64
+ - lib/state_machine/initializers.rb
65
+ - lib/state_machine/integrations/active_model/locale.rb
66
+ - lib/state_machine/integrations/active_model/observer.rb
67
+ - lib/state_machine/integrations/active_model/versions.rb
68
+ - lib/state_machine/integrations/active_model.rb
69
+ - lib/state_machine/integrations/active_record/locale.rb
70
+ - lib/state_machine/integrations/active_record/versions.rb
71
+ - lib/state_machine/integrations/active_record.rb
72
+ - lib/state_machine/integrations/base.rb
73
+ - lib/state_machine/integrations/data_mapper/observer.rb
74
+ - lib/state_machine/integrations/data_mapper/versions.rb
75
+ - lib/state_machine/integrations/data_mapper.rb
76
+ - lib/state_machine/integrations/mongo_mapper/locale.rb
77
+ - lib/state_machine/integrations/mongo_mapper/versions.rb
78
+ - lib/state_machine/integrations/mongo_mapper.rb
79
+ - lib/state_machine/integrations/mongoid/locale.rb
80
+ - lib/state_machine/integrations/mongoid/versions.rb
81
+ - lib/state_machine/integrations/mongoid.rb
82
+ - lib/state_machine/integrations/sequel/versions.rb
83
+ - lib/state_machine/integrations/sequel.rb
84
+ - lib/state_machine/integrations.rb
85
+ - lib/state_machine/machine.rb
86
+ - lib/state_machine/machine_collection.rb
87
+ - lib/state_machine/matcher.rb
88
+ - lib/state_machine/matcher_helpers.rb
89
+ - lib/state_machine/node_collection.rb
90
+ - lib/state_machine/path.rb
91
+ - lib/state_machine/path_collection.rb
92
+ - lib/state_machine/state.rb
93
+ - lib/state_machine/state_collection.rb
94
+ - lib/state_machine/transition.rb
95
+ - lib/state_machine/transition_collection.rb
96
+ - lib/state_machine.rb
97
+ - lib/tasks/state_machine.rake
98
+ - lib/tasks/state_machine.rb
99
+ - test/files/en.yml
100
+ - test/files/switch.rb
101
+ - test/functional/alternate_state_machine_test.rb
102
+ - test/functional/state_machine_test.rb
103
+ - test/test_helper.rb
104
+ - test/unit/assertions_test.rb
105
+ - test/unit/branch_test.rb
106
+ - test/unit/callback_test.rb
107
+ - test/unit/condition_proxy_test.rb
108
+ - test/unit/error_test.rb
109
+ - test/unit/eval_helpers_test.rb
110
+ - test/unit/event_collection_test.rb
111
+ - test/unit/event_test.rb
112
+ - test/unit/integrations/active_model_test.rb
113
+ - test/unit/integrations/active_record_test.rb
114
+ - test/unit/integrations/base_test.rb
115
+ - test/unit/integrations/data_mapper_test.rb
116
+ - test/unit/integrations/mongo_mapper_test.rb
117
+ - test/unit/integrations/mongoid_test.rb
118
+ - test/unit/integrations/sequel_test.rb
119
+ - test/unit/integrations_test.rb
120
+ - test/unit/invalid_event_test.rb
121
+ - test/unit/invalid_parallel_transition_test.rb
122
+ - test/unit/invalid_transition_test.rb
123
+ - test/unit/machine_collection_test.rb
124
+ - test/unit/machine_test.rb
125
+ - test/unit/matcher_helpers_test.rb
126
+ - test/unit/matcher_test.rb
127
+ - test/unit/node_collection_test.rb
128
+ - test/unit/path_collection_test.rb
129
+ - test/unit/path_test.rb
130
+ - test/unit/state_collection_test.rb
131
+ - test/unit/state_machine_test.rb
132
+ - test/unit/state_test.rb
133
+ - test/unit/transition_collection_test.rb
134
+ - test/unit/transition_test.rb
135
+ - CHANGELOG.rdoc
136
+ - init.rb
137
+ - LICENSE
138
+ - Rakefile
139
+ - README.rdoc
140
+ has_rdoc: true
141
+ homepage: http://www.pluginaweek.org
142
+ licenses: []
143
+
144
+ post_install_message:
145
+ rdoc_options: []
146
+
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ hash: 3
155
+ segments:
156
+ - 0
157
+ version: "0"
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 3
164
+ segments:
165
+ - 0
166
+ version: "0"
167
+ requirements: []
168
+
169
+ rubyforge_project: pluginaweek
170
+ rubygems_version: 1.5.3
171
+ signing_key:
172
+ specification_version: 3
173
+ summary: Adds support for creating state machines for attributes on any Ruby class
174
+ test_files:
175
+ - test/functional/alternate_state_machine_test.rb
176
+ - test/functional/state_machine_test.rb
177
+ - test/unit/assertions_test.rb
178
+ - test/unit/branch_test.rb
179
+ - test/unit/callback_test.rb
180
+ - test/unit/condition_proxy_test.rb
181
+ - test/unit/error_test.rb
182
+ - test/unit/eval_helpers_test.rb
183
+ - test/unit/event_collection_test.rb
184
+ - test/unit/event_test.rb
185
+ - test/unit/integrations/active_model_test.rb
186
+ - test/unit/integrations/active_record_test.rb
187
+ - test/unit/integrations/base_test.rb
188
+ - test/unit/integrations/data_mapper_test.rb
189
+ - test/unit/integrations/mongo_mapper_test.rb
190
+ - test/unit/integrations/mongoid_test.rb
191
+ - test/unit/integrations/sequel_test.rb
192
+ - test/unit/integrations_test.rb
193
+ - test/unit/invalid_event_test.rb
194
+ - test/unit/invalid_parallel_transition_test.rb
195
+ - test/unit/invalid_transition_test.rb
196
+ - test/unit/machine_collection_test.rb
197
+ - test/unit/machine_test.rb
198
+ - test/unit/matcher_helpers_test.rb
199
+ - test/unit/matcher_test.rb
200
+ - test/unit/node_collection_test.rb
201
+ - test/unit/path_collection_test.rb
202
+ - test/unit/path_test.rb
203
+ - test/unit/state_collection_test.rb
204
+ - test/unit/state_machine_test.rb
205
+ - test/unit/state_test.rb
206
+ - test/unit/transition_collection_test.rb
207
+ - test/unit/transition_test.rb