netzke-core 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. data/CHANGELOG.md +16 -1
  2. data/Gemfile +12 -0
  3. data/README.md +22 -15
  4. data/Rakefile +19 -38
  5. data/app/controllers/netzke_controller.rb +1 -79
  6. data/javascripts/ext.js +17 -13
  7. data/lib/netzke/base.rb +6 -2
  8. data/lib/netzke/core/action_config.rb +7 -0
  9. data/lib/netzke/core/actions.rb +6 -32
  10. data/lib/netzke/core/client_class.rb +1 -1
  11. data/lib/netzke/core/component_config.rb +1 -1
  12. data/lib/netzke/core/composition.rb +17 -111
  13. data/lib/netzke/core/config_to_dsl_delegator.rb +0 -7
  14. data/lib/netzke/core/configuration.rb +48 -0
  15. data/lib/netzke/core/dsl_support.rb +71 -0
  16. data/lib/netzke/core/dynamic_assets.rb +10 -1
  17. data/lib/netzke/core/embedding.rb +2 -2
  18. data/lib/netzke/core/html.rb +29 -0
  19. data/lib/netzke/core/javascript.rb +32 -26
  20. data/lib/netzke/core/railz/action_view_ext/ext.rb +2 -2
  21. data/lib/netzke/core/railz/controller_extensions.rb +96 -3
  22. data/lib/netzke/core/railz/routes.rb +14 -3
  23. data/lib/netzke/core/ruby_ext/array.rb +4 -18
  24. data/lib/netzke/core/ruby_ext/hash.rb +19 -25
  25. data/lib/netzke/core/ruby_ext/time_with_zone.rb +1 -1
  26. data/lib/netzke/core/ruby_ext.rb +0 -2
  27. data/lib/netzke/core/session.rb +8 -1
  28. data/lib/netzke/core/state.rb +3 -3
  29. data/lib/netzke/core/version.rb +1 -1
  30. data/lib/netzke/core.rb +15 -7
  31. data/lib/netzke-core.rb +2 -9
  32. data/tasks/app_test_tasks.rake +94 -0
  33. data/tasks/rake_helper.rb +51 -0
  34. data/test/core_test_app/README +2 -2
  35. data/test/core_test_app/app/assets/javascripts/expect/expect.js +1253 -0
  36. data/test/core_test_app/app/assets/javascripts/mocha/mocha.js +5340 -0
  37. data/test/core_test_app/app/assets/stylesheets/mocha/mocha.css +231 -0
  38. data/test/core_test_app/app/components/{component_with_actions.rb → actions.rb} +7 -9
  39. data/test/core_test_app/app/components/{some_composite.rb → composition.rb} +16 -5
  40. data/test/core_test_app/app/components/{component_with_custom_css → css_inclusion}/stylesheets/custom.css +2 -2
  41. data/test/core_test_app/app/components/css_inclusion.rb +12 -0
  42. data/test/core_test_app/app/components/{component_loader/javascripts/component_loader.js → dynamic_loading/javascripts/dynamic_loading.js} +9 -1
  43. data/test/core_test_app/app/components/{component_loader.rb → dynamic_loading.rb} +12 -5
  44. data/test/core_test_app/app/components/{server_caller/javascripts/server_caller.js → endpoints/javascripts/endpoints.js} +10 -6
  45. data/test/core_test_app/app/components/{server_caller.rb → endpoints.rb} +12 -8
  46. data/test/core_test_app/app/components/{extended_server_caller.rb → endpoints_extended.rb} +6 -4
  47. data/test/core_test_app/app/components/ext_direct/composite.rb +5 -1
  48. data/test/core_test_app/app/components/feedback.rb +26 -0
  49. data/test/core_test_app/app/components/haml_panel/html/body.html.haml +10 -0
  50. data/test/core_test_app/app/components/haml_panel/html/server_response.html.haml +3 -0
  51. data/test/core_test_app/app/components/haml_panel.rb +32 -0
  52. data/test/core_test_app/app/components/hello_world.rb +1 -0
  53. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_one.js +2 -0
  54. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_two.js +2 -0
  55. data/test/core_test_app/app/components/js_inclusion/javascripts/js_inclusion.js +5 -0
  56. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_one.js +0 -0
  57. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_two.js +0 -0
  58. data/test/core_test_app/app/components/{component_with_js_mixin.rb → js_inclusion.rb} +3 -3
  59. data/test/core_test_app/app/components/js_inclusion_extended/javascripts/some_method_set.js +5 -0
  60. data/test/core_test_app/app/components/js_inclusion_extended.rb +6 -0
  61. data/test/core_test_app/app/components/loaded_css_inclusion.rb +22 -0
  62. data/test/core_test_app/app/components/{localized_panel.rb → localization.rb} +5 -5
  63. data/test/core_test_app/app/components/localization_extended.rb +2 -0
  64. data/test/core_test_app/app/components/persistence.rb +60 -0
  65. data/test/core_test_app/app/components/persistence_with_shared_state.rb +7 -0
  66. data/test/core_test_app/app/components/plugin_with_actions.rb +24 -0
  67. data/test/core_test_app/app/components/plugin_with_components.rb +3 -3
  68. data/test/core_test_app/app/components/plugin_with_endpoints.rb +29 -0
  69. data/test/core_test_app/app/components/plugins.rb +9 -0
  70. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/basic_stuff.rb +1 -1
  71. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/extra_stuff.rb +3 -3
  72. data/test/core_test_app/app/components/{kinda_complex_component.rb → ruby_modules.rb} +1 -1
  73. data/test/core_test_app/app/components/scoped/deeply_scoped/scoping.rb +10 -0
  74. data/test/core_test_app/app/components/scoped/scoping.rb +8 -0
  75. data/test/core_test_app/app/components/scoped/scoping_extended.rb +8 -0
  76. data/test/core_test_app/app/components/self_reloading.rb +25 -0
  77. data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +4 -4
  78. data/test/core_test_app/app/components/server_counter.rb +10 -10
  79. data/test/core_test_app/app/components/simple_authentication_component.rb +1 -0
  80. data/test/core_test_app/app/components/simple_component.rb +0 -4
  81. data/test/core_test_app/app/components/simple_composite.rb +1 -1
  82. data/test/core_test_app/app/components/simple_form_with_file_upload.rb +1 -2
  83. data/test/core_test_app/app/components/simple_tab_panel.rb +5 -3
  84. data/test/core_test_app/app/components/{panel_with_tools.rb → tools.rb} +3 -3
  85. data/test/core_test_app/app/components/window_with_simple_component.rb +1 -0
  86. data/test/core_test_app/app/controllers/alternative_controller.rb +10 -0
  87. data/test/core_test_app/app/controllers/specs_controller.rb +11 -0
  88. data/test/core_test_app/app/views/layouts/application.html.erb +19 -1
  89. data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +2 -2
  90. data/test/core_test_app/config/boot.rb +3 -10
  91. data/test/core_test_app/config/environments/development.rb +1 -0
  92. data/test/core_test_app/config/initializers/netzke.rb +4 -1
  93. data/test/core_test_app/config/locales/en.yml +11 -4
  94. data/test/core_test_app/config/locales/es.yml +1 -4
  95. data/test/core_test_app/config/routes.rb +10 -1
  96. data/test/core_test_app/core_test_app.tmproj +254 -0
  97. data/test/core_test_app/db/development.sqlite3 +0 -0
  98. data/test/core_test_app/{lib/tasks/.gitkeep → db/test.sqlite3} +0 -0
  99. data/test/core_test_app/log/development.log +78046 -0
  100. data/test/core_test_app/log/production.log +18 -0
  101. data/test/core_test_app/log/test.log +120048 -0
  102. data/test/core_test_app/rails_app.tmproj +324 -0
  103. data/test/core_test_app/tmp/cache/assets/C8B/BF0/sprockets%2F54de2792b036d1dab855f88599503551 +0 -0
  104. data/test/core_test_app/tmp/cache/assets/C92/5A0/sprockets%2F39e75754782ee12179bf35c9a0971d80 +0 -0
  105. data/test/core_test_app/tmp/cache/assets/C99/720/sprockets%2F981d5a1b957a012e380b22011a6d176d +0 -0
  106. data/test/core_test_app/tmp/cache/assets/C9F/750/sprockets%2F20ce3d64040a5d3a0a8883bd60754356 +0 -0
  107. data/test/core_test_app/tmp/cache/assets/CC4/C00/sprockets%2Fc615df52887d8c2e67e8413576a419c5 +0 -0
  108. data/test/core_test_app/tmp/cache/assets/CF1/3F0/sprockets%2Fc69ee42924fab565a3533d56473ce878 +0 -0
  109. data/test/core_test_app/tmp/cache/assets/D0E/870/sprockets%2Fa593bf4fac106add88c9434141a49663 +0 -0
  110. data/test/core_test_app/tmp/cache/assets/D14/8E0/sprockets%2F20748e8d1d7d090d122904a9fe6f18fc +0 -0
  111. data/test/core_test_app/tmp/cache/assets/D3E/DA0/sprockets%2Fa175f1ac5996544b908ba3ba3f64c4f3 +0 -0
  112. data/test/core_test_app/tmp/cache/assets/D43/C00/sprockets%2F7bc60c758776356d615ab5edff201ee2 +0 -0
  113. data/test/core_test_app/tmp/cache/assets/D4B/C50/sprockets%2F8483b7e322da338e8f9eb3b30a957e9a +0 -0
  114. data/test/core_test_app/tmp/cache/assets/D64/090/sprockets%2F5a01ff309c3f2503eb5e4f5667cca4b3 +0 -0
  115. data/test/core_test_app/tmp/cache/assets/D8B/FB0/sprockets%2F7a86225caaa389f1be600b4f3a2d1ef0 +0 -0
  116. data/test/core_test_app/tmp/cache/assets/D98/9C0/sprockets%2F18b80e8fe200aebc522e561a867ea6fb +0 -0
  117. data/test/core_test_app/tmp/cache/assets/DB0/6E0/sprockets%2F03e33f5a4779eeb48bcfc86ee717fb55 +0 -0
  118. data/test/core_test_app/tmp/cache/assets/DED/7E0/sprockets%2Feaedd52ba538f19e4ab543a3e20ce2c4 +0 -0
  119. data/test/core_test_app/tmp/cache/assets/E07/FF0/sprockets%2Fb3c071e0a6de36f041adbbdaa8ab060b +0 -0
  120. data/test/core_test_app/tmp/capybara/capybara-20101214105940.html +40 -0
  121. data/test/core_test_app/tmp/capybara/capybara-20101214110642.html +40 -0
  122. data/test/core_test_app/tmp/capybara/capybara-20101214110749.html +40 -0
  123. data/test/core_test_app/tmp/capybara/capybara-20101214110750.html +40 -0
  124. data/test/core_test_app/tmp/capybara/capybara-20101214111025.html +40 -0
  125. data/test/core_test_app/tmp/capybara/capybara-20101214111027.html +40 -0
  126. data/test/core_test_app/tmp/capybara/capybara-20101214111213.html +40 -0
  127. data/test/core_test_app/tmp/capybara/capybara-20101214111214.html +40 -0
  128. data/test/core_test_app/tmp/capybara/capybara-20101214111332.html +40 -0
  129. data/test/core_test_app/tmp/capybara/capybara-20101214111333.html +40 -0
  130. data/test/core_test_app/{spec/component → tmp/pids/passenger.3000.pid.lock} +0 -0
  131. metadata +370 -133
  132. data/.autotest +0 -1
  133. data/.travis.yml +0 -18
  134. data/Manifest +0 -50
  135. data/config/ci/before-travis.sh +0 -10
  136. data/install.rb +0 -1
  137. data/lib/netzke/core/options_hash.rb +0 -27
  138. data/lib/netzke/core/ruby_ext/string.rb +0 -26
  139. data/lib/netzke/core/ruby_ext/symbol.rb +0 -13
  140. data/netzke-core.gemspec +0 -253
  141. data/test/core_test_app/.gitignore +0 -4
  142. data/test/core_test_app/.powrc +0 -4
  143. data/test/core_test_app/.rvmrc +0 -1
  144. data/test/core_test_app/Gemfile +0 -19
  145. data/test/core_test_app/Gemfile.lock +0 -147
  146. data/test/core_test_app/app/components/border_layout_panel.rb +0 -4
  147. data/test/core_test_app/app/components/card_component_loader.rb +0 -25
  148. data/test/core_test_app/app/components/component_with_custom_css.rb +0 -11
  149. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/component_with_js_mixin.js +0 -5
  150. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +0 -2
  151. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +0 -2
  152. data/test/core_test_app/app/components/component_with_nested_through.rb +0 -28
  153. data/test/core_test_app/app/components/component_with_required_js.rb +0 -24
  154. data/test/core_test_app/app/components/dsl_delegated_properties.rb +0 -4
  155. data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +0 -5
  156. data/test/core_test_app/app/components/extended_component_with_actions.rb +0 -9
  157. data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +0 -5
  158. data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +0 -10
  159. data/test/core_test_app/app/components/extended_localized_panel.rb +0 -2
  160. data/test/core_test_app/app/components/included.js +0 -5
  161. data/test/core_test_app/app/components/inline_composite.rb +0 -13
  162. data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +0 -23
  163. data/test/core_test_app/app/components/multipane_component_loader.rb +0 -41
  164. data/test/core_test_app/app/components/nested_component.rb +0 -17
  165. data/test/core_test_app/app/components/panel_with_plugin.rb +0 -9
  166. data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +0 -10
  167. data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +0 -8
  168. data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +0 -8
  169. data/test/core_test_app/app/components/some_ext_component.rb +0 -8
  170. data/test/core_test_app/app/components/some_plugin.rb +0 -40
  171. data/test/core_test_app/app/components/stateful_component.rb +0 -46
  172. data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +0 -11
  173. data/test/core_test_app/config/database.yml.travis +0 -11
  174. data/test/core_test_app/db/schema.rb +0 -29
  175. data/test/core_test_app/features/actions_and_tools.feature +0 -22
  176. data/test/core_test_app/features/basic.feature +0 -7
  177. data/test/core_test_app/features/client-server.feature +0 -19
  178. data/test/core_test_app/features/complex_component.feature +0 -18
  179. data/test/core_test_app/features/component.feature +0 -10
  180. data/test/core_test_app/features/component_loader.feature +0 -52
  181. data/test/core_test_app/features/composition.feature +0 -45
  182. data/test/core_test_app/features/config_to_dsl_delegation.feature +0 -10
  183. data/test/core_test_app/features/custom_css.feature +0 -17
  184. data/test/core_test_app/features/ext.direct.feature +0 -32
  185. data/test/core_test_app/features/file_inclusion.feature +0 -10
  186. data/test/core_test_app/features/i18n.feature +0 -35
  187. data/test/core_test_app/features/inheritance.feature +0 -18
  188. data/test/core_test_app/features/js_include.feature +0 -20
  189. data/test/core_test_app/features/nested_views.feature +0 -10
  190. data/test/core_test_app/features/persistence.feature +0 -34
  191. data/test/core_test_app/features/plugin.feature +0 -16
  192. data/test/core_test_app/features/rails_views.feature +0 -16
  193. data/test/core_test_app/features/scopes.feature +0 -14
  194. data/test/core_test_app/features/step_definitions/custom_css_steps.rb +0 -7
  195. data/test/core_test_app/features/step_definitions/generic_steps.rb +0 -64
  196. data/test/core_test_app/features/step_definitions/web_steps.rb +0 -219
  197. data/test/core_test_app/features/support/env.rb +0 -58
  198. data/test/core_test_app/features/support/paths.rb +0 -42
  199. data/test/core_test_app/spec/action_config_spec.rb +0 -15
  200. data/test/core_test_app/spec/actions_spec.rb +0 -96
  201. data/test/core_test_app/spec/base_spec.rb +0 -35
  202. data/test/core_test_app/spec/client_class_spec.rb +0 -17
  203. data/test/core_test_app/spec/composition_spec.rb +0 -118
  204. data/test/core_test_app/spec/core_ext_spec.rb +0 -27
  205. data/test/core_test_app/spec/endpoint_response_spec.rb +0 -17
  206. data/test/core_test_app/spec/javascript_spec.rb +0 -33
  207. data/test/core_test_app/spec/js_class_config_scope.rb +0 -37
  208. data/test/core_test_app/spec/panel_spec.rb +0 -11
  209. data/test/core_test_app/spec/services_spec.rb +0 -16
  210. data/test/core_test_app/spec/spec.opt +0 -2
  211. data/test/core_test_app/spec/spec_helper.rb +0 -27
  212. data/test/core_test_app/spec/state_spec.rb +0 -20
  213. data/test/core_test_app/vendor/plugins/.gitkeep +0 -0
  214. data/test/unit/core_ext_test.rb +0 -8
  215. data/test/unit/netzke_core_test.rb +0 -178
  216. data/uninstall.rb +0 -1
