aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-07-12 22:30:11 -0300
committerJosé Valim <jose.valim@gmail.com>2011-07-12 22:30:17 -0300
commit8f0e0b63f526967fc13c78eedb5c3a28a8f6ee75 (patch)
tree02047e886c85d74e9404c8ac5ed508f9f7b7792b /railties
parent8cf45150dec7f30009d006e52c646acf6b615f89 (diff)
downloadrails-8f0e0b63f526967fc13c78eedb5c3a28a8f6ee75.tar.gz
rails-8f0e0b63f526967fc13c78eedb5c3a28a8f6ee75.tar.bz2
rails-8f0e0b63f526967fc13c78eedb5c3a28a8f6ee75.zip
assets.cache_store now defaults to filesystem. You will want to share tmp/assets_cache between deploys.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application/configuration.rb13
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb3
-rw-r--r--railties/lib/rails/tasks/tmp.rake3
-rw-r--r--railties/test/application/paths_test.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb1
5 files changed, 7 insertions, 14 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index 1a29483a73..82caad580d 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -30,6 +30,7 @@ module Rails
@log_level = nil
@middleware = app_middleware
@generators = app_generators
+ @cache_store = [ :file_store, "#{root}/tmp/cache/" ]
@assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false
@@ -37,6 +38,7 @@ module Rails
@assets.precompile = [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
@assets.prefix = "/assets"
+ @assets.cache_store = [ :file_store, "#{root}/tmp/assets_cache/" ]
@assets.js_compressor = nil
@assets.css_compressor = nil
end
@@ -70,7 +72,6 @@ module Rails
paths.add "public/javascripts"
paths.add "public/stylesheets"
paths.add "tmp"
- paths.add "tmp/cache"
paths
end
end
@@ -95,16 +96,6 @@ module Rails
YAML::load(ERB.new(IO.read(paths["config/database"].first)).result)
end
- def cache_store
- @cache_store ||= begin
- if File.exist?("#{root}/tmp/cache/")
- [ :file_store, "#{root}/tmp/cache/" ]
- else
- :memory_store
- end
- end
- end
-
def log_level
@log_level ||= Rails.env.production? ? :info : :debug
end
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 6af9d299aa..72086d5e66 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -117,7 +117,8 @@ module Rails
end
def tmp
- empty_directory_with_gitkeep "tmp/cache"
+ empty_directory "tmp/cache"
+ empty_directory "tmp/assets_cache"
end
def vendor
diff --git a/railties/lib/rails/tasks/tmp.rake b/railties/lib/rails/tasks/tmp.rake
index 3ee5452475..fd972d5aed 100644
--- a/railties/lib/rails/tasks/tmp.rake
+++ b/railties/lib/rails/tasks/tmp.rake
@@ -4,7 +4,7 @@ namespace :tmp do
desc "Creates tmp directories for sessions, cache, sockets, and pids"
task :create do
- FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids ))
+ FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids tmp/assets_cache ))
end
namespace :sessions do
@@ -18,6 +18,7 @@ namespace :tmp do
# desc "Clears all files and directories in tmp/cache"
task :clear do
FileUtils.rm_rf(Dir['tmp/cache/[^.]*'])
+ FileUtils.rm_rf(Dir['tmp/assets_cache/[^.]*'])
end
end
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 0d22d8c19a..964cff48cd 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -48,7 +48,6 @@ module ApplicationTests
assert_path @paths["vendor"], "vendor"
assert_path @paths["vendor/plugins"], "vendor/plugins"
assert_path @paths["tmp"], "tmp"
- assert_path @paths["tmp/cache"], "tmp/cache"
assert_path @paths["config"], "config"
assert_path @paths["config/locales"], "config/locales/en.yml"
assert_path @paths["config/environment"], "config/environment.rb"
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 81f0bf5e82..d1b8f123a0 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -34,6 +34,7 @@ DEFAULT_APP_FILES = %w(
vendor
vendor/assets
vendor/plugins
+ tmp/assets_cache
tmp/cache
)