trusty-cms 3.8.2 → 3.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +1 -1
- data/app/helpers/scoped_helper.rb +1 -1
- data/app/models/trusty_cms/config.rb +2 -5
- data/config/application.rb +4 -4
- data/config/initializers/devise.rb +1 -1
- data/db/migrate/{001_create_radiant_tables.rb → 001_create_trusty_tables.rb} +1 -1
- data/db/migrate/20111016150725_extend_page_part_content_limit.rb +0 -2
- data/lib/configuration_extensions/configuration_extensions.rb +9 -9
- data/lib/tasks/extensions.rake +4 -4
- data/lib/tasks/framework.rake +28 -28
- data/lib/tasks/radiant_config.rake +4 -4
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/config/definition.rb +1 -1
- data/lib/trusty_cms/extension_loader.rb +1 -1
- data/lib/trusty_cms/extension_path.rb +1 -1
- data/lib/trusty_cms/initializer.rb +14 -14
- data/lib/trusty_cms/taggable.rb +1 -1
- data/lib/trusty_cms/task_support.rb +2 -2
- data/spec/dummy/config/application.rb +8 -8
- data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +2 -2
- data/vendor/extensions/multi-site-extension/lib/tasks/scoped_admin_extension_tasks.rake +2 -2
- metadata +3 -103
- data/CONTRIBUTORS.md +0 -279
- data/Vagrantfile +0 -122
- data/app/mailers/password_mailer.rb +0 -10
- data/bin/ci/before_script +0 -10
- data/bin/trusty_test +0 -3
- data/lib/generators/extension/USAGE +0 -30
- data/lib/generators/extension/extension_generator.rb +0 -97
- data/lib/generators/extension/templates/README.md +0 -6
- data/lib/generators/extension/templates/RSpecRakefile +0 -109
- data/lib/generators/extension/templates/Rakefile +0 -25
- data/lib/generators/extension/templates/cucumber.yml +0 -1
- data/lib/generators/extension/templates/cucumber_env.rb +0 -11
- data/lib/generators/extension/templates/cucumber_paths.rb +0 -22
- data/lib/generators/extension/templates/en.yml +0 -3
- data/lib/generators/extension/templates/extension.rb +0 -21
- data/lib/generators/extension/templates/functional_test.rb +0 -15
- data/lib/generators/extension/templates/gemspec.rb +0 -29
- data/lib/generators/extension/templates/lib.rb +0 -8
- data/lib/generators/extension/templates/migration.rb +0 -9
- data/lib/generators/extension/templates/radiant_config.rb +0 -3
- data/lib/generators/extension/templates/routes.rb +0 -5
- data/lib/generators/extension/templates/spec.opts +0 -6
- data/lib/generators/extension/templates/spec_helper.rb +0 -42
- data/lib/generators/extension/templates/tasks.rake +0 -47
- data/lib/generators/extension/templates/test_helper.rb +0 -26
- data/lib/generators/extension_controller/USAGE +0 -36
- data/lib/generators/extension_controller/extension_controller_generator.rb +0 -84
- data/lib/generators/extension_controller/templates/controller.rb +0 -10
- data/lib/generators/extension_controller/templates/controller_spec.rb +0 -23
- data/lib/generators/extension_controller/templates/functional_test.rb +0 -11
- data/lib/generators/extension_controller/templates/helper.rb +0 -2
- data/lib/generators/extension_controller/templates/helper_spec.rb +0 -11
- data/lib/generators/extension_controller/templates/helper_test.rb +0 -4
- data/lib/generators/extension_controller/templates/view.html.erb +0 -2
- data/lib/generators/extension_controller/templates/view_spec.rb +0 -12
- data/lib/generators/extension_mailer/USAGE +0 -17
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +0 -68
- data/lib/generators/extension_mailer/templates/fixture.erb +0 -3
- data/lib/generators/extension_mailer/templates/mailer.rb +0 -15
- data/lib/generators/extension_mailer/templates/unit_test.rb +0 -21
- data/lib/generators/extension_mailer/templates/view.erb +0 -3
- data/lib/generators/extension_migration/USAGE +0 -34
- data/lib/generators/extension_migration/extension_migration_generator.rb +0 -25
- data/lib/generators/extension_migration/templates/migration.rb +0 -11
- data/lib/generators/extension_model/USAGE +0 -35
- data/lib/generators/extension_model/extension_model_generator.rb +0 -68
- data/lib/generators/extension_model/templates/fixtures.yml +0 -19
- data/lib/generators/extension_model/templates/migration.rb +0 -16
- data/lib/generators/extension_model/templates/model.rb +0 -2
- data/lib/generators/extension_model/templates/model_spec.rb +0 -11
- data/lib/generators/extension_model/templates/unit_test.rb +0 -8
- data/lib/generators/generator_base_extension.rb +0 -18
- data/lib/generators/instance/instance_generator.rb +0 -148
- data/lib/generators/instance/templates/databases/db2.yml +0 -40
- data/lib/generators/instance/templates/databases/mysql.yml +0 -47
- data/lib/generators/instance/templates/databases/postgresql.yml +0 -44
- data/lib/generators/instance/templates/databases/sqlite3.yml +0 -16
- data/lib/generators/instance/templates/databases/sqlserver.yml +0 -21
- data/lib/generators/instance/templates/instance_boot.rb +0 -122
- data/lib/generators/instance/templates/instance_config.ru +0 -2
- data/lib/generators/instance/templates/instance_environment.rb +0 -93
- data/lib/generators/instance/templates/instance_gemfile +0 -78
- data/lib/generators/instance/templates/instance_generate +0 -6
- data/lib/generators/instance/templates/instance_radiant_config.rb +0 -16
- data/lib/generators/instance/templates/instance_rakefile +0 -3
- data/lib/generators/instance/templates/instance_routes.rb +0 -1
- data/lib/generators/language_extension/USAGE +0 -27
- data/lib/generators/language_extension/language_extension_generator.rb +0 -71
- data/lib/generators/language_extension/templates/README +0 -3
- data/lib/generators/language_extension/templates/RSpecRakefile +0 -123
- data/lib/generators/language_extension/templates/Rakefile +0 -25
- data/lib/generators/language_extension/templates/available_tags.yml +0 -553
- data/lib/generators/language_extension/templates/cucumber.yml +0 -1
- data/lib/generators/language_extension/templates/cucumber_env.rb +0 -16
- data/lib/generators/language_extension/templates/cucumber_paths.rb +0 -14
- data/lib/generators/language_extension/templates/extension.rb +0 -12
- data/lib/generators/language_extension/templates/functional_test.rb +0 -15
- data/lib/generators/language_extension/templates/gemspec.rb +0 -24
- data/lib/generators/language_extension/templates/lang.yml +0 -181
- data/lib/generators/language_extension/templates/lib.rb +0 -8
- data/lib/generators/language_extension/templates/spec.opts +0 -6
- data/lib/generators/language_extension/templates/spec_helper.rb +0 -36
- data/lib/generators/language_extension/templates/tasks.rake +0 -28
- data/lib/generators/language_extension/templates/test_helper.rb +0 -26
- data/lib/generators/trusty_cms/USAGE +0 -8
- data/lib/generators/trusty_cms/templates/Rakefile.erb +0 -7
- data/lib/generators/trusty_cms/templates/application.rb.erb +0 -149
- data/lib/generators/trusty_cms/templates/boot.rb.erb +0 -9
- data/lib/generators/trusty_cms/templates/config.ru.erb +0 -4
- data/lib/generators/trusty_cms/templates/database.yml.erb +0 -28
- data/lib/generators/trusty_cms/templates/environment.rb.erb +0 -5
- data/lib/generators/trusty_cms/templates/environments/development.rb.erb +0 -24
- data/lib/generators/trusty_cms/templates/environments/production.rb.erb +0 -26
- data/lib/generators/trusty_cms/templates/environments/test.rb.erb +0 -35
- data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +0 -13
- data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +0 -8
- data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +0 -16
- data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +0 -18
- data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
- data/lib/generators/trusty_cms/trusty_cms_generator.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03c798051f6a9e3ca039cde76868c92f4c167851a51a7faba5e0f094cbc28bba
|
4
|
+
data.tar.gz: 1622ca9cff174468884c1b605563870e1edbb19ed6a2289b8782f01641f65dd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed160cae1847c602d13b8db042f2d494f4d673fb5eac40745d5214a453bc7d4743199984cd737c07a9be1d739bec5cf6988b2ddf3f9958a0907184bcb2bd76d
|
7
|
+
data.tar.gz: 109ac3bb659fc9ea54806ca3e292e286aeef883a40d315d3a88f7d0e6810efd8647be7db598e919b3adc5abc3b11eb4fff1f96a6f398fc5a330e44fcc841db24
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -41,7 +41,6 @@ module TrustyCms
|
|
41
41
|
# end
|
42
42
|
# end
|
43
43
|
#
|
44
|
-
# and usually in a config/radiant_config.rb file either in radiant itself, in the application directory
|
45
44
|
# or in an extension. TrustyCms currently defines the following settings and makes them editable by
|
46
45
|
# admin users on the site configuration page:
|
47
46
|
#
|
@@ -135,7 +134,7 @@ module TrustyCms
|
|
135
134
|
end
|
136
135
|
|
137
136
|
def cache_file
|
138
|
-
File.join(cache_path,'
|
137
|
+
File.join(cache_path,'trusty_config_cache.txt')
|
139
138
|
end
|
140
139
|
|
141
140
|
def site_settings
|
@@ -177,9 +176,7 @@ module TrustyCms
|
|
177
176
|
# * :allow_blank should be false if the config item must not be blank or nil
|
178
177
|
# * :allow_change should be false if the config item can only be set, not changed. Add a default to specify an unchanging config entry.
|
179
178
|
# * :allow_display should be false if the config item should not be showable in radius tags
|
180
|
-
#
|
181
|
-
# From the main radiant config/initializers/radiant_config.rb:
|
182
|
-
#
|
179
|
+
#
|
183
180
|
# TrustyCms.config do |config|
|
184
181
|
# config.define 'defaults.locale', :select_from => lambda { TrustyCms::AvailableLocales.locales }, :allow_blank => true
|
185
182
|
# config.define 'defaults.page.parts', :default => "Body,Extended"
|
data/config/application.rb
CHANGED
@@ -37,16 +37,16 @@ module TrustyCms
|
|
37
37
|
end
|
38
38
|
paths["app/helpers"] = []
|
39
39
|
# config.add_plugin_paths(extension_loader.paths(:plugin))
|
40
|
-
|
41
|
-
config.i18n.load_path =
|
40
|
+
trusty_locale_paths = Dir[File.join(TRUSTY_CMS_ROOT, 'config', 'locales', '*.{rb,yml}')]
|
41
|
+
config.i18n.load_path = trusty_locale_paths + extension_loader.paths(:locale)
|
42
42
|
I18n.enforce_available_locales = true
|
43
43
|
|
44
44
|
config.encoding = 'utf-8'
|
45
45
|
|
46
46
|
config.middleware.use Rack::Cache,
|
47
47
|
:private_headers => ['Authorization'],
|
48
|
-
:entitystore => "
|
49
|
-
:metastore => "
|
48
|
+
:entitystore => "trusty:tmp/cache/entity",
|
49
|
+
:metastore => "trusty:tmp/cache/meta",
|
50
50
|
:verbose => false,
|
51
51
|
:allow_reload => false,
|
52
52
|
:allow_revalidate => false
|
@@ -92,7 +92,7 @@ Devise.setup do |config|
|
|
92
92
|
# It will change confirmation, password recovery and other workflows
|
93
93
|
# to behave the same regardless if the e-mail provided was right or wrong.
|
94
94
|
# Does not affect registerable.
|
95
|
-
|
95
|
+
config.paranoid = true
|
96
96
|
|
97
97
|
# By default Devise will store the user in session. You can skip storage for
|
98
98
|
# particular strategies by setting this option.
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class ExtendPagePartContentLimit < ActiveRecord::Migration[5.2]
|
2
2
|
def self.up
|
3
3
|
if ActiveRecord::Base.connection.adapter_name =~ /m[sy]sql/i
|
4
|
-
# Make sure text longer than 64kB is not cropped in MySQL and MSSQL
|
5
|
-
# See https://github.com/radiant/radiant-sheets-extension/issues/10
|
6
4
|
change_column :page_parts, :content, :text, :limit => 1048575
|
7
5
|
end
|
8
6
|
end
|
@@ -27,7 +27,7 @@ module TrustyCms
|
|
27
27
|
Rails.configuration
|
28
28
|
end
|
29
29
|
|
30
|
-
# Returns the root directory of this
|
30
|
+
# Returns the root directory of this installation (which is usually the gem directory).
|
31
31
|
# This is not the same as Rails.root, which is the instance directory and tends to contain only site-delivery material.
|
32
32
|
#
|
33
33
|
def root
|
@@ -56,7 +56,7 @@ module TrustyCms
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def vendor?
|
59
|
-
File.exist?("#{Rails.root}/vendor/
|
59
|
+
File.exist?("#{Rails.root}/vendor/trusty")
|
60
60
|
end
|
61
61
|
|
62
62
|
def app?
|
@@ -82,8 +82,8 @@ class Rails::Application::Configuration
|
|
82
82
|
|
83
83
|
# The TrustyCms::Configuration class extends Rails::Configuration with three purposes:
|
84
84
|
# * to reset some rails defaults so that files are found in TRUSTY_CMS_ROOT instead of Rails.root
|
85
|
-
# * to notice that some gems and plugins are in fact
|
86
|
-
# * to notice that some
|
85
|
+
# * to notice that some gems and plugins are in fact trusty extensions
|
86
|
+
# * to notice that some trusty extensions add load paths (for plugins, controllers, metal, etc)
|
87
87
|
|
88
88
|
attr_accessor :extension_paths, :ignored_extensions
|
89
89
|
|
@@ -177,7 +177,7 @@ class Rails::Application::Configuration
|
|
177
177
|
end
|
178
178
|
|
179
179
|
# Returns an alphabetical list of every extension found among all the load paths and bundled gems. Any plugin or
|
180
|
-
# gem whose path ends in the form +
|
180
|
+
# gem whose path ends in the form +trusty-something-extension+ is considered to be an extension.
|
181
181
|
#
|
182
182
|
# TrustyCms.configuration.available_extensions # => [:name, :name, :name, :name]
|
183
183
|
#
|
@@ -204,7 +204,7 @@ class Rails::Application::Configuration
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
# Scans the bundled gems for any whose name match the +
|
207
|
+
# Scans the bundled gems for any whose name match the +trusty-something-extension+ format
|
208
208
|
# and returns a list of their names as symbols.
|
209
209
|
#
|
210
210
|
# TrustyCms.configuration.gem_extensions # => [:name, :name]
|
@@ -221,7 +221,7 @@ class Rails::Application::Configuration
|
|
221
221
|
# Old extension-dependency mechanism now deprecated
|
222
222
|
#
|
223
223
|
def extension(ext)
|
224
|
-
::ActiveSupport::Deprecation.warn("Extension dependencies have been deprecated and are no longer supported in
|
224
|
+
::ActiveSupport::Deprecation.warn("Extension dependencies have been deprecated and are no longer supported in trusty 1.0. Extensions with dependencies should be packaged as gems and use the .gemspec to declare them.", caller)
|
225
225
|
end
|
226
226
|
|
227
227
|
# Old gem-invogation method now deprecated
|
@@ -299,7 +299,7 @@ class VendorBoot < Boot
|
|
299
299
|
end
|
300
300
|
|
301
301
|
def load_error_message
|
302
|
-
"Please verify that vendor/
|
302
|
+
"Please verify that vendor/trusty contains a complete copy of the TrustyCms sources."
|
303
303
|
end
|
304
304
|
end
|
305
305
|
|
@@ -315,7 +315,7 @@ class AppBoot < Boot
|
|
315
315
|
end
|
316
316
|
|
317
317
|
class GemBoot < Boot
|
318
|
-
# The location and version of the
|
318
|
+
# The location and version of the trusty gem should be set in your Gemfile
|
319
319
|
def load_error_message
|
320
320
|
"Have you run `bundle install`?'."
|
321
321
|
end
|
data/lib/tasks/extensions.rake
CHANGED
@@ -38,9 +38,9 @@ namespace :test do
|
|
38
38
|
if File.directory?(File.join(directory, 'test'))
|
39
39
|
chdir directory do
|
40
40
|
if RUBY_PLATFORM =~ /win32/
|
41
|
-
system "rake.cmd test
|
41
|
+
system "rake.cmd test TRUSTY_ENV_FILE=#{Rails.root}/config/environment"
|
42
42
|
else
|
43
|
-
system "rake test
|
43
|
+
system "rake test TRUSTY_ENV_FILE=#{Rails.root}/config/environment"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -64,9 +64,9 @@ namespace :spec do
|
|
64
64
|
puts %{\nRunning specs on #{extension} extension from #{directory}/spec\n}
|
65
65
|
chdir directory do
|
66
66
|
if RUBY_PLATFORM =~ /win32/
|
67
|
-
system "rake.cmd spec
|
67
|
+
system "rake.cmd spec TRUSTY_ENV_FILE=#{Rails.root}/config/environment"
|
68
68
|
else
|
69
|
-
system "rake spec
|
69
|
+
system "rake spec TRUSTY_ENV_FILE=#{Rails.root}/config/environment"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
data/lib/tasks/framework.rake
CHANGED
@@ -2,28 +2,28 @@
|
|
2
2
|
unless File.directory? "#{Rails.root}/app"
|
3
3
|
namespace :trusty_cms do
|
4
4
|
namespace :freeze do
|
5
|
-
desc "Lock this application to the current gems (by unpacking them into vendor/
|
5
|
+
desc "Lock this application to the current gems (by unpacking them into vendor/trusty)"
|
6
6
|
task :gems do
|
7
7
|
require 'rubygems'
|
8
8
|
require 'rubygems/gem_runner'
|
9
9
|
|
10
|
-
|
10
|
+
trusty = (version = ENV['VERSION']) ?
|
11
11
|
Gem.cache.search('trusty-cms', "= #{version}").first :
|
12
12
|
Gem.cache.search('trusty-cms').sort_by { |g| g.version }.last
|
13
13
|
|
14
|
-
version ||=
|
14
|
+
version ||= trusty.version
|
15
15
|
|
16
|
-
unless
|
17
|
-
puts "No
|
16
|
+
unless trusty
|
17
|
+
puts "No trusty gem #{version} is installed. Do 'gem list trusty' to see what you have available."
|
18
18
|
exit
|
19
19
|
end
|
20
20
|
|
21
|
-
puts "Freezing to the gems for TrustyCms #{
|
22
|
-
rm_rf "vendor/
|
21
|
+
puts "Freezing to the gems for TrustyCms #{trusty.version}"
|
22
|
+
rm_rf "vendor/trusty"
|
23
23
|
|
24
24
|
chdir("vendor") do
|
25
|
-
Gem::GemRunner.new.run(["unpack", "
|
26
|
-
FileUtils.mv(Dir.glob("
|
25
|
+
Gem::GemRunner.new.run(["unpack", "trusty", "--version", "=#{version}"])
|
26
|
+
FileUtils.mv(Dir.glob("trusty*").first, "trusty")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -35,30 +35,30 @@ unless File.directory? "#{Rails.root}/app"
|
|
35
35
|
exit 1
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
trusty_git = "git://github.com/pgharts/trusty-cms.git"
|
39
39
|
|
40
40
|
if File.exist?("vendor/trusty_cms/.git/HEAD")
|
41
|
-
cd("vendor/
|
41
|
+
cd("vendor/trusty") { system "git checkout master"; system "git pull origin master"}
|
42
42
|
else
|
43
|
-
system "git clone #{
|
43
|
+
system "git clone #{trusty_git} vendor/trusty"
|
44
44
|
end
|
45
45
|
|
46
46
|
case
|
47
47
|
when ENV['TAG']
|
48
|
-
cd("vendor/
|
48
|
+
cd("vendor/trusty") { system "git checkout -b v#{ENV['TAG']} #{ENV['TAG']}"}
|
49
49
|
when ENV['BRANCH']
|
50
|
-
cd("vendor/
|
50
|
+
cd("vendor/trusty") { system "git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}"}
|
51
51
|
when ENV['REVISION']
|
52
|
-
cd("vendor/
|
52
|
+
cd("vendor/trusty") { system "git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}"}
|
53
53
|
end
|
54
54
|
|
55
|
-
cd("vendor/
|
55
|
+
cd("vendor/trusty") { system "git submodule update --init"}
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
desc "Unlock this application from freeze of gems or edge and return to a fluid use of system gems"
|
60
60
|
task :unfreeze do
|
61
|
-
rm_rf "vendor/
|
61
|
+
rm_rf "vendor/trusty"
|
62
62
|
end
|
63
63
|
|
64
64
|
desc "Update configs, scripts, html, images, sass, stylesheets and javascripts from TrustyCms."
|
@@ -94,7 +94,7 @@ unless File.directory? "#{Rails.root}/app"
|
|
94
94
|
install "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_generate", "#{local_base}/generate", :mode => 0755
|
95
95
|
end
|
96
96
|
|
97
|
-
desc "Update your javascripts from your current
|
97
|
+
desc "Update your javascripts from your current trusty install"
|
98
98
|
task :javascripts do
|
99
99
|
FileUtils.mkdir_p("#{Rails.root}/public/javascripts/admin/")
|
100
100
|
copy_javascripts = proc do |project_dir, scripts|
|
@@ -110,7 +110,7 @@ unless File.directory? "#{Rails.root}/app"
|
|
110
110
|
TrustyCms::TaskSupport.cache_admin_js
|
111
111
|
end
|
112
112
|
|
113
|
-
desc "Update Gemfile from your current
|
113
|
+
desc "Update Gemfile from your current trusty install, backing up if required."
|
114
114
|
task :bundle do
|
115
115
|
require 'erb'
|
116
116
|
file = "#{Rails.root}/Gemfile"
|
@@ -128,7 +128,7 @@ unless File.directory? "#{Rails.root}/app"
|
|
128
128
|
active_db_gem = db_gems.keys.find { |g| Gem.loaded_specs[g] } || 'sqlite3'
|
129
129
|
|
130
130
|
File.open(tmpfile, 'w') do |f|
|
131
|
-
|
131
|
+
trusty_version = TrustyCms::VERSION.to_s
|
132
132
|
db = db_gems[active_db_gem]
|
133
133
|
f.write ERB.new(File.read(genfile)).result(binding)
|
134
134
|
end
|
@@ -138,7 +138,7 @@ unless File.directory? "#{Rails.root}/app"
|
|
138
138
|
if File.exist?(file)
|
139
139
|
FileUtils.cp(file, backfile)
|
140
140
|
warning << "** WARNING **
|
141
|
-
Your old Gemfile has been saved as Gemfile.bak. If you had
|
141
|
+
Your old Gemfile has been saved as Gemfile.bak. If you had trusty extensions or other gems in that file, please copy those lines to the new file. After checking the Gemfile, please run `bundle install` to update your application."
|
142
142
|
else
|
143
143
|
warning << "** WARNING **
|
144
144
|
A Gemfile has been created in your application directory. If you have config.gem entries in your old environment.rb (now .bak), please move them to the Gemfile. When you're happy with it, run `bundle install` to install the gems."
|
@@ -149,7 +149,7 @@ A Gemfile has been created in your application directory. If you have config.gem
|
|
149
149
|
puts warning
|
150
150
|
end
|
151
151
|
|
152
|
-
desc "Update configuration files from your current
|
152
|
+
desc "Update configuration files from your current trusty install"
|
153
153
|
task :configs do
|
154
154
|
require 'erb'
|
155
155
|
instances = {
|
@@ -187,7 +187,7 @@ A Gemfile has been created in your application directory. If you have config.gem
|
|
187
187
|
[:env, :development, :test, :cucumber, :production].each do |env_file|
|
188
188
|
File.open(tmps[env_file], 'w') do |f|
|
189
189
|
app_name = File.basename(File.expand_path(Rails.root))
|
190
|
-
|
190
|
+
trusty_version = TrustyCms::VERSION.to_s
|
191
191
|
f.write ERB.new(File.read(gens[env_file])).result(binding)
|
192
192
|
end
|
193
193
|
unless File.exist?(instances[env_file]) && FileUtils.compare_file(instances[env_file], tmps[env_file])
|
@@ -206,16 +206,16 @@ the new files: #{warning}"
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
desc "Update static HTML files from your current
|
209
|
+
desc "Update static HTML files from your current trusty install"
|
210
210
|
task :static_html do
|
211
211
|
project_dir = Rails.root + "/public/"
|
212
212
|
html_files = Dir["#{File.dirname(__FILE__)}/../../public/*.html"].delete_if { |f| f =~ /404.html|500.html/ }
|
213
213
|
FileUtils.cp(html_files, project_dir)
|
214
214
|
end
|
215
215
|
|
216
|
-
desc "Update admin and
|
216
|
+
desc "Update admin and trusty images from your current trusty install"
|
217
217
|
task :images do
|
218
|
-
%w{admin
|
218
|
+
%w{admin trusty}.each do |d|
|
219
219
|
project_dir = Rails.root + "/public/images/#{d}/"
|
220
220
|
FileUtils.mkdir_p(project_dir)
|
221
221
|
images = Dir["#{File.dirname(__FILE__)}/../../public/images/#{d}/*"]
|
@@ -223,7 +223,7 @@ the new files: #{warning}"
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
desc "Update admin stylesheets from your current
|
226
|
+
desc "Update admin stylesheets from your current trusty install"
|
227
227
|
task :stylesheets do
|
228
228
|
project_dir = Rails.root + '/public/stylesheets/admin/'
|
229
229
|
|
@@ -234,7 +234,7 @@ the new files: #{warning}"
|
|
234
234
|
copy_stylesheets[Rails.root + '/public/stylesheets/admin/',Dir["#{File.dirname(__FILE__)}/../../public/stylesheets/admin/*.css"]]
|
235
235
|
end
|
236
236
|
|
237
|
-
desc "Update admin sass files from your current
|
237
|
+
desc "Update admin sass files from your current trusty install"
|
238
238
|
task :sass do
|
239
239
|
copy_sass = proc do |project_dir, sass_files|
|
240
240
|
sass_files.reject!{|s| File.basename(s) == 'overrides.sass'} if File.exists?(project_dir + 'overrides.sass') || File.exists?(project_dir + '../overrides.css')
|
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'trusty_cms/task_support'
|
2
2
|
namespace :trusty_cms do
|
3
3
|
namespace :config do
|
4
|
-
desc "Export TrustyCms::Config to Rails.root/config/
|
4
|
+
desc "Export TrustyCms::Config to Rails.root/config/trusty_config.yml. Specify a path with TRUSTY_CONFIG_PATH - defaults to Rails.root/config/trusty_config.yml"
|
5
5
|
task :export => :environment do
|
6
|
-
config_path = ENV['
|
6
|
+
config_path = ENV['TRUSTY_CONFIG_PATH'] || "#{Rails.root}/config/trusty_config.yml"
|
7
7
|
clear = ENV['CLEAR_CONFIG'] || nil
|
8
8
|
TrustyCms::TaskSupport.config_export(config_path)
|
9
9
|
end
|
10
10
|
|
11
|
-
desc "Import TrustyCms::Config from Rails.root/config/
|
11
|
+
desc "Import TrustyCms::Config from Rails.root/config/trusty_config.yml. Specify a path with TRUSTY_CONFIG_PATH - defaults to Rails.root/config/trusty_config.yml Set CLEAR_CONFIG=true to delete all existing settings before import"
|
12
12
|
task :import => :environment do
|
13
|
-
config_path = ENV['
|
13
|
+
config_path = ENV['TRUSTY_CONFIG_PATH'] || "#{Rails.root}/config/trusty_config.yml"
|
14
14
|
clear = ENV['CLEAR_CONFIG'] || nil
|
15
15
|
TrustyCms::TaskSupport.config_import(config_path, clear)
|
16
16
|
end
|
data/lib/trusty_cms.rb
CHANGED
@@ -6,7 +6,7 @@ module TrustyCms
|
|
6
6
|
|
7
7
|
# Configuration 'definitions' are metadata held in memory that add restriction and description to individual config entries.
|
8
8
|
#
|
9
|
-
# By default
|
9
|
+
# By default trusty's configuration machinery is open and ad-hoc: config items are just globally-accessible variables.
|
10
10
|
# They're created when first mentioned and then available in all parts of the application. The definition mechanism is a way
|
11
11
|
# to place limits on that behavior. It allows you to protect a config entry, to specify the values it can take and to
|
12
12
|
# validate it when it changes. In the next update it will also allow you to declare that
|
@@ -120,7 +120,7 @@ module TrustyCms
|
|
120
120
|
# Builds an ExtensionPath object from the supplied path, working out the name of the extension on the way.
|
121
121
|
# The ExtensionPath object will later be used to scan and load the extension.
|
122
122
|
# An extension name can be supplied in addition to the path. It will be processed in the usual way to
|
123
|
-
# remove
|
123
|
+
# remove trusty- and -extension and any verion numbering.
|
124
124
|
#
|
125
125
|
def record_path(path, name=nil)
|
126
126
|
ExtensionPath.from_path(path, name)
|
@@ -37,7 +37,7 @@ module TrustyCms
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# Builds a new ExtensionPath object from the supplied path, working out the name of the extension by
|
40
|
-
# stripping the extra bits from
|
40
|
+
# stripping the extra bits from trusty-something-extension-1.0.0 to leave just 'something'. The object
|
41
41
|
# is returned, and also remembered here for later use by the initializer (to find load paths) and the
|
42
42
|
# ExtensionLoader, to load and activate the extension.
|
43
43
|
#
|
@@ -23,13 +23,13 @@ module TrustyCms
|
|
23
23
|
module Initializer
|
24
24
|
|
25
25
|
# Rails::Initializer is essentially a list of startup steps and we extend it here by:
|
26
|
-
# * overriding or extending some of those steps so that they use
|
26
|
+
# * overriding or extending some of those steps so that they use trusty and extension paths
|
27
27
|
# as well as (or instead of) the rails defaults.
|
28
28
|
# * appending some extra steps to set up the admin UI and activate extensions
|
29
29
|
|
30
30
|
|
31
|
-
# Returns true in the very unusual case where
|
32
|
-
# loaded as a gem or from vendor/. This is only likely in situations where
|
31
|
+
# Returns true in the very unusual case where trusty has been deployed as a rails app itself, rather than
|
32
|
+
# loaded as a gem or from vendor/. This is only likely in situations where trusty is customised so heavily
|
33
33
|
# that extensions are not sufficient.
|
34
34
|
#
|
35
35
|
def deployed_as_app?
|
@@ -43,7 +43,7 @@ module TrustyCms
|
|
43
43
|
super
|
44
44
|
end
|
45
45
|
|
46
|
-
# Overrides the Rails initializer to load metal from TRUSTY_CMS_ROOT and from
|
46
|
+
# Overrides the Rails initializer to load metal from TRUSTY_CMS_ROOT and from trusty extensions.
|
47
47
|
#
|
48
48
|
def initialize_metal
|
49
49
|
Rails::Rack::Metal.requested_metals = configuration.metals
|
@@ -57,11 +57,11 @@ module TrustyCms
|
|
57
57
|
Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
|
58
58
|
end
|
59
59
|
|
60
|
-
# Extends the Rails initializer to add locale paths from TRUSTY_CMS_ROOT and from
|
60
|
+
# Extends the Rails initializer to add locale paths from TRUSTY_CMS_ROOT and from trusty extensions.
|
61
61
|
#
|
62
62
|
def initialize_i18n
|
63
|
-
|
64
|
-
configuration.i18n.load_path =
|
63
|
+
trusty_locale_paths = Dir[File.join(TRUSTY_CMS_ROOT, 'config', 'locales', '*.{rb,yml}')]
|
64
|
+
configuration.i18n.load_path = trusty_locale_paths + extension_loader.paths(:locale)
|
65
65
|
super
|
66
66
|
end
|
67
67
|
|
@@ -81,40 +81,40 @@ module TrustyCms
|
|
81
81
|
@bundler_loaded ||= Bundler.require :default, Rails.env
|
82
82
|
end
|
83
83
|
|
84
|
-
# Extends the Rails initializer also to load
|
84
|
+
# Extends the Rails initializer also to load trusty extensions (which have been excluded from the list of plugins).
|
85
85
|
#
|
86
86
|
def load_plugins
|
87
87
|
super
|
88
88
|
extension_loader.load_extensions
|
89
89
|
end
|
90
90
|
|
91
|
-
# Extends the Rails initializer to run initializers from
|
91
|
+
# Extends the Rails initializer to run initializers from trusty and from extensions. The load order will be:
|
92
92
|
# 1. TRUSTY_CMS_ROOT/config/intializers/*.rb
|
93
93
|
# 2. Rails.root/config/intializers/*.rb
|
94
94
|
# 3. config/initializers/*.rb found in extensions, in extension load order.
|
95
95
|
#
|
96
|
-
# In the now rare case where
|
96
|
+
# In the now rare case where trusty is deployed as an ordinary rails application, step 1 is skipped
|
97
97
|
# because it is equivalent to step 2.
|
98
98
|
#
|
99
99
|
def load_application_initializers
|
100
|
-
|
100
|
+
load_trusty_initializers unless deployed_as_app?
|
101
101
|
super
|
102
102
|
extension_loader.load_extension_initalizers
|
103
103
|
end
|
104
104
|
|
105
105
|
# Loads initializers found in TRUSTY_CMS_ROOT/config/initializers.
|
106
106
|
#
|
107
|
-
def
|
107
|
+
def load_trusty_initializers
|
108
108
|
Dir["#{TRUSTY_CMS_ROOT}/config/initializers/**/*.rb"].sort.each do |initializer|
|
109
109
|
load(initializer)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
# Extends the Rails initializer with some extra steps at the end of initialization:
|
114
|
-
# * hook up
|
114
|
+
# * hook up trusty view paths in controllers and notifiers
|
115
115
|
# * initialize the navigation tabs in the admin interface
|
116
116
|
# * initialize the extendable partial sets that make up the admin interface
|
117
|
-
# * call +activate+ on all
|
117
|
+
# * call +activate+ on all trusty extensions
|
118
118
|
# * add extension controller paths
|
119
119
|
# * mark extension app paths for eager loading
|
120
120
|
#
|