trusty-cms 4.1.6 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +114 -107
- data/INSTALL.md +2 -0
- data/app/controllers/admin/pages_controller.rb +1 -1
- data/app/controllers/admin/preferences_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +1 -1
- data/app/controllers/admin/users_controller.rb +1 -1
- data/config/environments/development.rb +2 -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 +18 -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 +93 -0
- data/lib/generators/instance/templates/instance_gemfile +78 -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/generators/trusty_cms/USAGE +8 -0
- data/lib/generators/trusty_cms/templates/Rakefile.erb +7 -0
- data/lib/generators/trusty_cms/templates/application.rb.erb +149 -0
- data/lib/generators/trusty_cms/templates/boot.rb.erb +9 -0
- data/lib/generators/trusty_cms/templates/config.ru.erb +4 -0
- data/lib/generators/trusty_cms/templates/database.yml.erb +28 -0
- data/lib/generators/trusty_cms/templates/environment.rb.erb +5 -0
- data/lib/generators/trusty_cms/templates/environments/development.rb.erb +24 -0
- data/lib/generators/trusty_cms/templates/environments/production.rb.erb +26 -0
- data/lib/generators/trusty_cms/templates/environments/test.rb.erb +35 -0
- data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +13 -0
- data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +8 -0
- data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +16 -0
- data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +18 -0
- data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
- data/lib/generators/trusty_cms/trusty_cms_generator.rb +32 -0
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/setup.rb +8 -8
- data/trusty_cms.gemspec +4 -4
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb +195 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/check_box.rb +65 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb +18 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_check_boxes.rb +35 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_helpers.rb +118 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_radio_buttons.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_select.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb +26 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb +73 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb +31 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_local_field.rb +20 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_select.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/email_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/file_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/hidden_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/label.rb +80 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/month_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/number_field.rb +20 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/password_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/placeholderable.rb +24 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/radio_button.rb +32 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/range_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/search_field.rb +27 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/select.rb +42 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/tel_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_area.rb +24 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_field.rb +33 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_select.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/translator.rb +39 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/url_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/week_field.rb +14 -0
- data/yarn.lock +3 -3
- metadata +296 -71
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +0 -126
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +0 -4
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +0 -56
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +0 -43
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +0 -28
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +0 -36
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +0 -76
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +0 -23
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +0 -87
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +0 -157
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +0 -142
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +0 -81
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +0 -114
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
- data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +0 -114
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +0 -17
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +0 -37
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +0 -34
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +0 -40
- data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +0 -62
- data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +0 -60
- data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +0 -35
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +0 -97
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +0 -131
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +0 -105
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +0 -80
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +0 -91
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +0 -93
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
# Don't change this file!
|
3
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
4
|
+
|
5
|
+
|
6
|
+
# Set up gems listed in the Gemfile.
|
7
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
8
|
+
|
9
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# This is only an example configuration. Please see the Rails
|
3
|
+
# documentation for more details.
|
4
|
+
#
|
5
|
+
|
6
|
+
development:
|
7
|
+
adapter: mysql2
|
8
|
+
database: <%= project_name%>_blank_dev
|
9
|
+
username:
|
10
|
+
password:
|
11
|
+
host: localhost
|
12
|
+
|
13
|
+
test: &TEST
|
14
|
+
adapter: mysql2
|
15
|
+
database: <%= project_name%>_blank_test
|
16
|
+
username:
|
17
|
+
password:
|
18
|
+
host:
|
19
|
+
|
20
|
+
production:
|
21
|
+
adapter: mysql2
|
22
|
+
database: <%= project_name%>_blank_live
|
23
|
+
username:
|
24
|
+
password:
|
25
|
+
socket: /tmp/mysql.sock
|
26
|
+
|
27
|
+
cucumber:
|
28
|
+
<<: *TEST
|
@@ -0,0 +1,24 @@
|
|
1
|
+
TrustyCms::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and caching is turned off
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
#config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
config.domain = ".local"
|
20
|
+
|
21
|
+
config.after_initialize do
|
22
|
+
SiteController.cache_timeout = 0.minutes
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
TrustyCms::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Use a different logger for distributed setups
|
9
|
+
# config.logger = SyslogLogger.new
|
10
|
+
|
11
|
+
|
12
|
+
# Full error reports are disabled and caching is on
|
13
|
+
config.action_controller.consider_all_requests_local = false
|
14
|
+
config.action_controller.perform_caching = true
|
15
|
+
|
16
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
17
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
18
|
+
|
19
|
+
# Disable delivery errors if you bad email addresses should just be ignored
|
20
|
+
# config.action_mailer.raise_delivery_errors = false
|
21
|
+
|
22
|
+
# Cache your content for a longer time, the default is 5.minutes
|
23
|
+
# config.after_initialize do
|
24
|
+
# SiteController.cache_timeout = 12.hours
|
25
|
+
# end
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
TrustyCms::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# ensure test extensions are loaded
|
11
|
+
# test_extension_dir = File.join(File.expand_path(RADIANT_ROOT), 'test', 'fixtures', 'extensions')
|
12
|
+
# config.extension_paths.unshift test_extension_dir
|
13
|
+
# config.extension_paths.uniq!
|
14
|
+
# if !config.extensions.include?(:all)
|
15
|
+
# config.extensions.concat(Dir["#{test_extension_dir}/*"].sort.map {|x| File.basename(x).sub(/^\d+_/,'')})
|
16
|
+
# config.extensions.uniq!
|
17
|
+
# end
|
18
|
+
|
19
|
+
# Log error messages when you accidentally call methods on nil.
|
20
|
+
config.whiny_nils = true
|
21
|
+
config.domain = ".local"
|
22
|
+
|
23
|
+
# Show full error reports and disable caching
|
24
|
+
config.action_controller.consider_all_requests_local = true
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
# Disable request forgery protection in test environment
|
28
|
+
config.action_controller.allow_forgery_protection = false
|
29
|
+
|
30
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
31
|
+
# The :test delivery method accumulates sent emails in the
|
32
|
+
# ActionMailer::Base.deliveries array.
|
33
|
+
config.action_mailer.delivery_method = :test
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# config/initializers/secret_token.rb
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Your secret key for verifying the integrity of signed cookies.
|
6
|
+
# If you change this key, all old signed cookies will become invalid!
|
7
|
+
# Make sure the secret is at least 30 characters and all random,
|
8
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
9
|
+
TrustyCms::Application.config.secret_token = if Rails.env.development? or Rails.env.test?
|
10
|
+
('x' * 30) # meets minimum requirement of 30 chars long
|
11
|
+
else
|
12
|
+
ENV['SECRET_TOKEN']
|
13
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
TrustyCms::Application.config.session_store :cookie_store, :key => "_<%= project_name %>_session"
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# TestTrusty::Application.config.session_store :active_record_store
|
@@ -0,0 +1,16 @@
|
|
1
|
+
TrustyCms::Application.config do |config|
|
2
|
+
# this file can be used to set defaults, options and validation rules for local configuration settings.
|
3
|
+
# core settings are defined in RADIANT_ROOT/config/initializers/radiant_config.rb and by the corresponding
|
4
|
+
# file in each radiant extension. You probably don't need to add anything here, but in case you do:
|
5
|
+
|
6
|
+
# config.define 'site.show_footer?', :default => "true"
|
7
|
+
# config.define 'S3.bucket', :default => "key", :allow_change => false
|
8
|
+
|
9
|
+
# you can also use this file to set config values (by environment, for example):
|
10
|
+
|
11
|
+
# if RAILS_ENV == 'production'
|
12
|
+
# config['cache.duration'] = 86400
|
13
|
+
# else
|
14
|
+
# config['cache.duration'] = 0
|
15
|
+
# end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
2
|
+
# Lessens Debians need to edit.
|
3
|
+
require "rubygems" rescue nil
|
4
|
+
|
5
|
+
# Since Bundler is not really a 'must have' for Rails development just send off
|
6
|
+
# a warning and see if the sytem continues to load, the user can optionally use
|
7
|
+
# RADIANT_NOWARNINGS to disable it.
|
8
|
+
|
9
|
+
if File.file?(ENV['BUNDLE_GEMFILE'])
|
10
|
+
begin
|
11
|
+
require 'bundler/setup'
|
12
|
+
rescue LoadError
|
13
|
+
unless ENV['RADIANT_NOWARNINGS'] == true
|
14
|
+
$stderr.puts 'WARNING: It seems you do not have Bundler installed.'
|
15
|
+
$stderr.puts 'WARNING: You can install it by doing `gem install bundler`'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class TrustyCmsGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :project_name, type: :string, default: "trusty"
|
4
|
+
|
5
|
+
def generate_config
|
6
|
+
|
7
|
+
template "Rakefile.erb", "Rakefile"
|
8
|
+
template "config.ru.erb", "config.ru"
|
9
|
+
|
10
|
+
template "boot.rb.erb", "config/boot.rb"
|
11
|
+
template "environment.rb.erb", "config/environment.rb"
|
12
|
+
template "application.rb.erb", "config/application.rb"
|
13
|
+
template "preinitializer.rb.erb", "config/preinitializer.rb"
|
14
|
+
template "routes.rb.erb", "config/routes.rb"
|
15
|
+
template "database.yml.erb", "config/database.yml"
|
16
|
+
|
17
|
+
template "environments/development.rb.erb", "config/environments/development.rb"
|
18
|
+
template "environments/test.rb.erb", "config/environments/test.rb"
|
19
|
+
template "environments/production.rb.erb", "config/environments/production.rb"
|
20
|
+
|
21
|
+
template "initializers/trusty_cms_config.rb.erb", "config/initializers/trusty_cms_config.rb"
|
22
|
+
template "initializers/secret_token.rb.erb", "config/initializers/secret_token.rb"
|
23
|
+
template "initializers/session_store.rb.erb", "config/initializers/session_store.rb"
|
24
|
+
|
25
|
+
remove_file 'app/controllers/application_controller.rb'
|
26
|
+
remove_file 'app/helpers/application_helper.rb'
|
27
|
+
remove_file 'app/assets/javascripts/application.js'
|
28
|
+
remove_file 'app/views/layouts/application.html.erb'
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/lib/trusty_cms.rb
CHANGED
data/lib/trusty_cms/setup.rb
CHANGED
@@ -29,16 +29,16 @@ module TrustyCms
|
|
29
29
|
password ||= prompt_for_admin_password
|
30
30
|
end
|
31
31
|
attributes = {
|
32
|
-
|
33
|
-
|
32
|
+
first_name: name,
|
33
|
+
email: username,
|
34
34
|
password: password,
|
35
35
|
password_confirmation: password,
|
36
36
|
}
|
37
|
-
admin = User.find_by(
|
37
|
+
admin = User.find_by(email: username)
|
38
38
|
admin ||= User.new
|
39
|
-
admin.
|
39
|
+
admin.update(attributes)
|
40
40
|
admin.admin = true
|
41
|
-
admin.save
|
41
|
+
admin.save!
|
42
42
|
admin
|
43
43
|
end
|
44
44
|
|
@@ -98,17 +98,17 @@ module TrustyCms
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def prompt_for_admin_username
|
101
|
-
username = ask('Username (admin): ', String) do |q|
|
101
|
+
username = ask('Username (admin@trustarts.org): ', String) do |q|
|
102
102
|
q.validate = /^(|.{3,40})$/
|
103
103
|
q.responses[:not_valid] = 'Invalid username. Must be at least 3 characters long.'
|
104
104
|
q.whitespace = :strip
|
105
105
|
end
|
106
|
-
username = 'admin' if username.blank?
|
106
|
+
username = 'admin@trustarts.org' if username.blank?
|
107
107
|
username
|
108
108
|
end
|
109
109
|
|
110
110
|
def prompt_for_admin_password
|
111
|
-
default_password = '
|
111
|
+
default_password = 'Trusty123456@!'
|
112
112
|
password = ask("Password (#{default_password}): ", String) do |q|
|
113
113
|
q.echo = false unless defined?(::JRuby) # JRuby doesn't support stty interaction
|
114
114
|
q.validate = /^(|.{5,40})$/
|
data/trusty_cms.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = 'TrustyCms is a simple and powerful publishing system designed for small teams.
|
12
12
|
It is built with Rails and is similar to Textpattern or MovableType, but is
|
13
13
|
a general purpose content managment system--not merely a blogging engine.'
|
14
|
-
s.email = '
|
14
|
+
s.email = 'webteam@trustarts.org'
|
15
15
|
s.executables = ['trusty_cms']
|
16
16
|
s.extra_rdoc_files = ['README.md', 'INSTALL.md', 'LICENSE.md']
|
17
17
|
s.files = Dir['**/*', '.gitignore', 'public/.htaccess', 'log/.keep', 'vendor/extensions/.keep']
|
@@ -29,8 +29,8 @@ a general purpose content managment system--not merely a blogging engine.'
|
|
29
29
|
s.add_dependency 'delocalize', '>= 0.2', '< 2.0'
|
30
30
|
s.add_dependency 'devise'
|
31
31
|
s.add_dependency 'execjs', '~> 2.7'
|
32
|
-
s.add_dependency 'haml'
|
33
|
-
s.add_dependency 'haml-rails'
|
32
|
+
s.add_dependency 'haml'
|
33
|
+
s.add_dependency 'haml-rails'
|
34
34
|
s.add_dependency 'highline', '>= 1.7.8', '< 2.1.0'
|
35
35
|
s.add_dependency 'kraken-io'
|
36
36
|
s.add_dependency 'mini_racer'
|
@@ -40,7 +40,7 @@ a general purpose content managment system--not merely a blogging engine.'
|
|
40
40
|
s.add_dependency 'rack-cache', '~> 1.7'
|
41
41
|
s.add_dependency 'radius', '~> 0.7'
|
42
42
|
s.add_dependency 'rails'
|
43
|
-
s.add_dependency 'rake', '<
|
43
|
+
s.add_dependency 'rake', '< 14.0'
|
44
44
|
s.add_dependency 'rdoc', '>= 5.1', '< 7.0'
|
45
45
|
s.add_dependency 'RedCloth', '4.3.2'
|
46
46
|
s.add_dependency 'roadie-rails'
|
@@ -0,0 +1,195 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class Base # :nodoc:
|
7
|
+
include Helpers::ActiveModelInstanceTag, Helpers::TagHelper, Helpers::FormTagHelper
|
8
|
+
include FormOptionsHelper
|
9
|
+
|
10
|
+
attr_reader :object
|
11
|
+
|
12
|
+
def initialize(object_name, method_name, template_object, options = {})
|
13
|
+
@object_name, @method_name = object_name.to_s.dup, method_name.to_s.dup
|
14
|
+
@template_object = template_object
|
15
|
+
|
16
|
+
@object_name.sub!(/\[\]$/, "") || @object_name.sub!(/\[\]\]$/, "]")
|
17
|
+
@object = retrieve_object(options.delete(:object))
|
18
|
+
@skip_default_ids = options.delete(:skip_default_ids)
|
19
|
+
@allow_method_names_outside_object = options.delete(:allow_method_names_outside_object)
|
20
|
+
@options = options
|
21
|
+
|
22
|
+
if Regexp.last_match
|
23
|
+
@generate_indexed_names = true
|
24
|
+
@auto_index = retrieve_autoindex(Regexp.last_match.pre_match)
|
25
|
+
else
|
26
|
+
@generate_indexed_names = false
|
27
|
+
@auto_index = nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# This is what child classes implement.
|
32
|
+
def render
|
33
|
+
raise NotImplementedError, "Subclasses must implement a render method"
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def value
|
38
|
+
if @allow_method_names_outside_object
|
39
|
+
object.public_send @method_name if object && object.respond_to?(@method_name)
|
40
|
+
else
|
41
|
+
object.public_send @method_name if object
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def value_before_type_cast
|
46
|
+
unless object.nil?
|
47
|
+
method_before_type_cast = @method_name + "_before_type_cast"
|
48
|
+
|
49
|
+
if value_came_from_user? && object.respond_to?(method_before_type_cast)
|
50
|
+
object.public_send(method_before_type_cast)
|
51
|
+
else
|
52
|
+
value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def value_came_from_user?
|
58
|
+
method_name = "#{@method_name}_came_from_user?"
|
59
|
+
!object.respond_to?(method_name) || object.public_send(method_name)
|
60
|
+
end
|
61
|
+
|
62
|
+
def retrieve_object(object)
|
63
|
+
if object
|
64
|
+
object
|
65
|
+
elsif @template_object.instance_variable_defined?("@#{@object_name}")
|
66
|
+
@template_object.instance_variable_get("@#{@object_name}")
|
67
|
+
end
|
68
|
+
rescue NameError
|
69
|
+
# As @object_name may contain the nested syntax (item[subobject]) we need to fallback to nil.
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def retrieve_autoindex(pre_match)
|
74
|
+
object = self.object || @template_object.instance_variable_get("@#{pre_match}")
|
75
|
+
if object && object.respond_to?(:to_param)
|
76
|
+
object.to_param
|
77
|
+
else
|
78
|
+
raise ArgumentError, "object[] naming but object param and @object var don't exist or don't respond to to_param: #{object.inspect}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_default_name_and_id_for_value(tag_value, options)
|
83
|
+
if tag_value.nil?
|
84
|
+
add_default_name_and_id(options)
|
85
|
+
else
|
86
|
+
specified_id = options["id"]
|
87
|
+
add_default_name_and_id(options)
|
88
|
+
|
89
|
+
if specified_id.blank? && options["id"].present?
|
90
|
+
options["id"] += "_#{sanitized_value(tag_value)}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def add_default_name_and_id(options)
|
96
|
+
index = name_and_id_index(options)
|
97
|
+
options["name"] = options.fetch("name") { tag_name(options["multiple"], index) }
|
98
|
+
|
99
|
+
if generate_ids?
|
100
|
+
options["id"] = options.fetch("id") { tag_id(index) }
|
101
|
+
if namespace = options.delete("namespace")
|
102
|
+
options["id"] = options["id"] ? "#{namespace}_#{options['id']}" : namespace
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def tag_name(multiple = false, index = nil)
|
108
|
+
# a little duplication to construct less strings
|
109
|
+
case
|
110
|
+
when @object_name.empty?
|
111
|
+
"#{sanitized_method_name}#{multiple ? "[]" : ""}"
|
112
|
+
when index
|
113
|
+
"#{@object_name}[#{index}][#{sanitized_method_name}]#{multiple ? "[]" : ""}"
|
114
|
+
else
|
115
|
+
"#{@object_name}[#{sanitized_method_name}]#{multiple ? "[]" : ""}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def tag_id(index = nil)
|
120
|
+
# a little duplication to construct less strings
|
121
|
+
case
|
122
|
+
when @object_name.empty?
|
123
|
+
sanitized_method_name.dup
|
124
|
+
when index
|
125
|
+
"#{sanitized_object_name}_#{index}_#{sanitized_method_name}"
|
126
|
+
else
|
127
|
+
"#{sanitized_object_name}_#{sanitized_method_name}"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def sanitized_object_name
|
132
|
+
@sanitized_object_name ||= @object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "")
|
133
|
+
end
|
134
|
+
|
135
|
+
def sanitized_method_name
|
136
|
+
@sanitized_method_name ||= @method_name.sub(/\?$/, "")
|
137
|
+
end
|
138
|
+
|
139
|
+
def sanitized_value(value)
|
140
|
+
value.to_s.gsub(/[\s\.]/, "_").gsub(/[^-[[:word:]]]/, "").downcase
|
141
|
+
end
|
142
|
+
|
143
|
+
def select_content_tag(option_tags, options, html_options)
|
144
|
+
html_options = html_options.stringify_keys
|
145
|
+
add_default_name_and_id(html_options)
|
146
|
+
|
147
|
+
if placeholder_required?(html_options)
|
148
|
+
raise ArgumentError, "include_blank cannot be false for a required field." if options[:include_blank] == false
|
149
|
+
options[:include_blank] ||= true unless options[:prompt]
|
150
|
+
end
|
151
|
+
|
152
|
+
value = options.fetch(:selected) { value() }
|
153
|
+
select = content_tag("select", add_options(option_tags, options, value), html_options)
|
154
|
+
|
155
|
+
if html_options["multiple"] && options.fetch(:include_hidden, true)
|
156
|
+
tag("input", disabled: html_options["disabled"], name: html_options["name"], type: "hidden", value: "") + select
|
157
|
+
else
|
158
|
+
select
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def placeholder_required?(html_options)
|
163
|
+
# See https://html.spec.whatwg.org/multipage/forms.html#attr-select-required
|
164
|
+
html_options["required"] && !html_options["multiple"] && html_options.fetch("size", 1).to_i == 1
|
165
|
+
end
|
166
|
+
|
167
|
+
def add_options(option_tags, options, value = nil)
|
168
|
+
if options[:include_blank]
|
169
|
+
option_tags = tag_builder.content_tag_string("option", options[:include_blank].kind_of?(String) ? options[:include_blank] : nil, value: "") + "\n" + option_tags
|
170
|
+
end
|
171
|
+
if value.blank? && options[:prompt]
|
172
|
+
tag_options = { value: "" }.tap do |prompt_opts|
|
173
|
+
prompt_opts[:disabled] = true if options[:disabled] == ""
|
174
|
+
prompt_opts[:selected] = true if options[:selected] == ""
|
175
|
+
end
|
176
|
+
option_tags = tag_builder.content_tag_string("option", prompt_text(options[:prompt]), tag_options) + "\n" + option_tags
|
177
|
+
end
|
178
|
+
option_tags
|
179
|
+
end
|
180
|
+
|
181
|
+
def name_and_id_index(options)
|
182
|
+
if options.key?("index")
|
183
|
+
options.delete("index") || ""
|
184
|
+
elsif @generate_indexed_names
|
185
|
+
@auto_index || ""
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def generate_ids?
|
190
|
+
!@skip_default_ids
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|