aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-08 15:21:40 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-08 15:21:40 +0100
commit3b693dfb9384d15fcd3bbaa5f47da69019b2bf51 (patch)
treed2f68dbf32dc42f937af2fa9ff4a453e7b443df2
parentd3150c81061ff4e6d052ac1ff2dcd62a1daca28f (diff)
parentba2aea98079fb50a2c210001deb16ab84fac3b41 (diff)
downloadrails-3b693dfb9384d15fcd3bbaa5f47da69019b2bf51.tar.gz
rails-3b693dfb9384d15fcd3bbaa5f47da69019b2bf51.tar.bz2
rails-3b693dfb9384d15fcd3bbaa5f47da69019b2bf51.zip
Merge pull request #23552 from bronson/revert-dev-cache
revert dev:cache to rake task, fixes #23410
-rw-r--r--railties/lib/rails/commands.rb1
-rw-r--r--railties/lib/rails/commands/dev_cache.rb21
-rw-r--r--railties/lib/rails/tasks.rb1
-rw-r--r--railties/lib/rails/tasks/dev.rake14
-rw-r--r--railties/test/application/rake/dev_test.rb34
-rw-r--r--railties/test/commands/dev_cache_test.rb32
6 files changed, 49 insertions, 54 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index 7627fcf5a0..fa47c52b96 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -14,6 +14,5 @@ command = ARGV.shift
command = aliases[command] || command
require 'rails/command'
-require 'rails/commands/dev_cache'
Rails::Command.run(command, ARGV)
diff --git a/railties/lib/rails/commands/dev_cache.rb b/railties/lib/rails/commands/dev_cache.rb
deleted file mode 100644
index ec96e8f630..0000000000
--- a/railties/lib/rails/commands/dev_cache.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'rails/command'
-
-module Rails
- module Commands
- # This is a wrapper around the Rails dev:cache command
- class DevCache < Command
- set_banner :dev_cache, 'Toggle development mode caching on/off'
- def dev_cache
- if File.exist? 'tmp/caching-dev.txt'
- File.delete 'tmp/caching-dev.txt'
- puts 'Development mode is no longer being cached.'
- else
- FileUtils.touch 'tmp/caching-dev.txt'
- puts 'Development mode is now being cached.'
- end
-
- FileUtils.touch 'tmp/restart.txt'
- end
- end
- end
-end
diff --git a/railties/lib/rails/tasks.rb b/railties/lib/rails/tasks.rb
index d60eaf6f4f..d3e33584d7 100644
--- a/railties/lib/rails/tasks.rb
+++ b/railties/lib/rails/tasks.rb
@@ -3,6 +3,7 @@ require 'rake'
# Load Rails Rakefile extensions
%w(
annotations
+ dev
framework
initializers
log
diff --git a/railties/lib/rails/tasks/dev.rake b/railties/lib/rails/tasks/dev.rake
new file mode 100644
index 0000000000..4593100465
--- /dev/null
+++ b/railties/lib/rails/tasks/dev.rake
@@ -0,0 +1,14 @@
+namespace :dev do
+ desc 'Toggle development mode caching on/off'
+ task :cache do
+ if File.exist? 'tmp/caching-dev.txt'
+ File.delete 'tmp/caching-dev.txt'
+ puts 'Development mode is no longer being cached.'
+ else
+ FileUtils.touch 'tmp/caching-dev.txt'
+ puts 'Development mode is now being cached.'
+ end
+
+ FileUtils.touch 'tmp/restart.txt'
+ end
+end
diff --git a/railties/test/application/rake/dev_test.rb b/railties/test/application/rake/dev_test.rb
new file mode 100644
index 0000000000..43d7a5e156
--- /dev/null
+++ b/railties/test/application/rake/dev_test.rb
@@ -0,0 +1,34 @@
+require 'isolation/abstract_unit'
+
+module ApplicationTests
+ module RakeTests
+ class RakeDevTest < ActiveSupport::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ end
+
+ def teardown
+ teardown_app
+ end
+
+ test 'dev:cache creates file and outputs message' do
+ Dir.chdir(app_path) do
+ output = `rake dev:cache`
+ assert File.exist?('tmp/caching-dev.txt')
+ assert_match(/Development mode is now being cached/, output)
+ end
+ end
+
+ test 'dev:cache deletes file and outputs message' do
+ Dir.chdir(app_path) do
+ `rails dev:cache` # Create caching file.
+ output = `rails dev:cache` # Delete caching file.
+ assert_not File.exist?('tmp/caching-dev.txt')
+ assert_match(/Development mode is no longer being cached/, output)
+ end
+ end
+ end
+ end
+end
diff --git a/railties/test/commands/dev_cache_test.rb b/railties/test/commands/dev_cache_test.rb
deleted file mode 100644
index 1b7a72e7fc..0000000000
--- a/railties/test/commands/dev_cache_test.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require_relative '../isolation/abstract_unit'
-
-module CommandsTests
- class DevCacheTest < ActiveSupport::TestCase
- include ActiveSupport::Testing::Isolation
-
- def setup
- build_app
- end
-
- def teardown
- teardown_app
- end
-
- test 'dev:cache creates file and outputs message' do
- Dir.chdir(app_path) do
- output = `rails dev:cache`
- assert File.exist?('tmp/caching-dev.txt')
- assert_match(%r{Development mode is now being cached}, output)
- end
- end
-
- test 'dev:cache deletes file and outputs message' do
- Dir.chdir(app_path) do
- `rails dev:cache` # Create caching file.
- output = `rails dev:cache` # Delete caching file.
- assert_not File.exist?('tmp/caching-dev.txt')
- assert_match(%r{Development mode is no longer being cached}, output)
- end
- end
- end
-end