safe_monkey_patching 0.0.3 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4a3336fc1da84f401d73ae885fc745c522bececa36fd6a0a7f0dfb689b33440
4
- data.tar.gz: d7c81740653d36ca6d5beb3020fe09413b4a666dc11641c10788a4455b39613b
3
+ metadata.gz: e01bc3976674082551512928046bb759e70151602b8af093235e1a1961073088
4
+ data.tar.gz: a22799598c7a3c8ae838e04bc043db906f85682c8df5282d9d64585eed412317
5
5
  SHA512:
6
- metadata.gz: d11cf7ef416f9da99151eb68ec3a74a2fbdca2d22f52673edfc9c33676732ceb813c0c81d96d13cb599d080b3e68477b9acf7ab81bc159e83b46ec7c677217ec
7
- data.tar.gz: a6c5f033ea691de80411152de82273b2d48bd7429ed617fd3702d0b235c1ccd3585d0a67cca5d9946d84eba48b47c521067f04ee45517b93f55d1a9ab5f2e3e3
6
+ metadata.gz: 54dd179f6cb888f7972eedd1b1878f191948a3ed1a416186e7fa8623d58d22108984d6d3d8c6f980933e1cfd94510240b2d544dfe7f3a699a23e625532fcbf37
7
+ data.tar.gz: dcc4aaae9eae3017b1e6a4f4c1c89e7a2948d762dc25b19d00342c74fe29bb3172869608e39a648b3fde7c188f67d0da4d92f50f972ad7a01797ef1695e751b3
data/README.md CHANGED
@@ -8,7 +8,7 @@ module ActiveJob
8
8
  monkey_patch :deserialize
9
9
 
10
10
  def deserialize(job_data)
11
- ...
11
+ # ...
12
12
  end
13
13
  end
14
14
  end
@@ -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/monkey_patchs.yml b/monkey_patchs.yml
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,11 @@ diff --git a/monkey_patchs.yml b/monkey_patchs.yml
35
35
  + sha1: 131d3acf24768b30a3ccb1052591b1cdb603f0cd
36
36
  ```
37
37
 
38
- Dzięki temu będziemy wiedzieli, że trzeba tam zajrzeć 🥳
38
+ Również pokażą się pliki `monkey_patches-old.yml` i `WRONG_MONKEY_PATCHES.txt`, który pokazuje niekompatybilności z gemów.
39
+
40
+ Aby zaktualizować łatki, to trzeba zcomitować `monkey_patches-old.yml` i będzie :ok:.
41
+
42
+ Dzięki temu gemu nie będzie trzeba pamiętać o przejrzeniu patchów przy podbijaniu gemów 🥳
43
+
44
+
39
45
 
@@ -45,7 +45,7 @@ module SafeMonkeyPatching
45
45
  method_entry = { method.owner.to_s => { method.name.to_s =>
46
46
  { 'sha1' => Digest::SHA1.hexdigest(method.source) } } }
47
47
 
48
- new_database = database.merge(method_entry)
48
+ new_database = database.deep_merge(method_entry)
49
49
  File.open(File.join(gem_path, 'monkey_patches-new.yml'), 'w') do |f|
50
50
  f.puts(new_database.to_yaml)
51
51
  end
@@ -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").sort.to_h).to_yaml
64
- new_patches = SafeMonkeyPatching::Behavior.load_store(File.join(gem_path, "monkey_patches-new.yml").sort.to_h).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 'Wrong monkeypatches!'.red.bold
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.3
4
+ version: 0.0.7
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 monaky patching
27
+ description: Safe monkey patching
28
28
  email: andrzej@bisewski.dev
29
29
  executables: []
30
30
  extensions: []