aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/source_annotation_extractor.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move the deprecation call after the new class has been defined:Edouard CHIN2019-07-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | - If we create the deprecation before the new class is defined this creates an issue in case you use a `TracePoint`. The `Tracepoint#return_value` will try to get the new class constant resulting in a uninitialized constant Rails::SourceAnnotationExtractor The problem can be reproduced like this: ```ruby @defined = Set.new ANONYMOUS_CLASS_DEFINITION_TRACEPOINT = TracePoint.new(:c_return) do |tp| next unless @defined.add?(tp.return_value) end ANONYMOUS_CLASS_DEFINITION_TRACEPOINT.enable require 'rails' require "rails/source_annotation_extractor" ```
* Adds `register_tags`Younes SERRAJ2019-04-121-1/+14
|
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Port Annotations rake task to use Rails::NotesCommandAnnie-Claude Côté2018-07-041-1/+8
| | | | | | | * Invokes the notes Rails::Command and passes the rake task ENV variables as annotations options to it * Adds a deprecation warning for unsupported commands * Gets rid of reference to ENV["SOURCE_ANNOTATION_DIRECTORIES"] in SourceAnnotationExtractor since its now dealt with in the NotesCommand * Gets rid of rake desc for each rake notes task so they are not documented while using `rails -T` or `rails --help`
* [ci skip] Update documentation related to `rails notes`Annie-Claude Côté2018-07-031-11/+3
| | | | | | * Get rid of references to rake notes in the documentation * Get rid of references to environement variables used in SourceAnnotationExtractor * Updates the command line guide to reflect the new rails notes API
* [ci skip] Prefix class name with Rails:: in docsAlberto Almagro2018-04-201-3/+3
| | | | | After renaming and deprecation of SourceAnnotationExtractor documentation has been updated to reflect the new name Rails::SourceAnnotationExtractor
* [ci skip] Improve #find_in documentation.Alberto Almagro2018-04-201-3/+3
| | | | | | | | | The previous documentation version listed only the default registered extensions. This was misleading because if more extensions get registered with <tt>SourceAnnotationExtractor::Annotation.register_extensions</tt>, they would be also taken into account. By saying that we consider all registered extensions we document what happens in reality.
* Add deprecation note for SourceAnnotationExtractorPrem Sichanugrist2018-03-221-0/+7
|
* Make Annotation into a proper classPrem Sichanugrist2018-03-221-1/+1
| | | | | This cleans up the documentation for SourceAnnotationExtractor because RDoc does not seems to know how to parse `Struct.new() do` block.
* Move SourceAnnotationExtractor under Rails modulePrem Sichanugrist2018-03-221-117/+119
| | | | This class should be under Rails module as it belongs to Rails.
* Fix spaces in the comment block [ci skip]Yoshiyuki Hirano2017-08-231-1/+1
|
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* class Foo < Struct.new(:x) creates an extra unneeded anonymous classAkira Matsuda2017-01-131-1/+1
| | | | because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
* Merge pull request #25051 from bf4/extract_notes_as_binarySean Griffin2016-12-081-1/+1
|\ | | | | Extract notes as binary
| * Extract notes from files in binaryBenjamin Fleischer2016-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Prevents: ArgumentError: invalid byte sequence in UTF-8 railties/lib/rails/source_annotation_extractor.rb:115:in `=~' railties/lib/rails/source_annotation_extractor.rb:115:in `block in extract_annotations_from' And there's no reason we need to interpret the files as UTF-8 when scanning for annotations. Applies to Rails 4.2 as well.
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|/
* applies new string literal convention in railties/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Allow rake notes to work with other directories.John Meehan2016-07-051-0/+6
| | | | | | | Additional directories can be added using SourceAnnotationExtractor::Annotation.register_directories("spec", "other_dir") Result: rake notes will now extract notes from these directories.
* refer to rails command instead of rake in doc of `SourceAnnotationExtractor` ↵yuuji.yaginuma2016-07-021-3/+3
| | | | [ci skip]
* fix path of annotations.rake [ci skip]yuuji.yaginuma2015-08-201-1/+1
|
* Fix comment of SourceAnnotationExtractor#find_inyui-knk2014-11-091-3/+2
| | | | | | Commit(810af6f) changed which extensions are taken into account, so make to match comment of find_in. And sort extensions to follow the added order.
* Fix Shadowing extensions variable in Register Annotation Exentsionsrobertomiranda2014-03-161-2/+2
|
* Supporting .ruby, .yml and .yaml Extension in Rake Notesrobertomiranda2014-03-141-1/+1
|
* Remove .scss, .sass, .less, .haml, .slim, coffee from Rake Notes. Now we ↵robertomiranda2014-03-141-4/+2
| | | | have an API for register it in the corresponding gems
* Add Public Api for register new extensions for Rake Notesrobertomiranda2014-03-141-15/+24
|
* Replace map.flatten with flat_map in railtiesErik Michaels-Ober2014-03-041-1/+1
|
* [ci skip]updated documentation: added sass and less extensionsKuldeep Aggarwal2013-11-171-1/+1
|
* Adding LESS to rake notesJosh Crowder2013-08-151-1/+1
|
* handle notes in *.sass filesYuri Artemev2013-07-081-1/+1
|
* allow :dirs option for .enumerateBrian D. Burns2013-01-151-6/+15
| | | | | | Allows custom rake tasks to be defined using: SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
* use case statementBrian D. Burns2013-01-151-10/+16
|
* Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake. ↵Jeremy Kemper2013-01-061-5/+5
| | | | Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn'
* Add db to the list of default annotation foldersAntonio Cangiano2012-12-011-1/+1
|
* Add .rake to `rake notes` and `rake notes:custom`Brent J. Nordquist2012-10-121-7/+7
|
* Revert "Use flat_map { } instead of map {}.flatten"Santiago Pastorino2012-10-051-1/+1
| | | | | | | | | | | This reverts commit abf8de85519141496a6773310964ec03f6106f3f. We should take a deeper look to those cases flat_map doesn't do deep flattening. irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten => [1, 3, 1, 2] irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i} => [[1, 3], [1, 2]]
* Use flat_map { } instead of map {}.flattenSantiago Pastorino2012-10-051-1/+1
|
* Fixed styling issues brought up by @jeremyJason Noble2012-04-301-1/+1
|
* Add ability to specify custom annotation directoriesJason Noble & Ralph Shnelvar2012-04-301-1/+4
| | | | | | | | | SOURCE_ANNOTATION_DIRECTORIES='dir1,dir2' bundle exec rake notes Searches app, config, lib, script, test (default) Also searches dir1, dir2 References: #4536, #4540
* `rake notes` and `rake notes:custom` now supportTeng Siong Ong2012-04-221-3/+7
| | | css, scss and css.
* Fixed missing space bug introduces in ↵Anton Lindqvist2012-03-221-1/+1
| | | | rails/rails@9299bfdcd387253d83b645c205b8df477f2d0940.
* Display annotations from .coffee files in `rake notes`Bartlomiej Kozal2012-02-051-2/+2
|
* Align rake notes.Anton Lindqvist2011-12-261-1/+2
|
* revising docVijay Dev2011-12-111-3/+1
|
* Update source_annotation_extractor comment.Kazimierz Kiełkowicz2011-12-071-1/+1
|
* Add annotation to haml and slim template.Kazimierz Kiełkowicz2011-12-071-0/+4
|
* Remove .rxml, .rjs and .rhtml from source annotation regexp.Uģis Ozols2011-12-051-5/+5
|
* Updated rake:notes to search app, config, lib, script and test dirsjwarwick2011-07-061-4/+4
|