aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorTim Pope <code@tpope.net>2008-04-19 00:42:26 -0500
committerPratik Naik <pratiknaik@gmail.com>2008-07-02 05:21:59 +0100
commit3a95ee73cfbcfeada3b053c5b0fb7b5125ef12c7 (patch)
treea026710a94e8d7ea77abdfb04ee68e5bfd85834b /railties
parentf5052dd8a39099e4930faafe9b01e63ced2f6391 (diff)
downloadrails-3a95ee73cfbcfeada3b053c5b0fb7b5125ef12c7.tar.gz
rails-3a95ee73cfbcfeada3b053c5b0fb7b5125ef12c7.tar.bz2
rails-3a95ee73cfbcfeada3b053c5b0fb7b5125ef12c7.zip
Make rake test:uncommitted work with Git.
Note : rake test:uncommitted is considering only unstaged files. Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/tasks/testing.rake14
2 files changed, 12 insertions, 4 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index a37dc6c0eb..c18d5ac9b2 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Make rake test:uncommitted work with Git. [Tim Pope]
+
* Added Thin support to script/server. #488 [Bob Klosinski]
* Fix script/about in production mode. #370 [Cheah Chu Yeow, Xavier Noria, David Krmpotic]
diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake
index c8ba6eed94..328bde7442 100644
--- a/railties/lib/tasks/testing.rake
+++ b/railties/lib/tasks/testing.rake
@@ -66,10 +66,16 @@ namespace :test do
Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t|
def t.file_list
- changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
+ if File.directory?(".svn")
+ changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
+ elsif File.directory?(".git")
+ changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.map { |path| path.chomp }
+ else
+ abort "Not a Subversion or Git checkout."
+ end
- models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb/ }
- controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb/ }
+ models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ }
+ controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ }
unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" }
functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" }
@@ -80,7 +86,7 @@ namespace :test do
t.libs << 'test'
t.verbose = true
end
- Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion)"
+ Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)"
Rake::TestTask.new(:units => "db:test:prepare") do |t|
t.libs << "test"