data/lib/netzke/core.rb CHANGED
@@ -1,10 +1,4 @@
1
1
  require 'active_support/core_ext'
2
- require 'netzke/core/options_hash'
3
- require 'netzke/core/version'
4
- require 'netzke/core/dynamic_assets'
5
- require 'netzke/core/client_class'
6
- require 'netzke/core/css_config'
7
- require 'netzke/core/config_to_dsl_delegator'
8
2
 
9
3
  module Netzke
10
4
  # This module implements high-level configuration for Netzke Core.
@@ -21,6 +15,16 @@ module Netzke
21
15
  # * ext_path - absolute path to your Ext code root
22
16
  # * icons_uri - relative URI to the icons
23
17
  module Core
18
+ autoload :ComponentConfig, 'netzke/core/component_config'
19
+ autoload :ActionConfig, 'netzke/core/action_config'
20
+ autoload :Panel, 'netzke/core/panel'
21
+ autoload :EndpointResponse, 'netzke/core/endpoint_response'
22
+ autoload :Version, 'netzke/core/version'
23
+ autoload :DynamicAssets, 'netzke/core/dynamic_assets'
24
+ autoload :ClientClass, 'netzke/core/client_class'
25
+ autoload :CssConfig, 'netzke/core/css_config'
26
+ autoload :ConfigToDslDelegator, 'netzke/core/config_to_dsl_delegator'
27
+
24
28
  # :ext (or :touch - when and if ever implemented)
25
29
  mattr_accessor :platform
26
30
  @@platform = :ext
@@ -43,10 +47,14 @@ module Netzke
43
47
 
44
48
  mattr_accessor :ext_path
45
49
 
46
- # The amount of retries that the direct remoting provider will attempt in case of failure
50
+ # Amount of retries that the direct remoting provider will attempt in case of failure
47
51
  mattr_accessor :js_direct_max_retries
48
52
  @@js_direct_max_retries = 0
49
53
 
54
+ # Amount of time feedback delay is being shown
55
+ mattr_accessor :js_feedback_delay
56
+ @@js_feedback_delay = 2000
57
+
50
58
  mattr_accessor :with_icons
51
59
 
52
60
  def self.setup
data/lib/netzke-core.rb CHANGED
@@ -1,19 +1,12 @@
1
1
  require 'netzke/core'
2
- require 'netzke/base'
3
2
 
4
3
  module Netzke
5
4
  autoload :Plugin, 'netzke/plugin'
6
-
7
- module Core
8
- autoload :ComponentConfig, 'netzke/core/component_config'
9
- autoload :ActionConfig, 'netzke/core/action_config'
10
- autoload :Panel, 'netzke/core/panel'
11
- autoload :EndpointResponse, 'netzke/core/endpoint_response'
12
- end
5
+ autoload :Base, 'netzke/base'
13
6
  end
