trusty-cms 4.0.1 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +106 -106
  4. data/Rakefile +7 -7
  5. data/app/assets/images/admin/spinner.gif +0 -0
  6. data/app/assets/javascripts/admin.js +3 -0
  7. data/app/assets/javascripts/admin/more-or-less.js +2 -2
  8. data/app/assets/javascripts/admin/tabcontrol.js.erb +1 -2
  9. data/app/assets/stylesheets/admin/_base.scss +22 -6
  10. data/app/assets/stylesheets/admin/_multi_site_main.scss +28 -29
  11. data/app/assets/stylesheets/admin/_reset.scss +5 -4
  12. data/app/assets/stylesheets/admin/_site_chooser.scss +44 -69
  13. data/app/assets/stylesheets/admin/assets.scss +138 -141
  14. data/app/assets/stylesheets/admin/main.scss +10 -12
  15. data/app/assets/stylesheets/admin/modules/_boxes.scss +0 -3
  16. data/app/assets/stylesheets/admin/modules/_buttons.scss +30 -0
  17. data/app/assets/stylesheets/admin/modules/_links.scss +1 -1
  18. data/app/assets/stylesheets/admin/partials/_actions.scss +29 -46
  19. data/app/assets/stylesheets/admin/partials/_avatars.scss +3 -2
  20. data/app/assets/stylesheets/admin/partials/_content.scss +15 -38
  21. data/app/assets/stylesheets/admin/partials/_dateinput.scss +23 -14
  22. data/app/assets/stylesheets/admin/partials/_drawer.scss +78 -0
  23. data/app/assets/stylesheets/admin/partials/_dropdown.scss +9 -12
  24. data/app/assets/stylesheets/admin/partials/_footer.scss +4 -3
  25. data/app/assets/stylesheets/admin/partials/_forms.scss +64 -491
  26. data/app/assets/stylesheets/admin/partials/_header.scss +9 -118
  27. data/app/assets/stylesheets/admin/partials/_layout.scss +26 -2
  28. data/app/assets/stylesheets/admin/partials/_login_form.scss +28 -0
  29. data/app/assets/stylesheets/admin/partials/_messages.scss +10 -5
  30. data/app/assets/stylesheets/admin/partials/_popup.scss +61 -50
  31. data/app/assets/stylesheets/admin/partials/_preferences.scss +37 -0
  32. data/app/assets/stylesheets/admin/partials/_sidebar.scss +55 -0
  33. data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +24 -36
  34. data/app/assets/stylesheets/admin/partials/{_index.scss → _table.scss} +53 -84
  35. data/app/assets/stylesheets/admin/partials/_toolbar.scss +11 -6
  36. data/app/assets/stylesheets/admin/partials/_treetable.scss +1 -71
  37. data/app/assets/stylesheets/admin/partials/_typography.scss +30 -55
  38. data/app/assets/stylesheets/admin/partials/_validations.scss +6 -5
  39. data/app/assets/stylesheets/rad_social/rad_screen.scss +65 -64
  40. data/app/controllers/admin/assets_controller.rb +21 -31
  41. data/app/controllers/admin/configuration_controller.rb +9 -11
  42. data/app/controllers/admin/extensions_controller.rb +3 -3
  43. data/app/controllers/admin/layouts_controller.rb +3 -4
  44. data/app/controllers/admin/page_attachments_controller.rb +5 -5
  45. data/app/controllers/admin/page_fields_controller.rb +3 -4
  46. data/app/controllers/admin/page_parts_controller.rb +4 -5
  47. data/app/controllers/admin/pages_controller.rb +55 -56
  48. data/app/controllers/admin/references_controller.rb +1 -1
  49. data/app/controllers/admin/resource_controller.rb +132 -128
  50. data/app/controllers/admin/sites_controller.rb +4 -4
  51. data/app/controllers/admin/snippets_controller.rb +3 -4
  52. data/app/controllers/admin/users_controller.rb +16 -16
  53. data/app/controllers/application_controller.rb +47 -48
  54. data/app/controllers/site_controller.rb +51 -48
  55. data/app/controllers/social_mailer_controller.rb +13 -16
  56. data/app/helpers/admin/configuration_helper.rb +19 -20
  57. data/app/helpers/admin/layouts_helper.rb +0 -1
  58. data/app/helpers/admin/node_helper.rb +27 -24
  59. data/app/helpers/admin/pages_helper.rb +2 -2
  60. data/app/helpers/admin/preferences_helper.rb +0 -1
  61. data/app/helpers/admin/references_helper.rb +9 -10
  62. data/app/helpers/admin/regions_helper.rb +3 -3
  63. data/app/helpers/application_helper.rb +34 -35
  64. data/app/helpers/rad_social_helper.rb +8 -11
  65. data/app/helpers/scoped_helper.rb +1 -3
  66. data/app/helpers/sites_helper.rb +4 -4
  67. data/app/mailers/devise_mailer.rb +3 -4
  68. data/app/mailers/rad_social_mailer.rb +8 -8
  69. data/app/models/asset.rb +62 -63
  70. data/app/models/asset_type.rb +38 -39
  71. data/app/models/deprecated_tags.rb +3 -4
  72. data/app/models/file_not_found_page.rb +1 -3
  73. data/app/models/haml_filter.rb +1 -1
  74. data/app/models/layout.rb +4 -5
  75. data/app/models/legacy_user.rb +2 -2
  76. data/app/models/menu_renderer.rb +16 -18
  77. data/app/models/page.rb +96 -93
  78. data/app/models/page_attachment.rb +1 -2
  79. data/app/models/page_context.rb +11 -12
  80. data/app/models/page_part.rb +3 -4
  81. data/app/models/rails_page.rb +10 -12
  82. data/app/models/site.rb +22 -21
  83. data/app/models/snippet.rb +6 -8
  84. data/app/models/snippet_finder.rb +3 -3
  85. data/app/models/snippet_tags.rb +4 -4
  86. data/app/models/standard_tags.rb +258 -252
  87. data/app/models/status.rb +8 -8
  88. data/app/models/trusty_cms/config.rb +25 -25
  89. data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
  90. data/app/models/user.rb +15 -14
  91. data/app/models/user_action_observer.rb +3 -3
  92. data/app/users/_choose_site.html.haml +3 -7
  93. data/app/views/admin/assets/_form.html.haml +2 -1
  94. data/app/views/admin/assets/_search.html.haml +2 -1
  95. data/app/views/admin/assets/edit.html.haml +2 -10
  96. data/app/views/admin/assets/index.html.haml +4 -2
  97. data/app/views/admin/assets/new.html.haml +4 -8
  98. data/app/views/admin/assets/remove.html.haml +2 -1
  99. data/app/views/admin/configuration/edit.html.haml +7 -7
  100. data/app/views/admin/configuration/show.html.haml +6 -8
  101. data/app/views/admin/layouts/_choose_site.html.haml +2 -3
  102. data/app/views/admin/layouts/_form.html.haml +13 -12
  103. data/app/views/admin/layouts/_site_chooser.html.haml +2 -2
  104. data/app/views/admin/layouts/index.html.haml +11 -4
  105. data/app/views/admin/layouts/remove.html.haml +6 -5
  106. data/app/views/admin/page_attachments/_attachment.html.haml +2 -2
  107. data/app/views/admin/page_fields/_page_field.html.haml +3 -3
  108. data/app/views/admin/page_parts/_page_part.html.haml +5 -6
  109. data/app/views/admin/pages/_asset_popups.html.haml +15 -16
  110. data/app/views/admin/pages/_assets.html.haml +8 -7
  111. data/app/views/admin/pages/_fields.html.haml +16 -13
  112. data/app/views/admin/pages/_node.html.haml +3 -3
  113. data/app/views/admin/pages/_popups.html.haml +11 -11
  114. data/app/views/admin/pages/edit.html.haml +2 -2
  115. data/app/views/admin/pages/index.html.haml +5 -2
  116. data/app/views/admin/pages/new.html.haml +3 -3
  117. data/app/views/admin/pages/remove.html.haml +4 -3
  118. data/app/views/admin/preferences/edit.html.haml +5 -5
  119. data/app/views/admin/references/filters.haml +1 -1
  120. data/app/views/admin/references/tags.haml +3 -3
  121. data/app/views/admin/removed/_assets_bucket.html.haml +3 -3
  122. data/app/views/admin/removed/_assets_container.html.haml +18 -18
  123. data/app/views/admin/removed/_bucket.html.haml +1 -1
  124. data/app/views/admin/removed/_bucket_asset.html.haml +3 -3
  125. data/app/views/admin/removed/_show_bucket_link.html.haml +1 -1
  126. data/app/views/admin/removed/_upload_to_page.html.haml +5 -5
  127. data/app/views/admin/sites/_form.haml +18 -18
  128. data/app/views/admin/sites/edit.haml +1 -1
  129. data/app/views/admin/sites/index.haml +8 -4
  130. data/app/views/admin/sites/new.haml +1 -1
  131. data/app/views/admin/snippets/_choose_site.html.haml +4 -5
  132. data/app/views/admin/snippets/_form.html.haml +8 -9
  133. data/app/views/admin/snippets/edit.html.haml +1 -1
  134. data/app/views/admin/snippets/index.html.haml +11 -4
  135. data/app/views/admin/snippets/new.html.haml +1 -1
  136. data/app/views/admin/snippets/remove.html.haml +7 -6
  137. data/app/views/admin/users/_avatar.html.haml +2 -2
  138. data/app/views/admin/users/_choose_site.html.haml +3 -7
  139. data/app/views/admin/users/_form.html.haml +18 -21
  140. data/app/views/admin/users/_password_fields.html.haml +6 -6
  141. data/app/views/admin/users/index.html.haml +13 -6
  142. data/app/views/admin/users/remove.html.haml +4 -4
  143. data/app/views/admin/welcome/login.html.haml +8 -8
  144. data/app/views/devise/passwords/edit.html.haml +6 -6
  145. data/app/views/devise/passwords/new.html.haml +3 -3
  146. data/app/views/devise/sessions/new.html.haml +8 -8
  147. data/app/views/devise/shared/_links.html.haml +2 -2
  148. data/app/views/layouts/application.html.haml +24 -19
  149. data/app/views/rad_social_mailer/social_mail_form.html.haml +15 -15
  150. data/app/views/widget/_email_form.html.haml +14 -14
  151. data/app/views/widget/_horizontal_widget.html.haml +5 -5
  152. data/bin/rails +4 -4
  153. data/bin/trusty_cms +3 -5
  154. data/config.ru +1 -1
  155. data/config/application.rb +14 -15
  156. data/config/boot.rb +1 -2
  157. data/config/environment.rb +1 -1
  158. data/config/environments/production.rb +0 -1
  159. data/config/environments/test.rb +1 -2
  160. data/config/initializers/devise.rb +1 -1
  161. data/config/initializers/kraken.rb +2 -2
  162. data/config/initializers/tmp.rb +1 -1
  163. data/config/initializers/trusty_cms_config.rb +48 -48
  164. data/config/locales/en.yml +8 -8
  165. data/config/routes.rb +6 -7
  166. data/lib/active_record_extensions/active_record_extensions.rb +1 -2
  167. data/lib/annotatable.rb +3 -5
  168. data/lib/configuration_extensions/configuration_extensions.rb +1 -1
  169. data/lib/inheritable_class_attributes.rb +13 -9
  170. data/lib/login_system.rb +73 -73
  171. data/lib/method_observer.rb +13 -12
  172. data/lib/ostruct.rb +7 -10
  173. data/lib/simpleton.rb +0 -4
  174. data/lib/string_extensions/string_extensions.rb +3 -3
  175. data/lib/symbol_extensions/symbol_extensions.rb +1 -1
  176. data/lib/tasks/database.rake +28 -28
  177. data/lib/tasks/extensions.rake +18 -18
  178. data/lib/tasks/framework.rake +68 -68
  179. data/lib/tasks/radiant_config.rake +4 -4
  180. data/lib/tasks/snippets_extension_tasks.rake +11 -11
  181. data/lib/tasks/translate.rake +14 -14
  182. data/lib/tasks/upgrade_to_devise.rake +1 -1
  183. data/lib/translation_support.rb +22 -22
  184. data/lib/trusty_cms.rb +2 -2
  185. data/lib/trusty_cms/admin_ui.rb +19 -16
  186. data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
  187. data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
  188. data/lib/trusty_cms/available_locales.rb +2 -4
  189. data/lib/trusty_cms/config/definition.rb +11 -8
  190. data/lib/trusty_cms/engine.rb +14 -14
  191. data/lib/trusty_cms/extension.rb +14 -16
  192. data/lib/trusty_cms/extension_loader.rb +6 -6
  193. data/lib/trusty_cms/extension_migrator.rb +42 -41
  194. data/lib/trusty_cms/extension_path.rb +20 -19
  195. data/lib/trusty_cms/initializer.rb +5 -8
  196. data/lib/trusty_cms/pagination/controller.rb +7 -10
  197. data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
  198. data/lib/trusty_cms/resource_responses.rb +3 -3
  199. data/lib/trusty_cms/setup.rb +130 -132
  200. data/lib/trusty_cms/taggable.rb +19 -22
  201. data/lib/trusty_cms/task_support.rb +9 -6
  202. data/package.json +10 -2
  203. data/public/dispatch.fcgi +1 -1
  204. data/public/dispatch.rb +2 -2
  205. data/script/extension +1 -1
  206. data/script/rails +2 -2
  207. data/spec/dummy/package.json +1 -1
  208. data/spec/dummy/yarn.lock +3 -3
  209. data/trusty_cms.gemspec +25 -25
  210. data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
  211. data/yarn.lock +1992 -4
  212. metadata +54 -42
  213. data/app/assets/stylesheets/admin/partials/_deprecated.scss +0 -65
  214. data/app/assets/stylesheets/admin/partials/_jquery-ui-structure.scss +0 -258
  215. data/app/assets/stylesheets/admin/partials/_jquery-ui-theme.scss +0 -410
  216. data/app/assets/stylesheets/admin/partials/_jquery-ui.scss +0 -650
  217. data/app/views/admin/assets/refresh.html.haml +0 -14
