controll 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +253 -93
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/controll.gemspec +121 -84
- data/lib/controll/assistant/param_assistant.rb +23 -0
- data/lib/controll/assistant/session_assistant.rb +23 -0
- data/lib/controll/assistant.rb +9 -7
- data/lib/controll/commander.rb +16 -3
- data/lib/controll/enabler/macros.rb +75 -0
- data/lib/controll/enabler/maps.rb +15 -0
- data/lib/controll/enabler/notify.rb +43 -0
- data/lib/controll/enabler/path_handler.rb +49 -0
- data/lib/controll/enabler/path_resolver.rb +47 -0
- data/lib/controll/enabler.rb +49 -0
- data/lib/controll/engine.rb +9 -0
- data/lib/controll/errors.rb +4 -1
- data/lib/controll/event/helper.rb +20 -0
- data/lib/controll/{helper/event_matcher.rb → event/matcher.rb} +3 -3
- data/lib/controll/event.rb +60 -0
- data/lib/controll/events.rb +48 -0
- data/lib/controll/executor/base.rb +3 -7
- data/lib/controll/executor/controlled.rb +36 -0
- data/lib/controll/executor/delegator.rb +6 -0
- data/lib/controll/executor.rb +8 -1
- data/lib/controll/flow/action/base.rb +30 -0
- data/lib/controll/flow/action/fallback.rb +25 -0
- data/lib/controll/flow/action/path_action.rb +24 -0
- data/lib/controll/flow/action.rb +7 -0
- data/lib/controll/flow/action_mapper/base.rb +13 -0
- data/lib/controll/flow/action_mapper/complex.rb +52 -0
- data/lib/controll/flow/action_mapper/simple.rb +54 -0
- data/lib/controll/flow/action_mapper.rb +7 -0
- data/lib/controll/flow/errors.rb +16 -0
- data/lib/controll/flow/event_mapper/path_finder.rb +36 -0
- data/lib/controll/flow/event_mapper/util.rb +43 -0
- data/lib/controll/flow/event_mapper.rb +6 -0
- data/lib/controll/flow/master/executor.rb +57 -0
- data/lib/controll/flow/master/macros.rb +66 -0
- data/lib/controll/flow/master.rb +70 -0
- data/lib/controll/flow.rb +15 -0
- data/lib/controll/focused/enabler.rb +31 -0
- data/lib/controll/helper.rb +0 -94
- data/lib/controll/macros.rb +12 -0
- data/lib/controll/notify/base.rb +22 -43
- data/lib/controll/notify/flash.rb +3 -3
- data/lib/controll/notify/macros.rb +57 -0
- data/lib/controll/notify/message/handler.rb +36 -0
- data/lib/controll/notify/message/resolver.rb +28 -0
- data/lib/controll/notify/message/translator.rb +45 -0
- data/lib/controll/notify/message.rb +25 -0
- data/lib/controll/notify/typed.rb +13 -22
- data/lib/controll/notify.rb +11 -4
- data/lib/controll.rb +8 -2
- data/lib/generators/controll/assistant_generator.rb +27 -0
- data/lib/generators/controll/executor_generator.rb +23 -0
- data/lib/generators/controll/flow_handler_generator.rb +21 -0
- data/lib/generators/controll/notifier_generator.rb +21 -0
- data/lib/generators/controll/setup_generator.rb +37 -0
- data/lib/generators/controll/templates/assistant.tt +10 -0
- data/lib/generators/controll/templates/commander.tt +15 -0
- data/lib/generators/controll/templates/executor.tt +14 -0
- data/lib/generators/controll/templates/flow_handler.tt +26 -0
- data/lib/generators/controll/templates/notifier.tt +31 -0
- data/spec/acceptance/app_test.rb +1 -1
- data/spec/controll/assistant/param_assistant_spec.rb +31 -0
- data/spec/controll/assistant/session_assistant_spec.rb +31 -0
- data/spec/controll/assistant_spec.rb +26 -0
- data/spec/controll/command_spec.rb +4 -4
- data/spec/controll/enabler/macros_spec.rb +76 -0
- data/spec/controll/enabler/maps_spec.rb +31 -0
- data/spec/controll/{helper → enabler}/notify_spec.rb +7 -17
- data/spec/controll/enabler/path_handler_spec.rb +24 -0
- data/spec/controll/enabler/path_resolver_spec.rb +87 -0
- data/spec/controll/enabler_spec.rb +30 -0
- data/spec/controll/event/helper_spec.rb +33 -0
- data/spec/controll/{helper/event_matcher_spec.rb → event/matcher_spec.rb} +4 -3
- data/spec/controll/event_spec.rb +66 -0
- data/spec/controll/events_spec.rb +23 -0
- data/spec/controll/executor/controlled_spec.rb +36 -0
- data/spec/controll/executor/{notificator_spec.rb → delegator_spec.rb} +4 -4
- data/spec/controll/flow/action_mapper/complex_spec.rb +102 -0
- data/spec/controll/flow/action_mapper/fallback_spec.rb +34 -0
- data/spec/controll/{flow_handler/render_spec.rb → flow/action_mapper/simple_spec.rb} +25 -22
- data/spec/controll/{flow_handler/redirect/action_spec.rb → flow/event_mapper/path_finder_spec.rb} +10 -10
- data/spec/controll/{flow_handler/redirect/mapper_spec.rb → flow/event_mapper/util_spec.rb} +9 -9
- data/spec/controll/flow/master/executor_spec.rb +56 -0
- data/spec/{app/app/models/.gitkeep → controll/flow/master/macros_spec.rb} +0 -0
- data/spec/controll/flow/master_spec.rb +157 -0
- data/spec/controll/notify/base_spec.rb +6 -12
- data/spec/controll/notify/message/handler_spec.rb +27 -0
- data/spec/controll/notify/message/resolver_spec.rb +53 -0
- data/spec/controll/notify/message/translator_spec.rb +46 -0
- data/spec/controll/notify/message_spec.rb +4 -0
- data/spec/controll/notify/{message_handler.rb → services_notifier.rb} +3 -5
- data/spec/controll/notify/typed_spec.rb +2 -2
- data/spec/{app → controll_app}/.gitignore +0 -0
- data/spec/{app → controll_app}/Gemfile +0 -0
- data/spec/{app → controll_app}/Gemfile.lock +0 -0
- data/spec/{app → controll_app}/README.rdoc +0 -0
- data/spec/{app → controll_app}/Rakefile +0 -0
- data/spec/controll_app/app/controll/commanders/services_commander.rb +5 -0
- data/spec/controll_app/app/controll/executors/services_executor.rb +4 -0
- data/spec/controll_app/app/controll/flows/create_services.rb +9 -0
- data/spec/controll_app/app/controll/notifiers/services_notifier.rb +9 -0
- data/spec/{app → controll_app}/app/controllers/application_controller.rb +0 -1
- data/spec/controll_app/app/controllers/services_controller.rb +8 -0
- data/spec/{app/lib/assets → controll_app/app/models}/.gitkeep +0 -0
- data/spec/{app → controll_app}/app/models/post.rb +0 -0
- data/spec/{app → controll_app}/app/views/layouts/application.html.erb +0 -0
- data/spec/{app → controll_app}/app/views/posts/_form.html.erb +0 -0
- data/spec/{app → controll_app}/app/views/posts/edit.html.erb +0 -0
- data/spec/{app → controll_app}/app/views/posts/index.html.erb +0 -0
- data/spec/{app → controll_app}/app/views/posts/new.html.erb +0 -0
- data/spec/{app → controll_app}/app/views/posts/show.html.erb +0 -0
- data/spec/{app → controll_app}/config/application.rb +1 -1
- data/spec/{app → controll_app}/config/boot.rb +0 -0
- data/spec/{app → controll_app}/config/environment.rb +0 -0
- data/spec/{app → controll_app}/config/environments/development.rb +0 -0
- data/spec/{app → controll_app}/config/environments/test.rb +0 -0
- data/spec/{app → controll_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{app → controll_app}/config/initializers/inflections.rb +0 -0
- data/spec/{app → controll_app}/config/initializers/mime_types.rb +0 -0
- data/spec/{app → controll_app}/config/initializers/secret_token.rb +0 -0
- data/spec/{app → controll_app}/config/initializers/session_store.rb +0 -0
- data/spec/{app → controll_app}/config/locales/en.yml +0 -0
- data/spec/controll_app/config/routes.rb +5 -0
- data/spec/{app → controll_app}/config.ru +0 -0
- data/spec/{app → controll_app}/db/seeds.rb +0 -0
- data/spec/{app/lib/tasks → controll_app/log}/.gitkeep +0 -0
- data/spec/{app → controll_app}/public/404.html +0 -0
- data/spec/{app → controll_app}/public/422.html +0 -0
- data/spec/{app → controll_app}/public/500.html +0 -0
- data/spec/{app → controll_app}/public/favicon.ico +0 -0
- data/spec/{app → controll_app}/public/index.html +0 -0
- data/spec/{app → controll_app}/public/javascripts/application.js +0 -0
- data/spec/{app → controll_app}/public/robots.txt +0 -0
- data/spec/{app → controll_app}/public/stylesheets/application.css +0 -0
- metadata +122 -85
- data/lib/controll/executor/notificator.rb +0 -12
- data/lib/controll/flow_handler/base.rb +0 -19
- data/lib/controll/flow_handler/control.rb +0 -85
- data/lib/controll/flow_handler/errors.rb +0 -5
- data/lib/controll/flow_handler/event_helper.rb +0 -18
- data/lib/controll/flow_handler/redirect/action.rb +0 -45
- data/lib/controll/flow_handler/redirect/mapper.rb +0 -41
- data/lib/controll/flow_handler/redirect.rb +0 -51
- data/lib/controll/flow_handler/render.rb +0 -51
- data/lib/controll/flow_handler.rb +0 -11
- data/lib/controll/helper/notify.rb +0 -74
- data/lib/controll/helper/path_resolver.rb +0 -45
- data/spec/app/app/controllers/posts_controller.rb +0 -52
- data/spec/app/config/routes.rb +0 -62
- data/spec/app/log/.gitkeep +0 -0
- data/spec/app/script/rails +0 -6
- data/spec/app/spec/controllers/posts_controller_spec.rb +0 -59
- data/spec/app/spec/isolated_spec_helper.rb +0 -6
- data/spec/app/spec/spec_helper.rb +0 -5
- data/spec/app/spec/unit/controllers/posts_controller_isolated_spec.rb +0 -63
- data/spec/app/spec/unit/controllers/posts_controller_spec.rb +0 -59
- data/spec/app/test/functional/.gitkeep +0 -0
- data/spec/app/test/functional/posts_controller_test.rb +0 -67
- data/spec/app/test/isolated_test_helper.rb +0 -7
- data/spec/app/test/test_helper.rb +0 -6
- data/spec/app/test/unit/.gitkeep +0 -0
- data/spec/app/test/unit/controllers/posts_controller_isolated_test.rb +0 -71
- data/spec/app/test/unit/controllers/posts_controller_test.rb +0 -67
- data/spec/app/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/app/vendor/plugins/.gitkeep +0 -0
- data/spec/controll/asssistant_spec.rb +0 -5
- data/spec/controll/flow_handler/control_spec.rb +0 -159
- data/spec/controll/flow_handler/redirect_spec.rb +0 -93
- data/spec/controll/helper/path_resolver_spec.rb +0 -49
- data/spec/controll/helper_spec.rb +0 -108
data/controll.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "controll"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = "2012-
|
13
|
-
s.description = "
|
12
|
+
s.date = "2012-09-17"
|
13
|
+
s.description = "Flow, Executor, Notifier and more, all tied together tool pack"
|
14
14
|
s.email = "kmandrup@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
@@ -28,109 +28,146 @@ Gem::Specification.new do |s|
|
|
28
28
|
"controll.gemspec",
|
29
29
|
"lib/controll.rb",
|
30
30
|
"lib/controll/assistant.rb",
|
31
|
+
"lib/controll/assistant/param_assistant.rb",
|
32
|
+
"lib/controll/assistant/session_assistant.rb",
|
31
33
|
"lib/controll/command.rb",
|
32
34
|
"lib/controll/commander.rb",
|
35
|
+
"lib/controll/enabler.rb",
|
36
|
+
"lib/controll/enabler/macros.rb",
|
37
|
+
"lib/controll/enabler/maps.rb",
|
38
|
+
"lib/controll/enabler/notify.rb",
|
39
|
+
"lib/controll/enabler/path_handler.rb",
|
40
|
+
"lib/controll/enabler/path_resolver.rb",
|
41
|
+
"lib/controll/engine.rb",
|
33
42
|
"lib/controll/errors.rb",
|
43
|
+
"lib/controll/event.rb",
|
44
|
+
"lib/controll/event/helper.rb",
|
45
|
+
"lib/controll/event/matcher.rb",
|
46
|
+
"lib/controll/events.rb",
|
34
47
|
"lib/controll/executor.rb",
|
35
48
|
"lib/controll/executor/base.rb",
|
36
|
-
"lib/controll/executor/
|
37
|
-
"lib/controll/
|
38
|
-
"lib/controll/
|
39
|
-
"lib/controll/
|
40
|
-
"lib/controll/
|
41
|
-
"lib/controll/
|
42
|
-
"lib/controll/
|
43
|
-
"lib/controll/
|
44
|
-
"lib/controll/
|
45
|
-
"lib/controll/
|
49
|
+
"lib/controll/executor/controlled.rb",
|
50
|
+
"lib/controll/executor/delegator.rb",
|
51
|
+
"lib/controll/flow.rb",
|
52
|
+
"lib/controll/flow/action.rb",
|
53
|
+
"lib/controll/flow/action/base.rb",
|
54
|
+
"lib/controll/flow/action/fallback.rb",
|
55
|
+
"lib/controll/flow/action/path_action.rb",
|
56
|
+
"lib/controll/flow/action_mapper.rb",
|
57
|
+
"lib/controll/flow/action_mapper/base.rb",
|
58
|
+
"lib/controll/flow/action_mapper/complex.rb",
|
59
|
+
"lib/controll/flow/action_mapper/simple.rb",
|
60
|
+
"lib/controll/flow/errors.rb",
|
61
|
+
"lib/controll/flow/event_mapper.rb",
|
62
|
+
"lib/controll/flow/event_mapper/path_finder.rb",
|
63
|
+
"lib/controll/flow/event_mapper/util.rb",
|
64
|
+
"lib/controll/flow/master.rb",
|
65
|
+
"lib/controll/flow/master/executor.rb",
|
66
|
+
"lib/controll/flow/master/macros.rb",
|
67
|
+
"lib/controll/focused/enabler.rb",
|
46
68
|
"lib/controll/helper.rb",
|
47
|
-
"lib/controll/helper/event_matcher.rb",
|
48
69
|
"lib/controll/helper/hash_access.rb",
|
49
|
-
"lib/controll/helper/notify.rb",
|
50
70
|
"lib/controll/helper/params.rb",
|
51
|
-
"lib/controll/helper/path_resolver.rb",
|
52
71
|
"lib/controll/helper/session.rb",
|
72
|
+
"lib/controll/macros.rb",
|
53
73
|
"lib/controll/notify.rb",
|
54
74
|
"lib/controll/notify/base.rb",
|
55
75
|
"lib/controll/notify/flash.rb",
|
76
|
+
"lib/controll/notify/macros.rb",
|
77
|
+
"lib/controll/notify/message.rb",
|
78
|
+
"lib/controll/notify/message/handler.rb",
|
79
|
+
"lib/controll/notify/message/resolver.rb",
|
80
|
+
"lib/controll/notify/message/translator.rb",
|
56
81
|
"lib/controll/notify/typed.rb",
|
82
|
+
"lib/generators/controll/assistant_generator.rb",
|
83
|
+
"lib/generators/controll/executor_generator.rb",
|
84
|
+
"lib/generators/controll/flow_handler_generator.rb",
|
85
|
+
"lib/generators/controll/notifier_generator.rb",
|
86
|
+
"lib/generators/controll/setup_generator.rb",
|
87
|
+
"lib/generators/controll/templates/assistant.tt",
|
88
|
+
"lib/generators/controll/templates/commander.tt",
|
89
|
+
"lib/generators/controll/templates/executor.tt",
|
90
|
+
"lib/generators/controll/templates/flow_handler.tt",
|
91
|
+
"lib/generators/controll/templates/notifier.tt",
|
57
92
|
"spec/acceptance/app_test.rb",
|
58
|
-
"spec/
|
59
|
-
"spec/
|
60
|
-
"spec/
|
61
|
-
"spec/app/README.rdoc",
|
62
|
-
"spec/app/Rakefile",
|
63
|
-
"spec/app/app/controllers/application_controller.rb",
|
64
|
-
"spec/app/app/controllers/posts_controller.rb",
|
65
|
-
"spec/app/app/models/.gitkeep",
|
66
|
-
"spec/app/app/models/post.rb",
|
67
|
-
"spec/app/app/views/layouts/application.html.erb",
|
68
|
-
"spec/app/app/views/posts/_form.html.erb",
|
69
|
-
"spec/app/app/views/posts/edit.html.erb",
|
70
|
-
"spec/app/app/views/posts/index.html.erb",
|
71
|
-
"spec/app/app/views/posts/new.html.erb",
|
72
|
-
"spec/app/app/views/posts/show.html.erb",
|
73
|
-
"spec/app/config.ru",
|
74
|
-
"spec/app/config/application.rb",
|
75
|
-
"spec/app/config/boot.rb",
|
76
|
-
"spec/app/config/environment.rb",
|
77
|
-
"spec/app/config/environments/development.rb",
|
78
|
-
"spec/app/config/environments/test.rb",
|
79
|
-
"spec/app/config/initializers/backtrace_silencers.rb",
|
80
|
-
"spec/app/config/initializers/inflections.rb",
|
81
|
-
"spec/app/config/initializers/mime_types.rb",
|
82
|
-
"spec/app/config/initializers/secret_token.rb",
|
83
|
-
"spec/app/config/initializers/session_store.rb",
|
84
|
-
"spec/app/config/locales/en.yml",
|
85
|
-
"spec/app/config/routes.rb",
|
86
|
-
"spec/app/db/seeds.rb",
|
87
|
-
"spec/app/lib/assets/.gitkeep",
|
88
|
-
"spec/app/lib/tasks/.gitkeep",
|
89
|
-
"spec/app/log/.gitkeep",
|
90
|
-
"spec/app/public/404.html",
|
91
|
-
"spec/app/public/422.html",
|
92
|
-
"spec/app/public/500.html",
|
93
|
-
"spec/app/public/favicon.ico",
|
94
|
-
"spec/app/public/index.html",
|
95
|
-
"spec/app/public/javascripts/application.js",
|
96
|
-
"spec/app/public/robots.txt",
|
97
|
-
"spec/app/public/stylesheets/application.css",
|
98
|
-
"spec/app/script/rails",
|
99
|
-
"spec/app/spec/controllers/posts_controller_spec.rb",
|
100
|
-
"spec/app/spec/isolated_spec_helper.rb",
|
101
|
-
"spec/app/spec/spec_helper.rb",
|
102
|
-
"spec/app/spec/unit/controllers/posts_controller_isolated_spec.rb",
|
103
|
-
"spec/app/spec/unit/controllers/posts_controller_spec.rb",
|
104
|
-
"spec/app/test/functional/.gitkeep",
|
105
|
-
"spec/app/test/functional/posts_controller_test.rb",
|
106
|
-
"spec/app/test/isolated_test_helper.rb",
|
107
|
-
"spec/app/test/test_helper.rb",
|
108
|
-
"spec/app/test/unit/.gitkeep",
|
109
|
-
"spec/app/test/unit/controllers/posts_controller_isolated_test.rb",
|
110
|
-
"spec/app/test/unit/controllers/posts_controller_test.rb",
|
111
|
-
"spec/app/vendor/assets/javascripts/.gitkeep",
|
112
|
-
"spec/app/vendor/assets/stylesheets/.gitkeep",
|
113
|
-
"spec/app/vendor/plugins/.gitkeep",
|
114
|
-
"spec/controll/asssistant_spec.rb",
|
93
|
+
"spec/controll/assistant/param_assistant_spec.rb",
|
94
|
+
"spec/controll/assistant/session_assistant_spec.rb",
|
95
|
+
"spec/controll/assistant_spec.rb",
|
115
96
|
"spec/controll/command_spec.rb",
|
116
97
|
"spec/controll/commander_spec.rb",
|
117
|
-
"spec/controll/
|
118
|
-
"spec/controll/
|
119
|
-
"spec/controll/
|
120
|
-
"spec/controll/
|
121
|
-
"spec/controll/
|
122
|
-
"spec/controll/
|
123
|
-
"spec/controll/
|
98
|
+
"spec/controll/enabler/macros_spec.rb",
|
99
|
+
"spec/controll/enabler/maps_spec.rb",
|
100
|
+
"spec/controll/enabler/notify_spec.rb",
|
101
|
+
"spec/controll/enabler/path_handler_spec.rb",
|
102
|
+
"spec/controll/enabler/path_resolver_spec.rb",
|
103
|
+
"spec/controll/enabler_spec.rb",
|
104
|
+
"spec/controll/event/helper_spec.rb",
|
105
|
+
"spec/controll/event/matcher_spec.rb",
|
106
|
+
"spec/controll/event_spec.rb",
|
107
|
+
"spec/controll/events_spec.rb",
|
108
|
+
"spec/controll/executor/controlled_spec.rb",
|
109
|
+
"spec/controll/executor/delegator_spec.rb",
|
110
|
+
"spec/controll/flow/action_mapper/complex_spec.rb",
|
111
|
+
"spec/controll/flow/action_mapper/fallback_spec.rb",
|
112
|
+
"spec/controll/flow/action_mapper/simple_spec.rb",
|
113
|
+
"spec/controll/flow/event_mapper/path_finder_spec.rb",
|
114
|
+
"spec/controll/flow/event_mapper/util_spec.rb",
|
115
|
+
"spec/controll/flow/master/executor_spec.rb",
|
116
|
+
"spec/controll/flow/master/macros_spec.rb",
|
117
|
+
"spec/controll/flow/master_spec.rb",
|
124
118
|
"spec/controll/helper/hash_access_spec.rb",
|
125
|
-
"spec/controll/helper/notify_spec.rb",
|
126
119
|
"spec/controll/helper/params_spec.rb",
|
127
|
-
"spec/controll/helper/path_resolver_spec.rb",
|
128
120
|
"spec/controll/helper/session_spec.rb",
|
129
|
-
"spec/controll/helper_spec.rb",
|
130
121
|
"spec/controll/notify/base_spec.rb",
|
131
122
|
"spec/controll/notify/flash_spec.rb",
|
132
|
-
"spec/controll/notify/
|
123
|
+
"spec/controll/notify/message/handler_spec.rb",
|
124
|
+
"spec/controll/notify/message/resolver_spec.rb",
|
125
|
+
"spec/controll/notify/message/translator_spec.rb",
|
126
|
+
"spec/controll/notify/message_spec.rb",
|
127
|
+
"spec/controll/notify/services_notifier.rb",
|
133
128
|
"spec/controll/notify/typed_spec.rb",
|
129
|
+
"spec/controll_app/.gitignore",
|
130
|
+
"spec/controll_app/Gemfile",
|
131
|
+
"spec/controll_app/Gemfile.lock",
|
132
|
+
"spec/controll_app/README.rdoc",
|
133
|
+
"spec/controll_app/Rakefile",
|
134
|
+
"spec/controll_app/app/controll/commanders/services_commander.rb",
|
135
|
+
"spec/controll_app/app/controll/executors/services_executor.rb",
|
136
|
+
"spec/controll_app/app/controll/flows/create_services.rb",
|
137
|
+
"spec/controll_app/app/controll/notifiers/services_notifier.rb",
|
138
|
+
"spec/controll_app/app/controllers/application_controller.rb",
|
139
|
+
"spec/controll_app/app/controllers/services_controller.rb",
|
140
|
+
"spec/controll_app/app/models/.gitkeep",
|
141
|
+
"spec/controll_app/app/models/post.rb",
|
142
|
+
"spec/controll_app/app/views/layouts/application.html.erb",
|
143
|
+
"spec/controll_app/app/views/posts/_form.html.erb",
|
144
|
+
"spec/controll_app/app/views/posts/edit.html.erb",
|
145
|
+
"spec/controll_app/app/views/posts/index.html.erb",
|
146
|
+
"spec/controll_app/app/views/posts/new.html.erb",
|
147
|
+
"spec/controll_app/app/views/posts/show.html.erb",
|
148
|
+
"spec/controll_app/config.ru",
|
149
|
+
"spec/controll_app/config/application.rb",
|
150
|
+
"spec/controll_app/config/boot.rb",
|
151
|
+
"spec/controll_app/config/environment.rb",
|
152
|
+
"spec/controll_app/config/environments/development.rb",
|
153
|
+
"spec/controll_app/config/environments/test.rb",
|
154
|
+
"spec/controll_app/config/initializers/backtrace_silencers.rb",
|
155
|
+
"spec/controll_app/config/initializers/inflections.rb",
|
156
|
+
"spec/controll_app/config/initializers/mime_types.rb",
|
157
|
+
"spec/controll_app/config/initializers/secret_token.rb",
|
158
|
+
"spec/controll_app/config/initializers/session_store.rb",
|
159
|
+
"spec/controll_app/config/locales/en.yml",
|
160
|
+
"spec/controll_app/config/routes.rb",
|
161
|
+
"spec/controll_app/db/seeds.rb",
|
162
|
+
"spec/controll_app/log/.gitkeep",
|
163
|
+
"spec/controll_app/public/404.html",
|
164
|
+
"spec/controll_app/public/422.html",
|
165
|
+
"spec/controll_app/public/500.html",
|
166
|
+
"spec/controll_app/public/favicon.ico",
|
167
|
+
"spec/controll_app/public/index.html",
|
168
|
+
"spec/controll_app/public/javascripts/application.js",
|
169
|
+
"spec/controll_app/public/robots.txt",
|
170
|
+
"spec/controll_app/public/stylesheets/application.css",
|
134
171
|
"spec/functional_test_helper.rb",
|
135
172
|
"spec/helper.rb",
|
136
173
|
"spec/rspec_controller_class.rb",
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Controll
|
2
|
+
class ParamAssistant < Assistant
|
3
|
+
include Controll::Helper::Params
|
4
|
+
|
5
|
+
controller_methods :params
|
6
|
+
|
7
|
+
module Helper
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
def param name
|
11
|
+
param_assistant.send(name)
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def param_assistant clazz
|
16
|
+
define_method :param_assistant do
|
17
|
+
@param_assistant ||= clazz.new self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Controll
|
2
|
+
class SessionAssistant < Assistant
|
3
|
+
include Controll::Helper::Session
|
4
|
+
|
5
|
+
controller_methods :session
|
6
|
+
|
7
|
+
module Helper
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
def sess name
|
11
|
+
session_assistant.send(name)
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def session_assistant clazz
|
16
|
+
define_method :session_assistant do
|
17
|
+
@session_assistant ||= clazz.new self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/controll/assistant.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
module Controll
|
2
|
+
autoload :SessionAssistant, 'controll/assistant/session_assistant'
|
3
|
+
autoload :ParamAssistant, 'controll/assistant/param_assistant'
|
4
|
+
|
2
5
|
class Assistant
|
3
6
|
attr_reader :controller, :options
|
4
7
|
|
@@ -6,14 +9,13 @@ module Controll
|
|
6
9
|
@controller = controller
|
7
10
|
@options = options
|
8
11
|
end
|
9
|
-
end
|
10
|
-
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
controller.send(meth, *args, &block)
|
16
|
-
end
|
13
|
+
def self.controller_methods *names
|
14
|
+
delegate *names, to: :controller
|
15
|
+
end
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
19
|
+
module Assistants
|
20
|
+
Assistant = Controll::Assistant
|
21
|
+
end
|
data/lib/controll/commander.rb
CHANGED
@@ -4,10 +4,10 @@ module Controll
|
|
4
4
|
# makes #command_method available
|
5
5
|
extend Imperator::Command::MethodFactory
|
6
6
|
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :initiator, :options
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
@
|
9
|
+
def initialize initiator, options = {}
|
10
|
+
@initiator = initiator
|
11
11
|
@options = options
|
12
12
|
end
|
13
13
|
|
@@ -20,5 +20,18 @@ module Controll
|
|
20
20
|
end
|
21
21
|
alias_method :use_command, :command!
|
22
22
|
alias_method :perform_command, :command!
|
23
|
+
|
24
|
+
alias_method :controller, :initiator
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def initiator_methods *names
|
28
|
+
delegate names, to: :initiator
|
29
|
+
end
|
30
|
+
alias_method :controller_methods, :initiator_methods
|
31
|
+
end
|
23
32
|
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module Commanders
|
36
|
+
Commander = Controll::Commander
|
24
37
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Controll
|
2
|
+
module Enabler
|
3
|
+
module Macros
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
|
8
|
+
# on Controller:
|
9
|
+
# - fx Admin::ServicesController -> :services
|
10
|
+
# On Focused Controller action:
|
11
|
+
# - fx Admin::ServicesController::Update -> :update_services
|
12
|
+
def controll *artifacts
|
13
|
+
def name_of clazz
|
14
|
+
clazz = clazz.to_s
|
15
|
+
if clazz =~ /Controller$/
|
16
|
+
clazz.sub(/Controller$/, '').split('::').last.underscore
|
17
|
+
else
|
18
|
+
parts = clazz.sub(/Controller/, '').split('::')
|
19
|
+
(parts.pop << parts.last).underscore
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
options = artifacts.extract_options!
|
24
|
+
name = name_of self.class
|
25
|
+
artifacts.each do |artifact|
|
26
|
+
send(artifact, name, options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# TODO: refactor - all use exactly the same pattern - can be generated!
|
31
|
+
def commander name, options = {}
|
32
|
+
define_method :commander do
|
33
|
+
instance_variable_get("@commander") || begin
|
34
|
+
clazz = "Commanders::#{name.to_s.camelize}".constantize
|
35
|
+
instance_variable_set "@commander", clazz.new(self, options)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def notifier name, options = {}
|
41
|
+
define_method :notifier do
|
42
|
+
instance_variable_get("@notifier") || begin
|
43
|
+
clazz = "Notifiers::#{name.to_s.camelize}".constantize
|
44
|
+
instance_variable_set "@notifier", clazz.new(self, options)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def flow name, options = {}
|
50
|
+
define_method :flow do
|
51
|
+
unless instance_variable_get("@flow")
|
52
|
+
clazz = "Flows::#{name.to_s.camelize}".constantize
|
53
|
+
instance_variable_set "@flow", clazz.new(self, options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def assistant name, options = {}
|
59
|
+
define_method :assistant do
|
60
|
+
unless instance_variable_get("@assistant")
|
61
|
+
clazz = "Assistants::#{name.to_s.camelize}".constantize
|
62
|
+
instance_variable_set "@assistant", clazz.new(self, options)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def assistant_methods *names
|
68
|
+
options = names.extract_options!
|
69
|
+
assistant = options[:to] || :assistant
|
70
|
+
delegate names, to: assistant
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Controll
|
2
|
+
module Enabler
|
3
|
+
module Notify
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
Controll::Event.valid_types.each do |type|
|
8
|
+
meth = "create_#{type}"
|
9
|
+
define_method meth do |*args|
|
10
|
+
return create_event type, type if args.empty?
|
11
|
+
create_event args.first, type, args[1..-1]
|
12
|
+
end
|
13
|
+
alias_method type, meth
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
include Controll::Event::Helper
|
18
|
+
|
19
|
+
def notify event, *args
|
20
|
+
events << normalize(event, *args)
|
21
|
+
self # enable method chaining on controller
|
22
|
+
end
|
23
|
+
|
24
|
+
# event stack
|
25
|
+
def events
|
26
|
+
@events ||= Controll::Events.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def main_event
|
30
|
+
events.last || create_success
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def process_events notifier = nil
|
36
|
+
notifier ||= self.notifier
|
37
|
+
events.each do |event|
|
38
|
+
notifier.send(event.type).notify event.name, event.options
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Controll::Enabler
|
2
|
+
class PathHandler
|
3
|
+
attr_reader :controller, :type, :options, :path
|
4
|
+
|
5
|
+
def initialize controller, type
|
6
|
+
@controller, @type = [controller, type]
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.renderer controller, map
|
10
|
+
self.new controller, map, :render
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.redirecter controller, map
|
14
|
+
self.new controller, map, :redirect
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute *args
|
18
|
+
extract! *args
|
19
|
+
process_notifications
|
20
|
+
path ? handle_path : fallback
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def map
|
26
|
+
@map ||= controller.class.send("#{type}_map")
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :control_action, :type
|
30
|
+
|
31
|
+
def handle_path
|
32
|
+
controller.send control_action, path, options
|
33
|
+
end
|
34
|
+
|
35
|
+
def fallback
|
36
|
+
controller.do_fallback action
|
37
|
+
end
|
38
|
+
|
39
|
+
def extract! *args
|
40
|
+
@options = args.extract_options!
|
41
|
+
action = args.first
|
42
|
+
@path = path_resolver(map).resolve action
|
43
|
+
end
|
44
|
+
|
45
|
+
def path_resolver map
|
46
|
+
@path_resolver ||= PathResolver.new controller, map
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Controll::Enabler
|
2
|
+
class PathResolver
|
3
|
+
attr_reader :caller, :event_map
|
4
|
+
|
5
|
+
ActionMapper = Controll::Flow::ActionMapper
|
6
|
+
Action = Controll::Flow::Action
|
7
|
+
|
8
|
+
def initialize caller, event_map
|
9
|
+
@caller = caller
|
10
|
+
@event_map = event_map
|
11
|
+
end
|
12
|
+
|
13
|
+
def resolve action = nil
|
14
|
+
@path ||= handle action
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
alias_method :controller, :caller
|
20
|
+
|
21
|
+
delegate :notify, :main_event, to: :caller
|
22
|
+
|
23
|
+
def handle action
|
24
|
+
case action
|
25
|
+
when Action::Fallback
|
26
|
+
nil
|
27
|
+
when Action::PathAction
|
28
|
+
action.resolved_path
|
29
|
+
when Symbol, Controll::Event
|
30
|
+
resolve_event action
|
31
|
+
else
|
32
|
+
resolve_event
|
33
|
+
end
|
34
|
+
rescue Controll::Flow::PathActionError
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def resolve_event event = nil
|
39
|
+
notify event if event
|
40
|
+
mapper.map_event
|
41
|
+
end
|
42
|
+
|
43
|
+
def mapper
|
44
|
+
@mapper ||= Controll::Flow::EventMapper::Util.new main_event, event_map
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Controll
|
2
|
+
module Enabler
|
3
|
+
autoload :Macros, 'controll/enabler/macros'
|
4
|
+
autoload :Notify, 'controll/enabler/notify'
|
5
|
+
autoload :PathResolver, 'controll/enabler/path_resolver'
|
6
|
+
autoload :PathHandler, 'controll/enabler/path_handler'
|
7
|
+
autoload :Maps, 'controll/enabler/maps'
|
8
|
+
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include Controll::Helper::Params
|
13
|
+
include Controll::Helper::Session
|
14
|
+
|
15
|
+
include Notify
|
16
|
+
include Macros
|
17
|
+
include Maps
|
18
|
+
|
19
|
+
delegate :command, :command!, :use_command, to: :commander
|
20
|
+
end
|
21
|
+
|
22
|
+
# override this for custom Controller specific fallback action
|
23
|
+
def do_fallback action
|
24
|
+
do_redirect fallback_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def do_redirect *args
|
28
|
+
redirecter.execute *args
|
29
|
+
end
|
30
|
+
|
31
|
+
def do_render *args
|
32
|
+
renderer.execute *args
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def fallback_path
|
38
|
+
root_url
|
39
|
+
end
|
40
|
+
|
41
|
+
def renderer
|
42
|
+
@renderer||= PathHandler.new self, :render
|
43
|
+
end
|
44
|
+
|
45
|
+
def redirecter
|
46
|
+
@redirecter ||= PathHandler.new self, :redirect
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/controll/errors.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Controll
|
2
|
+
module Event::Helper
|
3
|
+
def normalize event, *args
|
4
|
+
case event
|
5
|
+
when Controll::Event
|
6
|
+
event
|
7
|
+
when Symbol, String
|
8
|
+
create_event event.to_sym, *args
|
9
|
+
when Hash, Hashie::Mash
|
10
|
+
create_event event.delete(:name), event
|
11
|
+
else
|
12
|
+
raise Controll::Event::InvalidError, "Event: #{event} could not be normalized, must be a Hash, String or Symbol"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_event name, *args
|
17
|
+
Controll::Event.new name, *args
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|