Skip to content

Commit dba8ce9

Browse files
committed
Use rails routes instead of rake routes, minimum rails is now 5.0
Signed-off-by: Vasily Fedoseyev <[email protected]>
1 parent ae0b79c commit dba8ce9

File tree

9 files changed

+18
-13
lines changed

9 files changed

+18
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Please see https://github.com/ctran/annotate_models/releases for changes between releases.
22

3+
## 4.0.0
4+
Changes
5+
- Minimum supported rails version is now 5.0
6+
- Fixed rails 6 warning on `rake routes` deprecation
7+
38
## 3.1.1
49
Changes
510
- Bump required ruby version to >= 2.4 [#772](https://github.com/ctran/annotate_models/pull/772)

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
22

33
ruby '>= 2.4.0'
44

5-
gem 'activerecord', '>= 4.2.5', '< 6', require: false
5+
gem 'activerecord', '>= 5.0', '< 7', require: false
66
gem 'rake', require: false
77

88
group :development do

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ when using `SpatialAdapter`, `PostgisAdapter` or `PostGISAdapter`:
5151
# path :geometry line_string, 4326
5252
```
5353

54-
Also, if you pass the `-r` option, it'll annotate `routes.rb` with the output of `rake routes`.
54+
Also, if you pass the `-r` option, it'll annotate `routes.rb` with the output of `rails routes`.
5555

5656

5757
## Upgrading to 3.X and annotate models not working?
@@ -219,7 +219,7 @@ you can do so with a simple environment variable, instead of editing the
219219
If --w option is used, the same text will be used as opening and closing
220220
--wo, --wrapper-open STR Annotation wrapper opening.
221221
--wc, --wrapper-close STR Annotation wrapper closing
222-
-r, --routes Annotate routes.rb with the output of 'rake routes'
222+
-r, --routes Annotate routes.rb with the output of 'rails routes'
223223
--models Annotate ActiveRecord models
224224
-a, --active-admin Annotate active_admin models
225225
-v, --version Show the current version of this gem

annotate.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323

2424
s.specification_version = 4 if s.respond_to? :specification_version
2525
s.add_runtime_dependency(%q<rake>, '>= 10.4', '< 14.0')
26-
s.add_runtime_dependency(%q<activerecord>, ['>= 3.2', '< 8.0'])
26+
s.add_runtime_dependency(%q<activerecord>, ['>= 5.0', '< 8.0'])
2727

2828
s.metadata = {
2929
"bug_tracker_uri" => "https://github.com/ctran/annotate_models/issues/",

lib/annotate/annotate_routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
#
66
#
7-
# Prepends the output of "rake routes" to the top of your routes.rb file.
7+
# Prepends the output of "rails routes" to the top of your routes.rb file.
88
# Yes, it's simple but I'm thick and often need a reminder of what my routes
99
# mean.
1010
#

lib/annotate/annotate_routes/header_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def generate(options = {})
1616
private
1717

1818
def routes_map(options)
19-
result = `rake routes`.chomp("\n").split(/\n/, -1)
19+
result = `rails routes`.chomp("\n").split(/\n/, -1)
2020

2121
# In old versions of Rake, the first line of output was the cwd. Not so
2222
# much in newer ones. We ditch that line if it exists, and if not, we

lib/annotate/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength
145145

146146
option_parser.on('-r',
147147
'--routes',
148-
"Annotate routes.rb with the output of 'rake routes'") do
148+
"Annotate routes.rb with the output of 'rails routes'") do
149149
env['routes'] = 'true'
150150
end
151151

lib/annotate/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Annotate
22
def self.version
3-
'3.2.0'
3+
'4.0.0'
44
end
55
end

spec/lib/annotate/annotate_routes_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
expect(File).to receive(:exist?).with(ROUTE_FILE).and_return(true).once
5050
expect(File).to receive(:read).with(ROUTE_FILE).and_return(route_file_content).once
5151

52-
expect(AnnotateRoutes::HeaderGenerator).to receive(:`).with('rake routes').and_return(rake_routes_result).once
52+
expect(AnnotateRoutes::HeaderGenerator).to receive(:`).with('rails routes').and_return(rake_routes_result).once
5353
end
5454

55-
context 'When the result of `rake routes` is present' do
56-
context 'When the result of `rake routes` does not contain Rake version' do
55+
context 'When the result of `rails routes` is present' do
56+
context 'When the result of `rails routes` does not contain Rake version' do
5757
context 'When the file does not contain magic comment' do
5858
let :rake_routes_result do
5959
<<-EOS
@@ -236,7 +236,7 @@
236236
end
237237
end
238238

239-
context 'When the result of `rake routes` contains Rake version' do
239+
context 'When the result of `rails routes` contains Rake version' do
240240
context 'with older Rake versions' do
241241
let :rake_routes_result do
242242
<<~EOS.chomp
@@ -394,7 +394,7 @@
394394
end
395395
end
396396

397-
context 'When the result of `rake routes` is blank' do
397+
context 'When the result of `rails routes` is blank' do
398398
let :rake_routes_result do
399399
''
400400
end

0 commit comments

Comments
 (0)