@@ -2,20 +2,20 @@ require 'rake/testtask'
2
2
 
3
3
  namespace :db do
4
4
  namespace :migrate do
5
- desc "Run all TrustyCms extension migrations"
6
- task :extensions => :environment do
5
+ desc 'Run all TrustyCms extension migrations'
6
+ task extensions: :environment do
7
7
  require 'trusty_cms/extension_migrator'
8
8
  TrustyCms::ExtensionMigrator.migrate_extensions
9
9
  Rake::Task['db:schema:dump'].invoke
10
10
  end
11
11
  end
12
12
  namespace :remigrate do
13
- desc "Migrate down and back up all TrustyCms extension migrations"
14
- task :extensions => :environment do
13
+ desc 'Migrate down and back up all TrustyCms extension migrations'
14
+ task extensions: :environment do
15
15
  require 'highline/import'
16
16
  if agree("This task will destroy any data stored by extensions in the database. Are you sure you want to \ncontinue? [yn] ")
17
17
  require 'trusty_cms/extension_migrator'
18
- TrustyCms::Extension.descendants.each {|ext| ext.migrator.migrate(0) }
18
+ TrustyCms::Extension.descendants.each { |ext| ext.migrator.migrate(0) }
19
19
  Rake::Task['db:migrate:extensions'].invoke
