| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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"
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
|
|
|
|
|
|
| |
* 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`
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
After renaming and deprecation of SourceAnnotationExtractor
documentation has been updated to reflect the new name Rails::SourceAnnotationExtractor
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
This cleans up the documentation for SourceAnnotationExtractor because
RDoc does not seems to know how to parse `Struct.new() do` block.
|
|
|
|
| |
This class should be under Rails module as it belongs to Rails.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
| |
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
|
|\
| |
| | |
Extract notes as binary
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
| |
Additional directories can be added using
SourceAnnotationExtractor::Annotation.register_directories("spec", "other_dir")
Result: rake notes will now extract notes from these directories.
|
|
|
|
| |
[ci skip]
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
have an API for register it in the corresponding gems
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Allows custom rake tasks to be defined using:
SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
|
| |
|
|
|
|
| |
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'
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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]]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
SOURCE_ANNOTATION_DIRECTORIES='dir1,dir2' bundle exec rake notes
Searches app, config, lib, script, test (default)
Also searches dir1, dir2
References: #4536, #4540
|
|
|
| |
css, scss and css.
|
|
|
|
| |
rails/rails@9299bfdcd387253d83b645c205b8df477f2d0940.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|