rails_deprecated_syntax 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rails_deprecated_syntax.rb +41 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5bac8e712e0cc835bae57c75744de878936f3b8bb2244f8f0734c69a0f1ba9f9
4
+ data.tar.gz: 7313b31544d590af3f21e9228c607265ddb0aa8b9d657fcfde02fadb45354602
5
+ SHA512:
6
+ metadata.gz: c4daa466c3b538d1453eb30cb922e77539a5c204ca902c1264a99f9766533232e12f776e7e1b1fab263fb721daba675ef6d9a2597211022cd63e08d57d3bc3e0
7
+ data.tar.gz: b3b4262da740d459e314d645e4ad82b1335a0ede48ff733ea0bc75746db79cb6d102715cd8051756174ecdf5595059ca7c29bb793a79b92bfdfaac8446cc8403
@@ -0,0 +1,41 @@
1
+ class RailsDeprecatedSyntax
2
+
3
+ # DEPRECATIONS illustrates wich methods had been deprecated
4
+ # see more on https=>//edgeguides.rubyonrails.org/5_0_release_notes.html
5
+ DEPRECATIONS = {
6
+ 'config.static_cache_control'=> 'Deprecated config.static_cache_control in favor of config.public_file_server.headers',
7
+ 'config.serve_static_files'=> 'Deprecated config.serve_static_files in favor of config.public_file_server.enabled',
8
+ '_filter'=> 'Deprecated all *_filter callbacks in favor of *_action callbacks',
9
+ '_via_redirect'=> 'Deprecated *_via_redirect integration test methods. Use follow_redirect! manually after the request call for the same behavior',
10
+ 'skip_action_callback'=> 'Deprecated AbstractController#skip_action_callback in favor of individual skip_callback methods.',
11
+ 'render[[:space:]]nothing'=> 'Deprecated :nothing option for render method',
12
+ 'render[[:space:]]\:nothing'=> 'Deprecated :nothing option for render method',
13
+ 'redirect_to[[:space:]]:back'=> 'Deprecated redirect_to :back in favor of redirect_back',
14
+ 'table_exists?'=> 'Deprecated table_exists? - The #table_exists? method would check both tables and views.',
15
+ 'add_on_empty'=> 'Deprecated ActiveModel::Errors#add_on_empty and ActiveModel::Errors#add_on_blank with no replacement.',
16
+ 'add_on_blank'=> 'Deprecated ActiveModel::Errors#add_on_empty and ActiveModel::Errors#add_on_blank with no replacement.',
17
+ 'MissingSourceFile'=> 'Deprecated MissingSourceFile in favor of LoadError',
18
+ 'alias_method_chain'=> 'Deprecated alias_method_chain in favour of Module#prepend introduced in Ruby 2.0',
19
+ }.freeze
20
+
21
+ @report = ''
22
+
23
+ def self.check_deprecations(path)
24
+ path = path ? " -- #{path}" : '.'
25
+
26
+ DEPRECATIONS.map do |k, v|
27
+ result = `git grep -nr #{k} #{path}`
28
+ next if result.empty?
29
+
30
+ @report.concat("---------------------------------------------------------------------\n")
31
+ @report.concat("#{v}\n")
32
+ @report.concat("#{result}\n")
33
+ end
34
+
35
+ @report
36
+ end
37
+
38
+ def self.show_deprecations(path)
39
+ puts self.check_deprecations(path)
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_deprecated_syntax
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alejandra S. Cernas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-05-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: When trying to upgrate to Rails 5, there could be lots of methods that
14
+ not longer work, this gem aims to find the easy replaceable deprecated methods within
15
+ your app based on the Release Notes of version 5
16
+ email: stephaniacernas@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/rails_deprecated_syntax.rb
22
+ homepage: https://github.com/emerak/rails_deprecated_syntax
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.0.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Shows deprecated syntax and the alternative on Rails version 5
45
+ test_files: []