20
20
  Rake::Task['db:schema:dump'].invoke
21
21
  end
@@ -24,13 +24,13 @@ namespace :db do
24
24
  end
25
25
 
26
26
  namespace :test do
27
- desc "Runs tests on all available TrustyCms extensions, pass EXT=extension_name to test a single extension"
28
- task :extensions => "db:test:prepare" do
27
+ desc 'Runs tests on all available TrustyCms extensions, pass EXT=extension_name to test a single extension'
28
+ task extensions: 'db:test:prepare' do
29
29
  extensions = TrustyCms.configuration.enabled_extensions
30
- if ENV["EXT"]
31
- extensions = extensions & [ENV["EXT"].to_sym]
30
+ if ENV['EXT']
31
+ extensions = extensions & [ENV['EXT'].to_sym]
32
32
  if extensions.empty?
33
- puts "Sorry, that extension is not installed."
33
+ puts 'Sorry, that extension is not installed.'
34
34
  end
35
35
  end
36
36
  extensions.each do |extension|
@@ -49,13 +49,13 @@ namespace :test do
49
49
  end
50
50
 
51
51
  namespace :spec do
52
- desc "Runs specs on all available TrustyCms extensions, pass EXT=extension_name to test a single extension"
53
- task :extensions => "db:test:prepare" do
52
+ desc 'Runs specs on all available TrustyCms extensions, pass EXT=extension_name to test a single extension'
53
+ task extensions: 'db:test:prepare' do
54
54
  extensions = TrustyCms.configuration.enabled_extensions
