specdiff 0.1.0 → 0.1.1

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: 7da7ac63f4638bd752f83ff41a27488757e43e57c028891d4fd944afd03f58ca
4
- data.tar.gz: d5a49e6aeb3525a454df920aa7d1b541a0812ffb9f8d0e1813a4bc05b57b006f
3
+ metadata.gz: 888c68bf9d22b79bcd5453f24049e375026f150ec28a96fee5610432246a480c
4
+ data.tar.gz: 82d74700d65c9e0564862d6ae4b615f25381735e2378d0f1a6236b1b945b1c4b
5
5
  SHA512:
6
- metadata.gz: 38ae83cd45a69892ca6d22915e0b253447eb12f42165a7673751abbb3993381702a02771ad3181a96d26204e6d171268a14423e85c2323a345df243be918f5a5
7
- data.tar.gz: f44ce432951f3e2198ed6c4ed4cfc975b4eb201ced235791cd917c2476ca7a60fcb4ce0aff023fd4423f97b7eee2819d395d514b970188a5bc232ce89ee44ea6
6
+ metadata.gz: dbe9750778a84629cabee0b1a70936e471d180d71f38a585d056ca8e723b9b04925591ce4de9536a2b0855e03b1c73ccff10a4716b63358b7c233ee1f80443c8
7
+ data.tar.gz: a115665ae50487b6decb6ebdddab0d840093702ab2c06d7f5b14536cbbd90ca81d3017c32deb390c325a2572a1e8aa13b9f828fcfa7846b7b5e288efef47a431
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2023-12-04
4
+
5
+ ### Fixed
6
+
7
+ - Fix #empty? not returning true when the diff is actually empty
8
+
3
9
  ## [0.1.0] - 2023-11-30
4
10
 
5
11
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- specdiff (0.1.0)
4
+ specdiff (0.1.1)
5
5
  diff-lcs (~> 1.5)
6
6
  hashdiff (~> 1.0)
7
7
 
data/README.md CHANGED
@@ -61,13 +61,25 @@ diff.empty? # => true/false, if it is empty you might want to not print the diff
61
61
  diff.to_s # => a string for showing to a developer who may or may not be scratching their head
62
62
  ```
63
63
 
64
+ ### Registering plugins
65
+
66
+ ```rb
67
+ # Specdiff comes with json support, but it must be loaded like so:
68
+ Specdiff.load!(:json)
69
+
70
+ # Custom plugins can be loaded like this:
71
+ Specdiff.load!(MyCustomType)
72
+ ```
73
+
74
+ Check out the [source code](./lib/specdiff/plugins/json.rb) to learn the plugin interface.
75
+
64
76
  ## Development
65
77
 
66
78
  Install the software versions specified in `.tool-versions`.
67
79
 
68
80
  Run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests and linter and make sure they're green before starting to make your changes.
69
81
 
70
- Run `bundle exec rake -AD` gor a full list of all the available tasks you may use for development purposes.
82
+ Run `bundle exec rake -AD` for a full list of all the available tasks you may use for development purposes.
71
83
 
72
84
  You can also run `bin/console` for an interactive prompt that will allow you to experiment with the gem code loaded.
73
85
 
data/lib/specdiff/diff.rb CHANGED
@@ -10,7 +10,8 @@
10
10
  end
11
11
 
12
12
  def empty?
13
- differ == ::Specdiff::Differ::NotFound
13
+ differ == ::Specdiff::Differ::NotFound ||
14
+ (differ.respond_to?(:empty?) && differ.empty?(self))
14
15
  end
15
16
 
16
17
  def types
@@ -17,6 +17,10 @@ class Specdiff::Differ::Hashdiff
17
17
  )
18
18
  end
19
19
 
20
+ def self.empty?(diff)
21
+ diff.raw.empty?
22
+ end
23
+
20
24
  def self.stringify(diff)
21
25
  diff.raw.pretty_inspect
22
26
 
@@ -47,6 +47,8 @@ class Specdiff::Differ::Text
47
47
  diff << hunks.last.diff(:unified).to_s
48
48
  end
49
49
 
50
+ return diff if diff == ""
51
+
50
52
  diff << "\n"
51
53
 
52
54
  return colorize_by_line(diff) do |line|
@@ -67,6 +69,10 @@ class Specdiff::Differ::Text
67
69
  end
68
70
  end
69
71
 
72
+ def self.empty?(diff)
73
+ diff.raw == ""
74
+ end
75
+
70
76
  def self.stringify(diff)
71
77
  diff.raw
72
78
  end
@@ -1,3 +1,3 @@
1
1
  module Specdiff
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Odin Heggvold Bekkelund
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashdiff