di 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +6 -0
  3. data/LICENSE +1 -1
  4. data/lib/di.rb +13 -5
  5. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 492fd8b1ee082ed8ee489760ef1d360b9f56d12a
4
- data.tar.gz: d2e3f3b24063143f279f5bb83889ec798b64127a
3
+ metadata.gz: 61c8f70aa068fb3d011c9baf120f8ec0b5978051
4
+ data.tar.gz: de784ceb4217db80523b59f63e6cb246bfa883a5
5
5
  SHA512:
6
- metadata.gz: e0951beceb1947defd0d710a4458ef9ce6835190b00bc19e8544f6fcb0b43949e2e13972f8e11441b46373461fe8b7a9174941cc235754d6131a48583d4f3bf8
7
- data.tar.gz: e870a6f3e215697edb356316b0ff77ddb07b98246b7974985a00ab91f305d929a5a0283e04d1ab0006bb41d82db43109d715e36bdaa20d216c1b4d3aaa20f809
6
+ metadata.gz: 35b97e1c80d0d57e95769997eec6c786e229564b2518e30a3df751356d7bc3db9987a2c72f31910ae6d4dd012fca4ea7aff097669323efb5940035cc425c8549
7
+ data.tar.gz: eabdb6553af81cec6b8ad8db3b7fb102e5caca21a1504d4b51955539d28c9d7092e56236d64681fcd0393afa2bbe317748f01029265ed44510312966f25a8925
data/HISTORY CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.4.3 2015-01-05
2
+
3
+ * Do not use colors if the terminal does not support colors.
4
+
5
+ * Do not invoke a pager when on a dumb terminal.
6
+
1
7
  == 0.4.2 2013-08-16
2
8
 
3
9
  * Do not close inherited file descriptors on invoking diff(1) so that
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Akinori MUSHA
1
+ Copyright (c) 2008-2015 Akinori MUSHA
2
2
 
3
3
  All rights reserved.
4
4
 
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, 2012, 2013 Akinori MUSHA
6
+ # Copyright (c) 2008-2015 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.4.2"
31
+ MYVERSION = "0.4.3"
32
32
  MYNAME = File.basename($0)
33
- MYCOPYRIGHT = "Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Akinori MUSHA"
33
+ MYCOPYRIGHT = "Copyright (c) 2008-2015 Akinori MUSHA"
34
34
 
35
35
  DIFF_CMD = ENV.fetch('DIFF', 'diff')
36
36
  ENV_NAME = "#{MYNAME.tr('-a-z', '_A-Z')}_OPTIONS"
@@ -114,6 +114,14 @@ def setup
114
114
  })
115
115
  end
116
116
 
117
+ def tty_color?
118
+ $stdout.tty? && `tput colors`.to_i >= 8
119
+ end
120
+
121
+ def tty_dumb?
122
+ !$stdout.tty? || ENV['TERM'] == 'dumb'
123
+ end
124
+
117
125
  def parse_args!(args)
118
126
  require 'optparse'
119
127
 
@@ -133,7 +141,7 @@ usage: #{MYNAME} [flags] [files]
133
141
 
134
142
  opts.on('--[no-]pager',
135
143
  'Pipe output into pager if stdout is a terminal. [+][*]') { |val|
136
- $diff.use_pager = val if $stdout.tty?
144
+ $diff.use_pager = val unless val && tty_dumb?
137
145
  }
138
146
  opts.on('--[no-]color[=WHEN]',
139
147
  'Colorize output if stdout is a terminal and the format is unified or context. [+][*]') { |val|
@@ -141,7 +149,7 @@ usage: #{MYNAME} [flags] [files]
141
149
  when true, 'always'
142
150
  $diff.colorize = true
143
151
  when 'auto'
144
- $diff.colorize = $stdout.tty?
152
+ $diff.colorize = tty_color?
145
153
  when false, 'never'
146
154
  $diff.colorize = false
147
155
  else
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: di
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-15 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.2
27
27
  description: |
@@ -36,8 +36,8 @@ extra_rdoc_files:
36
36
  - LICENSE
37
37
  - README.rdoc
38
38
  files:
39
- - .document
40
- - .gitignore
39
+ - ".document"
40
+ - ".gitignore"
41
41
  - HISTORY
42
42
  - LICENSE
43
43
  - README.rdoc
@@ -57,20 +57,21 @@ require_paths:
57
57
  - lib
58
58
  required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: 1.8.7
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
69
  rubyforge_project:
70
- rubygems_version: 2.0.3
70
+ rubygems_version: 2.2.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: A wrapper around GNU diff(1)
74
74
  test_files:
75
75
  - test/helper.rb
76
76
  - test/test_di.rb
77
+ has_rdoc: