aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r--railties/lib/tasks/annotations.rake19
-rw-r--r--railties/lib/tasks/testing.rake14
2 files changed, 18 insertions, 15 deletions
diff --git a/railties/lib/tasks/annotations.rake b/railties/lib/tasks/annotations.rake
index ea6046670f..48ac40099a 100644
--- a/railties/lib/tasks/annotations.rake
+++ b/railties/lib/tasks/annotations.rake
@@ -6,18 +6,15 @@ task :notes do
end
namespace :notes do
- desc "Enumerate all OPTIMIZE annotations"
- task :optimize do
- SourceAnnotationExtractor.enumerate "OPTIMIZE"
+ ["OPTIMIZE", "FIXME", "TODO"].each do |annotation|
+ desc "Enumerate all #{annotation} annotations"
+ task annotation.downcase.intern do
+ SourceAnnotationExtractor.enumerate annotation
+ end
end
- desc "Enumerate all FIXME annotations"
- task :fixme do
- SourceAnnotationExtractor.enumerate "FIXME"
- end
-
- desc "Enumerate all TODO annotations"
- task :todo do
- SourceAnnotationExtractor.enumerate "TODO"
+ desc "Enumerate a custom annotation, specify with ANNOTATION=WTFHAX"
+ task :custom do
+ SourceAnnotationExtractor.enumerate ENV['ANNOTATION']
end
end \ No newline at end of file
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"