trusty-cms 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +23 -0
- data/CHANGELOG.md +754 -0
- data/CONTRIBUTORS.md +263 -0
- data/Gemfile +40 -0
- data/Gemfile.lock +177 -0
- data/INSTALL.md +10 -0
- data/LICENSE.md +21 -0
- data/README.md +85 -0
- data/Rakefile +7 -0
- data/app/controllers/admin/configuration_controller.rb +50 -0
- data/app/controllers/admin/extensions_controller.rb +11 -0
- data/app/controllers/admin/layouts_controller.rb +8 -0
- data/app/controllers/admin/page_fields_controller.rb +9 -0
- data/app/controllers/admin/page_parts_controller.rb +9 -0
- data/app/controllers/admin/pages_controller.rb +89 -0
- data/app/controllers/admin/preferences_controller.rb +46 -0
- data/app/controllers/admin/references_controller.rb +7 -0
- data/app/controllers/admin/resource_controller.rb +245 -0
- data/app/controllers/admin/users_controller.rb +40 -0
- data/app/controllers/admin/welcome_controller.rb +48 -0
- data/app/controllers/application_controller.rb +114 -0
- data/app/controllers/site_controller.rb +97 -0
- data/app/helpers/admin/configuration_helper.rb +80 -0
- data/app/helpers/admin/export_helper.rb +2 -0
- data/app/helpers/admin/extensions_helper.rb +2 -0
- data/app/helpers/admin/layouts_helper.rb +21 -0
- data/app/helpers/admin/node_helper.rb +96 -0
- data/app/helpers/admin/pages_helper.rb +117 -0
- data/app/helpers/admin/preferences_helper.rb +3 -0
- data/app/helpers/admin/references_helper.rb +46 -0
- data/app/helpers/admin/regions_helper.rb +28 -0
- data/app/helpers/admin/resource_helper.rb +2 -0
- data/app/helpers/admin/users_helper.rb +8 -0
- data/app/helpers/admin/welcome_helper.rb +2 -0
- data/app/helpers/application_helper.rb +241 -0
- data/app/helpers/site_helper.rb +2 -0
- data/app/models/deprecated_tags.rb +42 -0
- data/app/models/file_not_found_page.rb +32 -0
- data/app/models/layout.rb +15 -0
- data/app/models/menu_renderer.rb +140 -0
- data/app/models/page.rb +377 -0
- data/app/models/page_context.rb +53 -0
- data/app/models/page_field.rb +3 -0
- data/app/models/page_part.rb +20 -0
- data/app/models/standard_tags.rb +1318 -0
- data/app/models/status.rb +41 -0
- data/app/models/text_filter.rb +36 -0
- data/app/models/trusty_cms/config.rb +313 -0
- data/app/models/trusty_cms/page_response_cache_director.rb +43 -0
- data/app/models/user.rb +96 -0
- data/app/models/user_action_observer.rb +25 -0
- data/app/views/admin/configuration/edit.html.haml +38 -0
- data/app/views/admin/configuration/show.html.haml +58 -0
- data/app/views/admin/extensions/index.html.haml +41 -0
- data/app/views/admin/layouts/_form.html.haml +39 -0
- data/app/views/admin/layouts/edit.html.haml +9 -0
- data/app/views/admin/layouts/index.html.haml +35 -0
- data/app/views/admin/layouts/new.html.haml +7 -0
- data/app/views/admin/layouts/remove.html.haml +16 -0
- data/app/views/admin/page_fields/_page_field.html.haml +12 -0
- data/app/views/admin/page_parts/_page_part.html.haml +18 -0
- data/app/views/admin/pages/_fields.html.haml +71 -0
- data/app/views/admin/pages/_meta_row.html.haml +8 -0
- data/app/views/admin/pages/_node.html.haml +26 -0
- data/app/views/admin/pages/_popups.html.haml +27 -0
- data/app/views/admin/pages/children.html.haml +2 -0
- data/app/views/admin/pages/edit.html.haml +12 -0
- data/app/views/admin/pages/index.html.haml +26 -0
- data/app/views/admin/pages/new.html.haml +10 -0
- data/app/views/admin/pages/remove.html.haml +18 -0
- data/app/views/admin/preferences/edit.html.haml +44 -0
- data/app/views/admin/references/_tag_reference.haml +3 -0
- data/app/views/admin/references/filters.haml +6 -0
- data/app/views/admin/references/tags.haml +30 -0
- data/app/views/admin/users/_avatar.html.haml +5 -0
- data/app/views/admin/users/_form.html.haml +53 -0
- data/app/views/admin/users/_password_fields.html.haml +18 -0
- data/app/views/admin/users/edit.html.haml +9 -0
- data/app/views/admin/users/index.html.haml +39 -0
- data/app/views/admin/users/new.html.haml +6 -0
- data/app/views/admin/users/remove.html.haml +16 -0
- data/app/views/admin/welcome/login.html.haml +23 -0
- data/app/views/layouts/application.html.haml +50 -0
- data/app/views/site/not_found.html.haml +3 -0
- data/bin/ci/before_script +15 -0
- data/bin/trusty_cms +53 -0
- data/config/application.rb +124 -0
- data/config/boot.rb +9 -0
- data/config/compass.config +15 -0
- data/config/database.db2.yml +20 -0
- data/config/database.mysql.yml +25 -0
- data/config/database.postgresql.yml +25 -0
- data/config/database.sqlite.yml +16 -0
- data/config/database.sqlserver.yml +20 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +19 -0
- data/config/environments/production.rb +27 -0
- data/config/environments/test.rb +35 -0
- data/config/initializers/active_record_extensions.rb +1 -0
- data/config/initializers/configuration_extensions.rb +0 -0
- data/config/initializers/haml.rb +2 -0
- data/config/initializers/object_extensions.rb +1 -0
- data/config/initializers/radiant_config.rb +16 -0
- data/config/initializers/rails_patch.rb +2 -0
- data/config/initializers/response_cache_timeout.rb +3 -0
- data/config/initializers/string_extensions.rb +1 -0
- data/config/initializers/symbol_extensions.rb +1 -0
- data/config/initializers/tmp.rb +2 -0
- data/config/locales/en.yml +230 -0
- data/config/locales/en_available_tags.yml +625 -0
- data/config/preinitializer.rb +18 -0
- data/config/routes.rb +30 -0
- data/db/migrate/001_create_radiant_tables.rb +75 -0
- data/db/migrate/002_insert_initial_data.rb +12 -0
- data/db/migrate/003_rename_behavior_column.rb +9 -0
- data/db/migrate/004_rename_filter_column.rb +11 -0
- data/db/migrate/005_add_virtual_column_to_page.rb +9 -0
- data/db/migrate/006_integer_columns_to_boolean.rb +36 -0
- data/db/migrate/007_remove_virtual_column_from_page.rb +9 -0
- data/db/migrate/008_add_virtual_column_to_page_again.rb +9 -0
- data/db/migrate/009_add_content_type_field_to_layout.rb +9 -0
- data/db/migrate/010_merge_behaviors_and_pages.rb +57 -0
- data/db/migrate/011_rename_type_column_on_page_to_class_name.rb +9 -0
- data/db/migrate/012_create_extension_meta.rb +13 -0
- data/db/migrate/013_add_notes_field_to_user.rb +9 -0
- data/db/migrate/014_rename_config_default_parts_key.rb +17 -0
- data/db/migrate/015_add_optimistic_locking.rb +15 -0
- data/db/migrate/016_add_sessions.rb +16 -0
- data/db/migrate/017_rename_created_by_updated_by_columns.rb +15 -0
- data/db/migrate/018_add_description_and_keywords_to_pages.rb +11 -0
- data/db/migrate/019_add_salt_to_users.rb +11 -0
- data/db/migrate/020_add_session_info_to_users.rb +11 -0
- data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
- data/db/migrate/20081203140407_add_indexes.rb +19 -0
- data/db/migrate/20090226140109_add_user_language.rb +9 -0
- data/db/migrate/20090929164633_rename_developer_role_to_designer.rb +9 -0
- data/db/migrate/20091003095744_change_user_language_to_locale.rb +9 -0
- data/db/migrate/20100805154952_add_page_fields.rb +15 -0
- data/db/migrate/20100805155020_convert_page_metas.rb +24 -0
- data/db/migrate/20100810151922_add_field_name_index.rb +11 -0
- data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +13 -0
- data/db/migrate/20111016150725_extend_page_part_content_limit.rb +15 -0
- data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +11 -0
- data/db/schema.rb +128 -0
- data/lib/active_record_extensions/active_record_extensions.rb +27 -0
- data/lib/annotatable.rb +68 -0
- data/lib/configuration_extensions/configuration_extensions.rb +357 -0
- data/lib/generators/extension/USAGE +30 -0
- data/lib/generators/extension/extension_generator.rb +97 -0
- data/lib/generators/extension/templates/README.md +6 -0
- data/lib/generators/extension/templates/RSpecRakefile +109 -0
- data/lib/generators/extension/templates/Rakefile +25 -0
- data/lib/generators/extension/templates/cucumber.yml +1 -0
- data/lib/generators/extension/templates/cucumber_env.rb +11 -0
- data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
- data/lib/generators/extension/templates/en.yml +3 -0
- data/lib/generators/extension/templates/extension.rb +21 -0
- data/lib/generators/extension/templates/functional_test.rb +15 -0
- data/lib/generators/extension/templates/gemspec.rb +29 -0
- data/lib/generators/extension/templates/lib.rb +8 -0
- data/lib/generators/extension/templates/migration.rb +9 -0
- data/lib/generators/extension/templates/radiant_config.rb +3 -0
- data/lib/generators/extension/templates/routes.rb +5 -0
- data/lib/generators/extension/templates/spec.opts +6 -0
- data/lib/generators/extension/templates/spec_helper.rb +42 -0
- data/lib/generators/extension/templates/tasks.rake +47 -0
- data/lib/generators/extension/templates/test_helper.rb +26 -0
- data/lib/generators/extension_controller/USAGE +36 -0
- data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
- data/lib/generators/extension_controller/templates/controller.rb +10 -0
- data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
- data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
- data/lib/generators/extension_controller/templates/helper.rb +2 -0
- data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
- data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
- data/lib/generators/extension_controller/templates/view.html.erb +2 -0
- data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
- data/lib/generators/extension_mailer/USAGE +17 -0
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
- data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
- data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
- data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
- data/lib/generators/extension_mailer/templates/view.erb +3 -0
- data/lib/generators/extension_migration/USAGE +34 -0
- data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
- data/lib/generators/extension_migration/templates/migration.rb +11 -0
- data/lib/generators/extension_model/USAGE +35 -0
- data/lib/generators/extension_model/extension_model_generator.rb +68 -0
- data/lib/generators/extension_model/templates/fixtures.yml +19 -0
- data/lib/generators/extension_model/templates/migration.rb +16 -0
- data/lib/generators/extension_model/templates/model.rb +2 -0
- data/lib/generators/extension_model/templates/model_spec.rb +11 -0
- data/lib/generators/extension_model/templates/unit_test.rb +8 -0
- data/lib/generators/generator_base_extension.rb +16 -0
- data/lib/generators/instance/instance_generator.rb +148 -0
- data/lib/generators/instance/templates/databases/db2.yml +40 -0
- data/lib/generators/instance/templates/databases/mysql.yml +47 -0
- data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
- data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
- data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
- data/lib/generators/instance/templates/instance_boot.rb +122 -0
- data/lib/generators/instance/templates/instance_config.ru +2 -0
- data/lib/generators/instance/templates/instance_environment.rb +83 -0
- data/lib/generators/instance/templates/instance_gemfile +81 -0
- data/lib/generators/instance/templates/instance_generate +6 -0
- data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
- data/lib/generators/instance/templates/instance_rakefile +3 -0
- data/lib/generators/instance/templates/instance_routes.rb +1 -0
- data/lib/generators/language_extension/USAGE +27 -0
- data/lib/generators/language_extension/language_extension_generator.rb +71 -0
- data/lib/generators/language_extension/templates/README +3 -0
- data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
- data/lib/generators/language_extension/templates/Rakefile +25 -0
- data/lib/generators/language_extension/templates/available_tags.yml +553 -0
- data/lib/generators/language_extension/templates/cucumber.yml +1 -0
- data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
- data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
- data/lib/generators/language_extension/templates/extension.rb +12 -0
- data/lib/generators/language_extension/templates/functional_test.rb +15 -0
- data/lib/generators/language_extension/templates/gemspec.rb +24 -0
- data/lib/generators/language_extension/templates/lang.yml +181 -0
- data/lib/generators/language_extension/templates/lib.rb +8 -0
- data/lib/generators/language_extension/templates/spec.opts +6 -0
- data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
- data/lib/generators/language_extension/templates/tasks.rake +28 -0
- data/lib/generators/language_extension/templates/test_helper.rb +26 -0
- data/lib/inheritable_class_attributes.rb +65 -0
- data/lib/local_time.rb +6 -0
- data/lib/login_system.rb +132 -0
- data/lib/method_observer.rb +50 -0
- data/lib/object_extensions/object_extensions.rb +5 -0
- data/lib/simpleton.rb +21 -0
- data/lib/string_extensions/string_extensions.rb +25 -0
- data/lib/symbol_extensions/symbol_extensions.rb +5 -0
- data/lib/tasks/database.rake +85 -0
- data/lib/tasks/environments.rake +11 -0
- data/lib/tasks/extensions.rake +85 -0
- data/lib/tasks/framework.rake +255 -0
- data/lib/tasks/instance.rake +23 -0
- data/lib/tasks/prototype.rake +31 -0
- data/lib/tasks/radiant_config.rake +18 -0
- data/lib/tasks/release.rake +131 -0
- data/lib/tasks/translate.rake +59 -0
- data/lib/tasks/undefine.rake +28 -0
- data/lib/translation_support.rb +54 -0
- data/lib/trusty_cms/admin_ui/region_partials.rb +23 -0
- data/lib/trusty_cms/admin_ui/region_set.rb +35 -0
- data/lib/trusty_cms/admin_ui.rb +244 -0
- data/lib/trusty_cms/available_locales.rb +19 -0
- data/lib/trusty_cms/cache.rb +100 -0
- data/lib/trusty_cms/config/definition.rb +142 -0
- data/lib/trusty_cms/engine.rb +10 -0
- data/lib/trusty_cms/extension/script.rb +395 -0
- data/lib/trusty_cms/extension.rb +146 -0
- data/lib/trusty_cms/extension_loader.rb +130 -0
- data/lib/trusty_cms/extension_migrator.rb +98 -0
- data/lib/trusty_cms/extension_path.rb +200 -0
- data/lib/trusty_cms/initializer.rb +162 -0
- data/lib/trusty_cms/pagination/controller.rb +41 -0
- data/lib/trusty_cms/pagination/link_renderer.rb +34 -0
- data/lib/trusty_cms/resource_responses.rb +121 -0
- data/lib/trusty_cms/setup.rb +227 -0
- data/lib/trusty_cms/taggable.rb +138 -0
- data/lib/trusty_cms/task_support.rb +66 -0
- data/lib/trusty_cms.rb +19 -0
- data/log/.keep +0 -0
- data/public/.htaccess +40 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/admin/add_tab.png +0 -0
- data/public/images/admin/avatar_32x32.png +0 -0
- data/public/images/admin/avatar_64x64.png +0 -0
- data/public/images/admin/avatar_96x96.png +0 -0
- data/public/images/admin/brown_bottom_line.gif +0 -0
- data/public/images/admin/calendar_down.gif +0 -0
- data/public/images/admin/collapse.png +0 -0
- data/public/images/admin/draft_page.png +0 -0
- data/public/images/admin/expand.png +0 -0
- data/public/images/admin/image.png +0 -0
- data/public/images/admin/javascript.png +0 -0
- data/public/images/admin/layout.png +0 -0
- data/public/images/admin/metadata_toggle.png +0 -0
- data/public/images/admin/minus.png +0 -0
- data/public/images/admin/minus_disabled.png +0 -0
- data/public/images/admin/minus_grey.png +0 -0
- data/public/images/admin/navigation_secondary_separator.gif +0 -0
- data/public/images/admin/page.png +0 -0
- data/public/images/admin/plus.png +0 -0
- data/public/images/admin/plus_disabled.png +0 -0
- data/public/images/admin/plus_grey.png +0 -0
- data/public/images/admin/popup_border_background.png +0 -0
- data/public/images/admin/popup_border_bottom_left.png +0 -0
- data/public/images/admin/popup_border_bottom_right.png +0 -0
- data/public/images/admin/popup_border_top_left.png +0 -0
- data/public/images/admin/popup_border_top_right.png +0 -0
- data/public/images/admin/search.png +0 -0
- data/public/images/admin/single_form_shadow.png +0 -0
- data/public/images/admin/snippet.png +0 -0
- data/public/images/admin/spinner.gif +0 -0
- data/public/images/admin/status_background.png +0 -0
- data/public/images/admin/status_bottom_left.png +0 -0
- data/public/images/admin/status_bottom_right.png +0 -0
- data/public/images/admin/status_spinner.gif +0 -0
- data/public/images/admin/status_top_left.png +0 -0
- data/public/images/admin/status_top_right.png +0 -0
- data/public/images/admin/stylesheet.png +0 -0
- data/public/images/admin/tab_close.png +0 -0
- data/public/images/admin/upload.png +0 -0
- data/public/images/admin/virtual_page.png +0 -0
- data/public/images/radiant/radiant-badge-color.png +0 -0
- data/public/javascripts/admin/application.js +94 -0
- data/public/javascripts/admin/codearea.js +165 -0
- data/public/javascripts/admin/controls.js +965 -0
- data/public/javascripts/admin/cookie.js +80 -0
- data/public/javascripts/admin/dateinput.js +402 -0
- data/public/javascripts/admin/dragdrop.js +974 -0
- data/public/javascripts/admin/dropdown.js +216 -0
- data/public/javascripts/admin/effects.js +1122 -0
- data/public/javascripts/admin/lowpro.js +340 -0
- data/public/javascripts/admin/overrides.js +1 -0
- data/public/javascripts/admin/page_preview.js +41 -0
- data/public/javascripts/admin/pagefield.js +54 -0
- data/public/javascripts/admin/pagestatus.js +17 -0
- data/public/javascripts/admin/popup.js +339 -0
- data/public/javascripts/admin/prototype.js +4874 -0
- data/public/javascripts/admin/ruledtable.js +13 -0
- data/public/javascripts/admin/shortcuts.js +33 -0
- data/public/javascripts/admin/sitemap.js +149 -0
- data/public/javascripts/admin/status.js +233 -0
- data/public/javascripts/admin/tabcontrol.js +123 -0
- data/public/javascripts/admin/toggle.js +430 -0
- data/public/javascripts/admin/utility.js +53 -0
- data/public/javascripts/admin/validationerror.js +18 -0
- data/public/loading-iframe.html +11 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/sass/admin/_base.sass +18 -0
- data/public/stylesheets/sass/admin/main.sass +27 -0
- data/public/stylesheets/sass/admin/modules/_boxes.sass +6 -0
- data/public/stylesheets/sass/admin/modules/_gradients.sass +4 -0
- data/public/stylesheets/sass/admin/modules/_links.sass +18 -0
- data/public/stylesheets/sass/admin/overrides.sass +2 -0
- data/public/stylesheets/sass/admin/partials/_actions.sass +96 -0
- data/public/stylesheets/sass/admin/partials/_avatars.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_content.sass +58 -0
- data/public/stylesheets/sass/admin/partials/_dateinput.sass +62 -0
- data/public/stylesheets/sass/admin/partials/_deprecated.sass +55 -0
- data/public/stylesheets/sass/admin/partials/_dropdown.sass +28 -0
- data/public/stylesheets/sass/admin/partials/_footer.sass +12 -0
- data/public/stylesheets/sass/admin/partials/_forms.sass +322 -0
- data/public/stylesheets/sass/admin/partials/_header.sass +114 -0
- data/public/stylesheets/sass/admin/partials/_index.sass +147 -0
- data/public/stylesheets/sass/admin/partials/_layout.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_messages.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_popup.sass +213 -0
- data/public/stylesheets/sass/admin/partials/_tabcontrol.sass +72 -0
- data/public/stylesheets/sass/admin/partials/_toolbar.sass +31 -0
- data/public/stylesheets/sass/admin/partials/_typography.sass +60 -0
- data/public/stylesheets/sass/admin/partials/_validations.sass +19 -0
- data/rails/init.rb +1 -0
- data/script/about +4 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/extension +5 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/performance/request +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/rails +6 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/version +5 -0
- data/spec/ci/database.mysql.yml +4 -0
- data/spec/ci/database.postgresql.yml +4 -0
- data/spec/ci/database.sqlite.yml +3 -0
- data/trusty_cms.gemspec +50 -0
- metadata +781 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
|
2
|
+
|
3
|
+
describe <%= class_name %>Controller do
|
4
|
+
|
5
|
+
<% if actions.empty? -%>
|
6
|
+
#Delete this example and add some real ones
|
7
|
+
<% else -%>
|
8
|
+
#Delete these examples and add some real ones
|
9
|
+
<% end -%>
|
10
|
+
it "should use <%= class_name %>Controller" do
|
11
|
+
controller.should be_an_instance_of(<%= class_name %>Controller)
|
12
|
+
end
|
13
|
+
|
14
|
+
<% unless actions.empty? -%>
|
15
|
+
<% for action in actions -%>
|
16
|
+
|
17
|
+
it "GET '<%= action %>' should be successful" do
|
18
|
+
get '<%= action %>'
|
19
|
+
response.should be_success
|
20
|
+
end
|
21
|
+
<% end -%>
|
22
|
+
<% end -%>
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
2
|
+
|
3
|
+
# Re-raise errors caught by the controller.
|
4
|
+
<%= class_name %>Controller.class_eval { def rescue_action(e) raise e end }
|
5
|
+
|
6
|
+
class <%= class_name %>ControllerTest < ActionController::TestCase
|
7
|
+
# Replace this with your real tests.
|
8
|
+
def test_truth
|
9
|
+
assert true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
|
2
|
+
|
3
|
+
describe <%= class_name %>Helper do
|
4
|
+
|
5
|
+
#Delete this example and add some real ones or delete this file
|
6
|
+
it "should include the <%= class_name %>Helper" do
|
7
|
+
included_modules = self.metaclass.send :included_modules
|
8
|
+
included_modules.should include(<%= class_name %>Helper)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
|
2
|
+
|
3
|
+
describe "/<%= class_name.underscore %>/<%= action %>" do
|
4
|
+
before do
|
5
|
+
render '<%= class_name.underscore %>/<%= action %>'
|
6
|
+
end
|
7
|
+
|
8
|
+
#Delete this example and add some real ones or delete this file
|
9
|
+
it "should tell you where to find the file" do
|
10
|
+
response.should have_tag('p', 'Find me in app/views/<%= class_name.underscore %>/<%= action %>.rhtml')
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Description:
|
2
|
+
Stubs out a new mailer and its views for the given extension.
|
3
|
+
Pass the mailer name, either CamelCased or under_scored,
|
4
|
+
and an optional list of emails as arguments.
|
5
|
+
|
6
|
+
This generates a mailer class in app/models, view templates in
|
7
|
+
app/views/mailer_name, a unit test in test/unit, and fixtures in
|
8
|
+
test/fixtures.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
`./script/generate extension_mailer MyExt Notifications signup forgot_password invoice`
|
12
|
+
|
13
|
+
creates a Notifications mailer class, views, test, and fixtures:
|
14
|
+
Mailer: vendor/my_ext/app/models/notifications.rb
|
15
|
+
Views: vendor/my_ext/app/views/notifications/signup.erb [...]
|
16
|
+
Test: vendor/my_ext/test/unit/test/unit/notifications_test.rb
|
17
|
+
Fixtures: vendor/my_ext/test/fixtures/notifications/signup [...]
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rails_generator/base'
|
2
|
+
require 'rails_generator/generators/components/mailer/mailer_generator'
|
3
|
+
|
4
|
+
class ExtensionMailerGenerator < MailerGenerator
|
5
|
+
|
6
|
+
attr_accessor :extension_name
|
7
|
+
default_options :with_test_unit => false
|
8
|
+
|
9
|
+
def initialize(runtime_args, runtime_options = {})
|
10
|
+
runtime_args = runtime_args.dup
|
11
|
+
@extension_name = runtime_args.shift
|
12
|
+
super(runtime_args, runtime_options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def manifest
|
16
|
+
if extension_uses_rspec?
|
17
|
+
rspec_manifest
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def rspec_manifest
|
24
|
+
record do |m|
|
25
|
+
# Check for class naming collisions.
|
26
|
+
m.class_collisions class_path, class_name
|
27
|
+
|
28
|
+
# Mailer, view, test, and fixture directories.
|
29
|
+
m.directory File.join('app/models', class_path)
|
30
|
+
m.directory File.join('app/views', file_path)
|
31
|
+
|
32
|
+
# Mailer class and unit test.
|
33
|
+
m.template "mailer:mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
|
34
|
+
|
35
|
+
# View template and fixture for each action.
|
36
|
+
actions.each do |action|
|
37
|
+
relative_path = File.join(file_path, action)
|
38
|
+
view_path = File.join('app/views', "#{relative_path}.erb")
|
39
|
+
|
40
|
+
m.template "mailer:view.erb", view_path,
|
41
|
+
:assigns => { :action => action, :path => view_path }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def banner
|
47
|
+
"Usage: #{$0} #{spec.name} ExtensionName #{spec.name.camelize}Name [options]"
|
48
|
+
end
|
49
|
+
|
50
|
+
def extension_path
|
51
|
+
File.join('vendor', 'extensions', @extension_name.underscore)
|
52
|
+
end
|
53
|
+
|
54
|
+
def destination_root
|
55
|
+
File.join(Rails.root, extension_path)
|
56
|
+
end
|
57
|
+
|
58
|
+
def extension_uses_rspec?
|
59
|
+
File.exists?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_options!(opt)
|
63
|
+
opt.separator ''
|
64
|
+
opt.separator 'Options:'
|
65
|
+
opt.on("--with-test-unit",
|
66
|
+
"Use Test::Unit tests instead sof RSpec.") { |v| options[:with_test_unit] = v }
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class <%= class_name %> < ActionMailer::Base
|
2
|
+
|
3
|
+
<% for action in actions -%>
|
4
|
+
|
5
|
+
def <%= action %>(sent_at = Time.now)
|
6
|
+
subject '<%= class_name %>#<%= action %>'
|
7
|
+
recipients ''
|
8
|
+
from ''
|
9
|
+
sent_on sent_at
|
10
|
+
|
11
|
+
body :greeting => 'Hi,'
|
12
|
+
end
|
13
|
+
<% end -%>
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
2
|
+
|
3
|
+
class <%= class_name %>Test < ActionMailer::TestCase
|
4
|
+
tests <%= class_name %>
|
5
|
+
<% for action in actions -%>
|
6
|
+
def test_<%= action %>
|
7
|
+
@expected.subject = '<%= class_name %>#<%= action %>'
|
8
|
+
@expected.body = read_fixture('<%= action %>')
|
9
|
+
@expected.date = Time.now
|
10
|
+
|
11
|
+
assert_equal @expected.encoded, <%= class_name %>.create_<%= action %>(@expected.date).encoded
|
12
|
+
end
|
13
|
+
|
14
|
+
<% end -%>
|
15
|
+
<% if actions.blank? -%>
|
16
|
+
# replace this with your real tests
|
17
|
+
def test_truth
|
18
|
+
assert true
|
19
|
+
end
|
20
|
+
<% end -%>
|
21
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Description:
|
2
|
+
The extension_migration generator creates a stub for a new migration for an
|
3
|
+
extension.
|
4
|
+
|
5
|
+
The generator takes the extension name, a migration name as its arguments,
|
6
|
+
and an optional list of attribute pairs as arguments. The migration name
|
7
|
+
may be given in CamelCase or under_score.
|
8
|
+
|
9
|
+
You can name your migration in either of these formats to generate add/remove
|
10
|
+
column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable
|
11
|
+
|
12
|
+
A migration class is generated in vendor/extensions/extension_name/db/migrate
|
13
|
+
prefixed by a timestamp of the current date and time.
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
`./script/generate extension_migration MyExt AddSslFlag`
|
17
|
+
|
18
|
+
If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration
|
19
|
+
vendor/extensions/my_ext/db/migrate/20080514090912_add_ssl_flag.rb
|
20
|
+
|
21
|
+
`./script/generate migration MyExt AddTitleBodyToPost title:string body:text published:boolean`
|
22
|
+
|
23
|
+
This will create the AddTitleBodyToPost in vendor/extensions/my_ext/db/migrate/20080514090912_add_title_body_to_post.rb
|
24
|
+
with this in the Up migration:
|
25
|
+
|
26
|
+
add_column :posts, :title, :string
|
27
|
+
add_column :posts, :body, :text
|
28
|
+
add_column :posts, :published, :boolean
|
29
|
+
|
30
|
+
And this in the Down migration:
|
31
|
+
|
32
|
+
remove_column :posts, :published
|
33
|
+
remove_column :posts, :body
|
34
|
+
remove_column :posts, :title
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_generator/base'
|
2
|
+
require 'rails_generator/generators/components/migration/migration_generator'
|
3
|
+
|
4
|
+
class ExtensionMigrationGenerator < MigrationGenerator
|
5
|
+
|
6
|
+
attr_accessor :extension_name
|
7
|
+
|
8
|
+
def initialize(runtime_args, runtime_options = {})
|
9
|
+
runtime_args = runtime_args.dup
|
10
|
+
@extension_name = runtime_args.shift
|
11
|
+
super(runtime_args, runtime_options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def banner
|
15
|
+
"Usage: #{$0} extension_migration ExtensionName MigrationName [field:type, field:type]"
|
16
|
+
end
|
17
|
+
|
18
|
+
def extension_path
|
19
|
+
File.join('vendor', 'extensions', @extension_name.underscore)
|
20
|
+
end
|
21
|
+
|
22
|
+
def destination_root
|
23
|
+
File.join(Rails.root, extension_path)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= class_name.underscore.camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up<% attributes.each do |attribute| %>
|
3
|
+
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
|
4
|
+
<%- end %>
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down<% attributes.reverse.each do |attribute| %>
|
8
|
+
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
|
9
|
+
<%- end %>
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Description:
|
2
|
+
The extension_model generator creates stubs for a new model for an
|
3
|
+
extension.
|
4
|
+
|
5
|
+
The generator takes the extension name and a model name as its arguments.
|
6
|
+
The model name may be given in CamelCase or under_score and should not be
|
7
|
+
suffixed with 'Model'.
|
8
|
+
|
9
|
+
As additional parameters, the generator will take attribute pairs
|
10
|
+
described by name and type. These attributes will be used to prepopulate
|
11
|
+
the migration to create the table for the model and give you a set of
|
12
|
+
predefined fixtures. You don't have to think up all attributes up front,
|
13
|
+
but it's a good idea of adding just the baseline of what's needed to start
|
14
|
+
really working with the resource.
|
15
|
+
|
16
|
+
The generator creates a model class in
|
17
|
+
vendor/extensions/extension_name/app/models, a test suite in
|
18
|
+
vendor/extensions/extension_name/test/unit, test fixtures in
|
19
|
+
vendor/extensions/extension_name/test/fixtures/singular_name.yml, and a
|
20
|
+
migration in vendor/extensions/extension_name/db/migrate.
|
21
|
+
|
22
|
+
Examples:
|
23
|
+
./script/generate extension_model MyExt account
|
24
|
+
|
25
|
+
This will create an Account model:
|
26
|
+
|
27
|
+
Model: vendor/extensions/my_ext/app/models/account.rb
|
28
|
+
Migration: vendor/extensions/my_ext/db/migrate/XXX_add_accounts.rb
|
29
|
+
Spec: vendor/extensions/my_ext/spec/models/account_spec.rb
|
30
|
+
Test: vendor/extensions/my_ext/test/unit/account_test.rb (if extension created with "--with-test-unit")
|
31
|
+
Fixtures: vendor/extensions/my_ext/test/fixtures/accounts.yml (if extension created with "--with-test-unit")
|
32
|
+
|
33
|
+
./script/generate extension_model MyExt post title:string body:text
|
34
|
+
|
35
|
+
Creates post model with predefined attributes.
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rails_generator/base'
|
2
|
+
require 'rails_generator/generators/components/model/model_generator'
|
3
|
+
|
4
|
+
class ExtensionModelGenerator < ModelGenerator
|
5
|
+
|
6
|
+
attr_accessor :extension_name
|
7
|
+
default_options :with_test_unit => false
|
8
|
+
|
9
|
+
def initialize(runtime_args, runtime_options = {})
|
10
|
+
runtime_args = runtime_args.dup
|
11
|
+
@extension_name = runtime_args.shift
|
12
|
+
super(runtime_args, runtime_options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def manifest
|
16
|
+
if extension_uses_rspec?
|
17
|
+
rspec_manifest
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def rspec_manifest
|
24
|
+
record do |m|
|
25
|
+
# Check for class naming collisions.
|
26
|
+
m.class_collisions class_path, class_name
|
27
|
+
|
28
|
+
# Model, spec, and fixture directories.
|
29
|
+
m.directory File.join('app/models', class_path)
|
30
|
+
m.directory File.join('spec/models', class_path)
|
31
|
+
# m.directory File.join('spec/fixtures', class_path)
|
32
|
+
|
33
|
+
# Model class, spec and fixtures.
|
34
|
+
m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
35
|
+
# m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
|
36
|
+
m.template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
|
37
|
+
|
38
|
+
unless options[:skip_migration]
|
39
|
+
m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
|
40
|
+
:migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
|
41
|
+
}, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def banner
|
47
|
+
"Usage: #{$0} extension_model ExtensionName ModelName [field:type, field:type]"
|
48
|
+
end
|
49
|
+
|
50
|
+
def extension_path
|
51
|
+
File.join('vendor', 'extensions', @extension_name.underscore)
|
52
|
+
end
|
53
|
+
|
54
|
+
def destination_root
|
55
|
+
File.join(Rails.root, extension_path)
|
56
|
+
end
|
57
|
+
|
58
|
+
def extension_uses_rspec?
|
59
|
+
File.exists?(File.join(destination_root, 'spec')) && !options[:with_test_unit]
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_options!(opt)
|
63
|
+
opt.separator ''
|
64
|
+
opt.separator 'Options:'
|
65
|
+
opt.on("--with-test-unit",
|
66
|
+
"Use Test::Unit tests instead sof RSpec.") { |v| options[:with_test_unit] = v }
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
<% unless attributes.empty? -%>
|
4
|
+
one:
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
<%= attribute.name %>: <%= attribute.default %>
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
two:
|
10
|
+
<% for attribute in attributes -%>
|
11
|
+
<%= attribute.name %>: <%= attribute.default %>
|
12
|
+
<% end -%>
|
13
|
+
<% else -%>
|
14
|
+
# one:
|
15
|
+
# column: value
|
16
|
+
#
|
17
|
+
# two:
|
18
|
+
# column: value
|
19
|
+
<% end -%>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class <%= migration_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= table_name %> do |t|
|
4
|
+
<% for attribute in attributes -%>
|
5
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
6
|
+
<% end -%>
|
7
|
+
<% unless options[:skip_timestamps] %>
|
8
|
+
t.timestamps
|
9
|
+
<% end -%>
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :<%= table_name %>
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
|
2
|
+
|
3
|
+
describe <%= class_name %> do
|
4
|
+
before(:each) do
|
5
|
+
@<%= file_name %> = <%= class_name %>.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should be valid" do
|
9
|
+
@<%= file_name %>.should be_valid
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rails_generator'
|
2
|
+
module TrustyCms
|
3
|
+
module GeneratorBaseExtension
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval %{
|
6
|
+
alias_method_chain :existing_migrations, :extensions
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
def existing_migrations_with_extensions(file_name)
|
11
|
+
Dir.glob("#{destination_path(@migration_directory)}/[0-9]*_*.rb").grep(/[0-9]+_#{file_name}.rb$/)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
Rails::Generator::Commands::Base.class_eval { include TrustyCms::GeneratorBaseExtension }
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
# Small addition to enable the enqueing of "bundle install"
|
4
|
+
class Rails::Generator::Commands::Create
|
5
|
+
def run_bundler(destination_root)
|
6
|
+
# thanks to http://spectator.in/2011/01/28/bundler-in-subshells/
|
7
|
+
bundler_vars = %w(BUNDLE_GEMFILE RUBYOPT )
|
8
|
+
command = %{"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" install --gemfile="#{File.join(File.expand_path(destination_root), 'Gemfile')}"}
|
9
|
+
begin
|
10
|
+
bundled_env = ENV.to_hash
|
11
|
+
bundler_vars.each{ |var| ENV.delete(var) }
|
12
|
+
print `#{command}`
|
13
|
+
ensure
|
14
|
+
ENV.replace(bundled_env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class InstanceGenerator < Rails::Generator::Base
|
20
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
21
|
+
Config::CONFIG['ruby_install_name'])
|
22
|
+
|
23
|
+
DATABASES = %w( mysql postgresql sqlite3 sqlserver db2 )
|
24
|
+
|
25
|
+
MYSQL_SOCKET_LOCATIONS = [
|
26
|
+
"/tmp/mysql.sock", # default
|
27
|
+
"/var/run/mysqld/mysqld.sock", # debian/gentoo
|
28
|
+
"/var/tmp/mysql.sock", # freebsd
|
29
|
+
"/var/lib/mysql/mysql.sock", # fedora
|
30
|
+
"/opt/local/lib/mysql/mysql.sock", # fedora
|
31
|
+
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
|
32
|
+
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
|
33
|
+
"/opt/local/var/run/mysql5/mysqld.sock" # mac + darwinports + mysql5
|
34
|
+
]
|
35
|
+
|
36
|
+
default_options :db => "sqlite3", :shebang => DEFAULT_SHEBANG, :freeze => false
|
37
|
+
|
38
|
+
def initialize(runtime_args, runtime_options = {})
|
39
|
+
super
|
40
|
+
usage if args.empty?
|
41
|
+
usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))
|
42
|
+
@destination_root = args.shift
|
43
|
+
end
|
44
|
+
|
45
|
+
def manifest
|
46
|
+
# The absolute location of the TrustyCms files
|
47
|
+
root = File.expand_path(TRUSTY_CMS_ROOT)
|
48
|
+
|
49
|
+
# Use /usr/bin/env if no special shebang was specified
|
50
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
51
|
+
dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
|
52
|
+
|
53
|
+
record do |m|
|
54
|
+
# Root directory
|
55
|
+
m.directory ""
|
56
|
+
|
57
|
+
# Standard files and directories
|
58
|
+
base_dirs = %w(config config/environments config/initializers db log script public vendor/plugins vendor/extensions)
|
59
|
+
text_files = %w(CHANGELOG.md CONTRIBUTORS.md LICENSE.md INSTALL.md README.md)
|
60
|
+
environments = Dir["#{root}/config/environments/*.rb"]
|
61
|
+
bundler_compatibility_files = %w{config/preinitializer.rb}
|
62
|
+
schema_file = %w{db/schema.rb}
|
63
|
+
scripts = Dir["#{root}/script/**/*"].reject { |f| f =~ /(destroy|generate|plugin)$/ }
|
64
|
+
public_files = ["public/.htaccess"] + Dir["#{root}/public/**/*"]
|
65
|
+
test_files = ["config/cucumber.yml"]
|
66
|
+
|
67
|
+
files = base_dirs + text_files + environments + bundler_compatibility_files + schema_file + scripts + public_files + test_files
|
68
|
+
files.map! { |f| f = $1 if f =~ %r{^#{root}/(.+)$}; f }
|
69
|
+
files.sort!
|
70
|
+
|
71
|
+
files.each do |file|
|
72
|
+
case
|
73
|
+
when File.directory?("#{root}/#{file}")
|
74
|
+
m.directory file
|
75
|
+
when file =~ %r{^script/}
|
76
|
+
m.file radiant_root(file), file, script_options
|
77
|
+
when file =~ %r{^public/dispatch}
|
78
|
+
m.file radiant_root(file), file, dispatcher_options
|
79
|
+
else
|
80
|
+
m.file radiant_root(file), file
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# script/generate
|
85
|
+
m.file "instance_generate", "script/generate", script_options
|
86
|
+
|
87
|
+
# database.yml and .htaccess
|
88
|
+
m.template "databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
|
89
|
+
:app_name => File.basename(File.expand_path(@destination_root)),
|
90
|
+
:socket => options[:db] == "mysql" ? mysql_socket_location : nil
|
91
|
+
}
|
92
|
+
|
93
|
+
# Instance Gemfile
|
94
|
+
m.template "instance_gemfile", "Gemfile", :assigns => {
|
95
|
+
:radiant_version => TrustyCms::Version.to_s,
|
96
|
+
:db => options[:db]
|
97
|
+
}
|
98
|
+
|
99
|
+
# Instance Rakefile
|
100
|
+
m.file "instance_rakefile", "Rakefile"
|
101
|
+
|
102
|
+
# Config.ru is useful in rack-based situations like Pow
|
103
|
+
m.file "instance_config.ru", "config.ru"
|
104
|
+
|
105
|
+
# Instance Configurations
|
106
|
+
m.file "instance_routes.rb", "config/routes.rb"
|
107
|
+
m.template "instance_environment.rb", "config/environment.rb", :assigns => {
|
108
|
+
:radiant_environment => File.join(File.dirname(__FILE__), 'templates', radiant_root("config/environment.rb")),
|
109
|
+
:app_name => File.basename(File.expand_path(@destination_root))
|
110
|
+
}
|
111
|
+
m.template "instance_boot.rb", "config/boot.rb"
|
112
|
+
m.file "instance_radiant_config.rb", "config/initializers/radiant_config.rb"
|
113
|
+
|
114
|
+
# Run bundler
|
115
|
+
m.run_bundler @destination_root
|
116
|
+
|
117
|
+
m.readme radiant_root("INSTALL.md")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
protected
|
122
|
+
|
123
|
+
def banner
|
124
|
+
"Usage: #{$0} /path/to/trusty_cms/app [options]"
|
125
|
+
end
|
126
|
+
|
127
|
+
def add_options!(opt)
|
128
|
+
opt.separator ''
|
129
|
+
opt.separator 'Options:'
|
130
|
+
opt.on("-r", "--ruby=path", String,
|
131
|
+
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
132
|
+
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
133
|
+
opt.on("-d", "--database=name", String,
|
134
|
+
"Preconfigure for selected database (options: #{DATABASES.join(", ")}).",
|
135
|
+
"Default: sqlite3") { |v| options[:db] = v }
|
136
|
+
end
|
137
|
+
|
138
|
+
def mysql_socket_location
|
139
|
+
RUBY_PLATFORM =~ /mswin32/ ? MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } : nil
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def radiant_root(filename = '')
|
145
|
+
File.join("..", "..", "..", "..", filename)
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# DB2 9.7
|
2
|
+
#
|
3
|
+
# Home Page
|
4
|
+
# http://rubyforge.org/projects/rubyibm/
|
5
|
+
#
|
6
|
+
# To install the ibm_db gem:
|
7
|
+
# On Linux:
|
8
|
+
# $ sudo -s
|
9
|
+
# $ . /home/db2inst1/sqllib/db2profile
|
10
|
+
# $ export IBM_DB_LIB=/opt/ibm/db2/V9.7/lib
|
11
|
+
# $ export IBM_DB_INCLUDE=/opt/ibm/db2/V9.7/include
|
12
|
+
# $ gem install ibm_db
|
13
|
+
#
|
14
|
+
# On Windows:
|
15
|
+
# Issue the command: gem install ibm_db
|
16
|
+
# If prompted, select the mswin32 option
|
17
|
+
#
|
18
|
+
# For more details on the installation and the available connection parameters refer to:
|
19
|
+
# http://rubyforge.org/docman/?group_id=2361
|
20
|
+
|
21
|
+
development:
|
22
|
+
adapter: ibm_db
|
23
|
+
database: <%= app_name[0,4] %>_dev
|
24
|
+
username: db2inst1
|
25
|
+
password:
|
26
|
+
|
27
|
+
# Warning: The database defined as 'test' will be erased and
|
28
|
+
# re-generated from your development database when you run 'rake'.
|
29
|
+
# Do not set this db to the same as development or production.
|
30
|
+
test:
|
31
|
+
adapter: ibm_db
|
32
|
+
database: <%= app_name[0,4] %>_tst
|
33
|
+
username: db2inst1
|
34
|
+
password:
|
35
|
+
|
36
|
+
production:
|
37
|
+
adapter: ibm_db
|
38
|
+
database: <%= app_name[0,4] %>_prd
|
39
|
+
username: db2inst1
|
40
|
+
password:
|