14
7
 
15
8
  # Rails specific
16
- if defined? Rails
9
+ if defined? ::Rails
17
10
  require 'netzke/core/railz'
18
11
 
19
12
  ActiveSupport.on_load(:action_controller) do
@@ -0,0 +1,94 @@
1
+ #
2
+ # Task for test performing :
3
+ #
4
+ # test - run tests on test rails application, it will run `rspec spec`
5
+ #
6
+ # test:prepare - prepare test application for testing, creates symbolic link to
7
+ # database.yml from database.sample.yml and run db:create, db:migrate
8
+ # and db:seed rake tasks. Also it allows to install Extjs library for
9
+ # the test app, to do it you will need to specify --with-extjs parameter.
10
+ #
11
+ # test:check - run to check if test app is ready for testing.
12
+ #
13
+
14
+ require './tasks/rake_helper'
15
+
16
+ def commented_sh(comment, command)
17
+ puts(comment)
18
+ system("#{command} > /dev/null")
19
+ end
20
+
21
+ def download_extjs(options = {})
22
+ return false unless (extjs_home = options[:to])
23
+ extjs_download_url = "http://cdn.sencha.io/ext-4.1.1a-gpl.zip"
24
+ archive_name = extjs_download_url.match(/[^\/]+$/)[0]
25
+ extracted_folder = archive_name.match(/^(.+)-gpl\.[^\.]+$/)[1]
26
+
27
+ commented_sh("Downloading Extjs from #{extjs_download_url}".green, %(wget #{extjs_download_url})) &&
28
+ commented_sh("Extracting Extjs from archive".green, %(unzip #{archive_name})) &&
29
+ system(%(mkdir -p #{extjs_home})) &&
30
+ system(%(mv #{extracted_folder}/* #{extjs_home})) &&
31
+ system(%(rmdir "#{extracted_folder}" && rm "#{archive_name}"))
32
+ end
33
+
34
+ def install_extjs
35
+ extjs_home = File.join(GemInfo.gem_root, 'extjs')
36
+ return false unless download_extjs(to: extjs_home)
37
+ system %(ln -s #{extjs_home} #{File.join(GemInfo.test_app_root, 'public', 'extjs')})
38
+ end
39
+
40
+ desc "Run all tests"
41
+ task :test do
42
+ if TestAppChecker.ready?
43
+ system("bundle exec rspec spec") || abort
44
+ else
45
+ abort("Test application in #{GemInfo.test_app_root} is not ready. You can run rake test:check to see what is wrong.")
46
+ end
47
+ end
48
+
49
+ namespace :test do
50
+ desc "Downloads and installs Ext JS to test app"
51
+ task :install_extjs do
52
+ puts "Installing Extjs library for application in #{GemInfo.test_app_root}".green
53
+ if TestAppChecker.extjs_installed?
54
+ puts "Extjs is already installed.".green
55
+ else
56
+ extjs_home = File.join(GemInfo.gem_root, 'extjs')
57
+ if download_extjs(to: extjs_home)
58
+ system(%(ln -s #{extjs_home} #{File.join(GemInfo.test_app_root, 'public', 'extjs')}))
59
+ else
60
+ abort "For some reason can't download Extjs. Try to do it manually. Sorry for inconvenience.".red
61
+ end
62
+ end
63
+ end
64
+
65
+ desc "Checks if test application is ready for testing."
66
+ task :check do
67
+ puts "Checking application in #{GemInfo.test_app_root} folder.".green
68
+ if !TestAppChecker.extjs_installed?
69
+ puts "You need to #{'install Ext JS'.green} in #{GemInfo.test_app_root} test application."
70
+ puts "You can do so by running " + "rake test:install_extjs".green + "."
71
+ puts "Alternatively, you can #{'symlink Ext JS'.green} folder to " +
72
+ "#{GemInfo.test_app_root}/public/extjs" + " manually, or run #{'EXTJS_SRC=cdn rake'.green} to make use of Sencha CDN."
73
+ else
74
+ puts "Everything seems fine. You can run the tests now.".green
75
+ end
76
+ end
77
+
78
+ desc "Prepare test application."
79
+ task :prepare do
80
+ if !TestAppChecker.extjs_installed?
81
+ print "Would you like to download and install Ext JS in test application? [y/n]: ".green
82
+
83
+ case STDIN.gets.strip
84
+ when 'Y', 'y', 'j', 'J', 'yes' then # j for Germans (Ja)
85
+ Rake::Task['test:install_extjs'].invoke
86
+ else
87
+ puts "Ok. Then you will need to add/symlink Ext JS folder and its content to #{GemInfo.test_app_root}/public manually.".green
88
+ end
89
+ end
90
+
91
+ puts "Test application is configured. You can run the tests now.".green
92
+ end
93
+
94
+ end
@@ -0,0 +1,51 @@
1
+ #
2
+ # Helpers for rake tasks.
3
+ #
4
+ # GemInfo - class where info about gem is stored.
5
+ #
6
+ # TestAppChecker - helps to check if test app is ready for testing
7
+ #
8
+
9
+ class GemInfo
10
+ def self.gem_root
11
+ @netzke_gem_root ||= File.expand_path('../..', __FILE__)
12
+ end
13
+ def self.test_app_root
14
+ @test_app_root ||= File.join(gem_root, 'test', 'core_test_app')
15
+ end
16
+ end
17
+
18
+
19
+ class TestAppChecker
20
+ def self.extjs_installed?
21
+ ENV['EXTJS_SRC'] == 'cdn' || File.exists?(File.join(GemInfo.test_app_root, 'public', 'extjs'))
22
+ end
23
+
24
+ def self.ready?
25
+ self.extjs_installed?
26
+ end
27
+ end
28
+
29
+ # colorization
30
+ class String
31
+
32
+ def colorize(color_code)
33
+ "\e[#{color_code}m#{self}\e[0m"
34
+ end
35
+
36
+ def red
37
+ colorize(31)
38
+ end
39
+
40
+ def green
41
+ colorize(32)
42
+ end
43
+
44
+ def yellow
45
+ colorize(33)
46
+ end
47
+
48
+ def pink
49
+ colorize(35)
50
+ end
51
+ end
@@ -1,6 +1,6 @@
1
1
  == Netzke-core testing application
2
2
 
3
- This application is used as a helper app by the Cucumber and RSpec tests run from the root of the plugin, but can also be run stand-alone (don't forget to link extjs into public, and run the migrations).
3
+ This application is used as a helper app by the RSpec tests run from the root of the plugin, but can also be run stand-alone (don't forget to link extjs into public, and run the migrations).
4
4
 
5
5
  After you start the server, you can access any component from lib/netzke using the following URL schema:
6
6
 
@@ -12,4 +12,4 @@ or
12
12
 
13
13
  http://localhost:3000/components/ScopedComponents::SomeScopedComponent
14
14
 
15
- etc
15
+ etc