refinerycms 0.9.5.24 → 0.9.5.25

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/Rakefile CHANGED
@@ -1,7 +1,13 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require(File.join(File.dirname(__FILE__), 'config', 'boot'))
4
+ begin
5
+ # Load up the environment instead of just the boot file because we want all of the tasks available.
6
+ require(File.join(File.dirname(__FILE__), 'config', 'environment'))
7
+ rescue
8
+ # Load up the boot file instead because there's something wrong with the environment.
9
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
10
+ end
5
11
 
6
12
  require 'rake'
7
13
  require 'rake/testtask'
@@ -9,11 +15,18 @@ require 'rake/rdoctask'
9
15
 
10
16
  require 'tasks/rails'
11
17
 
18
+ # When running Refinery from a gem we lose the rake tasks, so add them back in:
12
19
  unless REFINERY_ROOT == RAILS_ROOT
13
- # Load any custom rakefile extensions (for the gem only)
14
20
  Dir[File.join(REFINERY_ROOT, %w(vendor plugins * ** tasks ** *.rake))].sort.each { |ext| load ext }
15
21
  end
16
22
 
23
+ # We also need to load in the rake tasks from gem plugins whether Refinery is a gem or not:
24
+ if defined?($refinery_gem_plugin_lib_paths) && !$refinery_gem_plugin_lib_paths.nil?
25
+ $refinery_gem_plugin_lib_paths.each do |path|
26
+ Dir[File.join(path, %w(tasks ** *.rake))].sort.each { |ext| load ext }
27
+ end
28
+ end
29
+
17
30
  desc 'Removes trailing whitespace'
18
31
  task :whitespace do
19
32
  sh %{find . -name '*.*rb' -exec sed -i '' 's/\t/ /g' {} \\; -exec sed -i '' 's/ *$//g' {} \\; }
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5.24
1
+ 0.9.5.25
@@ -17,6 +17,9 @@ unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
17
17
  # copy in any new migrations.
18
18
  FileUtils::cp Dir[File.join(REFINERY_ROOT, %w(db migrate *.rb))], File.join(RAILS_ROOT, %w(db migrate))
19
19
 
20
+ # replace rakefile.
21
+ FileUtils::cp File.join(REFINERY_ROOT, %w(Rakefile)), File.join(RAILS_ROOT, %w(Rakefile))
22
+
20
23
  # read in the config files
21
24
  app_config = File.open(File.join(RAILS_ROOT, %w(config environment.rb)), "r").read
22
25
  environment_updated = false
@@ -13,15 +13,17 @@ module Refinery
13
13
  end
14
14
  end
15
15
  if defined? Rails::Plugin::Loader
16
- class GemedPluginLoader < Rails::Plugin::Loader
16
+ class PluginLoader < Rails::Plugin::Loader
17
17
  def add_plugin_load_paths
18
18
  super
19
- # add plugin lib paths to the $LOAD_PATH so that rake tasks etc. can be run when using a gem.
20
- plugins.each do |plugin|
21
- plugin.load_paths.reject { |path| path.scan(/refinerycms.+?vendor\/plugins\/.+?\/lib/).empty? }.each do |path|
22
- $LOAD_PATH.unshift path
23
- end
19
+ # 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.
20
+ search_for = Regexp.new(File.join('(', REFINERY_ROOT, %w(vendor plugins \)? .+? lib)))
21
+ paths = plugins.collect{ |plugin| plugin.load_paths }.flatten.reject{|path| path.scan(search_for).empty? or path.include?('/rails-') }
22
+ paths = paths.reject{ |path| path.include?(REFINERY_ROOT) } if REFINERY_ROOT == RAILS_ROOT # superfluous when not in gem.
23
+ ($refinery_gem_plugin_lib_paths = paths).each do |path|
24
+ $LOAD_PATH.unshift path
24
25
  end
26
+ $LOAD_PATH.uniq!
25
27
  end
26
28
  end
27
29
  end
@@ -30,7 +32,7 @@ module Refinery
30
32
  def self.run(command = :process, configuration = Configuration.new)
31
33
  Rails.configuration = configuration
32
34
  configuration.reload_plugins = true if RAILS_ENV =~ /development/ and REFINERY_ROOT == RAILS_ROOT # seems to work, don't in gem.
33
- configuration.plugin_loader = Refinery::GemedPluginLoader unless REFINERY_ROOT == RAILS_ROOT # only do this in a gem.
35
+ configuration.plugin_loader = Refinery::PluginLoader
34
36
  super
35
37
  end
36
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.24
4
+ version: 0.9.5.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-12-09 00:00:00 +13:00
14
+ date: 2009-12-10 00:00:00 +13:00
15
15
  default_executable:
16
16
  dependencies: []
17
17