di 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,6 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ HISTORY
6
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/HISTORY ADDED
@@ -0,0 +1,15 @@
1
+ == 0.1.3 2010-03-10
2
+
3
+ * Fix handling of the following options and make custom format options
4
+ work:
5
+ -D/--ifdef=NAME
6
+ --GTYPE-group-format=GFMT
7
+ --line-format=LFMT
8
+ --LTYPE-line-format=LFMT
9
+
10
+ * Fix a problem where escape sequence ESC $ B .. : is regarded as CVS
11
+ keyword, which often appears in a text encoded in ISO-2022-JP.
12
+
13
+ == 0.1.1 2008-10-06
14
+
15
+ * Initial release
@@ -1,47 +1,4 @@
1
- = di
2
-
3
- * http://www.idaemons.org/projects/di/
4
-
5
- == DESCRIPTION:
6
-
7
- di - a wrapper around GNU diff(1)
8
-
9
- == FEATURES:
10
-
11
- The di(1) command wraps around GNU diff(1) to provide reasonable
12
- default settings and some original features:
13
-
14
- - Ignore non-significant files, such as backup files, object files,
15
- VCS administration files, etc. a la rsync(1)'s --cvs-ignore
16
- option.
17
-
18
- - Ignore difference of lines containing RCS tags.
19
-
20
- - Output in unified format.
21
-
22
- - Perform recursive comparison.
23
-
24
- - Turn on some other useful options: -N -p -d.
25
-
26
- - Provide the way to negate any of the above options.
27
-
28
- == SYNOPSIS:
29
-
30
- Run di --help for help.
31
-
32
- == REQUIREMENTS:
33
-
34
- - Ruby 1.8.6 or later
35
-
36
- - GNU diff(1)
37
-
38
- == INSTALL:
39
-
40
- gem install di
41
-
42
- == LICENSE:
43
-
44
- Copyright (c) 2008 Akinori MUSHA
1
+ Copyright (c) 2008, 2009, 2010 Akinori MUSHA
45
2
 
46
3
  All rights reserved.
47
4
 
data/README.rdoc ADDED
@@ -0,0 +1,46 @@
1
+ = di
2
+
3
+ * http://www.idaemons.org/projects/di/
4
+
5
+ == DESCRIPTION:
6
+
7
+ di - a wrapper around GNU diff(1)
8
+
9
+ == FEATURES:
10
+
11
+ The di(1) command wraps around GNU diff(1) to provide reasonable
12
+ default settings and some original features:
13
+
14
+ - Ignore non-significant files, such as backup files, object files,
15
+ VCS administration files, etc. a la rsync(1)'s --cvs-ignore
16
+ option.
17
+
18
+ - Ignore difference of lines containing RCS tags.
19
+
20
+ - Output in unified format by default.
21
+
22
+ - Perform recursive comparison.
23
+
24
+ - Turn on some other useful options: -N -p -d.
25
+
26
+ - Provide the way to negate any of the above options.
27
+
28
+ == SYNOPSIS:
29
+
30
+ Run di --help for help.
31
+
32
+ == REQUIREMENTS:
33
+
34
+ - Ruby 1.8.6 or later
35
+
36
+ - GNU diff(1)
37
+
38
+ == INSTALL:
39
+
40
+ gem install di
41
+
42
+ == COPYRIGHT:
43
+
44
+ Copyright (c) 2008, 2009, 2010 Akinori MUSHA
45
+
46
+ See LICENSE for license terms.
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "di"
8
+ gem.summary = %Q{A wrapper around GNU diff(1)}
9
+ gem.description = <<EOS
10
+ The di(1) command wraps around GNU diff(1) to provide reasonable
11
+ default settings and some original features.
12
+ EOS
13
+ gem.email = "knu@idaemons.org"
14
+ gem.homepage = "http://github.com/knu/di"
15
+ gem.authors = ["Akinori MUSHA"]
16
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
17
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
+ gem.executables = ["di"]
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ require 'rake/testtask'
26
+ Rake::TestTask.new(:test) do |test|
27
+ test.libs << 'lib' << 'test'
28
+ test.pattern = 'test/**/test_*.rb'
29
+ test.verbose = true
30
+ end
31
+
32
+ begin
33
+ require 'rcov/rcovtask'
34
+ Rcov::RcovTask.new do |test|
35
+ test.libs << 'test'
36
+ test.pattern = 'test/**/test_*.rb'
37
+ test.verbose = true
38
+ end
39
+ rescue LoadError
40
+ task :rcov do
41
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
+ end
43
+ end
44
+
45
+ task :test => :check_dependencies
46
+
47
+ task :default => :test
48
+
49
+ require 'rake/rdoctask'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "di #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.3
data/bin/di CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # di - a wrapper around GNU diff(1)
5
5
  #