55
- if ENV["EXT"]
56
- extensions = extensions & [ENV["EXT"].to_sym]
55
+ if ENV['EXT']
56
+ extensions = extensions & [ENV['EXT'].to_sym]
57
57
  if extensions.empty?
58
- puts "Sorry, that extension is not installed."
58
+ puts 'Sorry, that extension is not installed.'
59
59
  end
60
60
  end
61
61
  extensions.each do |extension|
@@ -76,10 +76,10 @@ end
76
76
 
77
77
  namespace :trusty_cms do
78
78
  namespace :extensions do
79
- desc "Runs update asset task for all extensions"
80
- task :update_all => [:environment] do
79
+ desc 'Runs update asset task for all extensions'
80
+ task update_all: [:environment] do
81
81
  extension_update_tasks = TrustyCms.configuration.enabled_extensions.map { |n| "trusty_cms:extensions:#{n}:update" }.select { |t| Rake::Task.task_defined?(t) }
82
- extension_update_tasks.each {|t| Rake::Task[t].invoke }
82
+ extension_update_tasks.each { |t| Rake::Task[t].invoke }
83
83
  end
84
84
  end
85
85
  end
@@ -2,14 +2,14 @@
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/trusty)"
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
- Gem.cache.search('trusty-cms').sort_by { |g| g.version }.last
12
+ Gem.cache.search('trusty-cms').max_by { |g| g.version }
13
13
 
14
14
  version ||= trusty.version
15
15
 
@@ -19,49 +19,48 @@ unless File.directory? "#{Rails.root}/app"
19
19
  end
20
20
 
21
21
  puts "Freezing to the gems for TrustyCms #{trusty.version}"
22
- rm_rf "vendor/trusty"
22
+ rm_rf 'vendor/trusty'
23
23
 
