di 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/HISTORY +4 -0
  2. data/LICENSE +1 -1
  3. data/README.rdoc +2 -2
  4. data/Rakefile +1 -1
  5. data/di.gemspec +11 -13
  6. data/lib/di.rb +11 -4
  7. metadata +6 -6
data/HISTORY CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.2 2012-01-18
2
+
3
+ * Try to fix a bug where "di DIR FILE..." produces a reversed diff.
4
+
1
5
  == 0.2.1 2011-08-04
2
6
 
3
7
  * Make the regexp pattern used for --ignore-cvs-lines more specific so
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008, 2009, 2010, 2011 Akinori MUSHA
1
+ Copyright (c) 2008, 2009, 2010, 2011, 2012 Akinori MUSHA
2
2
 
3
3
  All rights reserved.
4
4
 
@@ -1,6 +1,6 @@
1
1
  = di
2
2
 
3
- * http://www.idaemons.org/projects/di/
3
+ * https://github.com/knu/di
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -72,6 +72,6 @@ Or just install lib/di.rb as "di" to a directory in your PATH.
72
72
 
73
73
  == COPYRIGHT:
74
74
 
75
- Copyright (c) 2008, 2009, 2010, 2011 Akinori MUSHA
75
+ Copyright (c) 2008, 2009, 2010, 2011, 2012 Akinori MUSHA
76
76
 
77
77
  See LICENSE for license terms.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ The di(1) command wraps around GNU diff(1) to provide reasonable
13
13
  default settings and some original features.
14
14
  EOS
15
15
  gem.email = "knu@idaemons.org"
16
- gem.homepage = "http://github.com/knu/di"
16
+ gem.homepage = "https://github.com/knu/di"
17
17
  gem.authors = ["Akinori MUSHA"]
18
18
  gem.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
19
19
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
data/di.gemspec CHANGED
@@ -4,17 +4,15 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{di}
8
- s.version = "0.2.1"
7
+ s.name = "di"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Akinori MUSHA}]
12
- s.date = %q{2011-08-04}
13
- s.description = %q{The di(1) command wraps around GNU diff(1) to provide reasonable
14
- default settings and some original features.
15
- }
16
- s.email = %q{knu@idaemons.org}
17
- s.executables = [%q{di}]
11
+ s.authors = ["Akinori MUSHA"]
12
+ s.date = "2012-01-18"
13
+ s.description = "The di(1) command wraps around GNU diff(1) to provide reasonable\ndefault settings and some original features.\n"
14
+ s.email = "knu@idaemons.org"
15
+ s.executables = ["di"]
18
16
  s.extra_rdoc_files = [
19
17
  "LICENSE",
20
18
  "README.rdoc"
@@ -31,11 +29,11 @@ default settings and some original features.
31
29
  "test/helper.rb",
32
30
  "test/test_di.rb"
33
31
  ]
34
- s.homepage = %q{http://github.com/knu/di}
35
- s.require_paths = [%q{lib}]
32
+ s.homepage = "https://github.com/knu/di"
33
+ s.require_paths = ["lib"]
36
34
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
37
- s.rubygems_version = %q{1.8.5}
38
- s.summary = %q{A wrapper around GNU diff(1)}
35
+ s.rubygems_version = "1.8.15"
36
+ s.summary = "A wrapper around GNU diff(1)"
39
37
 
40
38
  if s.respond_to? :specification_version then
41
39
  s.specification_version = 3
data/lib/di.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # di - a wrapper around GNU diff(1)
5
5
  #
6
- # Copyright (c) 2008, 2009, 2010, 2011 Akinori MUSHA
6
+ # Copyright (c) 2008, 2009, 2010, 2011, 2012 Akinori MUSHA
7
7
  #
8
8
  # All rights reserved.
9
9
  #
@@ -28,9 +28,9 @@
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.1"
31
+ MYVERSION = "0.2.2"
32
32
  MYNAME = File.basename($0)
33
- MYCOPYRIGHT = "Copyright (c) 2008, 2009, 2010, 2011 Akinori MUSHA"
33
+ MYCOPYRIGHT = "Copyright (c) 2008, 2009, 2010, 2011, 2012 Akinori MUSHA"
34
34
 
35
35
  DIFF_CMD = ENV.fetch('DIFF', 'diff')
36
36
  ENV_NAME = "#{MYNAME.tr('-a-z', '_A-Z')}_OPTIONS"
@@ -95,6 +95,7 @@ def setup
95
95
  :whitespace => "\e[41m",
96
96
  :off => "\e[m",
97
97
  }
98
+ $diff.reversed = false
98
99
  end
99
100
 
100
101
  def parse_args!(args)
@@ -436,6 +437,7 @@ EOS
436
437
 
437
438
  if File.directory?(args.first)
438
439
  $diff.to_files, $diff.from_files = args[0..0], args[1..-1]
440
+ $diff.reversed = true
439
441
  else
440
442
  $diff.from_files, $diff.to_files = args[0..-2], args[-1..-1]
441
443
  end
@@ -569,6 +571,7 @@ def diff_main
569
571
  end
570
572
 
571
573
  def diff_files(file1, file2)
574
+ file1, file2 = file2, file1 if $diff.reversed
572
575
  if file1.is_a?(Array)
573
576
  file2.is_a?(Array) and raise "cannot compare two sets of multiple files"
574
577
  file1.empty? and return 0
@@ -629,7 +632,11 @@ def diff_dirs(dir1, dir2)
629
632
  }
630
633
  diff_files(files, dir2)
631
634
 
632
- [[dir1, missing2], [dir2, missing1]].each { |dir, missing|
635
+ if $diff.reversed
636
+ [[dir1, missing2], [dir2, missing1]]
637
+ else
638
+ [[dir2, missing1], [dir1, missing2]]
639
+ end.each { |dir, missing|
633
640
  new_files = []
634
641
  missing.each { |entry|
635
642
  file = File.join(dir, entry)
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
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: 2011-08-04 00:00:00 Z
18
+ date: 2012-01-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thoughtbot-shoulda
@@ -54,7 +54,7 @@ files:
54
54
  - lib/di.rb
55
55
  - test/helper.rb
56
56
  - test/test_di.rb
57
- homepage: http://github.com/knu/di
57
+ homepage: https://github.com/knu/di
58
58
  licenses: []
59
59
 
60
60
  post_install_message:
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  requirements: []
86
86
 
87
87
  rubyforge_project:
88
- rubygems_version: 1.8.5
88
+ rubygems_version: 1.8.15
89
89
  signing_key:
90
90
  specification_version: 3
91
91
  summary: A wrapper around GNU diff(1)