progress 3.2.2 → 3.3.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDQ1YmVhMWRhNzgwNWY3NTA0NTlmMGEzMGFhYWU0MTQ3NWU4MTUxNw==
5
- data.tar.gz: !binary |-
6
- NzAwYjY4ZTIxMWM2ZmRhYjgxYzkxNTFjN2E1YzVjMGJlYjhiYTM0MA==
2
+ SHA1:
3
+ metadata.gz: 28daf08a98f0ba97f2a5f1ac8898842319d5fea7
4
+ data.tar.gz: 4efe886e3d73b1bfbc8c1307bfa24086dd720138
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YjUwNzgyNTA4MjMzODQzNzAwYjE2N2UxNmFlYzM0Nzk0MWZiMjdhNTFhMzk1
10
- MzY4ZTAyY2I5N2MyMDU0ZTIyZjAwYWUyNTA1MDYwYTkyOWJiN2NhNGU4MTVj
11
- NTI4ZDcwY2MwMzRhYzA2OWExM2JjMGU5MmRkOWFmYTc2OGFhY2I=
12
- data.tar.gz: !binary |-
13
- YmEyNjdjZGQxM2E3ZGMwNGM0NGU0N2JiMWNlYmE1ZmFlNmU5YTE1NjU5MTIy
14
- OGM5YTYzOWQ2MDUzODU4MDI2OGFhNmVmZTc0MzBhODI0Y2Q2ZmRkMDVkZmI2
15
- MzNiYTE2YzRlOGVhMDQ4MTQ3MjA2MGMzMTNmYTNkYjdkNjBiYzE=
6
+ metadata.gz: 8268c6a60398b0feefae44c5ebc4d6c6fb1edb8f96bbecd8ff7ccc76f3da2c22dc3074360779e85bfa93bc5bae60321c9a5e612d2056db274922a29e16ea4a25
7
+ data.tar.gz: 4f73557125eb62d4c48607fa23b206947bbe41d8a308f493266f1acf1c5e71294267315aa0365ae20ee268bbed8dae99ea6339a20970411f559fb8b2ccb0df6c
data/.rubocop.yml CHANGED
@@ -3,11 +3,15 @@ AllCops:
3
3
  - '*.gemspec'
4
4
 
5
5
  Lint/EndAlignment:
6
- AlignWith: variable
6
+ EnforcedStyleAlignWith: variable
7
7
 
8
8
  Metrics/AbcSize:
9
9
  Max: 30
10
10
 
11
+ Metrics/BlockLength:
12
+ Exclude:
13
+ - spec/**/*_spec.rb
14
+
11
15
  Metrics/ClassLength:
12
16
  Max: 150
13
17
 
@@ -18,7 +22,7 @@ Metrics/MethodLength:
18
22
  Max: 20
19
23
 
20
24
  Metrics/ModuleLength:
21
- Max: 160
25
+ Max: 200
22
26
 
23
27
  Metrics/PerceivedComplexity:
24
28
  Max: 10
@@ -33,7 +37,7 @@ Style/BracesAroundHashParameters:
33
37
  Enabled: false
34
38
 
35
39
  Style/CaseIndentation:
36
- IndentWhenRelativeTo: end
40
+ EnforcedStyle: end
37
41
 
38
42
  Style/DotPosition:
39
43
  EnforcedStyle: trailing
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2016 Ivan Kuchin
1
+ Copyright (c) 2010-2017 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -137,4 +137,4 @@ Or if you know that B runs 9 times faster than C:
137
137
 
138
138
  ## Copyright
139
139
 
140
- Copyright (c) 2010-2016 Ivan Kuchin. See LICENSE.txt for details.
140
+ Copyright (c) 2010-2017 Ivan Kuchin. See LICENSE.txt for details.
@@ -92,6 +92,16 @@ class Progress
92
92
  @terminal_title = true && value
93
93
  end
94
94
 
95
+ attr_writer :io
96
+
97
+ def io
98
+ @io ||= $stderr
99
+ end
100
+
101
+ def io_tty?
102
+ io.tty? || ENV['PROGRESS_TTY']
103
+ end
104
+
95
105
  private
96
106
 
97
107
  attr_reader :eta
@@ -127,14 +137,6 @@ class Progress
127
137
  end
128
138
  end
129
139
 
130
- def io
131
- @io || $stderr
132
- end
133
-
134
- def io_tty?
135
- io.tty? || ENV['PROGRESS_TTY']
136
- end
137
-
138
140
  def start_beeper
139
141
  @beeper = Beeper.new(10) do
140
142
  print_message
data/progress.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'progress'
5
- s.version = '3.2.2'
5
+ s.version = '3.3.0'
6
6
  s.summary = %q{Show progress of long running tasks}
7
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
@@ -459,5 +459,57 @@ describe Progress do
459
459
  expect(io.string).to eq(reference_output)
460
460
  end
461
461
  end
462
+
463
+ describe '.io' do
464
+ it 'is $stderr by default' do
465
+ expect(Progress.io).to be $stderr
466
+ end
467
+
468
+ it 'is settable' do
469
+ io = StringIO.new
470
+
471
+ Progress.io = io
472
+
473
+ expect(Progress.io).to be io
474
+
475
+ Progress.io = nil
476
+ end
477
+
478
+ it 'is resettable' do
479
+ Progress.io = :something
480
+
481
+ expect(Progress.io).not_to be $stderr
482
+
483
+ Progress.io = nil
484
+
485
+ expect(Progress.io).to be $stderr
486
+ end
487
+ end
488
+
489
+ describe '.io_tty?' do
490
+ subject{ Progress.io_tty? }
491
+
492
+ let(:tty?){ false }
493
+ let(:progress_tty){ nil }
494
+
495
+ before do
496
+ allow(Progress.io).to receive(:tty?).and_return(tty?)
497
+ allow(ENV).to receive(:[]).with('PROGRESS_TTY').and_return(progress_tty)
498
+ end
499
+
500
+ it{ is_expected.not_to be_truthy }
501
+
502
+ context 'when io is tty' do
503
+ let(:tty?){ true }
504
+
505
+ it{ is_expected.to be_truthy }
506
+ end
507
+
508
+ context 'when PROGRESS_TTY' do
509
+ let(:tty?){ true }
510
+
511
+ it{ is_expected.to be_truthy }
512
+ end
513
+ end
462
514
  end
463
515
  end
metadata CHANGED
@@ -1,38 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :development
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: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.27'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.27'
27
41
  description:
28
42
  email:
29
43
  executables: []
30
44
  extensions: []
31
45
  extra_rdoc_files: []
32
46
  files:
33
- - .gitignore
34
- - .rubocop.yml
35
- - .travis.yml
47
+ - ".gitignore"
48
+ - ".rubocop.yml"
49
+ - ".travis.yml"
36
50
  - Gemfile
37
51
  - LICENSE.txt
38
52
  - README.markdown
@@ -58,21 +72,20 @@ require_paths:
58
72
  - lib
59
73
  required_ruby_version: !ruby/object:Gem::Requirement
60
74
  requirements:
61
- - - ! '>='
75
+ - - ">="
62
76
  - !ruby/object:Gem::Version
63
77
  version: '0'
64
78
  required_rubygems_version: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ! '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  requirements: []
70
84
  rubyforge_project: progress
71
- rubygems_version: 2.6.4
85
+ rubygems_version: 2.6.8
72
86
  signing_key:
73
87
  specification_version: 4
74
88
  summary: Show progress of long running tasks
75
89
  test_files:
76
90
  - spec/progress_spec.rb
77
91
  - spec/test.csv
78
- has_rdoc: