openshift-origin-console 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. data/COPYRIGHT +1 -0
  2. data/Gemfile +21 -0
  3. data/LICENSE +203 -0
  4. data/README.md +123 -0
  5. data/Rakefile +44 -0
  6. data/app/assets/images/cartridge-edge.gif +0 -0
  7. data/app/assets/images/console/arrow-down.png +0 -0
  8. data/app/assets/images/console/console-sprite.png +0 -0
  9. data/app/assets/images/favicon-32.png +0 -0
  10. data/app/assets/images/loader-dark.gif +0 -0
  11. data/app/assets/images/loader.gif +0 -0
  12. data/app/assets/images/sprite-vert.png +0 -0
  13. data/app/assets/javascripts/console.js +10 -0
  14. data/app/assets/javascripts/console/form.js.coffee +51 -0
  15. data/app/assets/stylesheets/_alerts.scss +84 -0
  16. data/app/assets/stylesheets/_breadcrumbs.scss +31 -0
  17. data/app/assets/stylesheets/_buttons.scss +229 -0
  18. data/app/assets/stylesheets/_code.scss +86 -0
  19. data/app/assets/stylesheets/_custom.scss +207 -0
  20. data/app/assets/stylesheets/_footer.scss +54 -0
  21. data/app/assets/stylesheets/_forms.scss +710 -0
  22. data/app/assets/stylesheets/_grid.scss +28 -0
  23. data/app/assets/stylesheets/_input-prepend-append.scss +138 -0
  24. data/app/assets/stylesheets/_labels.scss +40 -0
  25. data/app/assets/stylesheets/_mixins.scss +76 -0
  26. data/app/assets/stylesheets/_override-variables.scss +1 -0
  27. data/app/assets/stylesheets/_responsive.scss +438 -0
  28. data/app/assets/stylesheets/_ribbon.scss +57 -0
  29. data/app/assets/stylesheets/_type.scss +306 -0
  30. data/app/assets/stylesheets/_utilities.scss +10 -0
  31. data/app/assets/stylesheets/_variables.scss +131 -0
  32. data/app/assets/stylesheets/common.css.scss +82 -0
  33. data/app/assets/stylesheets/console/_application.scss +194 -0
  34. data/app/assets/stylesheets/console/_base.scss +26 -0
  35. data/app/assets/stylesheets/console/_breadcrumbs.scss +32 -0
  36. data/app/assets/stylesheets/console/_buttons.scss +214 -0
  37. data/app/assets/stylesheets/console/_core.scss +1002 -0
  38. data/app/assets/stylesheets/console/_dropdowns.scss +63 -0
  39. data/app/assets/stylesheets/console/_help.scss +54 -0
  40. data/app/assets/stylesheets/console/_mixins.scss +11 -0
  41. data/app/assets/stylesheets/console/_navbar.scss +415 -0
  42. data/app/assets/stylesheets/console/_ribbon.scss +82 -0
  43. data/app/assets/stylesheets/console/_tile.scss +122 -0
  44. data/app/assets/stylesheets/origin.css.scss +37 -0
  45. data/app/controllers/account/dashboard.rb +13 -0
  46. data/app/controllers/account_controller.rb +3 -0
  47. data/app/controllers/application_types_controller.rb +80 -0
  48. data/app/controllers/applications_controller.rb +183 -0
  49. data/app/controllers/building_controller.rb +81 -0
  50. data/app/controllers/capability_aware.rb +18 -0
  51. data/app/controllers/cartridge_types_controller.rb +53 -0
  52. data/app/controllers/cartridges_controller.rb +43 -0
  53. data/app/controllers/console/auth/basic.rb +65 -0
  54. data/app/controllers/console/auth/none.rb +5 -0
  55. data/app/controllers/console/auth/remote_user.rb +69 -0
  56. data/app/controllers/console/rescue.rb +48 -0
  57. data/app/controllers/console_controller.rb +19 -0
  58. data/app/controllers/console_index_controller.rb +14 -0
  59. data/app/controllers/domain_aware.rb +26 -0
  60. data/app/controllers/domain_session_sweeper.rb +29 -0
  61. data/app/controllers/domains_controller.rb +30 -0
  62. data/app/controllers/keys_controller.rb +43 -0
  63. data/app/controllers/scaling_controller.rb +46 -0
  64. data/app/controllers/sshkey_aware.rb +23 -0
  65. data/app/controllers/sshkey_session_sweeper.rb +29 -0
  66. data/app/controllers/user_session_sweeper.rb +29 -0
  67. data/app/helpers/console/community_helper.rb +78 -0
  68. data/app/helpers/console/console_helper.rb +26 -0
  69. data/app/helpers/console/help_helper.rb +270 -0
  70. data/app/helpers/console/html5_boilerplate_helper.rb +63 -0
  71. data/app/helpers/console/layout_helper.rb +277 -0
  72. data/app/helpers/console/model_helper.rb +106 -0
  73. data/app/helpers/console/secured_helper.rb +5 -0
  74. data/app/models/alias.rb +10 -0
  75. data/app/models/application.rb +148 -0
  76. data/app/models/application_associations.rb +36 -0
  77. data/app/models/application_template.rb +90 -0
  78. data/app/models/application_type.rb +258 -0
  79. data/app/models/async_aware.rb +60 -0
  80. data/app/models/capabilities.rb +62 -0
  81. data/app/models/cartridge.rb +122 -0
  82. data/app/models/cartridge_type.rb +140 -0
  83. data/app/models/domain.rb +44 -0
  84. data/app/models/domain_associations.rb +33 -0
  85. data/app/models/embedded.rb +11 -0
  86. data/app/models/gear.rb +13 -0
  87. data/app/models/gear_group.rb +104 -0
  88. data/app/models/key.rb +87 -0
  89. data/app/models/quickstart.rb +135 -0
  90. data/app/models/rest_api.rb +130 -0
  91. data/app/models/rest_api/base.rb +781 -0
  92. data/app/models/rest_api/cacheable.rb +91 -0
  93. data/app/models/rest_api/environment.rb +13 -0
  94. data/app/models/rest_api/info.rb +34 -0
  95. data/app/models/rest_api/log_subscriber.rb +29 -0
  96. data/app/models/rest_api/railties/controller_runtime.rb +37 -0
  97. data/app/models/user.rb +27 -0
  98. data/app/models/user_associations.rb +6 -0
  99. data/app/views/account/_domain.html.haml +14 -0
  100. data/app/views/account/_keys.html.haml +20 -0
  101. data/app/views/account/_user.html.haml +5 -0
  102. data/app/views/account/show.html.haml +15 -0
  103. data/app/views/application_templates/_application_template.html.haml +5 -0
  104. data/app/views/application_types/_application_type.html.haml +19 -0
  105. data/app/views/application_types/_custom.html.haml +19 -0
  106. data/app/views/application_types/_persisted.html.haml +26 -0
  107. data/app/views/application_types/_tile.html.haml +9 -0
  108. data/app/views/application_types/index.html.haml +87 -0
  109. data/app/views/application_types/search.html.haml +67 -0
  110. data/app/views/application_types/show.html.haml +219 -0
  111. data/app/views/applications/_application.html.haml +34 -0
  112. data/app/views/applications/_applications_filter.html.haml +8 -0
  113. data/app/views/applications/_footer.html.haml +0 -0
  114. data/app/views/applications/_name.html.haml +28 -0
  115. data/app/views/applications/delete.html.haml +19 -0
  116. data/app/views/applications/get_started.html.haml +145 -0
  117. data/app/views/applications/index.html.haml +55 -0
  118. data/app/views/applications/show.html.haml +193 -0
  119. data/app/views/building/delete.html.haml +22 -0
  120. data/app/views/building/new.html.haml +57 -0
  121. data/app/views/building/show.html.haml +12 -0
  122. data/app/views/cartridge_types/_cartridge_type.html.haml +61 -0
  123. data/app/views/cartridge_types/index.html.haml +37 -0
  124. data/app/views/cartridge_types/show.html.haml +21 -0
  125. data/app/views/cartridges/next_steps.html.haml +58 -0
  126. data/app/views/cartridges/show.html.haml +1 -0
  127. data/app/views/console/error.html.haml +58 -0
  128. data/app/views/console/help.html.haml +90 -0
  129. data/app/views/console/not_found.html.haml +69 -0
  130. data/app/views/console/unauthorized.html.haml +7 -0
  131. data/app/views/domains/_domain.html.haml +14 -0
  132. data/app/views/domains/_form.html.haml +13 -0
  133. data/app/views/domains/edit.html.haml +5 -0
  134. data/app/views/domains/new.html.haml +6 -0
  135. data/app/views/keys/_form.html.haml +14 -0
  136. data/app/views/keys/_simple_form.html.haml +14 -0
  137. data/app/views/keys/new.html.haml +2 -0
  138. data/app/views/layouts/_footer.html.haml +38 -0
  139. data/app/views/layouts/_head.html.haml +35 -0
  140. data/app/views/layouts/console.html.haml +60 -0
  141. data/app/views/layouts/console/_header.html.haml +44 -0
  142. data/app/views/layouts/console/_identity.html.haml +7 -0
  143. data/app/views/layouts/console/_javascripts.html.haml +5 -0
  144. data/app/views/layouts/console/_stylesheets.html.haml +6 -0
  145. data/app/views/scaling/delete.html.haml +17 -0
  146. data/app/views/scaling/new.html.haml +24 -0
  147. data/app/views/scaling/show.html.haml +81 -0
  148. data/app/views/shared/_tracking.html.haml +0 -0
  149. data/conf/console.conf.example +108 -0
  150. data/conf/openshift_console.conf +10 -0
  151. data/config/cartridge_types.yml +54 -0
  152. data/config/initializers/barista_config.rb +86 -0
  153. data/config/initializers/cartridge_types.rb +5 -0
  154. data/config/initializers/console_security.rb +1 -0
  155. data/config/initializers/date_helper.rb +5 -0
  156. data/config/initializers/extended_logger.rb +51 -0
  157. data/config/initializers/formtastic.rb +100 -0
  158. data/config/initializers/inflections.rb +38 -0
  159. data/config/initializers/rdiscount.rb +8 -0
  160. data/config/initializers/rest_api.rb +22 -0
  161. data/config/initializers/sass.rb +30 -0
  162. data/config/initializers/session_trace.rb +32 -0
  163. data/config/initializers/x_frame_options.rb +53 -0
  164. data/config/locales/en.yml +12 -0
  165. data/lib/active_resource/associations.rb +107 -0
  166. data/lib/active_resource/associations/builder/association.rb +35 -0
  167. data/lib/active_resource/associations/builder/belongs_to.rb +5 -0
  168. data/lib/active_resource/associations/builder/has_many.rb +5 -0
  169. data/lib/active_resource/associations/builder/has_one.rb +5 -0
  170. data/lib/active_resource/persistent_connection.rb +341 -0
  171. data/lib/active_resource/persistent_http_mock.rb +68 -0
  172. data/lib/active_resource/reflection.rb +78 -0
  173. data/lib/console.rb +8 -0
  174. data/lib/console/config_file.rb +13 -0
  175. data/lib/console/configuration.rb +163 -0
  176. data/lib/console/engine.rb +28 -0
  177. data/lib/console/formtastic/bootstrap_form_builder.rb +369 -0
  178. data/lib/console/rails/app_redirector.rb +40 -0
  179. data/lib/console/rails/filter_hash.rb +15 -0
  180. data/lib/console/rails/routes.rb +51 -0
  181. data/lib/console/version.rb +5 -0
  182. data/lib/tasks/assets.rake +79 -0
  183. data/lib/tasks/stats.rake +18 -0
  184. data/lib/tasks/test_suites.rake +73 -0
  185. data/test/coverage_helper.rb +27 -0
  186. data/test/fixtures/cartridges.json +1 -0
  187. data/test/fixtures/quickstarts.csv +3 -0
  188. data/test/functional/account_controller_test.rb +14 -0
  189. data/test/functional/application_types_controller_test.rb +251 -0
  190. data/test/functional/applications_controller_sanity_test.rb +26 -0
  191. data/test/functional/applications_controller_test.rb +365 -0
  192. data/test/functional/building_controller_test.rb +203 -0
  193. data/test/functional/cartridge_types_controller_isolation_test.rb +68 -0
  194. data/test/functional/cartridge_types_controller_test.rb +48 -0
  195. data/test/functional/cartridges_controller_test.rb +83 -0
  196. data/test/functional/console_auth_basic_controller_test.rb +82 -0
  197. data/test/functional/console_auth_remote_user_controller_test.rb +90 -0
  198. data/test/functional/console_index_controller_test.rb +22 -0
  199. data/test/functional/domains_controller_test.rb +194 -0
  200. data/test/functional/keys_controller_test.rb +163 -0
  201. data/test/functional/quickstarts.json +18 -0
  202. data/test/functional/scaling_controller_test.rb +153 -0
  203. data/test/integration/assets_test.rb +34 -0
  204. data/test/integration/help_link_test.rb +43 -0
  205. data/test/integration/quickstarts_test.rb +24 -0
  206. data/test/integration/rescue_from_test.rb +25 -0
  207. data/test/integration/rest_api/application_test.rb +115 -0
  208. data/test/integration/rest_api/cartridge_test.rb +44 -0
  209. data/test/integration/rest_api/cartridge_type_test.rb +143 -0
  210. data/test/integration/rest_api/domain_test.rb +91 -0
  211. data/test/integration/rest_api/info_test.rb +9 -0
  212. data/test/integration/rest_api/key_test.rb +85 -0
  213. data/test/integration/static_pages_test.rb +44 -0
  214. data/test/rails_app/Rakefile +7 -0
  215. data/test/rails_app/app/controllers/application_controller.rb +5 -0
  216. data/test/rails_app/config.ru +4 -0
  217. data/test/rails_app/config/application.rb +48 -0
  218. data/test/rails_app/config/boot.rb +10 -0
  219. data/test/rails_app/config/database.yml +25 -0
  220. data/test/rails_app/config/environment.rb +5 -0
  221. data/test/rails_app/config/environments/development.rb +38 -0
  222. data/test/rails_app/config/environments/production.rb +70 -0
  223. data/test/rails_app/config/environments/test.rb +43 -0
  224. data/test/rails_app/config/initializers/auth.rb +0 -0
  225. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  226. data/test/rails_app/config/initializers/inflections.rb +10 -0
  227. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  228. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  229. data/test/rails_app/config/initializers/session_store.rb +8 -0
  230. data/test/rails_app/config/locales/en.yml +5 -0
  231. data/test/rails_app/config/routes.rb +4 -0
  232. data/test/rails_app/script/rails +6 -0
  233. data/test/support/auth.rb +111 -0
  234. data/test/support/base.rb +142 -0
  235. data/test/support/errors.rb +28 -0
  236. data/test/support/rest_api.rb +189 -0
  237. data/test/test_helper.rb +14 -0
  238. data/test/unit/active_model_compliance_test.rb +23 -0
  239. data/test/unit/async_aware_test.rb +55 -0
  240. data/test/unit/configuration_test.rb +158 -0
  241. data/test/unit/filter_hash_test.rb +64 -0
  242. data/test/unit/helpers/model_helper_test.rb +61 -0
  243. data/test/unit/overrides_test.rb +9 -0
  244. data/test/unit/rest_api_test.rb +1590 -0
  245. data/vendor/assets/javascripts/MIT-LICENSE.txt +20 -0
  246. data/vendor/assets/javascripts/bootstrap-collapse.js +157 -0
  247. data/vendor/assets/javascripts/bootstrap-dropdown.js +100 -0
  248. data/vendor/assets/javascripts/bootstrap-tab.js +135 -0
  249. data/vendor/assets/javascripts/bootstrap-transition.js +61 -0
  250. data/vendor/assets/javascripts/jquery.spin.js +47 -0
  251. data/vendor/assets/javascripts/jquery.ui.widget.js +16 -0
  252. data/vendor/assets/javascripts/jquery_cookie.js +41 -0
  253. data/vendor/assets/javascripts/jquery_validate_min.js +51 -0
  254. data/vendor/assets/javascripts/modernizr.min.js +2 -0
  255. data/vendor/assets/javascripts/plugins.js +16 -0
  256. data/vendor/assets/stylesheets/bootstrap/_accordion.scss +28 -0
  257. data/vendor/assets/stylesheets/bootstrap/_alerts.scss +70 -0
  258. data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +22 -0
  259. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +147 -0
  260. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +183 -0
  261. data/vendor/assets/stylesheets/bootstrap/_carousel.scss +121 -0
  262. data/vendor/assets/stylesheets/bootstrap/_close.scss +18 -0
  263. data/vendor/assets/stylesheets/bootstrap/_code.scss +57 -0
  264. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +18 -0
  265. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +130 -0
  266. data/vendor/assets/stylesheets/bootstrap/_forms.scss +522 -0
  267. data/vendor/assets/stylesheets/bootstrap/_grid.scss +8 -0
  268. data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +20 -0
  269. data/vendor/assets/stylesheets/bootstrap/_labels.scss +32 -0
  270. data/vendor/assets/stylesheets/bootstrap/_layouts.scss +17 -0
  271. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +602 -0
  272. data/vendor/assets/stylesheets/bootstrap/_modals.scss +84 -0
  273. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +299 -0
  274. data/vendor/assets/stylesheets/bootstrap/_navs.scss +353 -0
  275. data/vendor/assets/stylesheets/bootstrap/_pager.scss +30 -0
  276. data/vendor/assets/stylesheets/bootstrap/_pagination.scss +55 -0
  277. data/vendor/assets/stylesheets/bootstrap/_popovers.scss +49 -0
  278. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
  279. data/vendor/assets/stylesheets/bootstrap/_reset.scss +126 -0
  280. data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +33 -0
  281. data/vendor/assets/stylesheets/bootstrap/_sprites.scss +158 -0
  282. data/vendor/assets/stylesheets/bootstrap/_tables.scss +150 -0
  283. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +35 -0
  284. data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +35 -0
  285. data/vendor/assets/stylesheets/bootstrap/_type.scss +218 -0
  286. data/vendor/assets/stylesheets/bootstrap/_utilities.scss +23 -0
  287. data/vendor/assets/stylesheets/bootstrap/_variables.scss +107 -0
  288. data/vendor/assets/stylesheets/bootstrap/_wells.scss +17 -0
  289. data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +66 -0
  290. data/vendor/assets/stylesheets/bootstrap/responsive.scss +334 -0
  291. metadata +506 -0
