trusty-cms 4.1.4 → 4.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +115 -111
- data/INSTALL.md +2 -0
- data/README.md +1 -1
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/app/views/admin/assets/edit.html.haml +3 -0
- data/config/environments/development.rb +2 -0
- data/config/locales/en.yml +1 -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 +7 -7
- data/trusty_cms.gemspec +3 -3
- data/yarn.lock +6 -6
- metadata +7635 -70
@@ -0,0 +1,44 @@
|
|
1
|
+
# PostgreSQL versions 7.4 - 8.1
|
2
|
+
#
|
3
|
+
# Get the C bindings:
|
4
|
+
# gem install postgres
|
5
|
+
# or use the pure-Ruby bindings on Windows:
|
6
|
+
# gem install postgres-pr
|
7
|
+
development:
|
8
|
+
adapter: postgresql
|
9
|
+
database: <%= app_name %>_development
|
10
|
+
username: <%= app_name %>
|
11
|
+
password:
|
12
|
+
|
13
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
14
|
+
# domain socket that doesn't need configuration. Windows does not have
|
15
|
+
# domain sockets, so uncomment these lines.
|
16
|
+
#host: localhost
|
17
|
+
#port: 5432
|
18
|
+
|
19
|
+
# Schema search path. The server defaults to $user,public
|
20
|
+
#schema_search_path: myapp,sharedapp,public
|
21
|
+
|
22
|
+
# Character set encoding. The server defaults to sql_ascii.
|
23
|
+
#encoding: UTF8
|
24
|
+
|
25
|
+
# Minimum log levels, in increasing order:
|
26
|
+
# debug5, debug4, debug3, debug2, debug1,
|
27
|
+
# info, notice, warning, error, log, fatal, or panic
|
28
|
+
# The server defaults to notice.
|
29
|
+
#min_messages: warning
|
30
|
+
|
31
|
+
# Warning: The database defined as 'test' will be erased and
|
32
|
+
# re-generated from your development database when you run 'rake'.
|
33
|
+
# Do not set this db to the same as development or production.
|
34
|
+
test:
|
35
|
+
adapter: postgresql
|
36
|
+
database: <%= app_name %>_test
|
37
|
+
username: <%= app_name %>
|
38
|
+
password:
|
39
|
+
|
40
|
+
production:
|
41
|
+
adapter: postgresql
|
42
|
+
database: <%= app_name %>_production
|
43
|
+
username: <%= app_name %>
|
44
|
+
password:
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3.db
|
6
|
+
|
7
|
+
# Warning: The database defined as 'test' will be erased and
|
8
|
+
# re-generated from your development database when you run 'rake'.
|
9
|
+
# Do not set this db to the same as development or production.
|
10
|
+
test:
|
11
|
+
adapter: sqlite3
|
12
|
+
database: db/test.sqlite3.db
|
13
|
+
|
14
|
+
production:
|
15
|
+
adapter: sqlite3
|
16
|
+
database: db/production.sqlite3.db
|
@@ -0,0 +1,21 @@
|
|
1
|
+
development:
|
2
|
+
adapter: sqlserver
|
3
|
+
database: <%= app_name %>_development
|
4
|
+
username: <%= app_name %>
|
5
|
+
password:
|
6
|
+
|
7
|
+
# Warning: The database defined as 'test' will be erased and
|
8
|
+
# re-generated from your development database when you run 'rake'.
|
9
|
+
# Do not set this db to the same as development or production.
|
10
|
+
test:
|
11
|
+
adapter: sqlserver
|
12
|
+
database: <%= app_name %>_test
|
13
|
+
username: <%= app_name %>
|
14
|
+
password:
|
15
|
+
|
16
|
+
production:
|
17
|
+
adapter: sqlserver
|
18
|
+
database: <%= app_name %>_production
|
19
|
+
username: <%= app_name %>
|
20
|
+
password:
|
21
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
Rails.root = "#{File.dirname(__FILE__)}/.." unless defined?(Rails.root)
|
5
|
+
Rails.env = (ENV['RAILS_ENV'] || 'development').dup unless defined?(Rails.env)
|
6
|
+
|
7
|
+
module Rails
|
8
|
+
class << self
|
9
|
+
def vendor_rails?
|
10
|
+
File.exist?("#{Rails.root}/vendor/rails")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module TrustyCms
|
16
|
+
class << self
|
17
|
+
def boot!
|
18
|
+
unless booted?
|
19
|
+
preinitialize
|
20
|
+
pick_boot.run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def booted?
|
25
|
+
defined? TrustyCms::Initializer
|
26
|
+
end
|
27
|
+
|
28
|
+
def pick_boot
|
29
|
+
case
|
30
|
+
when app?
|
31
|
+
AppBoot.new
|
32
|
+
when vendor?
|
33
|
+
VendorBoot.new
|
34
|
+
else
|
35
|
+
GemBoot.new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def vendor?
|
40
|
+
File.exist?("#{Rails.root}/vendor/radiant")
|
41
|
+
end
|
42
|
+
|
43
|
+
def app?
|
44
|
+
File.exist?("#{Rails.root}/lib/radiant.rb")
|
45
|
+
end
|
46
|
+
|
47
|
+
def preinitialize
|
48
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def loaded_via_gem?
|
52
|
+
pick_boot.is_a? GemBoot
|
53
|
+
end
|
54
|
+
|
55
|
+
def preinitializer_path
|
56
|
+
"#{Rails.root}/config/preinitializer.rb"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Boot
|
61
|
+
def run
|
62
|
+
load_mutex
|
63
|
+
load_initializer
|
64
|
+
end
|
65
|
+
|
66
|
+
# RubyGems from version 1.6 does not require thread but Rails depend on it
|
67
|
+
# This should newer rails do automaticly
|
68
|
+
def load_mutex
|
69
|
+
begin
|
70
|
+
require "thread" unless defined?(Mutex)
|
71
|
+
rescue LoadError => e
|
72
|
+
$stderr.puts %(Mutex could not be initialized. #{load_error_message})
|
73
|
+
exit 1
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def load_initializer
|
78
|
+
begin
|
79
|
+
require 'trusty_cms'
|
80
|
+
require 'trusty_cms/initializer'
|
81
|
+
rescue LoadError => e
|
82
|
+
$stderr.puts %(TrustyCms could not be initialized. #{load_error_message})
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
TrustyCms::Initializer.run(:set_load_path)
|
86
|
+
TrustyCms::Initializer.run(:install_gem_spec_stubs)
|
87
|
+
Rails::GemDependency.add_frozen_gem_path
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class VendorBoot < Boot
|
92
|
+
def load_initializer
|
93
|
+
$LOAD_PATH.unshift "#{Rails.root}/vendor/trusty_cms/lib"
|
94
|
+
super
|
95
|
+
end
|
96
|
+
|
97
|
+
def load_error_message
|
98
|
+
"Please verify that vendor/radiant contains a complete copy of the TrustyCms sources."
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class AppBoot < Boot
|
103
|
+
def load_initializer
|
104
|
+
$LOAD_PATH.unshift "#{Rails.root}/lib"
|
105
|
+
super
|
106
|
+
end
|
107
|
+
|
108
|
+
def load_error_message
|
109
|
+
"Please verify that you have a complete copy of the TrustyCms sources."
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class GemBoot < Boot
|
114
|
+
# The location and version of the radiant gem should be set in your Gemfile
|
115
|
+
def load_error_message
|
116
|
+
"Have you run `bundle install`?'."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# All that for this:
|
122
|
+
TrustyCms.boot!
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
+
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
9
|
+
|
10
|
+
require 'radius'
|
11
|
+
|
12
|
+
YAML::ENGINE.yamler = 'syck' if RUBY_VERSION =~ /1.9/
|
13
|
+
|
14
|
+
TrustyCms::Initializer.run do |config|
|
15
|
+
# Skip frameworks you're not going to use (only works if using vendor/rails).
|
16
|
+
# To use Rails without a database, you must remove the Active Record framework
|
17
|
+
# config.frameworks -= [ :action_mailer ]
|
18
|
+
|
19
|
+
# Only load the extensions named here, in the order given. By default all
|
20
|
+
# extensions in vendor/extensions are loaded, in alphabetical order. :all
|
21
|
+
# can be used as a placeholder for all extensions not explicitly named.
|
22
|
+
# config.extensions = [ :all ]
|
23
|
+
|
24
|
+
# Unload the extensions named here.
|
25
|
+
# config.ignore_extensions []
|
26
|
+
|
27
|
+
# Your secret key for verifying cookie session data integrity.
|
28
|
+
# If you change this key, all old sessions will become invalid!
|
29
|
+
# Make sure the secret is at least 30 characters and all random,
|
30
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
31
|
+
config.action_controller.session = {
|
32
|
+
:key => '_<%= app_name %>_session',
|
33
|
+
:secret => <% require 'digest/sha1' %>'<%= Digest::SHA1.hexdigest("--#{app_name}--#{Time.now.to_s}--#{rand(10000000)}--") %>'
|
34
|
+
}
|
35
|
+
|
36
|
+
# Comment out this line if you want to turn off all caching, or
|
37
|
+
# add options to modify the behavior. In the majority of deployment
|
38
|
+
# scenarios it is desirable to leave TrustyCms's cache enabled and in
|
39
|
+
# the default configuration.
|
40
|
+
#
|
41
|
+
# Additional options:
|
42
|
+
# :use_x_sendfile => true
|
43
|
+
# Turns on X-Sendfile support for Apache with mod_xsendfile or lighttpd.
|
44
|
+
# :use_x_accel_redirect => '/some/virtual/path'
|
45
|
+
# Turns on X-Accel-Redirect support for nginx. You have to provide
|
46
|
+
# a path that corresponds to a virtual location in your webserver
|
47
|
+
# configuration.
|
48
|
+
# :entitystore => "radiant:tmp/cache/entity"
|
49
|
+
# Sets the entity store type (preceding the colon) and storage
|
50
|
+
# location (following the colon, relative to Rails.root).
|
51
|
+
# We recommend you use radiant: since this will enable manual expiration.
|
52
|
+
# :metastore => "radiant:tmp/cache/meta"
|
53
|
+
# Sets the meta store type and storage location. We recommend you use
|
54
|
+
# radiant: since this will enable manual expiration and acceleration headers.
|
55
|
+
config.middleware.use Rack::Cache,
|
56
|
+
:private_headers => ['Authorization'],
|
57
|
+
:entitystore => "radiant:tmp/cache/entity",
|
58
|
+
:metastore => "radiant:tmp/cache/meta",
|
59
|
+
:verbose => false,
|
60
|
+
:allow_reload => false,
|
61
|
+
:allow_revalidate => false
|
62
|
+
# TODO: There's got to be a better place for this, but in order for assets to work fornow, we need ConditionalGet
|
63
|
+
# TODO: Workaround from: https://github.com/rtomayko/rack-cache/issues/80
|
64
|
+
config.middleware.insert_before(Rack::ConditionalGet, Rack::Cache)
|
65
|
+
config.assets.enabled = true
|
66
|
+
|
67
|
+
# Use the database for sessions instead of the cookie-based default,
|
68
|
+
# which shouldn't be used to store highly confidential information
|
69
|
+
# (create the session table with 'rake db:sessions:create')
|
70
|
+
config.action_controller.session_store = :cookie_store
|
71
|
+
|
72
|
+
# Activate observers that should always be running
|
73
|
+
config.active_record.observers = :user_action_observer
|
74
|
+
|
75
|
+
# Make Active Record use UTC-base instead of local time
|
76
|
+
config.time_zone = 'UTC'
|
77
|
+
|
78
|
+
# Set the default field error proc
|
79
|
+
config.action_view.field_error_proc = Proc.new do |html, instance|
|
80
|
+
if html !~ /label/
|
81
|
+
%{<span class="error-with-field">#{html} <span class="error">#{[instance.error_message].flatten.first}</span></span>}.html_safe
|
82
|
+
else
|
83
|
+
html
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
config.after_initialize do
|
88
|
+
# Add new inflection rules using the following format:
|
89
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
90
|
+
inflect.uncountable 'config'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# If you make any changes in this file, please run `bundle install`.
|
4
|
+
# If new versions of your installed gems are available, run `bundle update`
|
5
|
+
|
6
|
+
gem "radiant", "~> <%= radiant_version %>"
|
7
|
+
|
8
|
+
# alternatively, in development
|
9
|
+
# gem "trusty_cms", :path => "/path/to/trusty_cms/root"
|
10
|
+
|
11
|
+
# Uncomment to support CoffeeScript with a JS runtime (used in the Sheets extension)
|
12
|
+
# gem "execjs"
|
13
|
+
# And you may need one of these:
|
14
|
+
# gem "mustang" # Google V8 for Ruby
|
15
|
+
# gem "therubyracer" # Google V8 for Ruby
|
16
|
+
# gem "therubyrhino" # Mozilla Rhino for JRuby
|
17
|
+
# gem "johnson" # Mozilla SpiderMonkey for Ruby
|
18
|
+
|
19
|
+
# SQLite is the default database connection but only suitable for local use
|
20
|
+
<%= '# ' unless db == 'sqlite3' %>gem "sqlite3", "~> 1.3.5"
|
21
|
+
|
22
|
+
# To use MySQL2
|
23
|
+
<%= '# ' unless db == 'mysql2' %>"mysql2", "~> 0.4.2"
|
24
|
+
|
25
|
+
# Postgres
|
26
|
+
<%= '# ' unless db == 'postgresql' %>gem "pg", "~> 0.11.0"
|
27
|
+
|
28
|
+
# IBM DB2
|
29
|
+
<%= '# ' unless db == 'db2' %>gem "db2", "~> 2.6.2"
|
30
|
+
|
31
|
+
# SQL Server
|
32
|
+
<%= '# ' unless db == 'sqlserver' %>gem "tiny_tds"
|
33
|
+
<%= '# ' unless db == 'sqlserver' %>gem "activerecord-sqlserver-adapter", "~> 3.1.0"
|
34
|
+
|
35
|
+
# Default Extensions
|
36
|
+
gem "radiant-archive-extension", "~> 1.0.7"
|
37
|
+
gem "radiant-clipped-extension", "~> 1.1.0"
|
38
|
+
gem "radiant-debug-extension", "~> 1.0.2"
|
39
|
+
gem "radiant-exporter-extension", "~> 1.1.0"
|
40
|
+
gem "radiant-markdown_filter-extension", "~> 1.0.2"
|
41
|
+
gem "radiant-sheets-extension", "~> 1.1.0"
|
42
|
+
gem "radiant-snippets-extension", "~> 1.1.2"
|
43
|
+
gem "radiant-site_templates-extension", "~> 1.0.6"
|
44
|
+
gem "radiant-smarty_pants_filter-extension", "~> 1.0.2"
|
45
|
+
gem "radiant-textile_filter-extension", "~> 1.0.4"
|
46
|
+
|
47
|
+
|
48
|
+
# Language packs
|
49
|
+
# gem "radiant-dutch_language_pack-extension", "~> 1.0.1"
|
50
|
+
# gem "radiant-french_language_pack-extension", "~> 1.0.0"
|
51
|
+
# gem "radiant-german_language_pack-extension", "~> 1.0.1"
|
52
|
+
# gem "radiant-italian_language_pack-extension", "~> 1.0.0"
|
53
|
+
# gem "radiant-japanese_language_pack-extension", "~> 1.0.0"
|
54
|
+
# gem "radiant-russian_language_pack-extension", "~> 1.0.0"
|
55
|
+
|
56
|
+
# A standard gem extension
|
57
|
+
# gem "radiant-example-extension", :version => "~> 1.0.0"
|
58
|
+
|
59
|
+
# Your own forked extension
|
60
|
+
# gem "radiant-modified-extension", :git => "git://github.com/your/fork.git"
|
61
|
+
|
62
|
+
# A local extension in development
|
63
|
+
# gem "radiant-new-extension", :path => "/path/to/extension/root"
|
64
|
+
|
65
|
+
# Gems you would like to have in your development environment
|
66
|
+
# group :development do
|
67
|
+
# gem "wirble"
|
68
|
+
# end
|
69
|
+
|
70
|
+
# If you're running tests or specs
|
71
|
+
# group :test do
|
72
|
+
# gem "cucumber-rails", "~> 0.3.2"
|
73
|
+
# gem "database_cleaner", "~> 0.6.5"
|
74
|
+
# gem "webrat", "~> 0.7.3"
|
75
|
+
# gem "rspec-rails", "~> 1.3.3"
|
76
|
+
# gem "sqlite3", "~> 1.3.4"
|
77
|
+
# gem "ZenTest", "4.6.2"
|
78
|
+
# end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.expand_path('../../config/boot', __FILE__)
|
3
|
+
require 'generators/generator_base_extension'
|
4
|
+
|
5
|
+
Rails::Generator::Base.prepend_sources(Rails::Generator::PathSource.new(:builtin, "#{TrustyCms.root}/lib/generators"))
|
6
|
+
require 'commands/generate'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
TrustyCms.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 TRUSTY_CMS_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 @@
|
|
1
|
+
load File.join(TRUSTY_CMS_ROOT, "config", "routes.rb")
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Description:
|
2
|
+
The language_extension generator creates stubs for a new TrustyCms translation.
|
3
|
+
|
4
|
+
The generator takes an language abbreviation as its argument. The extension name may be
|
5
|
+
given as a language abbreviation 'en' or a localized abbreviation 'en-GB' and should not
|
6
|
+
be prefixed with 'i18n' or suffixed with 'Extension'.
|
7
|
+
|
8
|
+
The generator creates an extension directory in vendor/extensions that includes
|
9
|
+
i18n_<extension_name>_extension.rb, README and Rakefile files as well as lib, task,
|
10
|
+
and test directories.
|
11
|
+
|
12
|
+
Example:
|
13
|
+
./script/generate language_extension fr
|
14
|
+
|
15
|
+
This will create:
|
16
|
+
vendor/extensions/i18n_fr/config/locales/fr.yml
|
17
|
+
vendor/extensions/i18n_fr/lib/tasks
|
18
|
+
vendor/extensions/i18n_fr/README
|
19
|
+
vendor/extensions/i18n_fr/i18n_fr_extension.rb
|
20
|
+
vendor/extensions/i18n_fr/lib/tasks/i18n_fr_extension_tasks.rake
|
21
|
+
vendor/extensions/i18n_fr/spec/controllers
|
22
|
+
vendor/extensions/i18n_fr/spec/models
|
23
|
+
vendor/extensions/i18n_fr/spec/views
|
24
|
+
vendor/extensions/i18n_fr/spec/helpers
|
25
|
+
vendor/extensions/i18n_fr/Rakefile
|
26
|
+
vendor/extensions/i18n_fr/spec/spec_helper.rb
|
27
|
+
vendor/extensions/i18n_fr/spec/spec.opts
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class LanguageExtensionGenerator < Rails::Generator::NamedBase
|
2
|
+
default_options :with_test_unit => false
|
3
|
+
|
4
|
+
attr_reader :extension_path, :extension_file_name, :localization_name
|
5
|
+
|
6
|
+
def initialize(runtime_args, runtime_options = {})
|
7
|
+
super
|
8
|
+
@extension_file_name = "#{file_name}_language_pack_extension"
|
9
|
+
@extension_path = "vendor/extensions/#{file_name}_language_pack"
|
10
|
+
@localization_name = localization_name
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest
|
14
|
+
record do |m|
|
15
|
+
m.directory "#{extension_path}/config/locales"
|
16
|
+
m.directory "#{extension_path}/lib/tasks"
|
17
|
+
|
18
|
+
m.template 'README', "#{extension_path}/README"
|
19
|
+
m.template 'extension.rb', "#{extension_path}/#{extension_file_name}.rb"
|
20
|
+
# m.template 'tasks.rake', "#{extension_path}/lib/tasks/#{extension_file_name}_tasks.rake"
|
21
|
+
m.template 'lang.yml', "#{extension_path}/config/locales/#{localization_name}.yml"
|
22
|
+
m.template 'available_tags.yml', "#{extension_path}/config/locales/#{localization_name}_available_tags.yml"
|
23
|
+
m.template 'lib.rb', "#{extension_path}/lib/radiant-#{file_name}_language_pack-extension.rb"
|
24
|
+
m.template 'gemspec.rb', "#{extension_path}/radiant-#{file_name}_language_pack-extension.gemspec"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def class_name
|
30
|
+
super.to_name.gsub(' ', '') + 'LanguagePackExtension'
|
31
|
+
end
|
32
|
+
|
33
|
+
def extension_name
|
34
|
+
class_name.to_name('Extension')
|
35
|
+
end
|
36
|
+
|
37
|
+
def author_info
|
38
|
+
@author_info ||= begin
|
39
|
+
Git.global_config
|
40
|
+
rescue NameError
|
41
|
+
{}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def homepage
|
46
|
+
author_info['github.user'] ? "http://github.com/#{author_info['github.user']}/radiant-#{file_name}-extension" : "http://example.com/#{file_name}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def author_email
|
50
|
+
author_info['user.email'] || 'your email'
|
51
|
+
end
|
52
|
+
|
53
|
+
def author_name
|
54
|
+
author_info['user.name'] || 'Your Name'
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_options!(opt)
|
58
|
+
# opt.separator ''
|
59
|
+
# opt.separator 'Options:'
|
60
|
+
# opt.on("--with-test-unit",
|
61
|
+
# "Use Test::Unit for this extension instead of RSpec") { |v| options[:with_test_unit] = v }
|
62
|
+
end
|
63
|
+
|
64
|
+
def localization_name
|
65
|
+
file_name.split('_')[1] ? "#{file_name.split('_')[0]}-#{file_name.split('_')[1].upcase}" : file_name
|
66
|
+
end
|
67
|
+
|
68
|
+
def copy_files
|
69
|
+
FileUtils.cp("#{TRUSTY_CMS_ROOT}/config/locales/en_available_tags.yml","#{TRUSTY_CMS_ROOT}/#{extension_path}/config/locales/#{localization_name}_available_tags.yml")
|
70
|
+
end
|
71
|
+
end
|