refinerycms 0.9.6.14 → 0.9.6.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. data/.gitignore +4 -1
  2. data/Rakefile +3 -51
  3. data/VERSION +1 -1
  4. data/bin/refinery +20 -20
  5. data/bin/refinery-override +9 -9
  6. data/bin/refinery-update-core +41 -34
  7. data/config/application.rb +28 -87
  8. data/config/environment.rb +1 -4
  9. data/config/environments/development.rb +2 -0
  10. data/config/environments/production.rb +1 -1
  11. data/config/preinitializer.rb +2 -6
  12. data/db/schema.rb +1 -1
  13. data/db/seeds.rb +1 -1
  14. data/lib/refinery/tasks/refinery.rake +83 -0
  15. data/lib/refinery/tasks/refinery.rb +16 -0
  16. data/public/images/refinery/dialogLoadingAnimation.gif +0 -0
  17. data/public/javascripts/refinery/admin.js +9 -4
  18. data/public/javascripts/refinery/boot_wym.js +19 -5
  19. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +72 -70
  20. data/public/stylesheets/refinery/refinery.css +19 -7
  21. data/readme.md +2 -2
  22. data/test/fixtures/user_plugins.yml +36 -0
  23. data/test/fixtures/users.yml +1 -2
  24. data/test/functional/dashboard_controller_test.rb +23 -3
  25. data/test/functional/images_controller_test.rb +93 -0
  26. data/test/test_helper.rb +9 -3
  27. data/test/unit/image_test.rb +2 -2
  28. data/test/unit/inquiry_test.rb +6 -6
  29. data/test/unit/news_items_test.rb +8 -8
  30. data/test/unit/refinery_setting_test.rb +12 -12
  31. data/test/unit/resource_test.rb +3 -3
  32. data/themes/demolicious/views/layouts/application.html.erb +1 -1
  33. data/themes/demolicious/views/pages/home.html.erb +1 -1
  34. data/themes/demolicious/views/pages/show.html.erb +1 -1
  35. data/themes/hemingway/views/layouts/application.html.erb +1 -1
  36. data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +1 -1
  37. data/vendor/plugins/dashboard/rails/init.rb +1 -1
  38. data/vendor/plugins/images/app/controllers/admin/images_controller.rb +2 -2
  39. data/vendor/plugins/images/app/helpers/admin/images_helper.rb +6 -2
  40. data/vendor/plugins/images/app/models/image.rb +3 -3
  41. data/vendor/plugins/images/app/views/admin/images/_form.html.erb +4 -4
  42. data/vendor/plugins/images/app/views/admin/images/index.html.erb +2 -2
  43. data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
  44. data/vendor/plugins/inquiries/app/models/inquiry.rb +3 -3
  45. data/vendor/plugins/inquiries/app/views/admin/inquiries/show.html.erb +1 -1
  46. data/vendor/plugins/inquiries/rails/init.rb +1 -1
  47. data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
  48. data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
  49. data/vendor/plugins/news/app/models/news_item.rb +2 -2
  50. data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +1 -1
  51. data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +1 -1
  52. data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +13 -0
  53. data/vendor/plugins/pages/app/models/page_part.rb +3 -1
  54. data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +2 -2
  55. data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +2 -2
  56. data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
  57. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +3 -3
  58. data/vendor/plugins/refinery/app/views/admin/_menu.html.erb +3 -7
  59. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
  60. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +5 -3
  61. data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +1 -1
  62. data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +0 -1
  63. data/vendor/plugins/refinery/lib/refinery.rb +9 -2
  64. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
  65. data/vendor/plugins/refinery/lib/refinery/deprecations.rb +46 -0
  66. data/vendor/plugins/refinery/lib/refinery/initializer.rb +20 -9
  67. data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +6 -5
  68. data/vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb +2 -2
  69. data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +41 -11
  70. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -1
  71. data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +1 -1
  72. data/vendor/plugins/resources/app/models/resource.rb +3 -3
  73. data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +2 -2
  74. data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +2 -2
  75. data/vendor/plugins/themes/app/helpers/themes_helper.rb +1 -1
  76. data/vendor/plugins/themes/lib/theme_server.rb +1 -1
  77. data/vendor/plugins/themes/rails/init.rb +26 -18
  78. metadata +10 -20
  79. data/Gemfile +0 -12
  80. data/public/javascripts/thickbox.js +0 -350
  81. data/public/stylesheets/refinery/thickbox.css +0 -165
  82. data/vendor/cache/aasm-2.1.3.gem +0 -0
  83. data/vendor/cache/actionmailer-2.3.5.gem +0 -0
  84. data/vendor/cache/actionpack-2.3.5.gem +0 -0
  85. data/vendor/cache/activerecord-2.3.5.gem +0 -0
  86. data/vendor/cache/activeresource-2.3.5.gem +0 -0
  87. data/vendor/cache/activesupport-2.3.5.gem +0 -0
  88. data/vendor/cache/friendly_id-2.3.1.gem +0 -0
  89. data/vendor/cache/hpricot-0.8.2.gem +0 -0
  90. data/vendor/cache/rack-1.0.1.gem +0 -0
  91. data/vendor/cache/rails-2.3.5.gem +0 -0
  92. data/vendor/cache/rake-0.8.7.gem +0 -0
  93. data/vendor/cache/rubyzip-0.9.1.gem +0 -0
  94. data/vendor/cache/slim_scrooge-1.0.3.gem +0 -0
  95. data/vendor/cache/will_paginate-2.3.11.gem +0 -0
data/.gitignore CHANGED
@@ -20,4 +20,7 @@ public/javascripts/cache
20
20
  public/stylesheets/cache
21
21
  config/database.yml.example
22
22
  .yardoc/
23
- refinerycms.gemspec
23
+ refinerycms.gemspec
24
+ .bundle
25
+ vendor/cache
26
+ *.lock
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ begin
6
6
  require File.join(File.dirname(__FILE__), 'config', 'environment')
7
7
  rescue Exception
8
8
  # Log the exception to the console/logfile.
9
- puts "*** Couldn't load the config/environment file because something went wrong... ***"
10
- puts "*** Don't worry, we'll do it the normal way and load in config/boot instead... ***"
9
+ puts "*** Couldn't load the application's configuration because something went wrong... ***"
10
+ puts "*** Don't worry, we'll bypass the application's configuration and just boot instead... ***"
11
11
 
12
12
  # Load up the boot file instead because there's something wrong with the environment.
13
13
  require File.join(File.dirname(__FILE__), 'config', 'boot')
@@ -19,52 +19,4 @@ require 'rake/testtask'
19
19
  require 'rake/rdoctask'
20
20
  require 'tasks/rails'
21
21
 
22
- # Because we use plugins that are shipped via gems, we lose their rake tasks.
23
- # So here, we find them (if there are any) and include them into rake.
24
- extra_rake_tasks = []
25
- if defined?(Refinery) && Refinery.is_a_gem
26
- extra_rake_tasks << Dir[Refinery.root.join("vendor", "plugins", "*", "**", "tasks", "**", "*", "*.rake")].sort
27
- end
28
-
29
- # We also need to load in the rake tasks from gem plugins whether Refinery is a gem or not:
30
- if $refinery_gem_plugin_lib_paths.present?
31
- extra_rake_tasks << $refinery_gem_plugin_lib_paths.collect {|path| Dir[File.join(%W(#{path} tasks ** *.rake))].sort}
32
- end
33
-
34
- # Load in any extra tasks that we've found.
35
- extra_rake_tasks.flatten.compact.uniq.each {|rake| load rake }
36
-
37
- desc 'Removes trailing whitespace across the entire application.'
38
- task :whitespace do
39
- sh %{find . -name '*.*rb' -exec sed -i '' 's/\t/ /g' {} \\; -exec sed -i '' 's/ *$//g' {} \\; }
40
- end
41
-
42
- # You don't need to worry about this unless you're releasing Refinery gems.
43
- begin
44
- require 'jeweler'
45
- Jeweler::Tasks.new do |s|
46
- s.name = %q{refinerycms}
47
- s.description = %q{A beautiful open source Ruby on Rails content manager for small business. Easy to extend, easy to use, lightweight and all wrapped up in a super slick UI.}
48
- s.summary = %q{A beautiful open source Ruby on Rails content manager for small business.}
49
- s.email = %q{info@refinerycms.com}
50
- s.homepage = %q{http://refinerycms.com}
51
- s.authors = ["Resolve Digital", "David Jones", "Philip Arndt"]
52
- s.extra_rdoc_files = %w(readme.md contributors.md license.md VERSION)
53
- s.rdoc_options << "--inline-source"
54
- s.has_rdoc = true
55
- end
56
-
57
- namespace :version do
58
- namespace :bump do
59
- desc "Bump the application's version by a build version."
60
- task :build => [:version_required, :version] do
61
- version = Jeweler::VersionHelper.new(Rails.root.to_s)
62
- version.update_to(version.major, version.minor, version.patch, ((version.build || 0).to_i + 1))
63
- version.write
64
- $stdout.puts "Updated version: #{version.to_s}"
65
- end
66
- end
67
- end
68
- rescue LoadError
69
- #puts "Jeweler not available. Install it with: sudo gem install jeweler"
70
- end
22
+ require 'refinery/tasks/refinery'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6.14
1
+ 0.9.6.15
data/bin/refinery CHANGED
@@ -2,48 +2,48 @@
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
4
 
5
- REFINERY_ROOT = Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")) unless defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname)
5
+ refinery_root = (defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname) ? REFINERY_ROOT : Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")))
6
6
  unless (app_path = ARGV.shift).nil? or app_path.length == 0
7
7
  # if "" or "." or "./" is specified then get the current directory otherwise accept the specified app_path.
8
- RAILS_ROOT = (app_path.length <= 2 and ((is_current_dir = app_path =~ /(\.(\/)?)/).nil? or is_current_dir < 2)) ? Dir.getwd : app_path
9
- if File.exists? RAILS_ROOT
8
+ rails_root = (app_path.length <= 2 and ((is_current_dir = app_path =~ /(\.(\/)?)/).nil? or is_current_dir < 2)) ? Dir.getwd : app_path
9
+ if File.exists? rails_root
10
10
  if ARGV.include?("--force")
11
11
  # remove the contents of the current directory
12
- Dir[File.join(RAILS_ROOT, "*")].each {|dir| FileUtils::rm_rf(dir, :secure => true) }
12
+ Dir[File.join(rails_root, "*")].each {|dir| FileUtils::rm_rf(dir, :secure => true) }
13
13
  else
14
14
  puts "The path you specified already exists. If you want to override this directory (i.e. delete all the current contents) run this again with --force"
15
15
  end
16
16
  end
17
17
 
18
- unless File.exists? RAILS_ROOT and !ARGV.include?("--force")
18
+ unless File.exists? rails_root and !ARGV.include?("--force")
19
19
  # make the application path directory
20
- FileUtils::makedirs RAILS_ROOT
20
+ FileUtils::makedirs rails_root
21
21
 
22
22
  # copy in all of the relevant directories and root files.
23
23
  to_copy = %w(app config db lib public themes script contributors.md license.md Rakefile readme.md VERSION).map do |dir|
24
- REFINERY_ROOT.join(dir).to_s
24
+ refinery_root.join(dir).to_s
25
25
  end
26
- FileUtils::cp_r to_copy, RAILS_ROOT, :verbose => false
26
+ FileUtils::cp_r to_copy, rails_root, :verbose => false
27
27
 
28
28
  # ensure lib/refinery_initializer.rb doesn't make it in.
29
- FileUtils::rm File.join(%W(#{RAILS_ROOT} lib refinery_initializer.rb)) if File.exists?(File.join(%W(#{RAILS_ROOT} lib refinery_initializer.rb)))
29
+ FileUtils::rm File.join(%W(#{rails_root} lib refinery_initializer.rb)) if File.exists?(File.join(%W(#{rails_root} lib refinery_initializer.rb)))
30
30
 
31
31
  # add in the config files
32
32
  for config in %w(database amazon_s3 rackspace_cloudfiles)
33
- FileUtils::move File.join(%W(#{RAILS_ROOT} config #{config}.yml.example)), File.join(%W(#{RAILS_ROOT} config #{config}.yml))
33
+ FileUtils::move File.join(%W(#{rails_root} config #{config}.yml.example)), File.join(%W(#{rails_root} config #{config}.yml))
34
34
 
35
35
  # figure out the app name from the install path and swap out your_local_xxx with this name.
36
- unless RAILS_ROOT == "/" or RUBY_PLATFORM =~ /mswin/
37
- app_name = RAILS_ROOT.split(File::SEPARATOR).last
36
+ unless rails_root == "/" or RUBY_PLATFORM =~ /mswin/
37
+ app_name = rails_root.split(File::SEPARATOR).last
38
38
  # read in the file and split up the lines
39
- lines = File.open(File.join(%W(#{RAILS_ROOT} config #{config}.yml)), "r").read.split("\n")
39
+ lines = File.open(File.join(%W(#{rails_root} config #{config}.yml)), "r").read.split("\n")
40
40
  lines.each do |line|
41
41
  line.gsub!("your_local_#{config}", "#{app_name}_development")
42
42
  line.gsub!("your_test_#{config}", "#{app_name}_test")
43
43
  line.gsub!("your_production_#{config}", "#{app_name}_production")
44
44
  end
45
45
  # write the new content into the file.
46
- File.open(File.join(%W(#{RAILS_ROOT} config #{config}.yml)), "w").puts(lines.join("\n"))
46
+ File.open(File.join(%W(#{rails_root} config #{config}.yml)), "w").puts(lines.join("\n"))
47
47
  end
48
48
  end
49
49
 
@@ -53,24 +53,24 @@ unless (app_path = ARGV.shift).nil? or app_path.length == 0
53
53
  3.times { new_digest << Digest::SHA1.hexdigest("--refinery--#{Time.now.to_s}--#{rand(10000000)}--") }
54
54
 
55
55
  # read in the file and split up the lines
56
- app_config_file = File.exist?(File.join(%W(#{RAILS_ROOT} config application.rb))) ? "application.rb" : "environment.rb"
57
- lines = File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "r").read.split("\n")
56
+ app_config_file = File.exist?(File.join(%W(#{rails_root} config application.rb))) ? "application.rb" : "environment.rb"
57
+ lines = File.open(File.join(%W(#{rails_root} config #{app_config_file})), "r").read.split("\n")
58
58
  lines.each do |line|
59
59
  match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
60
60
  line.gsub!(match, new_digest) unless match.nil?
61
61
  end
62
62
  # write the new content into the file.
63
- File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "w").puts(lines.join("\n"))
63
+ File.open(File.join(%W(#{rails_root} config #{app_config_file})), "w").puts(lines.join("\n"))
64
64
 
65
65
  puts "\n---------"
66
- puts "Refinery successfully installed in '#{RAILS_ROOT}'!\n\n"
66
+ puts "Refinery successfully installed in '#{rails_root}'!\n\n"
67
67
 
68
68
  # update core script files with symlinks.
69
- system "refinery-update-core #{RAILS_ROOT} --from-refinery-installer"
69
+ system "refinery-update-core #{rails_root} --from-refinery-installer"
70
70
 
71
71
  puts "=== ACTION REQUIRED ==="
72
72
  puts "\nNow run these commands:"
73
- puts "\ncd #{RAILS_ROOT}"
73
+ puts "\ncd #{rails_root}"
74
74
  puts "rake db:setup"
75
75
  puts "rake gems:install"
76
76
  puts "\nruby script/server"
@@ -2,16 +2,16 @@
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
4
 
5
- REFINERY_ROOT = Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")) unless defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname)
5
+ refinery_root = (defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname) ? REFINERY_ROOT : Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")))
6
6
  unless (override_path = ARGV.shift).nil? or (override_path.length == 0)
7
7
  # if "" or "." or "./" is specified then get the current directory otherwise accept the specified app_path.
8
8
  if ((app_path = ARGV.shift).nil? or app_path.length <= 2) and ((is_current_dir = app_path =~ /(\.(\/)?)/).nil? or !is_current_dir or is_current_dir < 2)
9
- RAILS_ROOT = Pathname.new(Dir.getwd)
9
+ rails_root = Pathname.new(Dir.getwd)
10
10
  else
11
- RAILS_ROOT = Pathname.new(app_path)
11
+ rails_root = Pathname.new(app_path)
12
12
  end
13
13
 
14
- if RAILS_ROOT.exists?
14
+ if rails_root.exists?
15
15
  # figure out what to override
16
16
  override_parts = override_path.downcase.split('/').compact.collect {|part| part if part.length > 0 }.compact
17
17
  admin = ""
@@ -31,11 +31,11 @@ unless (override_path = ARGV.shift).nil? or (override_path.length == 0)
31
31
 
32
32
  # copy the controller
33
33
  unless controller_with_admin =~ /\*(\*)?/ and !action.nil?
34
- refinery_controllers = Dir[REFINERY_ROOT.join("vendor", "plugins", "**", "app", "controllers", "#{controller_with_admin}_controller.rb")]
34
+ refinery_controllers = Dir[refinery_root.join("vendor", "plugins", "**", "app", "controllers", "#{controller_with_admin}_controller.rb")]
35
35
  if refinery_controllers.compact.any? # the controllers may not exist.
36
36
  refinery_controllers.each do |refinery_controller|
37
37
  # make the directories
38
- FileUtils.mkdir_p(copy_to = RAILS_ROOT.join("app" "controllers", admin))
38
+ FileUtils.mkdir_p(copy_to = rails_root.join("app" "controllers", admin))
39
39
  FileUtils.cp(refinery_controller, copy_to)
40
40
  end
41
41
  else
@@ -46,7 +46,7 @@ unless (override_path = ARGV.shift).nil? or (override_path.length == 0)
46
46
  # copy the action, if it exists
47
47
  unless action.nil? or action.length == 0
48
48
  # get all the matching files
49
- looking_for = REFINERY_ROOT.join("vendor", "plugins", "**", "app", "views", controller_with_admin.split('/'), "#{action}*.erb")
49
+ looking_for = refinery_root.join("vendor", "plugins", "**", "app", "views", controller_with_admin.split('/'), "#{action}*.erb")
50
50
  action_files = Dir[looking_for]
51
51
 
52
52
  # copy in the action template
@@ -55,8 +55,8 @@ unless (override_path = ARGV.shift).nil? or (override_path.length == 0)
55
55
  action_file_dir = action_file_path.split('/')
56
56
  action_file_dir.pop # get rid of the file.
57
57
 
58
- FileUtils.mkdir_p(RAILS_ROOT.join("app", "views", action_file_dir))
59
- FileUtils.cp action_file, RAILS_ROOT.join("app", "views", action_file_path)
58
+ FileUtils.mkdir_p(rails_root.join("app", "views", action_file_dir))
59
+ FileUtils.cp action_file, rails_root.join("app", "views", action_file_path)
60
60
  end
61
61
  else
62
62
  puts "Note: No action was specified."
@@ -1,72 +1,79 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
- REFINERY_ROOT = Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")) unless defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname)
5
- RAILS_ROOT = ARGV.first unless defined? RAILS_ROOT
6
- unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
4
+ refinery_root = (defined?(REFINERY_ROOT) && REFINERY_ROOT.is_a?(Pathname) ? REFINERY_ROOT : Pathname.new(File.expand_path(File.dirname(__FILE__) << "/..")))
5
+ rails_root = (defined?(RAILS_ROOT) ? RAILS_ROOT : ARGV.first)
6
+ unless rails_root.nil? or rails_root.length == 0
7
7
  # ensure asset directories exist.
8
8
  dirs = [%w(public stylesheets), %w(public javascripts), %w(db migrate)]
9
- FileUtils::makedirs dirs.map {|dir| File.join(RAILS_ROOT, dir) }
9
+ FileUtils::makedirs dirs.map {|dir| File.join(rails_root, dir) }
10
10
 
11
11
  # copy in the new assets.
12
12
  assets = [%w(public stylesheets refinery), %w(public javascripts refinery), %w(public javascripts wymeditor), %w(VERSION)]
13
13
  assets.each do |asset|
14
- FileUtils::rm_rf File.join(RAILS_ROOT, asset), :secure => true # ensure the destination is clear.
15
- FileUtils::cp_r File.join(REFINERY_ROOT, asset), File.join(RAILS_ROOT, asset) # copy the new assets into the project.
14
+ FileUtils::rm_rf File.join(rails_root, asset), :secure => true # ensure the destination is clear.
15
+ FileUtils::cp_r File.join(refinery_root, asset), File.join(rails_root, asset) # copy the new assets into the project.
16
16
  end
17
17
 
18
18
  # copy in any new migrations.
19
- FileUtils::cp Dir[File.join(%W(#{REFINERY_ROOT} db migrate *.rb))], File.join(%W(#{RAILS_ROOT} db migrate))
19
+ FileUtils::cp Dir[File.join(%W(#{refinery_root} db migrate *.rb))], File.join(%W(#{rails_root} db migrate))
20
20
 
21
21
  # replace rakefile.
22
- FileUtils::cp File.join(%W(#{REFINERY_ROOT} Rakefile)), File.join(%W(#{RAILS_ROOT} Rakefile))
22
+ FileUtils::cp File.join(%W(#{refinery_root} Rakefile)), File.join(%W(#{rails_root} Rakefile))
23
23
 
24
24
  # replace the preinitializer.
25
- FileUtils::cp File.join(%W(#{REFINERY_ROOT} config preinitializer.rb)), File.join(%W(#{RAILS_ROOT} config preinitializer.rb))
25
+ FileUtils::cp File.join(%W(#{refinery_root} config preinitializer.rb)), File.join(%W(#{rails_root} config preinitializer.rb))
26
+
27
+ # copy the lib/refinery directory in
28
+ FileUtils::cp_r File.join(%W(#{refinery_root} lib refinery)), File.join(rails_root, "lib")
29
+
30
+ # get current secret key
31
+ if !File.exist?(File.join(%W(#{rails_root} config application.rb)))
32
+ lines = File.open(File.join(%W(#{rails_root} config environment.rb)), "r").read.split("\n")
33
+ else
34
+ lines = File.open(File.join(%W(#{rails_root} config application.rb)), "r").read.split("\n")
35
+ end
36
+ secret_key = ""
37
+ lines.each do |line|
38
+ match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
39
+ secret_key = match unless match.nil?
40
+ end
26
41
 
27
42
  # read in the config files
28
- if File.exist?(File.join(%W(#{RAILS_ROOT} config application.rb)))
29
- FileUtils::cp File.join(%W(#{REFINERY_ROOT} config environment.rb)), File.join(%W(#{RAILS_ROOT} config environment.rb))
43
+ if File.exist?(File.join(%W(#{rails_root} config application.rb)))
44
+ FileUtils::cp File.join(%W(#{refinery_root} config environment.rb)), File.join(%W(#{rails_root} config environment.rb))
30
45
  else
31
- # update secret key if environment still exists
32
- lines = File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "r").read.split("\n")
33
- secret_key = ""
34
- lines.each do |line|
35
- match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
36
- secret_key = match unless match.nil?
37
- end
38
46
  # write the new content into the file.
39
- FileUtils::cp File.join(%W(#{REFINERY_ROOT} config application.rb)), File.join(%W(#{RAILS_ROOT} config application.rb))
47
+ FileUtils::cp File.join(%W(#{refinery_root} config application.rb)), File.join(%W(#{rails_root} config application.rb))
40
48
 
41
- app_rb_lines = File.open(File.join(%W(#{RAILS_ROOT} config application.rb)), "r").read.split("\n")
49
+ app_rb_lines = File.open(File.join(%W(#{rails_root} config application.rb)), "r").read.split("\n")
42
50
  app_rb_lines.each do |line|
43
51
  match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
44
52
  line.gsub!(match, secret_key) unless match.nil?
45
53
  end
46
54
 
47
55
  # write the new content into the file.
48
- File.open(File.join(%W(#{RAILS_ROOT} config application.rb)), "w").puts(app_rb_lines.join("\n"))
56
+ File.open(File.join(%W(#{rails_root} config application.rb)), "w").puts(app_rb_lines.join("\n"))
49
57
 
50
- FileUtils::cp File.join(%W(#{REFINERY_ROOT} config environment.rb)), File.join(%W(#{RAILS_ROOT} config environment.rb))
58
+ FileUtils::cp File.join(%W(#{refinery_root} config environment.rb)), File.join(%W(#{rails_root} config environment.rb))
51
59
  end
52
60
 
53
61
  app_config_file = "application.rb"
54
62
 
55
- app_config = File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "r").read
56
- environment_updated = false
63
+ app_config = File.open(File.join(%W(#{rails_root} config #{app_config_file})), "r").read
57
64
 
58
- # backup app's environment.rb
65
+ # backup app's config file and replace it, if required.
66
+ environment_updated = false
59
67
  matcher = /(#===REFINERY REQUIRED GEMS===)(.+?)(#===REFINERY END OF REQUIRED GEMS===)/m
60
68
  unless (app_refinery_gems_section = app_config.scan(matcher).join("")).length == 0
61
- # read in the config file in the gem
62
- refinery_config = File.open(File.join(%W(#{REFINERY_ROOT} config #{app_config_file})), "r").read
63
- FileUtils.cp File.join(%W(#{RAILS_ROOT} config #{app_config_file})), File.join(%W(#{RAILS_ROOT} config #{app_config_file.gsub(".rb", "")}.autobackupbyrefinery.rb))
69
+ # backup the config file.
70
+ FileUtils.cp File.join(%W(#{rails_root} config #{app_config_file})), File.join(%W(#{rails_root} config #{app_config_file.gsub(".rb", "")}.autobackupbyrefinery.rb))
64
71
 
65
- # write the new content into the file.
66
- File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "w").puts(app_config.gsub!(
67
- app_refinery_gems_section,
68
- refinery_config.scan(matcher).join("")
69
- ))
72
+ # copy the new config file.
73
+ FileUtils.cp File.join(%W(#{refinery_root} config #{app_config_file})), File.join(%W(#{rails_root} config #{app_config_file}))
74
+
75
+ # Write the secret key back into the file.
76
+
70
77
 
71
78
  environment_updated = true
72
79
  end
@@ -75,7 +82,7 @@ unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
75
82
  puts "---------"
76
83
  puts "Copied new Refinery core assets."
77
84
  if environment_updated
78
- puts "I've made a backup of your current config/#{app_config_file} file as it has been updated with the latest Refinery RubyGem requirements."
85
+ puts "I've made a backup of your current config/#{app_config_file} file as it has been updated with the latest Refinery requirements."
79
86
  puts "The backup is located at config/#{app_config_file.gsub(".rb", "")}.autobackupbyrefinery.rb incase you need it."
80
87
  end
81
88
  puts ""
@@ -1,88 +1,29 @@
1
- if defined?(Rails::Application) # e.g. Rails 3
2
- module Refinery
3
- class Application < Rails::Application
4
- config.action_controller.session = {
5
- :session_key => '_refinery_session',
6
- :secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
7
- }
8
- end
9
-
10
- def gem_version
11
- #"0.9.6.14"
12
- end
13
- end
14
- else
15
- # Be sure to restart your server when you modify this file
16
-
17
- # Uncomment below to force Rails into production mode when
18
- # you don't control web/app server and can't set it the proper way
19
- # ENV['RAILS_ENV'] ||= 'production'
20
-
21
- # Specifies gem version of Rails to use when vendor/rails is not present
22
- RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
23
- # Freeze to a specific version of refinerycms when running as a gem
24
- # REFINERY_GEM_VERSION = '0.9.6.14' unless defined? REFINERY_GEM_VERSION
25
-
26
- # Bootstrap the Rails environment, frameworks, and default configuration
27
- require File.join(File.dirname(__FILE__), 'boot')
28
-
29
- # require the refinery initializer.
30
- require Refinery.root.join("lib", "refinery_initializer").to_s
31
-
32
- Refinery::Initializer.run do |config|
33
- # Settings in config/environments/* take precedence over those specified here.
34
- # Application configuration should go into files in config/initializers
35
- # -- all .rb files in that directory are automatically loaded.
36
- # See Rails::Configuration for more options.
37
-
38
- # Only load the plugins named here, in the order given. By default, all plugins
39
- # in vendor/plugins are loaded in alphabetical order.
40
- # :all can be used as a placeholder for all plugins not explicitly named
41
- # Loading gem plugins that other plugins may rely on first.
42
- config.plugins = [ :friendly_id, :will_paginate, :aasm, :all ]
43
-
44
- # Add additional load paths for your own custom dirs
45
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
46
-
47
- # Force all environments to use the same logger level
48
- # (by default production uses :info, the others :debug)
49
- # config.log_level = :debug
50
-
51
- # Your secret key for verifying cookie session data integrity.
52
- # If you change this key, all old sessions will become invalid!
53
- # Make sure the secret is at least 30 characters and all random,
54
- # no regular words or you'll be exposed to dictionary attacks.
55
- config.action_controller.session = {
56
- :session_key => '_refinery_session',
57
- :secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
58
- }
59
-
60
- # Use the database for sessions instead of the cookie-based default,
61
- # which shouldn't be used to store highly confidential information
62
- # (create the session table with 'rake db:sessions:create')
63
- # config.action_controller.session_store = :active_record_store
64
-
65
- # Use SQL instead of Active Record's schema dumper when creating the test database.
66
- # This is necessary if your schema can't be completely dumped by the schema dumper,
67
- # like if you have constraints or database-specific column types
68
- # config.active_record.schema_format = :sql
69
-
70
- # Activate observers that should always be running
71
- # config.active_record.observers = :cacher, :garbage_collector
72
-
73
- # Make Active Record use UTC-base instead of local time
74
- # config.active_record.default_timezone = :utc
75
- #
76
-
77
- #===REFINERY REQUIRED GEMS===
78
- config.gem "bundler", :version => ">= 0.9.4"
79
- config.gem "rake", :version => ">= 0.8.3", :lib => "rake"
80
- config.gem "friendly_id", :version => ">= 2.3.2", :lib => "friendly_id"
81
- config.gem "will_paginate", :version => ">= 2.3.11", :lib => "will_paginate"
82
- config.gem "rails", :version => ">= 2.3.5", :lib => "rails"
83
- config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm"
84
- config.gem "slim_scrooge", :version => ">= 1.0.5", :lib => "slim_scrooge"
85
- config.gem "hpricot", :version => ">= 0.8.1", :lib => "hpricot"
86
- #===REFINERY END OF REQUIRED GEMS===
87
- end
1
+ # Specifies gem version of Rails to use when vendor/rails is not present
2
+ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
3
+
4
+ # Specified gem version of Refinery to use when vendor/plugins/refinery/lib/refinery.rb is not present.
5
+ REFINERY_GEM_VERSION = '0.9.6.15' unless defined? REFINERY_GEM_VERSION
6
+
7
+ # Boot Rails
8
+ require File.join(File.dirname(__FILE__), 'boot')
9
+
10
+ # Here we load in Refinery to do the rest of the heavy lifting.
11
+ # Refinery is setup in config/preinitializer.rb
12
+ require Refinery.root.join("lib", "refinery_initializer").cleanpath.to_s
13
+
14
+ # Boot with Refinery. Most configuration is handled by Refinery.
15
+ # Anything you specify here that Refinery specified internally will override Refinery.
16
+ Refinery::Initializer.run do |config|
17
+ # Settings in config/environments/* take precedence over those specified here.
18
+ # Application configuration should go into files in config/initializers
19
+ # -- all .rb files in that directory are automatically loaded.
20
+ # See Rails::Configuration for more options.
21
+
22
+ config.action_controller.session = {
23
+ :session_key => '_refinery_session',
24
+ :secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
25
+ }
26
+
27
+ # Specify your application's gem requirements here. See the example below:
28
+ # config.gem "refinerycms-portfolio", :lib => "portfolio", :version => "~> 0.9.3.7"
88
29
  end