refinerycms 0.9.6.13 → 0.9.6.14
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.
- data/Gemfile +1 -1
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/bin/refinery-update-core +1 -1
- data/config/application.rb +8 -9
- data/config/preinitializer.rb +2 -6
- data/lib/refinery_initializer.rb +9 -9
- data/readme.md +1 -1
- data/vendor/plugins/refinery/lib/refinery.rb +3 -0
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +58 -26
- metadata +2 -2
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#===REFINERY REQUIRED GEMS===
|
4
4
|
source "http://rubygems.org"
|
5
5
|
gem "aasm", ">= 2.1.3", :require => "aasm"
|
6
|
-
gem "friendly_id", ">= 2.
|
6
|
+
gem "friendly_id", ">= 2.3.2", :require => "friendly_id"
|
7
7
|
gem "hpricot", ">= 0.8.1", :require => "hpricot"
|
8
8
|
gem "slim_scrooge", ">= 1.0.5", :require => "slim_scrooge"
|
9
9
|
gem "will_paginate", ">= 2.3.11", :require => "will_paginate"
|
data/Rakefile
CHANGED
@@ -6,9 +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
|
11
|
-
puts "\n*** So, we'll attempt to load in config/boot instead... ***"
|
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... ***"
|
12
11
|
|
13
12
|
# Load up the boot file instead because there's something wrong with the environment.
|
14
13
|
require File.join(File.dirname(__FILE__), 'config', 'boot')
|
@@ -23,12 +22,12 @@ require 'tasks/rails'
|
|
23
22
|
# Because we use plugins that are shipped via gems, we lose their rake tasks.
|
24
23
|
# So here, we find them (if there are any) and include them into rake.
|
25
24
|
extra_rake_tasks = []
|
26
|
-
if Refinery.is_a_gem
|
25
|
+
if defined?(Refinery) && Refinery.is_a_gem
|
27
26
|
extra_rake_tasks << Dir[Refinery.root.join("vendor", "plugins", "*", "**", "tasks", "**", "*", "*.rake")].sort
|
28
27
|
end
|
29
28
|
|
30
29
|
# We also need to load in the rake tasks from gem plugins whether Refinery is a gem or not:
|
31
|
-
if
|
30
|
+
if $refinery_gem_plugin_lib_paths.present?
|
32
31
|
extra_rake_tasks << $refinery_gem_plugin_lib_paths.collect {|path| Dir[File.join(%W(#{path} tasks ** *.rake))].sort}
|
33
32
|
end
|
34
33
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.6.
|
1
|
+
0.9.6.14
|
data/bin/refinery-update-core
CHANGED
@@ -9,7 +9,7 @@ unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
|
|
9
9
|
FileUtils::makedirs dirs.map {|dir| File.join(RAILS_ROOT, dir) }
|
10
10
|
|
11
11
|
# copy in the new assets.
|
12
|
-
assets = [%w(public stylesheets refinery), %w(public javascripts refinery), %w(public javascripts wymeditor)]
|
12
|
+
assets = [%w(public stylesheets refinery), %w(public javascripts refinery), %w(public javascripts wymeditor), %w(VERSION)]
|
13
13
|
assets.each do |asset|
|
14
14
|
FileUtils::rm_rf File.join(RAILS_ROOT, asset), :secure => true # ensure the destination is clear.
|
15
15
|
FileUtils::cp_r File.join(REFINERY_ROOT, asset), File.join(RAILS_ROOT, asset) # copy the new assets into the project.
|
data/config/application.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
if defined?(Rails::Application)
|
1
|
+
if defined?(Rails::Application) # e.g. Rails 3
|
2
2
|
module Refinery
|
3
3
|
class Application < Rails::Application
|
4
4
|
config.action_controller.session = {
|
@@ -8,7 +8,7 @@ if defined?(Rails::Application)
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def gem_version
|
11
|
-
#0.9.6
|
11
|
+
#"0.9.6.14"
|
12
12
|
end
|
13
13
|
end
|
14
14
|
else
|
@@ -21,21 +21,20 @@ else
|
|
21
21
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
22
22
|
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
23
23
|
# Freeze to a specific version of refinerycms when running as a gem
|
24
|
-
# REFINERY_GEM_VERSION = '0.9.6.
|
24
|
+
# REFINERY_GEM_VERSION = '0.9.6.14' unless defined? REFINERY_GEM_VERSION
|
25
25
|
|
26
26
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
27
27
|
require File.join(File.dirname(__FILE__), 'boot')
|
28
28
|
|
29
|
-
|
29
|
+
# require the refinery initializer.
|
30
|
+
require Refinery.root.join("lib", "refinery_initializer").to_s
|
31
|
+
|
32
|
+
Refinery::Initializer.run do |config|
|
30
33
|
# Settings in config/environments/* take precedence over those specified here.
|
31
34
|
# Application configuration should go into files in config/initializers
|
32
35
|
# -- all .rb files in that directory are automatically loaded.
|
33
36
|
# See Rails::Configuration for more options.
|
34
37
|
|
35
|
-
# Skip frameworks you're not going to use (only works if using vendor/rails).
|
36
|
-
# To use Rails without a database, you must remove the Active Record framework
|
37
|
-
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
38
|
-
|
39
38
|
# Only load the plugins named here, in the order given. By default, all plugins
|
40
39
|
# in vendor/plugins are loaded in alphabetical order.
|
41
40
|
# :all can be used as a placeholder for all plugins not explicitly named
|
@@ -78,7 +77,7 @@ else
|
|
78
77
|
#===REFINERY REQUIRED GEMS===
|
79
78
|
config.gem "bundler", :version => ">= 0.9.4"
|
80
79
|
config.gem "rake", :version => ">= 0.8.3", :lib => "rake"
|
81
|
-
config.gem "friendly_id", :version => ">= 2.
|
80
|
+
config.gem "friendly_id", :version => ">= 2.3.2", :lib => "friendly_id"
|
82
81
|
config.gem "will_paginate", :version => ">= 2.3.11", :lib => "will_paginate"
|
83
82
|
config.gem "rails", :version => ">= 2.3.5", :lib => "rails"
|
84
83
|
config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm"
|
data/config/preinitializer.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
|
3
|
-
# until Rails 3
|
4
|
-
# ENV["GEM_HOME"] = File.expand_path('../../vendor/bundler_gems', __FILE__)
|
5
|
-
|
6
2
|
# pick the refinery root path
|
7
3
|
rails_root = (defined?(Rails.root) ? Rails.root : Pathname.new(RAILS_ROOT)).cleanpath
|
8
|
-
if (non_gem_path = rails_root.join("lib", "
|
9
|
-
require non_gem_path.to_s
|
4
|
+
if (non_gem_path = rails_root.join("vendor", "plugins", "refinery", "lib", "refinery.rb")).exist?
|
5
|
+
require non_gem_path.realpath.to_s
|
10
6
|
else
|
11
7
|
require 'rubygems'
|
12
8
|
version = if defined? REFINERY_GEM_VERSION
|
data/lib/refinery_initializer.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
root_directory = Pathname.new(File.expand_path(File.dirname(__FILE__) << "/.."))
|
3
|
-
rails_root = ((defined?(Rails.root) && Rails.root.realpath.length > 0) ? Rails.root : Pathname.new(RAILS_ROOT))
|
3
|
+
rails_root = ((defined?(Rails.root) && Rails.root.realpath.to_s.length > 0) ? Rails.root : Pathname.new(RAILS_ROOT))
|
4
4
|
|
5
5
|
if (non_gem_refinery = rails_root.join("vendor", "plugins", "refinery", "lib", "refinery.rb")).exist?
|
6
6
|
require non_gem_refinery.realpath.to_s # this won't exist when using a gem.
|
7
|
+
Refinery.is_a_gem = false
|
7
8
|
else
|
8
|
-
require root_directory.join("vendor", "plugins", "refinery", "lib", "refinery
|
9
|
+
require root_directory.join("vendor", "plugins", "refinery", "lib", "refinery").realpath.to_s
|
10
|
+
Refinery.is_a_gem = true
|
9
11
|
end
|
10
12
|
|
11
13
|
# Now we need to set some things that are used by the rest of the application.
|
12
14
|
Refinery.root = root_directory.cleanpath
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
$LOAD_PATH.unshift Refinery.root.join("vendor", "plugins", "refinery", "lib").to_s
|
15
|
+
$LOAD_PATH.unshift Refinery.root.join("vendor", "plugins").to_s
|
16
|
+
$LOAD_PATH.unshift Refinery.root.join("vendor", "plugins", "refinery", "lib").to_s
|
17
|
+
$LOAD_PATH.uniq!
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
19
|
+
# We also need the other refinery initializer.
|
20
|
+
require 'refinery/initializer'
|
21
21
|
|
22
22
|
# Pull in attachment_fu patch for windows
|
23
23
|
require 'refinery/attachment_fu_patch' if RUBY_PLATFORM =~ /mswin/
|
data/readme.md
CHANGED
@@ -30,7 +30,7 @@ Unlike other content managers, Refinery is truly aimed at the end user making it
|
|
30
30
|
Refinery runs using a number of gems which (as of Refinery version 0.9.5.29) are outlined below:
|
31
31
|
|
32
32
|
* [rake >= 0.8.3](http://rubygems.org/gems/rake)
|
33
|
-
* [friendly_id >= 2.
|
33
|
+
* [friendly_id >= 2.3.2](http://rubygems.org/gems/friendly_id)
|
34
34
|
* [will_paginate >= 2.3.11](http://rubygems.org/gems/will_paginate)
|
35
35
|
* [rails >= 2.3.5](http://rubygems.org/gems/rails)
|
36
36
|
* [aasm >= 2.1.3](http://rubygems.org/gems/aasm)
|
@@ -1,6 +1,6 @@
|
|
1
|
+
# Try to include the rails initializer. If this isn't in a gem, this will fail.
|
1
2
|
if Refinery.is_a_gem
|
2
3
|
begin
|
3
|
-
# Try to include the rails initializer. If this isn't in a gem, this will fail.
|
4
4
|
require 'initializer'
|
5
5
|
rescue LoadError => load_error
|
6
6
|
# we don't need to do anything.
|
@@ -10,39 +10,71 @@ end
|
|
10
10
|
|
11
11
|
module Refinery
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
class Configuration < Rails::Configuration
|
14
|
+
def default_plugin_paths
|
15
|
+
paths = super.push(Refinery.root.join("vendor", "plugins").to_s).uniq
|
16
|
+
end
|
17
|
+
end if defined?(Rails::Configuration)
|
18
|
+
|
19
|
+
class PluginLoader < Rails::Plugin::Loader
|
20
|
+
def add_plugin_load_paths
|
21
|
+
# call rails' add_plugin_load_paths
|
22
|
+
super
|
23
|
+
|
24
|
+
# add plugin lib paths to the $LOAD_PATH so that rake tasks etc. can be run when using a gem for refinery or gems for plugins.
|
25
|
+
search_for = Regexp.new(File.join(%W(\( #{Refinery.root.join("vendor", "plugins")} \)? .+? lib)))
|
26
|
+
paths = plugins.collect{ |plugin| plugin.load_paths }.flatten.reject{|path| path.scan(search_for).empty? or path.include?('/rails-') }
|
27
|
+
paths = paths.reject{ |path| path.include?(Refinery.root.to_s) } unless Refinery.is_a_gem
|
28
|
+
paths.uniq!
|
29
|
+
($refinery_gem_plugin_lib_paths = paths).each do |path|
|
30
|
+
$LOAD_PATH.unshift path
|
17
31
|
end
|
32
|
+
$LOAD_PATH.uniq!
|
18
33
|
end
|
19
|
-
end
|
20
34
|
|
21
|
-
|
22
|
-
|
23
|
-
|
35
|
+
# We need to overload this because some gems raise errors if they're not installed
|
36
|
+
# rather than just letting the framework handle it so we need to trap them here.
|
37
|
+
def ensure_all_registered_plugins_are_loaded!
|
38
|
+
begin
|
24
39
|
super
|
25
|
-
|
26
|
-
|
27
|
-
paths = plugins.collect{ |plugin| plugin.load_paths }.flatten.reject{|path| path.scan(search_for).empty? or path.include?('/rails-') }
|
28
|
-
paths = paths.reject{ |path| path.include?(Refinery.root.to_s) } unless Refinery.is_a_gem
|
29
|
-
paths.uniq!
|
30
|
-
($refinery_gem_plugin_lib_paths = paths).each do |path|
|
31
|
-
$LOAD_PATH.unshift path
|
32
|
-
end
|
33
|
-
$LOAD_PATH.uniq!
|
40
|
+
rescue LoadError => load_error
|
41
|
+
raise LoadError, load_error.to_s unless load_error.to_s =~ /friendly_id|aasm|will_paginate/
|
34
42
|
end
|
35
43
|
end
|
36
|
-
end
|
44
|
+
end if defined?(Rails::Plugin::Loader)
|
37
45
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
class Initializer < Rails::Initializer
|
47
|
+
def self.run(command = :process, configuration = Configuration.new)
|
48
|
+
configuration.plugin_loader = Refinery::PluginLoader
|
49
|
+
Rails.configuration = configuration
|
50
|
+
|
51
|
+
# call rails' run
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
55
|
+
def load_plugins
|
56
|
+
# inject all gems that manipulate ActiveRecord::Base into the application
|
57
|
+
# and stub any calls that are dangerous.
|
58
|
+
::ActiveRecord::Base.module_eval do
|
59
|
+
begin
|
60
|
+
require 'friendly_id'
|
61
|
+
require 'will_paginate'
|
62
|
+
require 'aasm'
|
63
|
+
rescue LoadError => load_error
|
64
|
+
# this will stop us running rake gems:install which we don't really want so just trap this error.
|
65
|
+
puts "*** Trapping error caused by missing gems ***"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Stub has_friendly_id. This will get overriden when/if included.
|
69
|
+
# The config will still complain that the gem is missing but this allows it to do so.
|
70
|
+
def self.has_friendly_id(column, options = {}, &block)
|
71
|
+
super if defined? super and table_exists?
|
72
|
+
end
|
44
73
|
end
|
74
|
+
|
75
|
+
# call rails' load_plugins
|
76
|
+
super
|
45
77
|
end
|
46
|
-
end
|
78
|
+
end if defined?(Rails::Initializer)
|
47
79
|
|
48
80
|
end
|