Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed deprecated RAILS_ROOT to Rails.root.

  • Loading branch information...
commit f4d7c7e1c55e55cb05f61ec03476145ce099d36e 1 parent 8056fd0
@JoelJuliano-duplicate JoelJuliano-duplicate authored
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/bundle_fu.rb
View
32 lib/bundle_fu.rb
@@ -12,7 +12,7 @@ def bundle_files(filenames=[])
output << "/* --------- #{filename} --------- */ "
output << "\n"
begin
- content = (File.read(File.join(RAILS_ROOT, "public", filename)))
+ content = (File.read(File.join(Rails.root, "public", filename)))
rescue
output << "/* FILE READ ERROR! */"
next
@@ -80,7 +80,7 @@ def bundle(options={}, &block)
content_changed = false
new_files = nil
- abs_filelist_paths = [:css, :js].inject({}) { | hash, filetype | hash[filetype] = File.join(RAILS_ROOT, "public", paths[filetype], "#{options[:name]}.#{filetype}.filelist"); hash }
+ abs_filelist_paths = [:css, :js].inject({}) { | hash, filetype | hash[filetype] = File.join(Rails.root, "public", paths[filetype], "#{options[:name]}.#{filetype}.filelist"); hash }
# only rescan file list if content_changed, or if a filelist cache file is missing
unless content == BundleFu.content_store[options[:name]] && File.exists?(abs_filelist_paths[:css]) && File.exists?(abs_filelist_paths[:js])
@@ -99,7 +99,7 @@ def bundle(options={}, &block)
[:css, :js].each { |filetype|
output_filename = File.join(paths[filetype], "#{options[:name]}.#{filetype}")
- abs_path = File.join(RAILS_ROOT, "public", output_filename)
+ abs_path = File.join(Rails.root, "public", output_filename)
abs_filelist_path = abs_filelist_paths[filetype]
filelist = FileList.open( abs_filelist_path )
@@ -108,7 +108,7 @@ def bundle(options={}, &block)
new_filelist = new_files ? BundleFu::FileList.new(new_files[filetype]) : filelist.clone.update_mtimes
unless new_filelist == filelist
- FileUtils.mkdir_p(File.join(RAILS_ROOT, "public", paths[filetype]))
+ FileUtils.mkdir_p(File.join(Rails.root, "public", paths[filetype]))
# regenerate everything
if new_filelist.filenames.empty?
# delete the javascript/css bundle file if it's empty, but keep the filelist cache
@@ -121,26 +121,26 @@ def bundle(options={}, &block)
new_filelist.save_as(abs_filelist_path)
end
- if File.exists?(abs_path) && options[:bundle_fu]
- tag = filetype==:css ? stylesheet_link_tag(output_filename) : javascript_include_tag(output_filename)
+ if File.exists?(abs_path) && options[:bundle_fu]
+ tag = filetype==:css ? stylesheet_link_tag(output_filename) : javascript_include_tag(output_filename)
if Rails::version < "2.2.0"
- concat( tag , block.binding)
- else
- #concat doesn't need block.binding in Rails >= 2.2.0
- concat( tag )
+ concat( tag , block.binding)
+ else
+ #concat doesn't need block.binding in Rails >= 2.2.0
+ concat( tag )
end
end
}
- unless options[:bundle_fu]
+ unless options[:bundle_fu]
if Rails::version < "2.2.0"
- concat( content, block.binding )
- else
- #concat doesn't need block.binding in Rails >= 2.2.0
- concat( content )
+ concat( content, block.binding )
+ else
+ #concat doesn't need block.binding in Rails >= 2.2.0
+ concat( content )
end
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.