6
- # Copyright (c) 2008 Akinori MUSHA
6
+ # Copyright (c) 2008, 2009, 2010 Akinori MUSHA
7
7
  #
8
8
  # All rights reserved.
9
9
  #
@@ -27,12 +27,8 @@
27
27
  # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
28
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
29
  # SUCH DAMAGE.
30
- #
31
- # $Id: di 69 2008-10-06 03:58:09Z knu $
32
30
 
33
- MYVERSION = "0.1.1"
34
- MYREVISION = %w$Rev: 69 $[1]
35
- MYDATE = %w$Date: 2008-10-06 12:58:09 +0900 (Mon, 06 Oct 2008) $[1]
31
+ MYVERSION = "0.1.3"
36
32
  MYNAME = File.basename($0)
37
33
 
38
34
  DIFF_CMD = ENV.fetch('DIFF', 'diff')
@@ -76,6 +72,8 @@ def setup
76
72
  $diff.exclude = []
77
73
  $diff.include = []
78
74
  $diff.flags = []
75
+ $diff.format_flags = []
76
+ $diff.custom_format_p = false
79
77
  end
80
78
 
81
79
  def parse_args!(args)
@@ -83,7 +81,7 @@ def parse_args!(args)
83
81
 
84
82
  banner = <<-"EOF"
85
83
  #{MYNAME} - a wrapper around GNU diff(1)
86
- version #{MYVERSION} [revision #{MYREVISION}] (#{MYDATE})
84
+ version #{MYVERSION}
87
85
 
88
86
  usage: #{MYNAME} [flags] [files]
89
87
  EOF
@@ -149,19 +147,19 @@ usage: #{MYNAME} [flags] [files]
149
147
  }
150
148
  opts.on('-c[NUM]', '--context[=NUM]', Integer,
151
149
  'Output NUM (default 3) lines of copied context.') { |val|
152
- $diff.format = ['-C', val ? val.to_s : '3']
150
+ set_format_flag('-C', val ? val.to_s : '3')
153
151
  }
154
152
  opts.on('-C NUM', Integer,
155
153
  'Output NUM lines of copied context.') { |val|
156
- $diff.format = ['-C', val.to_s]
154
+ set_format_flag('-C', val.to_s)
157
155
  }
158
156
  opts.on('-u[NUM]', '--unified[=NUM]', Integer,
159
157
  'Output NUM (default 3) lines of unified context. [!]') { |val|
160
- $diff.format = ['-U', val ? val.to_s : '3']
158
+ set_format_flag('-U', val ? val.to_s : '3')
161
159
  }
162
160
  opts.on('-U NUM', Integer,
163
161
  'Output NUM lines of unified context.') { |val|
164
- $diff.format = ['-U', val.to_s]
162
+ set_format_flag('-U', val.to_s)
165
163
  }