@@ -0,0 +1,40 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+ module ApplicationRedirector
4
+ #
5
+ # Provide a redirect helper which allows the user to redirect
6
+ # to an application relative url.
7
+ #
8
+ # Usage (in routes.rb):
9
+ #
10
+ # match 'power' => app_redirect('platform')
11
+ # match 'email_confirm_express' => app_redirect {|p, req| "email_confirm?#{req.query_string}"}
12
+ #
13
+ # will generate a redirect from /<appbaseuri>/power to /<appbaseuri>/platform, regardless of
14
+ # whether Rails is run as a root site or as a subsite. Should respond to the same arguments as
15
+ # redirect.
16
+ #
17
+ def app_redirect(*args, &block)
18
+ options = args.last.is_a?(Hash) ? args.pop : {}
19
+ path = args.shift || block
20
+ path_proc = path.is_a?(Proc) ? path : lambda do |params|
21
+ path % params
22
+ end
23
+ block = lambda do |params, req|
24
+ newargs = [params]
25
+ newargs << req if path_proc.arity > 1
26
+ uri = URI.join('http://localhost', "#{req.script_name}/", path_proc.call(*newargs))
27
+ Rails.logger.debug "URI #{uri}, #{req.script_name}"
28
+ if uri.host == 'localhost'
29
+ uri.request_uri
30
+ else
31
+ uri
32
+ end
33
+ end
34
+
35
+ redirect(block, options)
36
+ end
37
+ end
38
+ include ApplicationRedirector
39
+ end
40
+ end
@@ -0,0 +1,15 @@
1
+ module FilterHash
2
+ def self.safe_values(h)
3
+ tests = filters
4
+ out = nil
5
+ h.keys.each do |k|
6
+ key_s = k.to_s.downcase
7
+ (out ||= h.dup)[k] = '[FILTERED]' if tests.any?{ |s| key_s.include?(s) }
8
+ end
9
+ out || h
10
+ end
11
+ protected
12
+ def self.filters
13
+ @filters ||= Rails.application.config.filter_parameters.map(&:to_s).map(&:downcase).uniq
14
+ end
15
+ end
@@ -0,0 +1,51 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+
4
+ def openshift_console(*args)
5
+ opts = args.extract_options!
6
+ openshift_console_routes
7
+ openshift_account_routes unless (Array(opts[:skip]).include? :account || Console.config.disable_account)
8
+ root :to => 'console_index#index', :via => :get, :as => :console
9
+ end
10
+
11
+ protected
12
+
13
+ def openshift_console_routes
14
+ match 'help' => 'console_index#help', :via => :get, :as => 'console_help'
15
+ match 'unauthorized' => 'console_index#unauthorized', :via => :get, :as => 'unauthorized'
16
+
17
+ # Application specific resources
18
+ resources :application_types, :only => [:show, :index], :id => /[^\/]+/
19
+ resources :applications do
20
+ resources :cartridges, :only => [:show, :create, :index], :id => /[^\/]+/
21
+ resources :cartridge_types, :only => [:show, :index], :id => /[^\/]+/
22
+
23
+ resource :building, :controller => :building, :id => /[^\/]+/, :only => [:show, :new, :destroy, :create] do
24
+ get :delete
25
+ end
26
+
27
+ resource :scaling, :controller => :scaling, :only => [:show, :new] do
28
+ get :delete
29
+ resources :cartridges, :controller => :scaling, :only => [:update], :id => /[^\/]+/, :format => false #, :format => /json|csv|xml|yaml/
30
+ end
31
+
32
+ member do
33
+ get :delete
34
+ get :get_started
35
+ end
36
+ end
37
+ end
38
+
39
+ def openshift_account_routes
40
+ # Account specific resources
41
+ resource :account,
42
+ :controller => :account,
43
+ :only => [:show]
44
+
45
+ scope 'account' do
46
+ resource :domain, :only => [:new, :create, :edit, :update]
47
+ resources :keys, :only => [:new, :create, :destroy]
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ module Console
2
+ module VERSION #:nocov:
3
+ STRING = Gem.loaded_specs['openshift-origin-console'].version.to_s rescue '0.0.0'
4
+ end
5
+ end
@@ -0,0 +1,79 @@
1
+ class GenerateConsoleViewTask < Rake::TaskLib
2
+ attr_accessor :layout, :views
3
+
4
+ def initialize(name)
5
+ yield self if block_given?
6
+ define(name)
7
+ end
8
+ def define(name)
9
+ task name => [:environment] do
10
+ views.each_pair do |view_path, file|
11
+ File.open(File.join(Rails.root, 'public', file), 'w') do |f|
12
+ f.write(render(view_path))
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ protected
19
+ def render(template)
20
+ view.render :template => template.dup, :layout => layout
21
+ end
22
+ def controller_class
23
+ ConsoleController
24
+ end
25
+ def controller
26
+ controller = controller_class.new
27
+ controller.request = ActionDispatch::TestRequest.new({'SCRIPT_NAME' => ENV['RAILS_RELATIVE_URL_ROOT']})
28
+ controller.env = controller.request.env
29
+ controller
30
+ end
31
+
32
+ def add_view_helpers(view, routes)
33
+ view.class_eval do
34
+ include routes.url_helpers
35
+
36
+ include Console::LayoutHelper
37
+ include Console::HelpHelper
38
+ include Console::Html5BoilerplateHelper
39
+ include Console::ModelHelper
40
+ include Console::SecuredHelper
41
+ include Console::CommunityHelper
42
+ include Console::ConsoleHelper
43
+ end
44
+ end
45
+
46
+ def subclass_view(view, routes)
47
+ view.class_eval do
48
+ def protect_against_forgery?
49
+ false
50
+ end
51
+
52
+ def default_url_options
53
+ {:host => 'localhost'}
54
+ end
55
+ end
56
+ end
57
+
58
+ def view
59
+ view = ActionView::Base.new(ActionController::Base.view_paths, {}, controller)
60
+
61
+ routes = Rails.application.routes
62
+ routes.default_url_options = {:host => 'localhost'}
63
+
64
+ add_view_helpers(view, routes)
65
+ subclass_view(view, routes)
66
+
67
+ view
68
+ end
69
+ end
70
+
71
+ namespace :assets do
72
+ GenerateConsoleViewTask.new(:public_pages) do |t|
73
+ t.layout = 'layouts/console'
74
+ t.views = {
75
+ 'console/not_found' => '404.html',
76
+ 'console/error' => '500.html',
77
+ }
78
+ end
79
+ end
@@ -0,0 +1,18 @@
1
+ namespace :engine do
2
+ desc "Report code statistics (KLOCs, etc) from the application"
3
+ task :stats do
4
+ ENGINE_STATS_DIRECTORIES = [
5
+ %w(Controllers app/controllers),
6
+ %w(Helpers app/helpers),
7
+ %w(Models app/models),
8
+ %w(Libraries lib/),
9
+ %w(APIs app/apis),
10
+ %w(Integration\ tests test/integration),
11
+ %w(Functional\ tests test/functional),
12
+ %w(Unit\ tests test/unit)
13
+ ].collect { |name, dir| [ name, "#{ENGINE_PATH}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
14
+
15
+ require 'rails/code_statistics'
16
+ CodeStatistics.new(*ENGINE_STATS_DIRECTORIES).to_s
17
+ end
18
+ end
@@ -0,0 +1,73 @@
1
+
2
+ class Rake::Task
3
+ def abandon
4
+ prerequisites.clear
5
+ @actions.clear
6
+ end
7
+ end
8
+
9
+ namespace :test do
10
+ namespace :prepare do
11
+ task :ci_reporter do
12
+ # removed deletion of test cases
13
+ if Gem.loaded_specs['ci_reporter']
14
+ require 'ci/reporter/rake/test_unit'
15
+ path = File.join(Gem.loaded_specs["ci_reporter"].full_gem_path, 'lib', 'ci', 'reporter', 'rake', 'test_unit_loader.rb')
16
+ test_loader = CI::Reporter.maybe_quote_filename path
17
+ ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{test_loader}"
18
+ end
19
+ end
20
+ end
21
+ task 'test:prepare' => 'test:prepare:ci_reporter'
22
+
23
+ Rake::TestTask.new :restapi => 'test:prepare' do |t|
24
+ t.libs << 'test'
25
+ t.test_files = FileList[
26
+ 'test/**/rest_api_test.rb',
27
+ 'test/**/rest_api/*_test.rb',
28
+ ]
29
+ end
30
+
31
+ namespace :check do
32
+ covered = []
33
+
34
+ Rake::TestTask.new :applications => ['test:prepare'] do |t|
35
+ t.libs << 'test'
36
+ covered.concat(t.test_files = FileList[
37
+ 'test/functional/applications_controller_sanity_test.rb',
38
+ 'test/functional/applications_controller_test.rb',
39
+ 'test/functional/application_types_controller_test.rb',
40
+ ])
41
+ end
42
+
43
+ Rake::TestTask.new :cartridges => ['test:prepare'] do |t|
44
+ t.libs << 'test'
45
+ covered.concat(t.test_files = FileList[
46
+ 'test/functional/cartridges_controller_test.rb',
47
+ 'test/functional/cartridge_types_controller_test.rb',
48
+ ])
49
+ end
50
+
51
+ Rake::TestTask.new :misc1 => ['test:prepare'] do |t|
52
+ t.libs << 'test'
53
+ covered.concat(t.test_files = FileList[
54
+ 'test/functional/domains_controller_test.rb',
55
+ 'test/functional/scaling_controller_test.rb',
56
+ ])
57
+ end
58
+
59
+ Rake::TestTask.new :restapi_integration => ['test:prepare'] do |t|
60
+ t.libs << 'test'
61
+ covered.concat(t.test_files = FileList[
62
+ 'test/integration/rest_api/**_test.rb',
63
+ ])
64
+ end
65
+
66
+ Rake::TestTask.new :base => ['test:prepare'] do |t|
67
+ t.libs << 'test'
68
+ t.test_files = FileList['test/**/*_test.rb'] - covered
69
+ end
70
+ end
71
+ task :check => Rake::Task.tasks.select{ |t| t.name.match(/\Atest:check:/) }.map(&:name)
72
+ task :extended => []
73
+ end
@@ -0,0 +1,27 @@
1
+ # Must be the first module imported at entry points (executables that run
2
+ # in seperate processes from the test harness) otherwise coverage will be
3
+ # incomplete
4
+
5
+ require 'simplecov'
6
+ SimpleCov.start 'rails' do
7
+ coverage_dir 'test/coverage/'
8
+ command_name 'Console tests'
9
+
10
+ # Filters - these files will be ignored.
11
+ add_filter 'app/models/rest_api/railties'
12
+
13
+ merge_timeout 1000
14
+
15
+ # Groups - general categories of test areas
16
+ #add_group('Controllers') { |src_file| src_file.filename.include?(File.join(%w[lib rhc commands])) }
17
+ #add_group('REST API') { |src_file| src_file.filename.include?(File.join(%w[lib rhc])) }
18
+ #add_group('REST') { |src_file| src_file.filename.include?(File.join(%w[lib rhc/rest])) }
19
+ #add_group('Legacy') { |src_file| src_file.filename.include?(File.join(%w[bin])) or
20
+ # src_file.filename.include?(File.join(%w[lib rhc-common.rb])) }
21
+ #add_group('Test') { |src_file| src_file.filename.include?(File.join(%w[features])) or
22
+ # src_file.filename.include?(File.join(%w[spec])) }
23
+
24
+ #use_merging = true
25
+ # Note, the #:nocov: coverage exclusion should only be used on external functions
26
+ # that cannot be nondestructively tested in a developer environment.
27
+ end
@@ -0,0 +1 @@
1
+ [{"scales_from":1,"name":"nodejs-0.6","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_NODEJS_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Node.js 0.6","tags":["cartridge","javascript","nodejs","web_framework"],"description":"Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js is perfect for data-intensive real-time applications that run across distributed devices.","version":"0.6.10","type":"standalone"},{"scales_from":1,"name":"zend-5.6","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"Commercial","properties":[{"name":"OPENSHIFT_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.zend.com","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"http://static.zend.com/topics/Zend-License-EULA-2010-09-2.pdf","collocated_with":[],"display_name":"Zend Server 5.6","tags":["cartridge","php","web_framework"],"description":"A PHP server by Zend for applications that require performance, reliability and security. Zend Server combined with Zend Studio offers code optimization, debugging, and code assist.","version":5.6,"type":"standalone"},{"scales_from":1,"name":"ruby-1.9","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"www.ruby-lang.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Ruby 1.9","tags":["cartridge","ruby","web_framework"],"description":"Ruby is a dynamic, reflective, general-purpose object-oriented programming language. Popular development frameworks include Ruby on Rails and Sinatra.","version":"1.0.0","type":"standalone"},{"scales_from":1,"name":"jbossas-7","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_JBOSSAS_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.jboss.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"JBoss Application Server 7.1","tags":["cartridge","java","jboss","web_framework"],"description":"The leading open source Java EE6 application server for enterprise Java applications. Popular development frameworks include Seam, CDI, Weld, and Spring.","version":"7.1.0","type":"standalone"},{"scales_from":1,"name":"python-2.6","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.python.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Python 2.6","tags":["cartridge","python","web_framework"],"description":"Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Popular development frameworks include: Django, Bottle, Pylons, Zope and TurboGears.","version":"1.0.0","type":"standalone"},{"scales_from":1,"name":"jenkins-1.4","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_JENKINS_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"},{"name":"JENKINS_URL","description":"URL for the jenkins server","type":"environment"},{"name":"JENKINS_USERNAME","description":"Admin user on jenkins server","type":"environment"},{"name":"JENKINS_PASSWORD","description":"Admin user's password for jenkins server","type":"environment"},{"name":"username","description":"Admin user on jenkins server","type":"cart_data"},{"name":"password","description":"Admin user's passowrd on jenkins server","type":"cart_data"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.jenkins-ci.org","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"Jenkins Server 1.4","tags":["cartridge","web_framework","ci"],"description":"Jenkins is a continuous integration (CI) build server that is deeply integrated into OpenShift. See the Jenkins info page for more.","version":"0.84.1","type":"standalone"},{"scales_from":1,"name":"ruby-1.8","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"www.ruby-lang.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Ruby 1.8","tags":["cartridge","ruby","web_framework"],"description":"Ruby is a dynamic, reflective, general-purpose object-oriented programming language. We recommend using Ruby 1.9 for new applications.","version":"1.0.0","type":"standalone"},{"scales_from":1,"name":"jbosseap-6.0","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_JBOSSEAP_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.redhat.com/products/jbossenterprisemiddleware/application-platform/","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"JBoss Enterprise Application Platform 6.0","tags":["cartridge","java","jboss","jee_full_profile","web_framework"],"description":"Market-leading open source enterprise platform for next-generation, highly transactional enterprise Java applications. Build and deploy enterprise Java in the cloud.","version":"6.0.0","type":"standalone"},{"scales_from":1,"name":"diy-0.1","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_DIY_LOG_DIR","description":"Directory to store application log files.","type":"environemnt"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environemnt"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environemnt"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environemnt"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environemnt"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environemnt"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environemnt"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environemnt"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environemnt"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environemnt"}],"help_topics":{"Getting Started":"https://www.openshift.com/community/videos/getting-started-with-diy-applications-on-openshift"},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"http://www.apache.org/licenses/LICENSE-2.0.txt","collocated_with":[],"display_name":"Do-It-Yourself","tags":["cartridge","web_framework","experimental"],"description":"The Do-It-Yourself (DIY) application type is a blank slate for trying unsupported languages, frameworks, and middleware on OpenShift. See the community site for examples of bringing your favorite framework to OpenShift.","version":"1.0.0","type":"standalone"},{"scales_from":1,"name":"jbossews-1.0","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_JBOSSEAP_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.redhat.com/products/jbossenterprisemiddleware/application-platform/","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"JBoss Enterprise Web Server 1.0","tags":["cartridge","java","jboss","tomcat","web_framework"],"description":"Market-leading open source enterprise platform for next-generation, highly transactional enterprise Java applications. Build and deploy enterprise Java in the cloud.","version":"1.0.2","type":"standalone"},{"scales_from":1,"name":"php-5.3","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"The PHP License, version 3.0","properties":[{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.php.net","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"http://www.php.net/license/3_0.txt","collocated_with":[],"display_name":"PHP 5.3","tags":["cartridge","php","web_framework"],"description":"PHP is a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. Popular development frameworks include: CakePHP, Zend, Symfony, and Code Igniter.","version":"5.3.2","type":"standalone"},{"scales_from":1,"name":"perl-5.10","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"OPENSHIFT_PERL_LOG_DIR","description":"Directory to store application log files.","type":"environment"},{"name":"OPENSHIFT_TMP_DIR","description":"Directory to store application temporary files.","type":"environment"},{"name":"OPENSHIFT_REPO_DIR","description":"Application root directory where application files reside. This directory is reset everytime you do a git-push","type":"environment"},{"name":"OPENSHIFT_INTERNAL_PORT","description":"Internal port to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_INTERNAL_IP","description":"Internal IP to which the web-framework binds to.","type":"environment"},{"name":"OPENSHIFT_APP_DNS","description":"Fully qualified domain name for the application.","type":"environment"},{"name":"OPENSHIFT_APP_NAME","description":"Application name","type":"environment"},{"name":"OPENSHIFT_DATA_DIR","description":"Directory to store application data files. Preserved across git-pushes. Not shared across gears.","type":"environment"},{"name":"OPENSHIFT_APP_UUID","description":"Unique ID which identified the application. Does not change between gears.","type":"environment"},{"name":"OPENSHIFT_GEAR_UUID","description":"Unique ID which identified the gear. This value changes between gears.","type":"environment"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.perl.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Perl 5.10","tags":["cartridge","perl","web_framework"],"description":"Perl is a high-level, general-purpose, interpreted, dynamic programming language. Dynamic content produced by Perl scripts can be served in response to incoming web requests.","version":"1.0.0","type":"standalone"},{"scales_from":1,"name":"mongodb-2.2","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Root user on mongo database","type":"cart_data"},{"name":"password","description":"Password for root user on mongo database","type":"cart_data"},{"name":"database_name","description":"Mongo DB name","type":"cart_data"},{"name":"connection_url","description":"Mongo DB connection URL","type":"cart_data"}],"help_topics":[{"Building with MongoDB":"https://openshift.redhat.com/community/developers/mongodb"}],"website":"http://www.10gen.com","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"http://www.apache.org/licenses/LICENSE-2.0.txt","collocated_with":[],"display_name":"MongoDB NoSQL Database 2.2","tags":["cartridge","database","nosql"],"description":"MongoDB is a scalable, high-performance, open source NoSQL database.","version":"2.2.0","type":"embedded"},{"scales_from":1,"name":"cron-1.4","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[],"help_topics":{"Getting Started Guide":"https://openshift.redhat.com/community/blogs/getting-started-with-cron-jobs-on-openshift"},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"http://www.apache.org/licenses/LICENSE-2.0.txt","collocated_with":[],"display_name":"Cron 1.4","tags":["cartridge"],"description":"The Cron cartridge allows you to run command line programs at scheduled times. Use this for background jobs and periodic processing.","version":1.4,"type":"embedded"},{"scales_from":1,"name":"mysql-5.1","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Root user on mysql database","type":"cart_data"},{"name":"password","description":"Password for root user on mysql database","type":"cart_data"},{"name":"database_name","description":"MySQL DB name","type":"cart_data"},{"name":"connection_url","description":"MySQL DB connection URL","type":"cart_data"}],"help_topics":[{"Building with MySQL":"http://docs.redhat.com/docs/en-US/OpenShift/2.0/html/User_Guide/sect-User_Guide-Working_With_Database_Cartridges.html"}],"website":"http://www.mysql.com","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"MySQL Database 5.1","tags":["cartridge","database"],"description":"MySQL is a multi-user, multi-threaded SQL database server.","version":5.1,"type":"embedded"},{"scales_from":1,"name":"postgresql-8.4","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Root user on PostgreSQL database","type":"cart_data"},{"name":"password","description":"Password for root user on PostgreSQL database","type":"cart_data"},{"name":"database_name","description":"PostgreSQL DB name","type":"cart_data"},{"name":"connection_url","description":"PostgreSQL DB connection URL","type":"cart_data"}],"help_topics":[{"Building with PostGreSQL":"http://docs.redhat.com/docs/en-US/OpenShift/2.0/html/User_Guide/sect-User_Guide-Working_With_Database_Cartridges.html"}],"website":"http://www.postgresql.org","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"PostgreSQL Database 8.4","tags":["cartridge","database"],"description":"PostgreSQL is an advanced Object-Relational database management system","version":8.4,"type":"embedded"},{"scales_from":1,"name":"haproxy-1.4","current_scale":0,"status_messages":null,"scales_with":null,"license":"unknown","properties":[],"help_topics":{},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"HAProxy 1.4","tags":["cartridge","web_proxy","git_host","scales"],"description":"HAProxy can be used as a load balancer and scaling agent for web frameworks","version":"1.4.20","type":"embedded"},{"scales_from":1,"name":"10gen-mms-agent-0.1","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"unknown","properties":[{"name":"monitoring_url","description":"10gen-mms-agent-0.1 monitoring URL","type":"cart_data"}],"help_topics":{"MMS Manual":"https://mms.10gen.com/help/"},"website":"https://mms.10gen.com/","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"https://mms.10gen.com/links/terms-of-service","collocated_with":[],"display_name":"10gen Mongo Monitoring Service Agent 0.1","tags":["cartridge","database-support"],"description":"MongoDB Monitoring Service (MMS) instruments MongoDB and provides information about current and historical operational metrics of your system.","version":"1.3.7","type":"embedded"},{"scales_from":1,"name":"phpmyadmin-3.4","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Admin user on phpmyadmin interface","type":"cart_data"},{"name":"password","description":"Password for admin user on phpmyadmin interface","type":"cart_data"},{"name":"connection_url","description":"phpMyAdmin connection URL","type":"cart_data"}],"help_topics":{},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"phpMyAdmin 3.4","tags":["cartridge"],"description":"Web based MySQL admin tool. Requires the MySQL cartridge to be installed first.","version":"1.1.0","type":"embedded"},{"scales_from":1,"name":"metrics-0.1","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"GPLv2","properties":[{"name":"connection_url","description":"Application metrics URL","type":"cart_data"}],"help_topics":{},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"OpenShift Metrics 0.1","tags":["cartridge"],"description":"An experimental cartridge that demonstrates retrieving real-time statistics from your application. May be removed or replaced in the future.","version":"1.0.0","type":"embedded"},{"scales_from":1,"name":"phpmoadmin-1.0","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Admin user on phpmoadmin interface","type":"cart_data"},{"name":"password","description":"Password for admin user on phpmoadmin interface","type":"cart_data"},{"name":"connection_url","description":"phpMoAdmin connection URL","type":"cart_data"}],"help_topics":{},"website":"http://www.phpmoadmin.com","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"phpMoAdmin 1.0","tags":["cartridge"],"description":"Web based MongoDB administration tool. Requires the MongoDB cartridge to be installed first.","version":"1.0.0","type":"embedded"},{"scales_from":1,"name":"rockmongo-1.1","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"username","description":"Admin user on rockmongo interface","type":"cart_data"},{"name":"password","description":"Password for admin user on rockmongo interface","type":"cart_data"},{"name":"connection_url","description":"RockMongo connection URL","type":"cart_data"}],"help_topics":{},"website":"","gear_profile":null,"supported_scales_to":1,"supported_scales_from":1,"scales_to":1,"license_url":"","collocated_with":[],"display_name":"RockMongo 1.1","tags":["cartridge"],"description":"Web based MongoDB administration tool. Requires the MongoDB cartridge to be installed first.","version":"1.1.0","type":"embedded"},{"scales_from":1,"name":"jenkins-client-1.4","current_scale":0,"status_messages":null,"scales_with":"haproxy-1.4","license":"ASL 2.0","properties":[{"name":"job_url","description":"URL for the build job submitted on jenkins server","type":"cart_data"}],"help_topics":{"Developer Center":"https://openshift.redhat.com/community/developers"},"website":"http://www.jenkins-ci.org","gear_profile":null,"supported_scales_to":-1,"supported_scales_from":1,"scales_to":-1,"license_url":"","collocated_with":[],"display_name":"Jenkins Client 1.4","tags":["cartridge","ci_builder"],"description":"The Jenkins client connects to your Jenkins application and enables builds and testing of your application. Requires the Jenkins Application to be created via the new application page.","version":"1.0.0","type":"embedded"}]
@@ -0,0 +1,3 @@
1
+ id href name updated summary body cartridges priority tags language icon website admin_tags initial_git_url
2
+ 12069 /community/content/ruby-and-mongo Ruby and Mongo 1351681507 Start an application with ruby and mongo. <p>Start an application with ruby and mongo.</p> ruby-*, mongodb-* 1 mongo, ruby Ruby
3
+ 12070 /community/content/wordpress-34 Wordpress 3.4 1351688441 A fantastic blog ecosystem <p>A fantastic blog ecosystem</p> php-5.3, mysql-5.1 blog, php, wordpress PHP /community/sites/default/files/quickstarts/g3281.png https://www.wordpress.org new https://github.com/openshift/wordpress-example
@@ -0,0 +1,14 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ class AccountControllerTest < ActionController::TestCase
4
+
5
+ test "should render dashboard" do
6
+ with_configured_user
7
+ get :show
8
+
9
+ assert_response :success
10
+ assert assigns(:user).login.present?
11
+ assert !assigns(:keys).nil?
12
+ assert assigns(:domain).nil?
13
+ end
14
+ end
@@ -0,0 +1,251 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ class ApplicationTypesControllerTest < ActionController::TestCase
4
+
5
+ setup{ Quickstart.reset! }
6
+
7
+ test 'should show index with proper title' do
8
+ with_unique_user
9
+ get :index
10
+ assert_response :success
11
+ assert_select 'head title', 'OpenShift Origin'
12
+ end
13
+
14
+ test "should show index" do
15
+ with_unique_user
16
+ get :index
17
+ assert_response :success
18
+ assert_template :index
19
+ assert groups = assigns(:type_groups)
20
+ assert groups.length > 1, groups.length.to_s
21
+ assert groups.any?{ |g| g[0] == 'Java' }
22
+ assert groups.first[1].present?
23
+ end
24
+
25
+ test "should be able to find templates" do
26
+ with_unique_user
27
+ types = ApplicationType.all
28
+ (templates,) = types.partition{|t| t.template?}
29
+ omit("No templates have been registered on this server") if templates.empty?
30
+ assert_not_equal 0, templates.length, "There should be templates to test against"
31
+ end
32
+
33
+ test "should be able to find quickstarts" do
34
+ with_unique_user
35
+ types = ApplicationType.all
36
+ (quickstarts,) = types.partition{|t| t.quickstart?}
37
+ omit("No quickstarts have been registered on this server") if quickstarts.empty?
38
+ assert_not_equal 0, quickstarts.length, "There should be quickstarts to test against"
39
+ end
40
+
41
+ test "should show empty search results" do
42
+ with_unique_user
43
+ ApplicationType.expects(:search).returns([])
44
+ get :index, :search => 'foo'
45
+ assert_response :success
46
+ assert_template :search
47
+ assert_equal 'foo', assigns(:search)
48
+ assert groups = assigns(:type_groups)
49
+ assert_equal 1, groups.length
50
+ assert_equal "Matches search 'foo'", groups.first[0]
51
+ assert groups.first[1].empty?
52
+ assert tags = assigns(:browse_tags)
53
+ assert tags.present?
54
+ assert tags.first[0].is_a? String
55
+ assert tags.first[1].is_a? Symbol
56
+ end
57
+
58
+ def assert_standard_show_type(t)
59
+ assert_response :success
60
+ assert type = assigns(:application_type)
61
+ assert_equal t.display_name, type.display_name
62
+ assert assigns(:application)
63
+ assert assigns(:domain)
64
+ assert css_select('input#application_domain_name').present?
65
+ if t.tags.include?(:template) or t.id == 'diy-0.1'
66
+ # Sanity-check known non-scalable types
67
+ assert_equal false, t.scalable?
68
+ elsif t.id == 'php-5.3'
69
+ # Sanity-check a known scaling-capable type
70
+ assert_equal true, t.scalable?
71
+ end
72
+ end
73
+
74
+ test "should show type page for cartridge" do
75
+ with_unique_user
76
+ type = ApplicationType.all.select{ |t| t.cartridge? }.sample(1).first
77
+
78
+ get :show, :id => type.id
79
+ assert_standard_show_type(type)
80
+ end
81
+
82
+ test "should show type page for quickstart" do
83
+ with_unique_user
84
+ type = ApplicationType.all.select(&:quickstart?).sample(1).first
85
+ omit("No quickstarts registered on this server") if type.nil?
86
+
87
+ get :show, :id => type.id
88
+ assert_standard_show_type(type)
89
+ end
90
+
91
+ test "should show type page for application template" do
92
+ with_unique_user
93
+ type = ApplicationType.all.select(&:template?).sample(1).first
94
+ omit("No templates registered on this server") if type.nil?
95
+
96
+ get :show, :id => type.id
97
+ assert_standard_show_type(type)
98
+ end
99
+
100
+ test "should handle invalid quickstart page" do
101
+ with_unique_user
102
+ type = Quickstart.new(:id => 'test', :name => '', :cartridges => '[{')
103
+ Quickstart.expects(:find).returns(type)
104
+
105
+ get :show, :id => 'quickstart!test'
106
+ assert_standard_show_type(type)
107
+ end
108
+
109
+ test "should render custom type" do
110
+ with_unique_user
111
+ get :show, :id => 'custom'
112
+ assert_response :success
113
+ assert_select '.alert.alert-error', /No cartridges are defined for this type/i
114
+ assert_select 'h3 > span.text-warning', 'None'
115
+ assert_select '.btn-primary[disabled=disabled]'
116
+ assert_select "input[name='application[initial_git_url]']", 0
117
+ end
118
+
119
+ test "should render custom single cart type" do
120
+ with_unique_user
121
+ get :show, :id => 'custom', :cartridges => 'ruby-1.9'
122
+ assert_response :success
123
+ assert_select 'h3', 'Ruby 1.9'
124
+ assert_select 'h3', 'From Scratch'
125
+ end
126
+
127
+ test "should render custom cart type with a choice" do
128
+ with_unique_user
129
+ get :show, :id => 'custom', :cartridges => 'ruby'
130
+ assert_response :success
131
+ assert_select "select[name='application[cartridges][]'] > option", 'Ruby 1.9'
132
+ assert_select "select[name='application[cartridges][]'] > option", 'Ruby 1.8'
133
+ end
134
+
135
+ test "should render custom multiple carts" do
136
+ with_unique_user
137
+ get :show, :id => 'custom', :cartridges => ['ruby-1.9', 'mysql-5.1']
138
+ assert_response :success
139
+ assert_select 'h3', /Ruby 1\.9/i
140
+ assert_select 'h3', /MySQL/i
141
+ end
142
+
143
+ test "should not render custom valid JSON" do
144
+ with_unique_user
145
+ get :show, :id => 'custom', :cartridges => ['ruby-1.9', 'mysql-5.1'].to_json
146
+ assert_response :success
147
+ assert assigns(:cartridges).blank?
148
+ assert_select '.alert.alert-error', /No cartridges are defined for this type/i
149
+ assert_select 'h3 > span.text-warning', 'None'
150
+ end
151
+
152
+ test "should not fail on custom invalid JSON" do
153
+ with_unique_user
154
+ get :show, :id => 'custom', :cartridges => "[{'ruby-1.9'}, {'mysql-5.1'}]"
155
+ assert_response :success
156
+ assert assigns(:cartridges).blank?
157
+ assert_select '.alert.alert-error', /No cartridges are defined for this type/i
158
+ assert_select 'h3 > span.text-warning', 'None'
159
+ end
160
+
161
+ test "should render custom initial_git_url" do
162
+ with_unique_user
163
+ get :show,
164
+ :id => 'custom',
165
+ :cartridges => 'ruby-1.9',
166
+ :initial_git_url => 'http://foo.com',
167
+ :initial_git_branch => 'bar'
168
+ assert_response :success
169
+ assert_select 'h3 > a', 'http://foo.com'
170
+ #assert_select 'h3', /branch 'bar'/
171
+ end
172
+
173
+ test "should render advanced custom type" do
174
+ with_unique_user
175
+ get :show, :id => 'custom', :advanced => true, :initial_git_url => 'http://foo.com', :initial_git_branch => 'bar'
176
+ assert_response :success
177
+ assert assigns(:advanced)
178
+ assert_select '.alert.alert-error', /No cartridges are defined for this type/i
179
+ assert_select 'h3 > span.text-warning', 'None'
180
+ assert_select '.btn-primary[disabled=disabled]'
181
+ assert_select "select[name='application[scale]']"
182
+ assert_select "input[name='application[initial_git_url]']" do |inputs|
183
+ assert inputs.first['value'] == 'http://foo.com'
184
+ end
185
+ #assert_select "input[name='application[initial_git_branch]']" do |inputs|
186
+ # assert inputs.first['value'] == 'bar'
187
+ #end
188
+ end
189
+
190
+ test "show page should cache user capabilities" do
191
+ # set up the test
192
+ with_user_with_multiple_gear_sizes
193
+ user = User.find(:one, :as => @controller.current_user)
194
+ types = ApplicationType.all
195
+ type = types[0]
196
+
197
+ # confirm the session is clear of relevant keys
198
+ assert session.has_key?(:user_capabilities) == false
199
+
200
+ # make the request
201
+ get :show, :id => type.id
202
+
203
+ # compare the session cache with expected values
204
+ assert_equal [user.max_gears, user.consumed_gears, user.gear_sizes], session[:user_capabilities]
205
+ assert_equal user.gear_sizes, assigns(:capabilities).gear_sizes
206
+ assert_equal user.max_gears, assigns(:capabilities).max_gears
207
+ assert_equal user.consumed_gears, assigns(:capabilities).consumed_gears
208
+ end
209
+
210
+ test "show page should refresh cached user_capabilities" do
211
+ # set up the test
212
+ with_user_with_multiple_gear_sizes
213
+ user = User.find(:one, :as => @controller.current_user)
214
+ types = ApplicationType.all
215
+ type = types[0]
216
+
217
+ # seed the cache with values that will never be returned by the broker.
218
+ session[:user_capabilities] = ['test_value','test_value',['test_value','test_value']]
219
+
220
+ # make the request
221
+ get :show, :id => type.id
222
+
223
+ # confirm that the assigned values match our cached values
224
+ assert_equal [user.max_gears, user.consumed_gears, user.gear_sizes], session[:user_capabilities]
225
+ assert_equal user.max_gears, assigns(:capabilities).max_gears
226
+ assert_equal user.consumed_gears, assigns(:capabilities).consumed_gears
227
+ assert_equal user.gear_sizes, assigns(:capabilities).gear_sizes
228
+ end
229
+
230
+ test "should raise on missing type" do
231
+ with_unique_user
232
+ get :show, :id => 'missing_application_type'
233
+ assert_response :success
234
+ assert_select 'h1', /Application Type 'missing_application_type' does not exist/
235
+ end
236
+
237
+ test "should fill domain info" do
238
+ with_unique_user
239
+ with_unique_domain
240
+ t = ApplicationType.all[0]
241
+
242
+ get :show, :id => t.id
243
+ assert_response :success
244
+ assert type = assigns(:application_type)
245
+ assert_equal t.display_name, type.display_name
246
+ assert assigns(:application)
247
+ assert domain = assigns(:domain)
248
+ assert_equal @domain.id, domain.id
249
+ assert css_select('input#application_domain_name').empty?
250
+ end
251
+ end