di 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/HISTORY +5 -0
  2. data/di.gemspec +2 -2
  3. data/lib/di.rb +19 -17
  4. metadata +4 -4
data/HISTORY CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.3 2012-03-29
2
+
3
+ * Fix the case where comparing two directories fails when the latter
4
+ contains a directory that the former doesn't have.
5
+
1
6
  == 0.2.2 2012-01-18
2
7
 
3
8
  * Try to fix a bug where "di DIR FILE..." produces a reversed diff.
data/di.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "di"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akinori MUSHA"]
12
- s.date = "2012-01-18"
12
+ s.date = "2012-03-29"
13
13
  s.description = "The di(1) command wraps around GNU diff(1) to provide reasonable\ndefault settings and some original features.\n"
14
14
  s.email = "knu@idaemons.org"
15
15
  s.executables = ["di"]
data/lib/di.rb CHANGED
@@ -28,7 +28,7 @@
28
28
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
29
  # SUCH DAMAGE.
30
30
 
31
- MYVERSION = "0.2.2"
31
+ MYVERSION = "0.2.3"
32
32
  MYNAME = File.basename($0)
33
33
  MYCOPYRIGHT = "Copyright (c) 2008, 2009, 2010, 2011, 2012 Akinori MUSHA"
34
34
 
@@ -615,22 +615,24 @@ def diff_dirs(dir1, dir2)
615
615
  missing1 = entries2 - entries1
616
616
  missing2 = entries1 - entries2
617
617
 
618
- files = []
619
- common.each { |file|
620
- file1 = File.join(dir1, file)
621
- file2 = File.join(dir2, file)
622
- file1_is_dir = File.directory?(file1)
623
- file2_is_dir = File.directory?(file2)
624
- if file1_is_dir && file2_is_dir
625
- diff_dirs(file1, file2) if $diff.recursive
626
- elsif !file1_is_dir && !file2_is_dir
627
- files << file1
628
- else
629
- missing1 << file
630
- missing2 << file
631
- end
632
- }
633
- diff_files(files, dir2)
618
+ unless common.empty?
619
+ files = []
620
+ common.each { |file|
621
+ file1 = File.join(dir1, file)
622
+ file2 = File.join(dir2, file)
623
+ file1_is_dir = File.directory?(file1)
624
+ file2_is_dir = File.directory?(file2)
625
+ if file1_is_dir && file2_is_dir
626
+ diff_dirs(file1, file2) if $diff.recursive
627
+ elsif !file1_is_dir && !file2_is_dir
628
+ files << file1
629
+ else
630
+ missing1 << file
631
+ missing2 << file
632
+ end
633
+ }
634
+ diff_files(files, dir2)
635
+ end
634
636
 
635
637
  if $diff.reversed
636
638
  [[dir1, missing2], [dir2, missing1]]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: di
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akinori MUSHA
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-18 00:00:00 Z
18
+ date: 2012-03-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thoughtbot-shoulda