safe_monkey_patching 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/safe_monkey_patching.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c21a6a5b63547a982f0b7b3a1cf8d3577d57cb5b1b6fa7f362538a20205685
|
4
|
+
data.tar.gz: 737ea1354ef21c729cfb63e378ec1e62d6513435b687d8fee28efd0bd318b7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e55bda84bae816d39b95d72b25790d4629bd224b703e805cab00a8faf1dd9920726a12f64d2394f3728c72cea970ea3c851eb1b2088a71fd4db663f45e46af
|
7
|
+
data.tar.gz: 6794e113e2e0047188571aeedf6bfb6be59dbde50971abad686cb3930207dac9ca46e15c7eef8b9ad69bf0f1b13c6a293e149b2b27b251e0d2a6b1acd15bc77d
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ a więc, gdy podbijemy railsy i zmieni się kod źródłowy, to `gif diff` nam o
|
|
27
27
|
|
28
28
|
```diff
|
29
29
|
|
30
|
-
diff --git a/
|
30
|
+
diff --git a/monkey_patches-old.yml b/monkey_patches-old.yml
|
31
31
|
|
32
32
|
ActiveJob::Core::ClassMethods:
|
33
33
|
deserialize:
|
@@ -35,5 +35,9 @@ diff --git a/monkey_patchs.yml b/monkey_patchs.yml
|
|
35
35
|
+ sha1: 131d3acf24768b30a3ccb1052591b1cdb603f0cd
|
36
36
|
```
|
37
37
|
|
38
|
-
|
38
|
+
Również pojawi się plik `WRONG_MONKEY_PATCHES.txt`, który pokazuje niekompatybilności z gemów.
|
39
|
+
|
40
|
+
Dzięki temu będziemy wiedzieli do jakich metod trzeba będzie zajrzeć 🥳
|
41
|
+
|
42
|
+
Aby zaktualizować monkey_patche, to trzeba po prostu zcomitować ten plik `monkey_patches-old.yml` i będzie git.
|
39
43
|
|
data/lib/safe_monkey_patching.rb
CHANGED
@@ -58,10 +58,12 @@ class Object
|
|
58
58
|
end
|
59
59
|
|
60
60
|
at_exit do
|
61
|
-
break unless Rails.env.test?
|
62
61
|
SafeMonkeyPatching::Behavior.gems_with_patches.each do |gem_path|
|
63
|
-
old_patches = SafeMonkeyPatching::Behavior.load_store(File.join(gem_path, "monkey_patches-old.yml")).to_yaml
|
64
|
-
new_patches = SafeMonkeyPatching::Behavior.load_store(File.join(gem_path, "monkey_patches-new.yml")).to_yaml
|
62
|
+
old_patches = SafeMonkeyPatching::Behavior.load_store(File.join(gem_path, "monkey_patches-old.yml")).sort.to_h.to_yaml
|
63
|
+
new_patches = SafeMonkeyPatching::Behavior.load_store(File.join(gem_path, "monkey_patches-new.yml")).sort.to_h.to_yaml
|
64
|
+
|
65
|
+
File.write(File.join(gem_path, "monkey_patches-old.yml"), old_patches)
|
66
|
+
File.write(File.join(gem_path, "monkey_patches-new.yml"), new_patches)
|
65
67
|
|
66
68
|
FileUtils.mv(File.join(gem_path, "monkey_patches-new.yml"),
|
67
69
|
File.join(gem_path, "monkey_patches-old.yml"))
|
@@ -69,7 +71,7 @@ at_exit do
|
|
69
71
|
diff = Diffy::Diff.new(old_patches, new_patches)
|
70
72
|
|
71
73
|
if diff.to_s.size.positive?
|
72
|
-
$stderr.puts
|
74
|
+
$stderr.puts "Wrong monkeypatches! \n But if they are correct, then just commit 'monkey_patches-old.yml'".red.bold
|
73
75
|
$stderr.puts gem_path
|
74
76
|
$stderr.puts diff.to_s(:color)
|
75
77
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_monkey_patching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrzej Bisewski
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: Safe
|
27
|
+
description: Safe monkey patching
|
28
28
|
email: andrzej@bisewski.dev
|
29
29
|
executables: []
|
30
30
|
extensions: []
|