trusty-cms 4.1.7 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +131 -128
  3. data/INSTALL.md +2 -0
  4. data/LICENSE.md +1 -1
  5. data/app/controllers/admin/pages_controller.rb +1 -1
  6. data/app/controllers/admin/preferences_controller.rb +1 -1
  7. data/app/controllers/admin/resource_controller.rb +1 -1
  8. data/app/controllers/admin/users_controller.rb +1 -1
  9. data/app/helpers/admin/node_helper.rb +1 -1
  10. data/app/models/asset.rb +3 -3
  11. data/app/models/page.rb +3 -3
  12. data/app/models/standard_tags.rb +3 -3
  13. data/app/models/user.rb +1 -1
  14. data/config/database.mysql.yml +10 -2
  15. data/config/environments/development.rb +2 -0
  16. data/db/migrate/20210331134718_create_active_storage_tables.active_storage.rb +36 -0
  17. data/lib/generators/extension/USAGE +30 -0
  18. data/lib/generators/extension/extension_generator.rb +97 -0
  19. data/lib/generators/extension/templates/README.md +6 -0
  20. data/lib/generators/extension/templates/RSpecRakefile +109 -0
  21. data/lib/generators/extension/templates/Rakefile +25 -0
  22. data/lib/generators/extension/templates/cucumber.yml +1 -0
  23. data/lib/generators/extension/templates/cucumber_env.rb +11 -0
  24. data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
  25. data/lib/generators/extension/templates/en.yml +3 -0
  26. data/lib/generators/extension/templates/extension.rb +21 -0
  27. data/lib/generators/extension/templates/functional_test.rb +15 -0
  28. data/lib/generators/extension/templates/gemspec.rb +29 -0
  29. data/lib/generators/extension/templates/lib.rb +8 -0
  30. data/lib/generators/extension/templates/migration.rb +9 -0
  31. data/lib/generators/extension/templates/radiant_config.rb +3 -0
  32. data/lib/generators/extension/templates/routes.rb +5 -0
  33. data/lib/generators/extension/templates/spec.opts +6 -0
  34. data/lib/generators/extension/templates/spec_helper.rb +42 -0
  35. data/lib/generators/extension/templates/tasks.rake +47 -0
  36. data/lib/generators/extension/templates/test_helper.rb +24 -0
  37. data/lib/generators/extension_controller/USAGE +36 -0
  38. data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
  39. data/lib/generators/extension_controller/templates/controller.rb +10 -0
  40. data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
  41. data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
  42. data/lib/generators/extension_controller/templates/helper.rb +2 -0
  43. data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
  44. data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
  45. data/lib/generators/extension_controller/templates/view.html.erb +2 -0
  46. data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
  47. data/lib/generators/extension_mailer/USAGE +17 -0
  48. data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
  49. data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
  50. data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
  51. data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
  52. data/lib/generators/extension_mailer/templates/view.erb +3 -0
  53. data/lib/generators/extension_migration/USAGE +34 -0
  54. data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
  55. data/lib/generators/extension_migration/templates/migration.rb +11 -0
  56. data/lib/generators/extension_model/USAGE +35 -0
  57. data/lib/generators/extension_model/extension_model_generator.rb +68 -0
  58. data/lib/generators/extension_model/templates/fixtures.yml +19 -0
  59. data/lib/generators/extension_model/templates/migration.rb +16 -0
  60. data/lib/generators/extension_model/templates/model.rb +2 -0
  61. data/lib/generators/extension_model/templates/model_spec.rb +11 -0
  62. data/lib/generators/extension_model/templates/unit_test.rb +8 -0
  63. data/lib/generators/generator_base_extension.rb +18 -0
  64. data/lib/generators/instance/instance_generator.rb +148 -0
  65. data/lib/generators/instance/templates/databases/db2.yml +40 -0
  66. data/lib/generators/instance/templates/databases/mysql.yml +47 -0
  67. data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
  68. data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
  69. data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
  70. data/lib/generators/instance/templates/instance_boot.rb +122 -0
  71. data/lib/generators/instance/templates/instance_config.ru +2 -0
  72. data/lib/generators/instance/templates/instance_environment.rb +93 -0
  73. data/lib/generators/instance/templates/instance_gemfile +78 -0
  74. data/lib/generators/instance/templates/instance_generate +6 -0
  75. data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
  76. data/lib/generators/instance/templates/instance_rakefile +3 -0
  77. data/lib/generators/instance/templates/instance_routes.rb +1 -0
  78. data/lib/generators/language_extension/USAGE +27 -0
  79. data/lib/generators/language_extension/language_extension_generator.rb +71 -0
  80. data/lib/generators/language_extension/templates/README +3 -0
  81. data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
  82. data/lib/generators/language_extension/templates/Rakefile +25 -0
  83. data/lib/generators/language_extension/templates/available_tags.yml +553 -0
  84. data/lib/generators/language_extension/templates/cucumber.yml +1 -0
  85. data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
  86. data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
  87. data/lib/generators/language_extension/templates/extension.rb +12 -0
  88. data/lib/generators/language_extension/templates/functional_test.rb +15 -0
  89. data/lib/generators/language_extension/templates/gemspec.rb +24 -0
  90. data/lib/generators/language_extension/templates/lang.yml +181 -0
  91. data/lib/generators/language_extension/templates/lib.rb +8 -0
  92. data/lib/generators/language_extension/templates/spec.opts +6 -0
  93. data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
  94. data/lib/generators/language_extension/templates/tasks.rake +28 -0
  95. data/lib/generators/language_extension/templates/test_helper.rb +26 -0
  96. data/lib/generators/trusty_cms/USAGE +8 -0
  97. data/lib/generators/trusty_cms/templates/Rakefile.erb +7 -0
  98. data/lib/generators/trusty_cms/templates/application.rb.erb +149 -0
  99. data/lib/generators/trusty_cms/templates/boot.rb.erb +9 -0
  100. data/lib/generators/trusty_cms/templates/config.ru.erb +4 -0
  101. data/lib/generators/trusty_cms/templates/database.yml.erb +28 -0
  102. data/lib/generators/trusty_cms/templates/environment.rb.erb +5 -0
  103. data/lib/generators/trusty_cms/templates/environments/development.rb.erb +24 -0
  104. data/lib/generators/trusty_cms/templates/environments/production.rb.erb +26 -0
  105. data/lib/generators/trusty_cms/templates/environments/test.rb.erb +35 -0
  106. data/lib/generators/trusty_cms/templates/initializers/secret_token.rb.erb +13 -0
  107. data/lib/generators/trusty_cms/templates/initializers/session_store.rb.erb +8 -0
  108. data/lib/generators/trusty_cms/templates/initializers/trusty_cms_config.rb.erb +16 -0
  109. data/lib/generators/trusty_cms/templates/preinitializer.rb.erb +18 -0
  110. data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -0
  111. data/lib/generators/trusty_cms/trusty_cms_generator.rb +32 -0
  112. data/lib/login_system.rb +1 -1
  113. data/lib/trusty_cms.rb +1 -1
  114. data/lib/trusty_cms/setup.rb +8 -8
  115. data/spec/dummy/config/database.yml +6 -2
  116. data/trusty_cms.gemspec +4 -5
  117. data/vendor/extensions/clipped-extension/lib/asset_tags.rb +4 -4
  118. data/yarn.lock +3 -3
  119. metadata +144 -84
  120. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +0 -126
  121. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +0 -4
  122. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +0 -56
  123. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +0 -43
  124. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +0 -28
  125. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +0 -36
  126. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +0 -76
  127. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +0 -23
  128. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +0 -87
  129. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +0 -157
  130. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +0 -142
  131. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +0 -81
  132. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +0 -114
  133. data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
  134. data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +0 -114
  135. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +0 -17
  136. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +0 -37
  137. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +0 -34
  138. data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +0 -40
  139. data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +0 -62
  140. data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +0 -60
  141. data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +0 -35
  142. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +0 -97
  143. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +0 -131
  144. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +0 -105
  145. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +0 -80
  146. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +0 -91
  147. data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +0 -93
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/config/environment'
2
+ run ActionController::Dispatcher.new
@@ -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,3 @@
1
+ require File.join(File.dirname(__FILE__), 'config', 'boot')
2
+
3
+ import File.join(TRUSTY_CMS_ROOT, 'Rakefile')
@@ -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
@@ -0,0 +1,3 @@
1
+ = <%= extension_name %>
2
+
3
+ Description goes here
@@ -0,0 +1,123 @@
1
+ # I think this is the one that should be moved to the extension Rakefile template
2
+
3
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
4
+ # Check to see if the rspec plugin is installed first and require
5
+ # it if it is. If not, use the gem version.
6
+
7
+ # Determine where the RSpec plugin is by loading the boot
8
+ unless defined? TRUSTY_CMS_ROOT
9
+ ENV["Rails.env"] = "test"
10
+ case
11
+ when ENV["RADIANT_ENV_FILE"]
12
+ require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
13
+ when File.dirname(__FILE__) =~ %r{vendor/trusty_cms/vendor/extensions}
14
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
15
+ else
16
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
17
+ end
18
+ end
19
+
20
+ require 'rake'
21
+ require 'rdoc/task'
22
+ require 'rake/testtask'
23
+
24
+ rspec_base = File.expand_path(TRUSTY_CMS_ROOT + '/vendor/plugins/rspec/lib')
25
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
26
+ require 'spec/rake/spectask'
27
+ require 'cucumber'
28
+ require 'cucumber/rake/task'
29
+
30
+ # Cleanup the TRUSTY_CMS_ROOT constant so specs will load the environment
31
+ Object.send(:remove_const, :TRUSTY_CMS_ROOT)
32
+
33
+ extension_root = File.expand_path(File.dirname(__FILE__))
34
+
35
+ task :default => :spec
36
+ task :stats => "spec:statsetup"
37
+
38
+ desc "Run all specs in spec directory"
39
+ Spec::Rake::SpecTask.new(:spec) do |t|
40
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
41
+ t.spec_files = FileList['spec/**/*_spec.rb']
42
+ end
43
+
44
+ task :features => 'spec:integration'
45
+
46
+ namespace :spec do
47
+ desc "Run all specs in spec directory with RCov"
48
+ Spec::Rake::SpecTask.new(:rcov) do |t|
49
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
50
+ t.spec_files = FileList['spec/**/*_spec.rb']
51
+ t.rcov = true
52
+ t.rcov_opts = ['--exclude', 'spec', '--rails']
53
+ end
54
+
55
+ desc "Print Specdoc for all specs"
56
+ Spec::Rake::SpecTask.new(:doc) do |t|
57
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
58
+ t.spec_files = FileList['spec/**/*_spec.rb']
59
+ end
60
+
61
+ [:models, :controllers, :views, :helpers].each do |sub|
62
+ desc "Run the specs under spec/#{sub}"
63
+ Spec::Rake::SpecTask.new(sub) do |t|
64
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
65
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
66
+ end
67
+ end
68
+
69
+ desc "Run the Cucumber features"
70
+ Cucumber::Rake::Task.new(:integration) do |t|
71
+ t.fork = true
72
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
73
+ # t.feature_pattern = "#{extension_root}/features/**/*.feature"
74
+ t.profile = "default"
75
+ end
76
+
77
+ # Setup specs for stats
78
+ task :statsetup do
79
+ require 'code_statistics'
80
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models)
81
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views)
82
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
83
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
84
+ ::CodeStatistics::TEST_TYPES << "Model specs"
85
+ ::CodeStatistics::TEST_TYPES << "View specs"
86
+ ::CodeStatistics::TEST_TYPES << "Controller specs"
87
+ ::CodeStatistics::TEST_TYPES << "Helper specs"
88
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
89
+ end
90
+
91
+ namespace :db do
92
+ namespace :fixtures do
93
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
94
+ task :load => :environment do
95
+ require 'active_record/fixtures'
96
+ ActiveRecord::Base.establish_connection(Rails.env.to_sym)
97
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
98
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+ desc 'Generate documentation for the <%= file_name %> extension.'
106
+ RDoc:Task.new(:rdoc) do |rdoc|
107
+ rdoc.rdoc_dir = 'rdoc'
108
+ rdoc.title = '<%= class_name %>'
109
+ rdoc.options << '--line-numbers' << '--inline-source'
110
+ rdoc.rdoc_files.include('README')
111
+ rdoc.rdoc_files.include('lib/**/*.rb')
112
+ end
113
+
114
+ # For extensions that are in transition
115
+ desc 'Test the <%= file_name %> extension.'
116
+ Rake::TestTask.new(:test) do |t|
117
+ t.libs << 'lib'
118
+ t.pattern = 'test/**/*_test.rb'
119
+ t.verbose = true
120
+ end
121
+
122
+ # Load any custom rakefiles for extension
123
+ Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
@@ -0,0 +1,25 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rdoc/task'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the <%= file_name %> extension.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the <%= file_name %> extension.'
16
+ RDoc:Task.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = '<%= class_name %>'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
23
+
24
+ # Load any custom rakefiles for extension
25
+ Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }