aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorrobertomiranda <rjmaltamar@gmail.com>2014-03-14 15:34:24 -0500
committerrobertomiranda <rjmaltamar@gmail.com>2014-03-14 17:39:04 -0500
commit810af6f6ee62d76e9ed529d93ea9686a45e5a81e (patch)
tree43aae4c06abf8fd52c3652b0308e0e117808179c /railties
parenta2fb164a4fadf0f34055089b75ef9077bded8524 (diff)
downloadrails-810af6f6ee62d76e9ed529d93ea9686a45e5a81e.tar.gz
rails-810af6f6ee62d76e9ed529d93ea9686a45e5a81e.tar.bz2
rails-810af6f6ee62d76e9ed529d93ea9686a45e5a81e.zip
Remove .scss, .sass, .less, .haml, .slim, coffee from Rake Notes. Now we have an API for register it in the corresponding gems
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/source_annotation_extractor.rb6
-rw-r--r--railties/test/application/rake/notes_test.rb16
2 files changed, 5 insertions, 17 deletions
diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb
index 5863ad1ed7..b5f1ca1602 100644
--- a/railties/lib/rails/source_annotation_extractor.rb
+++ b/railties/lib/rails/source_annotation_extractor.rb
@@ -28,11 +28,9 @@ class SourceAnnotationExtractor
self.extensions[/\.(#{extensions.join("|")})$/] = block
end
- register_extensions("builder", "rb", "coffe", "rake") { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
- register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
+ register_extensions("builder", "rb", "rake") { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
+ register_extensions("css", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
register_extensions("erb") { |tag| /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/ }
- register_extensions("haml") { |tag| /-\s*#\s*(#{tag}):?\s*(.*)$/ }
- register_extensions("slim") { |tag| /\/\s*\s*(#{tag}):?\s*(.*)$/ }
# Returns a representation of the annotation that looks like this:
#
diff --git a/railties/test/application/rake/notes_test.rb b/railties/test/application/rake/notes_test.rb
index 62ab28082d..2191de32af 100644
--- a/railties/test/application/rake/notes_test.rb
+++ b/railties/test/application/rake/notes_test.rb
@@ -1,4 +1,5 @@
require "isolation/abstract_unit"
+require 'rails/source_annotation_extractor'
module ApplicationTests
module RakeTests
@@ -18,14 +19,8 @@ module ApplicationTests
test 'notes finds notes for certain file_types' do
app_file "app/views/home/index.html.erb", "<% # TODO: note in erb %>"
- app_file "app/views/home/index.html.haml", "-# TODO: note in haml"
- app_file "app/views/home/index.html.slim", "/ TODO: note in slim"
- app_file "app/assets/javascripts/application.js.coffee", "# TODO: note in coffee"
app_file "app/assets/javascripts/application.js", "// TODO: note in js"
app_file "app/assets/stylesheets/application.css", "// TODO: note in css"
- app_file "app/assets/stylesheets/application.css.scss", "// TODO: note in scss"
- app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass"
- app_file "app/assets/stylesheets/application.css.less", "// TODO: note in less"
app_file "app/controllers/application_controller.rb", 1000.times.map { "" }.join("\n") << "# TODO: note in ruby"
app_file "lib/tasks/task.rake", "# TODO: note in rake"
app_file 'app/views/home/index.html.builder', '# TODO: note in builder'
@@ -42,19 +37,13 @@ module ApplicationTests
lines = output.scan(/\[([0-9\s]+)\](\s)/)
assert_match(/note in erb/, output)
- assert_match(/note in haml/, output)
- assert_match(/note in slim/, output)
assert_match(/note in ruby/, output)
- assert_match(/note in coffee/, output)
assert_match(/note in js/, output)
assert_match(/note in css/, output)
- assert_match(/note in scss/, output)
- assert_match(/note in sass/, output)
- assert_match(/note in less/, output)
assert_match(/note in rake/, output)
assert_match(/note in builder/, output)
- assert_equal 12, lines.size
+ assert_equal 6, lines.size
lines.each do |line|
assert_equal 4, line[0].size
@@ -178,6 +167,7 @@ module ApplicationTests
test 'register a new extension' do
SourceAnnotationExtractor::Annotation.register_extensions(".test1", ".test2") { |tag| /#{tag}/ }
assert SourceAnnotationExtractor::Annotation.extensions[/(\.test1|\.test2)/]
+ assert_blank SourceAnnotationExtractor::Annotation.extensions[/(\.haml)/]
end
private