24
- chdir("vendor") do
25
- Gem::GemRunner.new.run(["unpack", "trusty", "--version", "=#{version}"])
26
- FileUtils.mv(Dir.glob("trusty*").first, "trusty")
24
+ chdir('vendor') do
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
 
30
- desc "Lock to latest Edge TrustyCms or a specific revision with REVISION=X (ex: REVISION=245484e), a tag with TAG=Y (ex: TAG=0.6.6), or a branch with BRANCH=Z (ex: BRANCH=mental)"
30
+ desc 'Lock to latest Edge TrustyCms or a specific revision with REVISION=X (ex: REVISION=245484e), a tag with TAG=Y (ex: TAG=0.6.6), or a branch with BRANCH=Z (ex: BRANCH=mental)'
31
31
  task :edge do
32
32
  $verbose = false
33
- unless system "git --version"
34
- $stderr.puts "ERROR: Must have git available in the PATH to lock this application to Edge TrustyCms"
33
+ unless system 'git --version'
34
+ warn 'ERROR: Must have git available in the PATH to lock this application to Edge TrustyCms'
35
35
  exit 1
36
36
  end
37
37
 
38
- trusty_git = "git://github.com/pgharts/trusty-cms.git"
38
+ trusty_git = 'git://github.com/pgharts/trusty-cms.git'
39
39
 
40
- if File.exist?("vendor/trusty_cms/.git/HEAD")
41
- cd("vendor/trusty") { system "git checkout master"; system "git pull origin master"}
40
+ if File.exist?('vendor/trusty_cms/.git/HEAD')
41
+ cd('vendor/trusty') { system 'git checkout master'; system 'git pull origin master' }
42
42
  else
43
43
  system "git clone #{trusty_git} vendor/trusty"
44
44
  end
45
45
 
46
- case
47
- when ENV['TAG']
48
- cd("vendor/trusty") { system "git checkout -b v#{ENV['TAG']} #{ENV['TAG']}"}
49
- when ENV['BRANCH']
50
- cd("vendor/trusty") { system "git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}"}
51
- when ENV['REVISION']
52
- cd("vendor/trusty") { system "git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}"}
46
+ if ENV['TAG']
47
+ cd('vendor/trusty') { system "git checkout -b v#{ENV['TAG']} #{ENV['TAG']}" }
48
+ elsif ENV['BRANCH']
49
+ cd('vendor/trusty') { system "git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}" }
50
+ elsif ENV['REVISION']
51
+ cd('vendor/trusty') { system "git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}" }
53
52
  end
54
53
 
55
- cd("vendor/trusty") { system "git submodule update --init"}
54
+ cd('vendor/trusty') { system 'git submodule update --init' }
56
55
  end
57
56
  end
58
57
 
59
- desc "Unlock this application from freeze of gems or edge and return to a fluid use of system gems"
58
+ desc 'Unlock this application from freeze of gems or edge and return to a fluid use of system gems'
60
59
  task :unfreeze do
61
- rm_rf "vendor/trusty"
60
+ rm_rf 'vendor/trusty'
62
61
  end
63
62
 
64
- desc "Update configs, scripts, html, images, sass, stylesheets and javascripts from TrustyCms."
63
+ desc 'Update configs, scripts, html, images, sass, stylesheets and javascripts from TrustyCms.'
65
64
  task :update do
66
65
  tasks = %w{scripts javascripts configs static_html images sass stylesheets cached_assets bundle}
67
66
  tasks = tasks & ENV['ONLY'].split(',') if ENV['ONLY']
@@ -74,9 +73,9 @@ unless File.directory? "#{Rails.root}/app"
74
73
  end
75
74
 
76
75
  namespace :update do
77
- desc "Add new scripts to the instance script/ directory"
76
+ desc 'Add new scripts to the instance script/ directory'
78
77
  task :scripts do
79
- local_base = "script"
78
+ local_base = 'script'
80
79
  edge_base = "#{File.dirname(__FILE__)}/../../script"
81
80
 
82
81
  local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) }
@@ -84,33 +83,34 @@ unless File.directory? "#{Rails.root}/app"
84
83
  edge = edge.reject { |f| f =~ /(generate|plugin|destroy)$/ }
85
84
 
86
85
  edge.each do |script|
87
- base_name = script[(edge_base.length+1)..-1]
88
- next if local.detect { |path| base_name == path[(local_base.length+1)..-1] }
86
+ base_name = script[(edge_base.length + 1)..-1]
87
+ next if local.detect { |path| base_name == path[(local_base.length + 1)..-1] }
88
+
89
89
  if !File.directory?("#{local_base}/#{File.dirname(base_name)}")
90
90
  mkdir_p "#{local_base}/#{File.dirname(base_name)}"
91
91
  end
92
- install script, "#{local_base}/#{base_name}", :mode => 0755
92
+ install script, "#{local_base}/#{base_name}", mode: 0o755
93
93
  end
