trusty-cms 4.1.8 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +121 -121
  4. data/INSTALL.md +2 -0
  5. data/LICENSE.md +1 -1
  6. data/app/assets/javascripts/admin/custom_file_upload.js +7 -0
  7. data/app/controllers/admin/pages_controller.rb +1 -1
  8. data/app/controllers/admin/preferences_controller.rb +1 -1
  9. data/app/controllers/admin/resource_controller.rb +1 -1
  10. data/app/controllers/admin/users_controller.rb +1 -1
  11. data/app/helpers/admin/node_helper.rb +1 -1
  12. data/app/models/asset.rb +3 -3
  13. data/app/models/page.rb +3 -3
  14. data/app/models/standard_tags.rb +3 -3
  15. data/app/models/user.rb +1 -1
  16. data/app/views/admin/assets/new.html.haml +2 -0
  17. data/config/database.mysql.yml +10 -2
  18. data/config/environments/development.rb +2 -0
  19. data/db/migrate/20210331134718_create_active_storage_tables.active_storage.rb +36 -0
  20. data/lib/generators/extension/USAGE +30 -0
  21. data/lib/generators/extension/extension_generator.rb +97 -0
  22. data/lib/generators/extension/templates/README.md +6 -0
  23. data/lib/generators/extension/templates/RSpecRakefile +109 -0
  24. data/lib/generators/extension/templates/Rakefile +25 -0
  25. data/lib/generators/extension/templates/cucumber.yml +1 -0
  26. data/lib/generators/extension/templates/cucumber_env.rb +11 -0
  27. data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
  28. data/lib/generators/extension/templates/en.yml +3 -0
  29. data/lib/generators/extension/templates/extension.rb +21 -0
  30. data/lib/generators/extension/templates/functional_test.rb +15 -0
  31. data/lib/generators/extension/templates/gemspec.rb +29 -0
  32. data/lib/generators/extension/templates/lib.rb +8 -0
  33. data/lib/generators/extension/templates/migration.rb +9 -0
  34. data/lib/generators/extension/templates/radiant_config.rb +3 -0
  35. data/lib/generators/extension/templates/routes.rb +5 -0
  36. data/lib/generators/extension/templates/spec.opts +6 -0
  37. data/lib/generators/extension/templates/spec_helper.rb +42 -0
  38. data/lib/generators/extension/templates/tasks.rake +47 -0
  39. data/lib/generators/extension/templates/test_helper.rb +24 -0
  40. data/lib/generators/extension_controller/USAGE +36 -0
  41. data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
  42. data/lib/generators/extension_controller/templates/controller.rb +10 -0
  43. data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
  44. data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
  45. data/lib/generators/extension_controller/templates/helper.rb +2 -0
  46. data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
  47. data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
  48. data/lib/generators/extension_controller/templates/view.html.erb +2 -0
  49. data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
  50. data/lib/generators/extension_mailer/USAGE +17 -0
  51. data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
  52. data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
  53. data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
  54. data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
  55. data/lib/generators/extension_mailer/templates/view.erb +3 -0
  56. data/lib/generators/extension_migration/USAGE +34 -0
  57. data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
  58. data/lib/generators/extension_migration/templates/migration.rb +11 -0
  59. data/lib/generators/extension_model/USAGE +35 -0
  60. data/lib/generators/extension_model/extension_model_generator.rb +68 -0
  61. data/lib/generators/extension_model/templates/fixtures.yml +19 -0
  62. data/lib/generators/extension_model/templates/migration.rb +16 -0
  63. data/lib/generators/extension_model/templates/model.rb +2 -0
  64. data/lib/generators/extension_model/templates/model_spec.rb +11 -0
  65. data/lib/generators/extension_model/templates/unit_test.rb +8 -0
  66. data/lib/generators/generator_base_extension.rb +18 -0
  67. data/lib/generators/instance/instance_generator.rb +148 -0
  68. data/lib/generators/instance/templates/databases/db2.yml +40 -0
  69. data/lib/generators/instance/templates/databases/mysql.yml +47 -0
  70. data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
  71. data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
  72. data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
  73. data/lib/generators/instance/templates/instance_boot.rb +122 -0
  74. data/lib/generators/instance/templates/instance_config.ru +2 -0
  75. data/lib/generators/instance/templates/instance_environment.rb +93 -0
  76. data/lib/generators/instance/templates/instance_gemfile +78 -0
  77. data/lib/generators/instance/templates/instance_generate +6 -0
  78. data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
  79. data/lib/generators/instance/templates/instance_rakefile +3 -0
  80. data/lib/generators/instance/templates/instance_routes.rb +1 -0
  81. data/lib/generators/language_extension/USAGE +27 -0
  82. data/lib/generators/language_extension/language_extension_generator.rb +71 -0
  83. data/lib/generators/language_extension/templates/README +3 -0
  84. data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
  85. data/lib/generators/language_extension/templates/Rakefile +25 -0
  86. data/lib/generators/language_extension/templates/available_tags.yml +553 -0
  87. data/lib/generators/language_extension/templates/cucumber.yml +1 -0
  88. data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
  89. data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
  90. data/lib/generators/language_extension/templates/extension.rb +12 -0
  91. data/lib/generators/language_extension/templates/functional_test.rb +15 -0
  92. data/lib/generators/language_extension/templates/gemspec.rb +24 -0
  93. data/lib/generators/language_extension/templates/lang.yml +181 -0
  94. data/lib/generators/language_extension/templates/lib.rb +8 -0
  95. data/lib/generators/language_extension/templates/spec.opts +6 -0
  96. data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
  97. data/lib/generators/language_extension/templates/tasks.rake +28 -0
  98. data/lib/generators/language_extension/templates/test_helper.rb +26 -0
  99. data/lib/generators/trusty_cms/USAGE +8 -0
  100. data/lib/generators/trusty_cms/templates/Rakefile.erb +7 -0
  101. data/lib/generators/trusty_cms/templates/application.rb.erb +149 -0
  102. data/lib/generators/trusty_cms/templates/boot.rb.erb +9 -0
  103. data/lib/generators/trusty_cms/templates/config.ru.erb +4 -0
  104. data/lib/generators/trusty_cms/templates/database.yml.erb +28 -0
  105. data/lib/generators/trusty_cms/templates/environment.rb.erb +5 -0
  106. data/lib/generators/trusty_cms/templates/environments/development.rb.erb +24 -0
  107. data/lib/generators/trusty_cms/templates/environments/production.rb.erb +26 -0
  108. data/lib/generators/trusty_cms/templates/environments/test.rb.erb +35 -0
  109. data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +13 -0
  110. data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +8 -0
  111. data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +16 -0
  112. data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +18 -0
  113. data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
  114. data/lib/generators/trusty_cms/trusty_cms_generator.rb +32 -0
  115. data/lib/login_system.rb +1 -1
  116. data/lib/trusty_cms.rb +1 -1
  117. data/lib/trusty_cms/setup.rb +8 -8
  118. data/spec/dummy/config/database.yml +6 -2
  119. data/trusty_cms.gemspec +5 -6
  120. data/vendor/extensions/clipped-extension/lib/asset_tags.rb +4 -4
  121. data/yarn.lock +6 -6
  122. metadata +487 -118
  123. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +0 -126
  124. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +0 -4
  125. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +0 -56
  126. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +0 -43
  127. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +0 -28
  128. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +0 -36
  129. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +0 -76
  130. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +0 -23
  131. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +0 -87
  132. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +0 -157
  133. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +0 -142
  134. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +0 -81
  135. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +0 -114
  136. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
  137. data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +0 -114
  138. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +0 -17
  139. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +0 -37
  140. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +0 -34
  141. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +0 -40
  142. data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +0 -62
  143. data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +0 -60
  144. data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +0 -35
  145. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +0 -97
  146. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +0 -131
  147. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +0 -105
  148. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +0 -80
  149. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +0 -91
  150. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +0 -93
