aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-03-14 23:02:25 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-03-15 10:16:51 +0100
commitd54de0808c05c3f7c70dee8ab0111a94c8f90d00 (patch)
tree624ea3490e2ae86c0694e9373ae014b6e726baee /railties/lib/rails/commands
parent4fb5a92983bb0b88442b33757bb1e2cdfc49ef00 (diff)
downloadrails-d54de0808c05c3f7c70dee8ab0111a94c8f90d00.tar.gz
rails-d54de0808c05c3f7c70dee8ab0111a94c8f90d00.tar.bz2
rails-d54de0808c05c3f7c70dee8ab0111a94c8f90d00.zip
Share dev caching implementation between task and server.
Lets have the server and the Rake task go through the same ropes, so we can share all the file lookup, adding, and deleting code.
Diffstat (limited to 'railties/lib/rails/commands')
-rw-r--r--railties/lib/rails/commands/server.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index d7597a13e1..4e5bf34773 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -2,6 +2,7 @@ require 'fileutils'
require 'optparse'
require 'action_dispatch'
require 'rails'
+require 'rails/dev_caching'
module Rails
class Server < ::Rack::Server
@@ -100,12 +101,8 @@ module Rails
private
def setup_dev_caching
- return unless options[:environment] == "development"
-
- if options[:caching] == false
- delete_cache_file
- elsif options[:caching]
- create_cache_file
+ if options[:environment] == "development"
+ Rails::DevCaching.enable_by_argument(options[:caching])
end
end
@@ -116,14 +113,6 @@ module Rails
puts "=> Run `rails server -h` for more startup options"
end
- def create_cache_file
- FileUtils.touch("tmp/caching-dev.txt")
- end
-
- def delete_cache_file
- FileUtils.rm("tmp/caching-dev.txt") if File.exist?("tmp/caching-dev.txt")
- end
-
def create_tmp_directories
%w(cache pids sockets).each do |dir_to_make|
FileUtils.mkdir_p(File.join(Rails.root, 'tmp', dir_to_make))