94
- install "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_generate", "#{local_base}/generate", :mode => 0755
94
+ install "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_generate", "#{local_base}/generate", mode: 0o755
95
95
  end
96
96
 
97
- desc "Update your javascripts from your current trusty install"
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|
101
- scripts.reject!{|s| File.basename(s) == 'overrides.js'} if File.exists?(project_dir + 'overrides.js')
101
+ scripts.reject! { |s| File.basename(s) == 'overrides.js' } if File.exists?(project_dir + 'overrides.js')
102
102
  FileUtils.cp(scripts, project_dir)
103
103
  end
104
104
  copy_javascripts[Rails.root + '/public/javascripts/', Dir["#{File.dirname(__FILE__)}/../../public/javascripts/*.js"]]
105
105
  copy_javascripts[Rails.root + '/public/javascripts/admin/', Dir["#{File.dirname(__FILE__)}/../../public/javascripts/admin/*.js"]]
106
106
  end
107
107
 
108
- desc "Update the cached assets for the admin UI"
108
+ desc 'Update the cached assets for the admin UI'
109
109
  task :cached_assets do
110
110
  TrustyCms::TaskSupport.cache_admin_js
111
111
  end
112
112
 
113
- desc "Update Gemfile from your current trusty install, backing up if required."
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"
@@ -123,7 +123,7 @@ unless File.directory? "#{Rails.root}/app"
123
123
  'mysql2' => 'mysql2',
124
124
  'pg' => 'postgresql',
125
125
  'db2' => 'db2',
126
- 'activerecord-sqlserver-adapter' => 'sqlserver'
126
+ 'activerecord-sqlserver-adapter' => 'sqlserver',
127
127
  }
128
128
  active_db_gem = db_gems.keys.find { |g| Gem.loaded_specs[g] } || 'sqlite3'
129
129
 
@@ -134,7 +134,7 @@ unless File.directory? "#{Rails.root}/app"
134
134
  end
135
135
 
136
136
  unless File.exist?(file) && FileUtils.compare_file(file, tmpfile)
137
- warning = ""
137
+ warning = ''
138
138
  if File.exist?(file)
139
139
  FileUtils.cp(file, backfile)
140
140
  warning << "** WARNING **
@@ -149,44 +149,44 @@ 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 trusty install"
152
+ desc 'Update configuration files from your current trusty install'
153
153
  task :configs do
154
154
  require 'erb'
155
155
  instances = {
156
- :env => "#{Rails.root}/config/environment.rb",
157
- :development => "#{Rails.root}/config/environments/development.rb",
158
- :test => "#{Rails.root}/config/environments/test.rb",
159
- :cucumber => "#{Rails.root}/config/environments/cucumber.rb",
160
- :production => "#{Rails.root}/config/environments/production.rb"
156
+ env: "#{Rails.root}/config/environment.rb",
157
+ development: "#{Rails.root}/config/environments/development.rb",
158
+ test: "#{Rails.root}/config/environments/test.rb",
159
+ cucumber: "#{Rails.root}/config/environments/cucumber.rb",
160
+ production: "#{Rails.root}/config/environments/production.rb",
161
161
  }
162
162
  tmps = {
163
- :env => "#{Rails.root}/config/environment.tmp",
164
- :development => "#{Rails.root}/config/environments/development.tmp",
165
- :test => "#{Rails.root}/config/environments/test.tmp",
166
- :cucumber => "#{Rails.root}/config/environments/cucumber.rb",
167
- :production => "#{Rails.root}/config/environments/production.tmp"
163
+ env: "#{Rails.root}/config/environment.tmp",
164
+ development: "#{Rails.root}/config/environments/development.tmp",
165
+ test: "#{Rails.root}/config/environments/test.tmp",
166
+ cucumber: "#{Rails.root}/config/environments/cucumber.rb",
167
+ production: "#{Rails.root}/config/environments/production.tmp",
168
168
  }
169
169
  gens = {
170
- :env => "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb",
171
- :development => "#{File.dirname(__FILE__)}/../../config/environments/development.rb",
172
- :test => "#{File.dirname(__FILE__)}/../../config/environments/test.rb",
173
- :cucumber => "#{File.dirname(__FILE__)}/../../config/environments/cucumber.rb",
174
- :production => "#{File.dirname(__FILE__)}/../../config/environments/production.rb"
170
+ env: "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb",
171
+ development: "#{File.dirname(__FILE__)}/../../config/environments/development.rb",
172
+ test: "#{File.dirname(__FILE__)}/../../config/environments/test.rb",
173
+ cucumber: "#{File.dirname(__FILE__)}/../../config/environments/cucumber.rb",
174
+ production: "#{File.dirname(__FILE__)}/../../config/environments/production.rb",
175
175
  }