166
164
  opts.on('-L LABEL', '--label=LABEL',
167
165
  'Use LABEL instead of file name.') { |val|
@@ -182,25 +180,25 @@ usage: #{MYNAME} [flags] [files]
182
180
  opts.on('-e', '--ed[=-]', miniTrueClass,
183
181
  'Output an ed script.') { |val|
184
182
  if val
185
- $diff.format = ['-e', val]
183
+ set_format_flag('-e', val)
186
184
  end
187
185
  }
188
186
  opts.on('--normal[=-]', miniTrueClass,
189
187
  'Output a normal diff.') { |val|
190
188
  if val
191
- $diff.format = ['--normal', val]
189
+ set_format_flag('--normal', val)
192
190
  end
193
191
  }
194
192
  opts.on('-n', '--rcs[=-]', miniTrueClass,
195
193
  'Output an RCS format diff.') { |val|
196
194
  if val
197
- $diff.format = ['-n', val]
195
+ set_format_flag('-n', val)
198
196
  end
199
197
  }
200
198
  opts.on('-y', '--side-by-side[=-]', miniTrueClass,
201
199
  'Output in two columns.') { |val|
202
200
  if val
203
- $diff.format = ['-y', val]
201
+ set_format_flag('-y', val)
204
202
  end
205
203
  }
206
204
  opts.on('-W NUM', '--width=NUM', Integer,
@@ -217,35 +215,39 @@ usage: #{MYNAME} [flags] [files]
217
215
  }
218
216
  opts.on('-D NAME', '--ifdef=NAME',
219
217
  'Output merged file to show `#ifdef NAME\' diffs.') { |val|
220
- set_flag('-D', val)
218
+ set_format_flag('-D', val)
221
219
  }
222
220
  opts.on('--old-group-format=GFMT',
223
221
  'Format old input groups with GFMT.') { |val|
224
- set_flag('--old-group-format', val)
222
+ set_custom_format_flag('--old-group-format', val)
225
223
  }
226
224
  opts.on('--new-group-format=GFMT',
227
225
  'Format new input groups with GFMT.') { |val|
228
- set_flag('--new-group-format', val)
226
+ set_custom_format_flag('--new-group-format', val)
227
+ }
228
+ opts.on('--changed-group-format=GFMT',
229
+ 'Format changed input groups with GFMT.') { |val|
230
+ set_custom_format_flag('--changed-group-format', val)
229
231
  }
230
232
  opts.on('--unchanged-group-format=GFMT',
231
233
  'Format unchanged input groups with GFMT.') { |val|
232
- set_flag('--unchanged-group-format', val)
234
+ set_custom_format_flag('--unchanged-group-format', val)
233
235
  }
234
236
  opts.on('--line-format=LFMT',
235
237
  'Format all input lines with LFMT.') { |val|
236
- set_flag('--line-format', val)
238
+ set_custom_format_flag('--line-format', val)
237
239
  }
238
240
  opts.on('--old-line-format=LFMT',
239
241
  'Format old input lines with LFMT.') { |val|
240
- set_flag('--old-line-format', val)
242
+ set_custom_format_flag('--old-line-format', val)
241
243
  }
242
244
  opts.on('--new-line-format=LFMT',
243
245
  'Format new input lines with LFMT.') { |val|
244
- set_flag('--new-line-format', val)
246
+ set_custom_format_flag('--new-line-format', val)
245
247
  }
246
248
  opts.on('--unchanged-line-format=LFMT',
247
249
  'Format unchanged input lines with LFMT.') { |val|
248
- set_flag('--unchanged-line-format', val)
250
+ set_custom_format_flag('--unchanged-line-format', val)
249
251
  }
250
252
  opts.on('-l', '--paginate[=-]', miniTrueClass,
251
253
  'Pass the output through `pr\' to paginate it.') { |val|
@@ -338,14 +340,15 @@ usage: #{MYNAME} [flags] [files]
338
340
 
339
341
  begin
340
342
  opts.parse('--rsync-exclude', '--fignore-exclude', '--ignore-cvs-lines',
341
- '-N', '-r', '-p', '-d')
343
+ '-U3', '-N', '-r', '-p', '-d')
342
344
  opts.parse!(args)
343
345
 
344
- $diff.format ||= ['-U', '3']
345
- set_flag(*$diff.format)
346
+ $diff.format_flags.each { |format_flag|
347
+ set_flag(*format_flag)
348
+ }
346
349
 
347
350
  if $diff.ignore_cvs_lines
348
- opts.parse('--ignore-matching-lines=\$[A-Z][A-Za-z0-9][A-Za-z0-9]*\(:.*\)\{0,1\}\$')
351
+ opts.parse('--ignore-matching-lines="^[^\x1b]*\$[A-Z][A-Za-z0-9][A-Za-z0-9]*\(:.*\)\{0,1\}\$')
349
352
  end
350
353
  rescue OptionParser::ParseError => e
351
354
  warn e, "Try `#{MYNAME} --help' for more information."
@@ -403,6 +406,20 @@ def set_flag(flag, val)
403
406
  end
404
407
  end
405
408
 
409
+ def set_format_flag(flag, *val)
410
+ $diff.format_flags.clear
411
+ $diff.custom_format_p = false
412
+ $diff.format_flags.push([flag, *val])
413
+ end
414
+
415
+ def set_custom_format_flag(flag, *val)
416
+ if !$diff.custom_format_p
417
+ $diff.format_flags.clear
418
+ $diff.custom_format_p = true
419
+ end
420
+ $diff.format_flags.push([flag, *val])
421
+ end
422
+
406
423
  def diff_main
407
424
  $status = 0
408
425
 
data/di.gemspec ADDED
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{di}
8
+ s.version = "0.1.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Akinori MUSHA"]
12
+ s.date = %q{2010-03-10}
13
+ s.default_executable = %q{di}
14
+ s.description = %q{The di(1) command wraps around GNU diff(1) to provide reasonable
15
+ default settings and some original features.
16
+ }
17
+ s.email = %q{knu@idaemons.org}
18
+ s.executables = ["di"]
19
+ s.extra_rdoc_files = [
20
+ "LICENSE",
21
+ "README.rdoc"
22
+ ]
23
+ s.files = [
24
+ ".document",
25
+ ".gitignore",
26
+ "HISTORY",
27
+ "LICENSE",
28
+ "README.rdoc",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "bin/di",
32
+ "di.gemspec",
33
+ "test/helper.rb",
34
+ "test/test_di.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/knu/di}
37
+ s.rdoc_options = ["--charset=UTF-8"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.6}
40
+ s.summary = %q{A wrapper around GNU diff(1)}
41
+ s.test_files = [
42
+ "test/helper.rb",
43
+ "test/test_di.rb"
44
+ ]
45
+
46
+ if s.respond_to? :specification_version then
47
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
57
+ end
58
+ end
59
+
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'di'
8
+
9
+ class Test::Unit::TestCase
10
+ end
data/test/test_di.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestDi < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: di
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 3
9
+ version: 0.1.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Akinori MUSHA
@@ -9,47 +14,75 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2008-10-06 00:00:00 +09:00
13
- default_executable:
14
- dependencies: []
17
+ date: 2010-03-10 00:00:00 +09:00
18
+ default_executable: di
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thoughtbot-shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: |
33
+ The di(1) command wraps around GNU diff(1) to provide reasonable
34
+ default settings and some original features.
15
35
 
16
- description:
17
36
  email: knu@idaemons.org
18
37
  executables:
19
38
  - di
20
39
  extensions: []
21
40
 
22
- extra_rdoc_files: []
23
-
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
24
44
  files:
45
+ - .document
46
+ - .gitignore
47
+ - HISTORY
48
+ - LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - VERSION
25
52
  - bin/di
26
- - README.txt
27
- - History.txt
28
- has_rdoc: false
29
- homepage: http://www.idaemons.org/projects/di/
30
- post_install_message:
31
- rdoc_options: []
53
+ - di.gemspec
54
+ - test/helper.rb
55
+ - test/test_di.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/knu/di
58
+ licenses: []
32
59
 
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
33
63
  require_paths:
34
64
  - lib
35
65
  required_ruby_version: !ruby/object:Gem::Requirement
36
66
  requirements:
37
67
  - - ">="
38
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
39
71
  version: "0"
40
- version:
41
72
  required_rubygems_version: !ruby/object:Gem::Requirement
42
73
  requirements:
43
74
  - - ">="
44
75
  - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
45
78
  version: "0"
46
- version:
47
79
  requirements: []
48
80
 
49
- rubyforge_project: unixutils
50
- rubygems_version: 1.0.1
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.6
51
83
  signing_key:
52
- specification_version: 2
84
+ specification_version: 3
53
85
  summary: A wrapper around GNU diff(1)
54
- test_files: []
55
-
86
+ test_files:
87
+ - test/helper.rb
88
+ - test/test_di.rb
data/History.txt DELETED
@@ -1,3 +0,0 @@
1
- == 0.1.1 2008-10-06
2
-
3
- * Initial release