@@ -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:
@@ -0,0 +1,47 @@
1
+ # MySQL (default setup). Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MySQL driver:
4
+ # gem install mysql
5
+ # On MacOS X:
6
+ # gem install mysql -- --include=/usr/local/lib
7
+ # On Windows:
8
+ # There is no gem for Windows. Install mysql.so from RubyForApache.
9
+ # http://rubyforge.org/projects/rubyforapache
10
+ #
11
+ # And be sure to use new-style password hashing:
12
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
13
+ development:
14
+ adapter: mysql2
15
+ database: <%= app_name %>_development
16
+ username: root
17
+ password:
18
+ <% if socket -%>
19
+ socket: <%= socket %>
20
+ <% else -%>
21
+ host: localhost
22
+ <% end -%>
23
+
24
+ # Warning: The database defined as 'test' will be erased and
25
+ # re-generated from your development database when you run 'rake'.
26
+ # Do not set this db to the same as development or production.
27
+ test:
28
+ adapter: mysql2
29
+ database: <%= app_name %>_test
30
+ username: root
31
+ password:
32
+ <% if socket -%>
33
+ socket: <%= socket %>
34
+ <% else -%>
35
+ host: localhost
36
+ <% end -%>
37
+
38
+ production:
39
+ adapter: mysql2
40
+ database: <%= app_name %>_production
41
+ username: root
42
+ password:
43
+ <% if socket -%>
44
+ socket: <%= socket %>
45
+ <% else -%>
46
+ host: localhost
47
+ <% end -%>
@@ -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!