sloprb 0.1.0 → 0.1.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/CHANGELOG.md +5 -1
- data/lib/sloprb/typoeater.rb +13 -14
- data/lib/sloprb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 58e1a220d3b716251ffc2d18e26eba840c87010b06c87d2551f5a3838dc9bc85
|
|
4
|
+
data.tar.gz: e595902a25e97cc83b841689c814e85d32bb90ba657d57ab0b0c7668cb748b84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ade7937bcab79f4073a295a2942c1b996779fdad9d47f6d274f8b34ff1355c3f7a57136d212f510274fec12c1622801236dd336e0a6e817941ad56696b5d5740
|
|
7
|
+
data.tar.gz: 2cc575c4e56be00cbb73ef57f8e8bb7b5f3ce46188eeeeecbff18ea121ba457405535872a4975a86eb5f153adecbbcbf1b428426b1b0766acbfb85dd867cf693
|
data/CHANGELOG.md
CHANGED
data/lib/sloprb/typoeater.rb
CHANGED
|
@@ -43,7 +43,8 @@ module Sloprb
|
|
|
43
43
|
return if result.errors.any?
|
|
44
44
|
|
|
45
45
|
corrected
|
|
46
|
-
rescue
|
|
46
|
+
rescue => e
|
|
47
|
+
warn "[sloprb] failed to autocorrect #{path}: #{e.message}" if ENV["SLOPRB_DEBUG"]
|
|
47
48
|
nil
|
|
48
49
|
end
|
|
49
50
|
|
|
@@ -51,23 +52,21 @@ module Sloprb
|
|
|
51
52
|
require "require-hooks/setup"
|
|
52
53
|
|
|
53
54
|
RequireHooks.around_load do |path, &load_block|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
load_block.call
|
|
56
|
+
rescue ::SyntaxError => original_error
|
|
57
|
+
error_path = original_error.path
|
|
58
|
+
corrected = Typoeater.call(error_path, original_error)
|
|
59
|
+
raise original_error unless corrected
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
File.write(error_path, corrected)
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
warn "[sloprb] auto-corrected syntax error in #{error_path}"
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
65
|
+
begin
|
|
66
|
+
load(error_path)
|
|
67
|
+
rescue ::SyntaxError
|
|
68
|
+
raise original_error
|
|
69
69
|
end
|
|
70
|
-
result
|
|
71
70
|
end
|
|
72
71
|
end
|
|
73
72
|
|
data/lib/sloprb/version.rb
CHANGED