176
176
  backups = {
177
- :env => "#{Rails.root}/config/environment.bak",
178
- :development => "#{Rails.root}/config/environments/development.bak",
179
- :test => "#{Rails.root}/config/environments/test.bak",
180
- :cucumber => "#{Rails.root}/config/environments/cucumber.bak",
181
- :production => "#{Rails.root}/config/environments/production.bak"
177
+ env: "#{Rails.root}/config/environment.bak",
178
+ development: "#{Rails.root}/config/environments/development.bak",
179
+ test: "#{Rails.root}/config/environments/test.bak",
180
+ cucumber: "#{Rails.root}/config/environments/cucumber.bak",
181
+ production: "#{Rails.root}/config/environments/production.bak",
182
182
  }
183
183
 
184
184
  FileUtils.cp("#{File.dirname(__FILE__)}/../generators/instance/templates/instance_boot.rb", Rails.root + '/config/boot.rb')
185
185
  FileUtils.cp("#{File.dirname(__FILE__)}/../../config/preinitializer.rb", Rails.root + '/config/preinitializer.rb')
186
- warning = ""
187
- [:env, :development, :test, :cucumber, :production].each do |env_file|
186
+ warning = ''
187
+ %i[env development test cucumber production].each do |env_file|
188
188
  File.open(tmps[env_file], 'w') do |f|
189
- app_name = File.basename(File.expand_path(Rails.root))
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
@@ -206,14 +206,14 @@ the new files: #{warning}"
206
206
  end
207
207
  end
208
208
 
209
- desc "Update static HTML files from your current trusty install"
209
+ desc 'Update static HTML files from your current trusty install'
210
210
  task :static_html do
211
- project_dir = Rails.root + "/public/"
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 trusty images from your current trusty install"
216
+ desc 'Update admin and trusty images from your current trusty install'
217
217
  task :images do
218
218
  %w{admin trusty}.each do |d|
219
219
  project_dir = Rails.root + "/public/images/#{d}/"
@@ -223,22 +223,22 @@ the new files: #{warning}"
223
223
  end
224
224
  end
225
225
 
226
- desc "Update admin stylesheets from your current trusty install"
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
 
230
230
  copy_stylesheets = proc do |project_dir, styles|
231
- styles.reject!{|s| File.basename(s) == 'overrides.css'} if File.exists?(project_dir + 'overrides.css')
231
+ styles.reject! { |s| File.basename(s) == 'overrides.css' } if File.exists?(project_dir + 'overrides.css')
232
232
  FileUtils.cp(styles, project_dir)
233
233
  end
234
- copy_stylesheets[Rails.root + '/public/stylesheets/admin/',Dir["#{File.dirname(__FILE__)}/../../public/stylesheets/admin/*.css"]]
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 trusty install"
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
- sass_files.reject!{|s| File.basename(s) == 'overrides.sass'} if File.exists?(project_dir + 'overrides.sass') || File.exists?(project_dir + '../overrides.css')
241
- sass_files.reject!{|s| File.directory?(s) }
240
+ sass_files.reject! { |s| File.basename(s) == 'overrides.sass' } if File.exists?(project_dir + 'overrides.sass') || File.exists?(project_dir + '../overrides.css')
241
+ sass_files.reject! { |s| File.directory?(s) }
242
242
  FileUtils.mkpath(project_dir)
243
243
  FileUtils.cp(sass_files, project_dir)
244
244
  end
@@ -1,15 +1,15 @@
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/trusty_config.yml. Specify a path with TRUSTY_CONFIG_PATH - defaults to Rails.root/config/trusty_config.yml"
5
- task :export => :environment do
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
+ task export: :environment do
6
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/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
- task :import => :environment do
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
+ task import: :environment do
13
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)
@@ -1,9 +1,8 @@
1
1
  namespace :trusty do
2
2
  namespace :extensions do
3
3
  namespace :snippets do
4
-
5
4
  desc 'Runs the migration of the Snippets extension'
6
- task :migrate => :environment do
5
+ task migrate: :environment do
7
6
  require 'trusty_cms/extension_migrator'
8
7
  if ENV['VERSION']
9
8
  SnippetsExtension.migrator.migrate(ENV['VERSION'].to_i)
@@ -15,30 +14,31 @@ namespace :trusty do
15
14
  end
16
15
 
17
16
  desc 'Copies public assets of the Snippets to the instance public/ directory.'
18
- task :update => :environment do
19
- is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
17
+ task update: :environment do
18
+ is_svn_or_dir = proc { |path| path =~ /\.svn/ || File.directory?(path) }
20
19
  puts 'Copying assets from SnippetsExtension'
21
20
  Dir[SnippetsExtension.root + '/public/**/*'].reject(&is_svn_or_dir).each do |file|
22
21
  path = file.sub(SnippetsExtension.root, '')
