openshift-origin-console 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT +1 -0
- data/Gemfile +21 -0
- data/LICENSE +203 -0
- data/README.md +123 -0
- data/Rakefile +44 -0
- data/app/assets/images/cartridge-edge.gif +0 -0
- data/app/assets/images/console/arrow-down.png +0 -0
- data/app/assets/images/console/console-sprite.png +0 -0
- data/app/assets/images/favicon-32.png +0 -0
- data/app/assets/images/loader-dark.gif +0 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/images/sprite-vert.png +0 -0
- data/app/assets/javascripts/console.js +10 -0
- data/app/assets/javascripts/console/form.js.coffee +51 -0
- data/app/assets/stylesheets/_alerts.scss +84 -0
- data/app/assets/stylesheets/_breadcrumbs.scss +31 -0
- data/app/assets/stylesheets/_buttons.scss +229 -0
- data/app/assets/stylesheets/_code.scss +86 -0
- data/app/assets/stylesheets/_custom.scss +207 -0
- data/app/assets/stylesheets/_footer.scss +54 -0
- data/app/assets/stylesheets/_forms.scss +710 -0
- data/app/assets/stylesheets/_grid.scss +28 -0
- data/app/assets/stylesheets/_input-prepend-append.scss +138 -0
- data/app/assets/stylesheets/_labels.scss +40 -0
- data/app/assets/stylesheets/_mixins.scss +76 -0
- data/app/assets/stylesheets/_override-variables.scss +1 -0
- data/app/assets/stylesheets/_responsive.scss +438 -0
- data/app/assets/stylesheets/_ribbon.scss +57 -0
- data/app/assets/stylesheets/_type.scss +306 -0
- data/app/assets/stylesheets/_utilities.scss +10 -0
- data/app/assets/stylesheets/_variables.scss +131 -0
- data/app/assets/stylesheets/common.css.scss +82 -0
- data/app/assets/stylesheets/console/_application.scss +194 -0
- data/app/assets/stylesheets/console/_base.scss +26 -0
- data/app/assets/stylesheets/console/_breadcrumbs.scss +32 -0
- data/app/assets/stylesheets/console/_buttons.scss +214 -0
- data/app/assets/stylesheets/console/_core.scss +1002 -0
- data/app/assets/stylesheets/console/_dropdowns.scss +63 -0
- data/app/assets/stylesheets/console/_help.scss +54 -0
- data/app/assets/stylesheets/console/_mixins.scss +11 -0
- data/app/assets/stylesheets/console/_navbar.scss +415 -0
- data/app/assets/stylesheets/console/_ribbon.scss +82 -0
- data/app/assets/stylesheets/console/_tile.scss +122 -0
- data/app/assets/stylesheets/origin.css.scss +37 -0
- data/app/controllers/account/dashboard.rb +13 -0
- data/app/controllers/account_controller.rb +3 -0
- data/app/controllers/application_types_controller.rb +80 -0
- data/app/controllers/applications_controller.rb +183 -0
- data/app/controllers/building_controller.rb +81 -0
- data/app/controllers/capability_aware.rb +18 -0
- data/app/controllers/cartridge_types_controller.rb +53 -0
- data/app/controllers/cartridges_controller.rb +43 -0
- data/app/controllers/console/auth/basic.rb +65 -0
- data/app/controllers/console/auth/none.rb +5 -0
- data/app/controllers/console/auth/remote_user.rb +69 -0
- data/app/controllers/console/rescue.rb +48 -0
- data/app/controllers/console_controller.rb +19 -0
- data/app/controllers/console_index_controller.rb +14 -0
- data/app/controllers/domain_aware.rb +26 -0
- data/app/controllers/domain_session_sweeper.rb +29 -0
- data/app/controllers/domains_controller.rb +30 -0
- data/app/controllers/keys_controller.rb +43 -0
- data/app/controllers/scaling_controller.rb +46 -0
- data/app/controllers/sshkey_aware.rb +23 -0
- data/app/controllers/sshkey_session_sweeper.rb +29 -0
- data/app/controllers/user_session_sweeper.rb +29 -0
- data/app/helpers/console/community_helper.rb +78 -0
- data/app/helpers/console/console_helper.rb +26 -0
- data/app/helpers/console/help_helper.rb +270 -0
- data/app/helpers/console/html5_boilerplate_helper.rb +63 -0
- data/app/helpers/console/layout_helper.rb +277 -0
- data/app/helpers/console/model_helper.rb +106 -0
- data/app/helpers/console/secured_helper.rb +5 -0
- data/app/models/alias.rb +10 -0
- data/app/models/application.rb +148 -0
- data/app/models/application_associations.rb +36 -0
- data/app/models/application_template.rb +90 -0
- data/app/models/application_type.rb +258 -0
- data/app/models/async_aware.rb +60 -0
- data/app/models/capabilities.rb +62 -0
- data/app/models/cartridge.rb +122 -0
- data/app/models/cartridge_type.rb +140 -0
- data/app/models/domain.rb +44 -0
- data/app/models/domain_associations.rb +33 -0
- data/app/models/embedded.rb +11 -0
- data/app/models/gear.rb +13 -0
- data/app/models/gear_group.rb +104 -0
- data/app/models/key.rb +87 -0
- data/app/models/quickstart.rb +135 -0
- data/app/models/rest_api.rb +130 -0
- data/app/models/rest_api/base.rb +781 -0
- data/app/models/rest_api/cacheable.rb +91 -0
- data/app/models/rest_api/environment.rb +13 -0
- data/app/models/rest_api/info.rb +34 -0
- data/app/models/rest_api/log_subscriber.rb +29 -0
- data/app/models/rest_api/railties/controller_runtime.rb +37 -0
- data/app/models/user.rb +27 -0
- data/app/models/user_associations.rb +6 -0
- data/app/views/account/_domain.html.haml +14 -0
- data/app/views/account/_keys.html.haml +20 -0
- data/app/views/account/_user.html.haml +5 -0
- data/app/views/account/show.html.haml +15 -0
- data/app/views/application_templates/_application_template.html.haml +5 -0
- data/app/views/application_types/_application_type.html.haml +19 -0
- data/app/views/application_types/_custom.html.haml +19 -0
- data/app/views/application_types/_persisted.html.haml +26 -0
- data/app/views/application_types/_tile.html.haml +9 -0
- data/app/views/application_types/index.html.haml +87 -0
- data/app/views/application_types/search.html.haml +67 -0
- data/app/views/application_types/show.html.haml +219 -0
- data/app/views/applications/_application.html.haml +34 -0
- data/app/views/applications/_applications_filter.html.haml +8 -0
- data/app/views/applications/_footer.html.haml +0 -0
- data/app/views/applications/_name.html.haml +28 -0
- data/app/views/applications/delete.html.haml +19 -0
- data/app/views/applications/get_started.html.haml +145 -0
- data/app/views/applications/index.html.haml +55 -0
- data/app/views/applications/show.html.haml +193 -0
- data/app/views/building/delete.html.haml +22 -0
- data/app/views/building/new.html.haml +57 -0
- data/app/views/building/show.html.haml +12 -0
- data/app/views/cartridge_types/_cartridge_type.html.haml +61 -0
- data/app/views/cartridge_types/index.html.haml +37 -0
- data/app/views/cartridge_types/show.html.haml +21 -0
- data/app/views/cartridges/next_steps.html.haml +58 -0
- data/app/views/cartridges/show.html.haml +1 -0
- data/app/views/console/error.html.haml +58 -0
- data/app/views/console/help.html.haml +90 -0
- data/app/views/console/not_found.html.haml +69 -0
- data/app/views/console/unauthorized.html.haml +7 -0
- data/app/views/domains/_domain.html.haml +14 -0
- data/app/views/domains/_form.html.haml +13 -0
- data/app/views/domains/edit.html.haml +5 -0
- data/app/views/domains/new.html.haml +6 -0
- data/app/views/keys/_form.html.haml +14 -0
- data/app/views/keys/_simple_form.html.haml +14 -0
- data/app/views/keys/new.html.haml +2 -0
- data/app/views/layouts/_footer.html.haml +38 -0
- data/app/views/layouts/_head.html.haml +35 -0
- data/app/views/layouts/console.html.haml +60 -0
- data/app/views/layouts/console/_header.html.haml +44 -0
- data/app/views/layouts/console/_identity.html.haml +7 -0
- data/app/views/layouts/console/_javascripts.html.haml +5 -0
- data/app/views/layouts/console/_stylesheets.html.haml +6 -0
- data/app/views/scaling/delete.html.haml +17 -0
- data/app/views/scaling/new.html.haml +24 -0
- data/app/views/scaling/show.html.haml +81 -0
- data/app/views/shared/_tracking.html.haml +0 -0
- data/conf/console.conf.example +108 -0
- data/conf/openshift_console.conf +10 -0
- data/config/cartridge_types.yml +54 -0
- data/config/initializers/barista_config.rb +86 -0
- data/config/initializers/cartridge_types.rb +5 -0
- data/config/initializers/console_security.rb +1 -0
- data/config/initializers/date_helper.rb +5 -0
- data/config/initializers/extended_logger.rb +51 -0
- data/config/initializers/formtastic.rb +100 -0
- data/config/initializers/inflections.rb +38 -0
- data/config/initializers/rdiscount.rb +8 -0
- data/config/initializers/rest_api.rb +22 -0
- data/config/initializers/sass.rb +30 -0
- data/config/initializers/session_trace.rb +32 -0
- data/config/initializers/x_frame_options.rb +53 -0
- data/config/locales/en.yml +12 -0
- data/lib/active_resource/associations.rb +107 -0
- data/lib/active_resource/associations/builder/association.rb +35 -0
- data/lib/active_resource/associations/builder/belongs_to.rb +5 -0
- data/lib/active_resource/associations/builder/has_many.rb +5 -0
- data/lib/active_resource/associations/builder/has_one.rb +5 -0
- data/lib/active_resource/persistent_connection.rb +341 -0
- data/lib/active_resource/persistent_http_mock.rb +68 -0
- data/lib/active_resource/reflection.rb +78 -0
- data/lib/console.rb +8 -0
- data/lib/console/config_file.rb +13 -0
- data/lib/console/configuration.rb +163 -0
- data/lib/console/engine.rb +28 -0
- data/lib/console/formtastic/bootstrap_form_builder.rb +369 -0
- data/lib/console/rails/app_redirector.rb +40 -0
- data/lib/console/rails/filter_hash.rb +15 -0
- data/lib/console/rails/routes.rb +51 -0
- data/lib/console/version.rb +5 -0
- data/lib/tasks/assets.rake +79 -0
- data/lib/tasks/stats.rake +18 -0
- data/lib/tasks/test_suites.rake +73 -0
- data/test/coverage_helper.rb +27 -0
- data/test/fixtures/cartridges.json +1 -0
- data/test/fixtures/quickstarts.csv +3 -0
- data/test/functional/account_controller_test.rb +14 -0
- data/test/functional/application_types_controller_test.rb +251 -0
- data/test/functional/applications_controller_sanity_test.rb +26 -0
- data/test/functional/applications_controller_test.rb +365 -0
- data/test/functional/building_controller_test.rb +203 -0
- data/test/functional/cartridge_types_controller_isolation_test.rb +68 -0
- data/test/functional/cartridge_types_controller_test.rb +48 -0
- data/test/functional/cartridges_controller_test.rb +83 -0
- data/test/functional/console_auth_basic_controller_test.rb +82 -0
- data/test/functional/console_auth_remote_user_controller_test.rb +90 -0
- data/test/functional/console_index_controller_test.rb +22 -0
- data/test/functional/domains_controller_test.rb +194 -0
- data/test/functional/keys_controller_test.rb +163 -0
- data/test/functional/quickstarts.json +18 -0
- data/test/functional/scaling_controller_test.rb +153 -0
- data/test/integration/assets_test.rb +34 -0
- data/test/integration/help_link_test.rb +43 -0
- data/test/integration/quickstarts_test.rb +24 -0
- data/test/integration/rescue_from_test.rb +25 -0
- data/test/integration/rest_api/application_test.rb +115 -0
- data/test/integration/rest_api/cartridge_test.rb +44 -0
- data/test/integration/rest_api/cartridge_type_test.rb +143 -0
- data/test/integration/rest_api/domain_test.rb +91 -0
- data/test/integration/rest_api/info_test.rb +9 -0
- data/test/integration/rest_api/key_test.rb +85 -0
- data/test/integration/static_pages_test.rb +44 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/controllers/application_controller.rb +5 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +48 -0
- data/test/rails_app/config/boot.rb +10 -0
- data/test/rails_app/config/database.yml +25 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +38 -0
- data/test/rails_app/config/environments/production.rb +70 -0
- data/test/rails_app/config/environments/test.rb +43 -0
- data/test/rails_app/config/initializers/auth.rb +0 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +4 -0
- data/test/rails_app/script/rails +6 -0
- data/test/support/auth.rb +111 -0
- data/test/support/base.rb +142 -0
- data/test/support/errors.rb +28 -0
- data/test/support/rest_api.rb +189 -0
- data/test/test_helper.rb +14 -0
- data/test/unit/active_model_compliance_test.rb +23 -0
- data/test/unit/async_aware_test.rb +55 -0
- data/test/unit/configuration_test.rb +158 -0
- data/test/unit/filter_hash_test.rb +64 -0
- data/test/unit/helpers/model_helper_test.rb +61 -0
- data/test/unit/overrides_test.rb +9 -0
- data/test/unit/rest_api_test.rb +1590 -0
- data/vendor/assets/javascripts/MIT-LICENSE.txt +20 -0
- data/vendor/assets/javascripts/bootstrap-collapse.js +157 -0
- data/vendor/assets/javascripts/bootstrap-dropdown.js +100 -0
- data/vendor/assets/javascripts/bootstrap-tab.js +135 -0
- data/vendor/assets/javascripts/bootstrap-transition.js +61 -0
- data/vendor/assets/javascripts/jquery.spin.js +47 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +16 -0
- data/vendor/assets/javascripts/jquery_cookie.js +41 -0
- data/vendor/assets/javascripts/jquery_validate_min.js +51 -0
- data/vendor/assets/javascripts/modernizr.min.js +2 -0
- data/vendor/assets/javascripts/plugins.js +16 -0
- data/vendor/assets/stylesheets/bootstrap/_accordion.scss +28 -0
- data/vendor/assets/stylesheets/bootstrap/_alerts.scss +70 -0
- data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +22 -0
- data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +147 -0
- data/vendor/assets/stylesheets/bootstrap/_buttons.scss +183 -0
- data/vendor/assets/stylesheets/bootstrap/_carousel.scss +121 -0
- data/vendor/assets/stylesheets/bootstrap/_close.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/_code.scss +57 -0
- data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +130 -0
- data/vendor/assets/stylesheets/bootstrap/_forms.scss +522 -0
- data/vendor/assets/stylesheets/bootstrap/_grid.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +20 -0
- data/vendor/assets/stylesheets/bootstrap/_labels.scss +32 -0
- data/vendor/assets/stylesheets/bootstrap/_layouts.scss +17 -0
- data/vendor/assets/stylesheets/bootstrap/_mixins.scss +602 -0
- data/vendor/assets/stylesheets/bootstrap/_modals.scss +84 -0
- data/vendor/assets/stylesheets/bootstrap/_navbar.scss +299 -0
- data/vendor/assets/stylesheets/bootstrap/_navs.scss +353 -0
- data/vendor/assets/stylesheets/bootstrap/_pager.scss +30 -0
- data/vendor/assets/stylesheets/bootstrap/_pagination.scss +55 -0
- data/vendor/assets/stylesheets/bootstrap/_popovers.scss +49 -0
- data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
- data/vendor/assets/stylesheets/bootstrap/_reset.scss +126 -0
- data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +33 -0
- data/vendor/assets/stylesheets/bootstrap/_sprites.scss +158 -0
- data/vendor/assets/stylesheets/bootstrap/_tables.scss +150 -0
- data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_type.scss +218 -0
- data/vendor/assets/stylesheets/bootstrap/_utilities.scss +23 -0
- data/vendor/assets/stylesheets/bootstrap/_variables.scss +107 -0
- data/vendor/assets/stylesheets/bootstrap/_wells.scss +17 -0
- data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +66 -0
- data/vendor/assets/stylesheets/bootstrap/responsive.scss +334 -0
- metadata +506 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
known_types = YAML::load(IO.read(Console.config.cartridge_type_metadata))
|
2
|
+
known_types.each{ |t| t[:description] = t.delete(:description_html).html_safe if t[:description_html].present? }
|
3
|
+
|
4
|
+
Rails.application.config.cartridge_types_by_name = known_types.inject({}) { |i, t| i[t[:name]] = t; t.freeze; i }.freeze
|
5
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require Console.config.security_controller.underscore
|
@@ -0,0 +1,51 @@
|
|
1
|
+
if Rails.version[0..3] != '3.0.'
|
2
|
+
class ActiveSupport::BufferedLogger
|
3
|
+
def formatter=(formatter)
|
4
|
+
@log.formatter = formatter
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class Formatter
|
9
|
+
SEVERITY_TO_TAG_MAP = {'DEBUG'=>'meh', 'INFO'=>'fyi', 'WARN'=>'hmm', 'ERROR'=>'wtf', 'FATAL'=>'omg', 'UNKNOWN'=>'???'}
|
10
|
+
SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
|
11
|
+
USE_HUMOROUS_SEVERITIES = true
|
12
|
+
|
13
|
+
def call(severity, time, progname, msg)
|
14
|
+
formatted_severity = sprintf("%-5s","#{severity}")
|
15
|
+
|
16
|
+
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S.") << time.usec.to_s[0..2].rjust(3)
|
17
|
+
color = SEVERITY_TO_COLOR_MAP[severity]
|
18
|
+
|
19
|
+
"\033[0;37m#{formatted_time}\033[0m [\033[#{color}m#{formatted_severity}\033[0m] #{msg.strip} (pid:#{$$})\n"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Rails.logger.formatter = Formatter.new
|
24
|
+
|
25
|
+
else
|
26
|
+
|
27
|
+
require 'active_support/buffered_logger'
|
28
|
+
|
29
|
+
#
|
30
|
+
# Rails <3.2 does not support a formatter option, so we override BufferedLogger
|
31
|
+
# See http://cbpowell.wordpress.com/2012/04/05/beautiful-logging-for-ruby-on-rails-3-2/
|
32
|
+
# for more info about upgrading in Rails 3.2
|
33
|
+
#
|
34
|
+
raise "Code needs upgrade for rails 3.2+" if Rails.version[0..3] != '3.0.'
|
35
|
+
|
36
|
+
class ActiveSupport::BufferedLogger
|
37
|
+
SEVERITIES = Severity.constants.sort_by{|c| Severity.const_get(c) }
|
38
|
+
|
39
|
+
def add(severity, message = nil, progname = nil, &block)
|
40
|
+
return if @level > severity
|
41
|
+
message = (message || (block && block.call) || progname).to_s
|
42
|
+
# Prepend pid and severity to the written message
|
43
|
+
log = "[%s] %-5.5s %s" % [$$, SEVERITIES[severity], message.gsub(/^\n+/, '')]
|
44
|
+
# If a newline is necessary then create a new message ending with a newline.
|
45
|
+
log << "\n" unless log[-1] == ?\n
|
46
|
+
buffer << log
|
47
|
+
auto_flush
|
48
|
+
message
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'console/formtastic/bootstrap_form_builder'
|
2
|
+
|
3
|
+
#
|
4
|
+
# Minor backport from Rails 3.1, may break hash behavior of errors
|
5
|
+
#
|
6
|
+
if Rails.version[0..3] == '3.0.'
|
7
|
+
require 'active_model/errors'
|
8
|
+
module ActiveModel
|
9
|
+
class Errors
|
10
|
+
# Do the error messages include an error with key +error+?
|
11
|
+
def include?(error)
|
12
|
+
(v = self[error]) && v.any?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# encoding: utf-8
|
19
|
+
|
20
|
+
# --------------------------------------------------------------------------------------------------
|
21
|
+
# Please note: If you're subclassing Formtastic::SemanticFormBuilder in a Rails 3 project,
|
22
|
+
# Formtastic uses class_attribute for these configuration attributes instead of the deprecated
|
23
|
+
# class_inheritable_attribute. The behaviour is slightly different with subclasses (especially
|
24
|
+
# around attributes with Hash or Array) values, so make sure you understand what's happening.
|
25
|
+
# See the documentation for class_attribute in ActiveSupport for more information.
|
26
|
+
# --------------------------------------------------------------------------------------------------
|
27
|
+
|
28
|
+
# Set the default text field size when input is a string. Default is nil.
|
29
|
+
# Formtastic::SemanticFormBuilder.default_text_field_size = 50
|
30
|
+
|
31
|
+
# Set the default text area height when input is a text. Default is 20.
|
32
|
+
# Formtastic::SemanticFormBuilder.default_text_area_height = 5
|
33
|
+
Formtastic::SemanticFormBuilder.default_text_area_height = 5
|
34
|
+
|
35
|
+
# Set the default text area width when input is a text. Default is nil.
|
36
|
+
# Formtastic::SemanticFormBuilder.default_text_area_width = 50
|
37
|
+
|
38
|
+
# Should all fields be considered "required" by default?
|
39
|
+
# Rails 2 only, ignored by Rails 3 because it will never fall back to this default.
|
40
|
+
# Defaults to true.
|
41
|
+
# Formtastic::SemanticFormBuilder.all_fields_required_by_default = true
|
42
|
+
|
43
|
+
# Should select fields have a blank option/prompt by default?
|
44
|
+
# Defaults to true.
|
45
|
+
# Formtastic::SemanticFormBuilder.include_blank_for_select_by_default = true
|
46
|
+
|
47
|
+
# Set the string that will be appended to the labels/fieldsets which are required
|
48
|
+
# It accepts string or procs and the default is a localized version of
|
49
|
+
# '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
|
50
|
+
# in your locale, it will replace the abbr title properly. But if you don't want to use
|
51
|
+
# abbr tag, you can simply give a string as below
|
52
|
+
# Formtastic::SemanticFormBuilder.required_string = "(required)"
|
53
|
+
|
54
|
+
# Set the string that will be appended to the labels/fieldsets which are optional
|
55
|
+
# Defaults to an empty string ("") and also accepts procs (see required_string above)
|
56
|
+
# Formtastic::SemanticFormBuilder.optional_string = "(optional)"
|
57
|
+
|
58
|
+
# Set the way inline errors will be displayed.
|
59
|
+
# Defaults to :sentence, valid options are :sentence, :list, :first and :none
|
60
|
+
Formtastic::SemanticFormBuilder.inline_errors = :list
|
61
|
+
# Formtastic uses the following classes as default for hints, inline_errors and error list
|
62
|
+
|
63
|
+
# If you override the class here, please ensure to override it in your formtastic_changes.css stylesheet as well
|
64
|
+
Formtastic::SemanticFormBuilder.default_hint_class = "help-block"
|
65
|
+
Formtastic::SemanticFormBuilder.default_inline_error_class = "help-inline"
|
66
|
+
# Formtastic::SemanticFormBuilder.default_error_list_class = "errors"
|
67
|
+
|
68
|
+
# Set the method to call on label text to transform or format it for human-friendly
|
69
|
+
# reading when formtastic is used without object. Defaults to :humanize.
|
70
|
+
# Formtastic::SemanticFormBuilder.label_str_method = :humanize
|
71
|
+
|
72
|
+
# Set the array of methods to try calling on parent objects in :select and :radio inputs
|
73
|
+
# for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
|
74
|
+
# that is found on the object will be used.
|
75
|
+
# Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
76
|
+
# Formtastic::SemanticFormBuilder.collection_label_methods = [
|
77
|
+
# "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
78
|
+
|
79
|
+
# Formtastic by default renders inside li tags the input, hints and then
|
80
|
+
# errors messages. Sometimes you want the hints to be rendered first than
|
81
|
+
# the input, in the following order: hints, input and errors. You can
|
82
|
+
# customize it doing just as below:
|
83
|
+
Formtastic::SemanticFormBuilder.inline_order = [:input, :errors, :hints]
|
84
|
+
|
85
|
+
# Additionally, you can customize the order for specific types of inputs.
|
86
|
+
# This is configured on a type basis and if a type is not found it will
|
87
|
+
# fall back to the default order as defined by #inline_order
|
88
|
+
# Formtastic::SemanticFormBuilder.custom_inline_order[:checkbox] = [:errors, :hints, :input]
|
89
|
+
# Formtastic::SemanticFormBuilder.custom_inline_order[:select] = [:hints, :input, :errors]
|
90
|
+
|
91
|
+
# Specifies if labels/hints for input fields automatically be looked up using I18n.
|
92
|
+
# Default value: false. Overridden for specific fields by setting value to true,
|
93
|
+
# i.e. :label => true, or :hint => true (or opposite depending on initialized value)
|
94
|
+
Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true
|
95
|
+
|
96
|
+
# You can add custom inputs or override parts of Formtastic by subclassing SemanticFormBuilder and
|
97
|
+
# specifying that class here. Defaults to SemanticFormBuilder.
|
98
|
+
# Formtastic::SemanticFormHelper.builder = MyCustomBuilder
|
99
|
+
|
100
|
+
Formtastic::SemanticFormHelper.builder = Console::Formtastic::BootstrapFormBuilder
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
#
|
10
|
+
# From Rails 3.2
|
11
|
+
#
|
12
|
+
module ActiveSupport::Inflector
|
13
|
+
def safe_constantize(camel_cased_word)
|
14
|
+
begin
|
15
|
+
constantize(camel_cased_word)
|
16
|
+
rescue NameError => e
|
17
|
+
raise unless e.message =~ /(uninitialized constant|wrong constant name) #{const_regexp(camel_cased_word)}$/ ||
|
18
|
+
e.name.to_s == camel_cased_word.to_s
|
19
|
+
rescue ArgumentError => e
|
20
|
+
raise unless e.message =~ /not missing constant #{const_regexp(camel_cased_word)}\!$/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# Mount a regular expression that will match part by part of the constant.
|
24
|
+
# For instance, Foo::Bar::Baz will generate Foo(::Bar(::Baz)?)?
|
25
|
+
def const_regexp(camel_cased_word) #:nodoc:
|
26
|
+
parts = camel_cased_word.split("::")
|
27
|
+
last = parts.pop
|
28
|
+
|
29
|
+
parts.reverse.inject(last) do |acc, part|
|
30
|
+
part.empty? ? acc : "#{part}(::#{acc})?"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
class String
|
35
|
+
def safe_constantize
|
36
|
+
ActiveSupport::Inflector.safe_constantize(self)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rest_api'
|
2
|
+
require 'rest_api/log_subscriber'
|
3
|
+
require 'rest_api/railties/controller_runtime'
|
4
|
+
|
5
|
+
RestApi::LogSubscriber.attach_to :active_resource
|
6
|
+
|
7
|
+
begin
|
8
|
+
info = RestApi.info
|
9
|
+
Rails.logger.info "Connected to #{info.url} with version #{info.version}"
|
10
|
+
rescue Exception => e
|
11
|
+
puts e if Rails.env.development?
|
12
|
+
Rails.logger.warn e.message
|
13
|
+
end
|
14
|
+
|
15
|
+
ActiveSupport.on_load(:action_controller) do
|
16
|
+
include RestApi::Railties::ControllerRuntime
|
17
|
+
end
|
18
|
+
|
19
|
+
ActiveSupport.on_load(:action_controller) do
|
20
|
+
RestApi::Base.instantiate_observers
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
unless true #Console.config.disable_css
|
2
|
+
#
|
3
|
+
# Stylesheets are assumed to be generated into Rails tmp/stylesheets,
|
4
|
+
# either dynamically in development, or by the RPM build in production
|
5
|
+
#
|
6
|
+
options = {
|
7
|
+
:urls => ['/stylesheets'],
|
8
|
+
:root => "#{Rails.root}/tmp"
|
9
|
+
}
|
10
|
+
|
11
|
+
Sass::Plugin.options[:css_location] = Rails.root.join("tmp", "stylesheets")
|
12
|
+
|
13
|
+
Sass::Plugin.add_template_location(Console::Engine.root.join("app", "stylesheets"))
|
14
|
+
Sass::Plugin.add_template_location(Rails.root.join("app", "stylesheets"))
|
15
|
+
|
16
|
+
#
|
17
|
+
# All production environments pregenerate CSS using the RPM build, development
|
18
|
+
# environments use autogeneration. To trigger autogeneration you may need to
|
19
|
+
# run 'rake assets:clean'.
|
20
|
+
#
|
21
|
+
if Rails.env.development?
|
22
|
+
Rails.configuration.middleware.insert_after('Sass::Plugin::Rack', 'Rack::Static', options)
|
23
|
+
|
24
|
+
Sass::Plugin.options[:style] = :expanded
|
25
|
+
Sass::Plugin.options[:line_numbers] = true
|
26
|
+
Sass::Plugin.options[:debug_info] = true
|
27
|
+
else
|
28
|
+
Sass::Plugin.options[:never_update] = true
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
if Rails.version.to_f == 3.0 and Rails.env.development?
|
2
|
+
class ActiveSupport::MessageVerifier::InvalidSignature
|
3
|
+
def initialize(*arguments)
|
4
|
+
Rails.logger.warn "> Unable to verify cookie signature, session cannot be decoded" if caller.find{ |c| c.include? File.join('middleware', 'cookies.rb') }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
class ActionDispatch::Session::CookieStore < ActionDispatch::Session::AbstractStore
|
8
|
+
def unpacked_cookie_data(env)
|
9
|
+
env["action_dispatch.request.unsigned_session_cookie"] ||= begin
|
10
|
+
stale_session_check! do
|
11
|
+
request = ActionDispatch::Request.new(env)
|
12
|
+
ssn = request.cookie_jar[@key]
|
13
|
+
if ssn && ssn.include?('--')
|
14
|
+
undecoded = ssn[0,ssn.index('--')]
|
15
|
+
decoded = ActiveSupport::Base64.decode64(undecoded)
|
16
|
+
begin
|
17
|
+
Rails.logger.warn "> Session: #{Marshal.load(decoded).inspect}"
|
18
|
+
rescue StandardError => e
|
19
|
+
Rails.logger.warn "> Session unreadable (#{e.class}: #{e}): #{undecoded}"
|
20
|
+
end
|
21
|
+
else
|
22
|
+
Rails.logger.warn "> No session #{ssn}"
|
23
|
+
end
|
24
|
+
if data = request.cookie_jar.signed[@key]
|
25
|
+
data.stringify_keys!
|
26
|
+
end
|
27
|
+
data || {}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
if Rails.version.to_f == 3.0
|
2
|
+
#
|
3
|
+
# Backport use of X-Frame-Options in Rails 4.0 https://github.com/rails/rails/issues/6311
|
4
|
+
#
|
5
|
+
# Remove on upgrade.
|
6
|
+
#
|
7
|
+
class ActionDispatch::Response < Rack::Response
|
8
|
+
cattr_accessor(:default_x_frame_options)
|
9
|
+
|
10
|
+
def to_a
|
11
|
+
assign_default_content_type_and_charset!
|
12
|
+
handle_conditional_get!
|
13
|
+
self["Set-Cookie"] = self["Set-Cookie"].join("\n") if self["Set-Cookie"].respond_to?(:join)
|
14
|
+
self["ETag"] = @_etag if @_etag
|
15
|
+
if !self.class.default_x_frame_options.nil?
|
16
|
+
self["X-Frame-Options"] ||= self.class.default_x_frame_options
|
17
|
+
end
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
elsif Rails.version.to_f == 3.2
|
22
|
+
class ActionDispatch::Response
|
23
|
+
cattr_accessor(:default_x_frame_options)
|
24
|
+
|
25
|
+
def to_a
|
26
|
+
assign_default_content_type_and_charset!
|
27
|
+
handle_conditional_get!
|
28
|
+
|
29
|
+
@header[SET_COOKIE] = @header[SET_COOKIE].join("\n") if @header[SET_COOKIE].respond_to?(:join)
|
30
|
+
|
31
|
+
if self.class.default_x_frame_options
|
32
|
+
@header['X-Frame-Options'] ||= self.class.default_x_frame_options
|
33
|
+
end
|
34
|
+
|
35
|
+
if [204, 304].include?(@status)
|
36
|
+
@header.delete CONTENT_TYPE
|
37
|
+
[@status, @header, []]
|
38
|
+
else
|
39
|
+
[@status, @header, self]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
else
|
44
|
+
raise "Code needs upgrade for unknown rails version"
|
45
|
+
end
|
46
|
+
|
47
|
+
config = Rails.application.config
|
48
|
+
config.action_dispatch.x_frame_options ||= 'SAMEORIGIN'
|
49
|
+
|
50
|
+
if config.action_dispatch.x_frame_options
|
51
|
+
ActionDispatch::Response.default_x_frame_options = config.action_dispatch.x_frame_options
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
en:
|
2
|
+
unknown: 'A system error has occurred. If the problem persists, please contact Red Hat support.'
|
3
|
+
|
4
|
+
types:
|
5
|
+
php: PHP
|
6
|
+
|
7
|
+
rest_api:
|
8
|
+
errors:
|
9
|
+
'116': Your SSH public key appears to be invalid. Keys should start with a type (usually ssh-rsa or ssh-dss), a blank space, and then a long string of numbers and letters.
|
10
|
+
'121': You have already saved this public key with a different name. Provide a different key here.
|
11
|
+
'151': You must create a Jenkins application (to act as a build server) before you can add the Jenkins cartridge to an application.
|
12
|
+
'153': You are currently using more gears than the new plan would allow. Please scale down or delete applications before downgrading.
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#
|
2
|
+
# Reproduced from https://github.com/rails/rails/pull/230/files for adding ActiveResource association support
|
3
|
+
#
|
4
|
+
module ActiveResource::Associations
|
5
|
+
|
6
|
+
module Builder
|
7
|
+
autoload :Association, 'active_resource/associations/builder/association'
|
8
|
+
autoload :HasMany, 'active_resource/associations/builder/has_many'
|
9
|
+
autoload :HasOne, 'active_resource/associations/builder/has_one'
|
10
|
+
autoload :BelongsTo, 'active_resource/associations/builder/belongs_to'
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# Specifies a one-to-many association.
|
16
|
+
#
|
17
|
+
# === Options
|
18
|
+
# [:class_name]
|
19
|
+
# Specify the class name of the association. This class name would
|
20
|
+
# be used for resolving the association class.
|
21
|
+
#
|
22
|
+
# ==== Example for [:class_name] - option
|
23
|
+
# GET /posts/123.xml delivers following response body:
|
24
|
+
# <post>
|
25
|
+
# <title>ActiveResource now have associations</title>
|
26
|
+
# <content> ... </content>
|
27
|
+
# <comments>
|
28
|
+
# <comment> ... </comment>
|
29
|
+
# <comment> ... </comment>
|
30
|
+
# </comments>
|
31
|
+
# </post>
|
32
|
+
# ====
|
33
|
+
#
|
34
|
+
# <tt>has_many :comments, :class_name => 'myblog/comment'</tt>
|
35
|
+
# Would resolve those comments into the <tt>Myblog::Comment</tt> class.
|
36
|
+
def has_many(name, options = {})
|
37
|
+
Builder::HasMany.build(self, name, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Specifies a one-to-one association.
|
41
|
+
#
|
42
|
+
# === Options
|
43
|
+
# [:class_name]
|
44
|
+
# Specify the class name of the association. This class name would
|
45
|
+
# be used for resolving the association class.
|
46
|
+
#
|
47
|
+
# ==== Example for [:class_name] - option
|
48
|
+
# GET /posts/123.xml delivers following response body:
|
49
|
+
# <post>
|
50
|
+
# <title>ActiveResource now have associations</title>
|
51
|
+
# <content> ... </content>
|
52
|
+
# <author>
|
53
|
+
# <name>caffeinatedBoys</name>
|
54
|
+
# </author>
|
55
|
+
# </post>
|
56
|
+
# ====
|
57
|
+
#
|
58
|
+
# <tt>has_one :author, :class_name => 'myblog/author'</tt>
|
59
|
+
# Would resolve this author into the <tt>Myblog::Author</tt> class.
|
60
|
+
def has_one(name, options = {})
|
61
|
+
Builder::HasOne.build(self, name, options)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Specifies a one-to-one association with another class. This class should only be used
|
65
|
+
# if this class contains the foreign key.
|
66
|
+
#
|
67
|
+
# Methods will be added for retrieval and query for a single associated object, for which
|
68
|
+
# this object holds an id:
|
69
|
+
#
|
70
|
+
# [association(force_reload = false)]
|
71
|
+
# Returns the associated object. +nil+ is returned if the foreign key is +nil+.
|
72
|
+
# Throws a ActiveResource::ResourceNotFound exception if the foreign key is not +nil+
|
73
|
+
# and the resource is not found.
|
74
|
+
#
|
75
|
+
# (+association+ is replaced with the symbol passed as the first argument, so
|
76
|
+
# <tt>belongs_to :post</tt> would add among others <tt>post.nil?</tt>.
|
77
|
+
#
|
78
|
+
# === Example
|
79
|
+
#
|
80
|
+
# A Comment class declaress <tt>belongs_to :post</tt>, which will add:
|
81
|
+
# * <tt>Comment#post</tt> (similar to <tt>Post.find(post_id)</tt>)
|
82
|
+
# The declaration can also include an options hash to specialize the behavior of the association.
|
83
|
+
#
|
84
|
+
# === Options
|
85
|
+
# [:class_name]
|
86
|
+
# Specify the class name for the association. Use it only if that name canÄt be inferred from association name.
|
87
|
+
# So <tt>belongs_to :post</tt> will by default be linked to the Post class, but if the real class name is Article,
|
88
|
+
# you'll have to specify it with whis option.
|
89
|
+
# [:foreign_key]
|
90
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
91
|
+
# of the association with an "_id" suffix. So a class that defines a <tt>belongs_to :post</tt>
|
92
|
+
# association will use "post_id" as the default <tt>:foreign_key</tt>. Similarly,
|
93
|
+
# <tt>belongs_to :article, :class_name => "Post"</tt> will use a foreign key
|
94
|
+
# of "article_id".
|
95
|
+
#
|
96
|
+
# Option exampples:
|
97
|
+
# <tt>belongs_to :customer, :class_name => 'User'</tt>
|
98
|
+
# Creates a belongs_to association called customer which is represented through the <tt>User</tt> class.
|
99
|
+
#
|
100
|
+
# <tt>belongs_to :customer, :foreign_key => 'user_id'</tt>
|
101
|
+
# Creates a belongs_to association called customer which would be resolved by the foreign_key <tt>user_id</tt> instead of <tt>customer_id</tt>
|
102
|
+
#
|
103
|
+
def belongs_to(name, options={})
|
104
|
+
Builder::BelongsTo.build(self, name, options)
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|