uncruft 0.4.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uncruft/deprecatable.rb +1 -1
- data/lib/uncruft/deprecation_handler.rb +19 -9
- data/lib/uncruft/railtie.rb +4 -0
- data/lib/uncruft/version.rb +1 -1
- data/lib/uncruft/warning.rb +4 -4
- data/lib/uncruft.rb +4 -0
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75e548761723a5ef0bf1e9f5ab10ec4b415270ccf22b2961c7b24cfa0e25992d
|
|
4
|
+
data.tar.gz: 52ff06d81f84337a23ab913f23d792c9875b12ab863d2ff501f38dbd1b790986
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 390695412c3992cce207fc9d16847e42bd7d4788ae3d9b45d0bcfcdf324909883077a73ed350b75f26ab99eae635af2b813541f6b563e7395aaaaca2c55c6e2a
|
|
7
|
+
data.tar.gz: 86c23923dfc8aa15ca9d965af0b4b63f0592044c3d39a7b921a98e6a4bf1517d2746b26691752332c705b65c57e2e2fe4583d728a0f133c8834b5cd9ac3466ec
|
data/lib/uncruft/deprecatable.rb
CHANGED
|
@@ -44,6 +44,10 @@ module Uncruft
|
|
|
44
44
|
message.gsub!(gem_home, '$GEM_PATH')
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
if (user_install = user_install(message)).present?
|
|
48
|
+
message.gsub!(user_install, '$GEM_PATH')
|
|
49
|
+
end
|
|
50
|
+
|
|
47
51
|
if message.include?(bin_dir)
|
|
48
52
|
message.gsub!(bin_dir, '$BIN_PATH')
|
|
49
53
|
end
|
|
@@ -70,7 +74,11 @@ module Uncruft
|
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
def gem_home(message)
|
|
73
|
-
message.match(%r{(?i:c)alled from( .+ at)? (#{ENV
|
|
77
|
+
message.match(%r{(?i:c)alled from( .+ at)? (#{ENV.fetch('GEM_HOME', nil)}/(.+/)*gems)})&.[](2).presence
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def user_install(message)
|
|
81
|
+
message.match(%r{(?i:c)alled from( .+ at)? (#{Gem.user_dir}/(.+/)*gems)})&.[](2).presence
|
|
74
82
|
end
|
|
75
83
|
|
|
76
84
|
def absolute_path(message)
|
|
@@ -107,17 +115,19 @@ module Uncruft
|
|
|
107
115
|
|
|
108
116
|
def known_deprecations
|
|
109
117
|
@known_deprecations ||= if known_deprecations_file_exists?
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
file = File.read(Uncruft.ignorefile_path)
|
|
119
|
+
JSON.parse(file)['ignored_warnings'].to_set
|
|
120
|
+
else
|
|
121
|
+
Set.new
|
|
122
|
+
end
|
|
115
123
|
end
|
|
116
124
|
|
|
117
125
|
def file_content(deprecations)
|
|
118
|
-
JSON.pretty_generate
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
JSON.pretty_generate(
|
|
127
|
+
ignored_warnings: deprecations.sort,
|
|
128
|
+
updated: now,
|
|
129
|
+
rails_version: Rails::VERSION::STRING,
|
|
130
|
+
)
|
|
121
131
|
end
|
|
122
132
|
|
|
123
133
|
def now
|
data/lib/uncruft/railtie.rb
CHANGED
data/lib/uncruft/version.rb
CHANGED
data/lib/uncruft/warning.rb
CHANGED
|
@@ -4,12 +4,12 @@ module Uncruft
|
|
|
4
4
|
module Warning
|
|
5
5
|
DEPRECATION_PATTERN = /(deprecation|deprecated)/i
|
|
6
6
|
|
|
7
|
-
def warn(
|
|
7
|
+
def warn(*args, **kwargs)
|
|
8
|
+
str = args[0]
|
|
9
|
+
|
|
8
10
|
if str =~ DEPRECATION_PATTERN # rubocop:disable Performance/RegexpMatch
|
|
9
11
|
message = strip_caller_info(str, caller_locations(1..1).first).strip
|
|
10
|
-
|
|
11
|
-
elsif RUBY_VERSION < '2.7' && kwargs.empty?
|
|
12
|
-
super(str, *args)
|
|
12
|
+
Uncruft.deprecator.warn(message)
|
|
13
13
|
else
|
|
14
14
|
super
|
|
15
15
|
end
|
data/lib/uncruft.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uncruft
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Griffith
|
|
8
8
|
- Chris Zega
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: railties
|
|
@@ -47,7 +46,6 @@ licenses:
|
|
|
47
46
|
- MIT
|
|
48
47
|
metadata:
|
|
49
48
|
rubygems_mfa_required: 'true'
|
|
50
|
-
post_install_message:
|
|
51
49
|
rdoc_options: []
|
|
52
50
|
require_paths:
|
|
53
51
|
- lib
|
|
@@ -62,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
60
|
- !ruby/object:Gem::Version
|
|
63
61
|
version: '0'
|
|
64
62
|
requirements: []
|
|
65
|
-
rubygems_version: 3.
|
|
66
|
-
signing_key:
|
|
63
|
+
rubygems_version: 3.6.2
|
|
67
64
|
specification_version: 4
|
|
68
65
|
summary: A library to assist with Rails upgrades
|
|
69
66
|
test_files: []
|