23
22
  directory = File.dirname(path)
24
- mkdir_p Rails.root + directory, :verbose => false
25
- cp file, Rails.root + path, :verbose => false
23
+ mkdir_p Rails.root + directory, verbose: false
24
+ cp file, Rails.root + path, verbose: false
26
25
  end
27
26
  end
28
-
27
+
29
28
  desc 'Syncs all available translations for this ext to the English ext master'
30
- task :sync => :environment do
29
+ task sync: :environment do
31
30
  # The main translation root, basically where English is kept
32
31
  language_root = SnippetsExtension.root + '/config/locales'
33
32
  words = TranslationSupport.get_translation_keys(language_root)
34
-
33
+
35
34
  Dir['#{language_root}/*.yml'].each do |filename|
36
35
  next if filename.match('_available_tags')
36
+
37
37
  basename = File.basename(filename, '.yml')
38
38
  puts "Syncing #{basename}"
39
39
  (comments, other) = TranslationSupport.read_file(filename, basename)
40
- words.each { |k, v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
41
- other.delete_if { |k, v| !words[k] } # Remove if not defined in en.yml
40
+ words.each { |k, _v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
41
+ other.delete_if { |k, _v| !words[k] } # Remove if not defined in en.yml
42
42
  TranslationSupport.write_file(filename, basename, comments, other)
43
43
  end
44
44
  end
@@ -1,8 +1,7 @@
1
1
  namespace :trusty_cms do
2
2
  namespace :i18n do
3
-
4
- desc "Syncs all available translations to the English master"
5
- task :sync => :environment do
3
+ desc 'Syncs all available translations to the English master'
4
+ task sync: :environment do
6
5
  # All places TrustyCms can store locales
7
6
  locale_paths = TrustyCms::AvailableLocales.locale_paths
8
7
  # The main translation root, basically where English is kept
@@ -12,31 +11,32 @@ namespace :trusty_cms do
12
11
  if path == language_root || path.match('language_pack')
13
12
  Dir["#{path}/*.yml"].each do |filename|
14
13
  next if filename.match('_available_tags')
14
+
15
15
  basename = File.basename(filename, '.yml')
16
16
  puts "Syncing #{basename}"
17
17
  (comments, other) = TranslationSupport.read_file(filename, basename)
18
- words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
19
- other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
18
+ words.each { |k, _v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
19
+ other.delete_if { |k, _v| !words[k] } # Remove if not defined in en.yml
20
20
  TranslationSupport.write_file(filename, basename, comments, other)
21
21
  end
22
22
  end
23
23
  end
24
24
  end
25
25
 
26
- desc "Creates or updates the English available tag descriptions"
27
- task :available_tags => :environment do
26
+ desc 'Creates or updates the English available tag descriptions'
27
+ task available_tags: :environment do
28
28
  descriptions = Hash.new
29
29
  Page.tag_descriptions.sort.each do |tag, desc|
30
- tag = ' ' + tag.gsub(':','-') + ':'
31
- desc = desc.gsub(' ',' ')
32
- descriptions[tag] = ' "' + desc.gsub('%','&#37;').gsub('"','\"').strip + '"'
30
+ tag = ' ' + tag.gsub(':', '-') + ':'
31
+ desc = desc.gsub(' ', ' ')
32
+ descriptions[tag] = ' "' + desc.gsub('%', '&#37;').gsub('"', '\"').strip + '"'
33
33
  end
34
34
  comments = ''
35
- TranslationSupport.write_file("#{TRUSTY_CMS_ROOT}/config/locales/en_available_tags.yml","---\nen:\n desc",comments,descriptions)
35
+ TranslationSupport.write_file("#{TRUSTY_CMS_ROOT}/config/locales/en_available_tags.yml", "---\nen:\n desc", comments, descriptions)
36
36
  end
37
37
 
38
- desc "Syncs all translations available_tags to the English master"
39
- task :sync_available_tags => :environment do
38
+ desc 'Syncs all translations available_tags to the English master'
39
+ task sync_available_tags: :environment do
40
40
  # All places TrustyCms can store locales
41
41
  locale_paths = TrustyCms::AvailableLocales.locale_paths
42
42
  # The main translation root, basically where English is kept
@@ -46,6 +46,7 @@ namespace :trusty_cms do
46
46
  if path == language_root || path.match('language_pack')
47
47
  Dir["#{path}/*.yml"].each do |filename|
48
48
  next unless filename.match('_available_tags')
49
+
49
50
  basename = File.basename(filename, '_available_tags.yml')
50
51
  puts "Syncing #{basename}"
51
52
  (comments, other) = TranslationSupport.open_available_tags(filename)
@@ -54,6 +55,5 @@ namespace :trusty_cms do
54
55
  end
55
56
  end
56
57
  end
57
-
58
58
  end
59
59
  end