progress 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/lib/progress.rb +14 -2
  3. data/progress.gemspec +17 -19
  4. metadata +6 -7
  5. data/.gitignore +0 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
data/lib/progress.rb CHANGED
@@ -4,7 +4,7 @@ class Progress
4
4
  include Singleton
5
5
 
6
6
  module InstanceMethods # :nodoc:
7
- attr_accessor :title, :current, :total
7
+ attr_accessor :title, :current, :total, :note
8
8
  attr_reader :current_step
9
9
  def initialize(title, total)
10
10
  if title.is_a?(Numeric) && total.nil?
@@ -91,6 +91,7 @@ class Progress
91
91
  elsif block
92
92
  block.call
93
93
  end
94
+ self.note = nil
94
95
  end
95
96
 
96
97
  def set(value, &block)
@@ -121,6 +122,12 @@ class Progress
121
122
  end
122
123
  end
123
124
 
125
+ def note=(s)
126
+ if levels.last
127
+ levels.last.note = s
128
+ end
129
+ end
130
+
124
131
  attr_writer :lines, :highlight # :nodoc:
125
132
 
126
133
  private
@@ -208,10 +215,15 @@ class Progress
208
215
  message = "#{parts.reverse * ' > '}#{eta_string}"
209
216
  message_cl = "#{parts_cl.reverse * ' > '}#{eta_string}"
210
217
 
218
+ if note = levels.last.note
219
+ message << " - #{note}"
220
+ message_cl << " - #{note}"
221
+ end
222
+
211
223
  unless lines?
212
224
  previous_length = @previous_length || 0
213
225
  @previous_length = message_cl.length
214
- message = "#{message}#{' ' * [previous_length - message_cl.length, 0].max}\r"
226
+ message << "#{' ' * [previous_length - message_cl.length, 0].max}\r"
215
227
  end
216
228
 
217
229
  lines? ? io.puts(message) : io.print(message)
data/progress.gemspec CHANGED
@@ -1,42 +1,40 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{progress}
8
- s.version = "1.0.1"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Boba Fat"]
12
- s.date = %q{2010-11-14}
12
+ s.date = %q{2010-12-07}
13
13
  s.extra_rdoc_files = [
14
14
  "README.rdoc"
15
15
  ]
16
16
  s.files = [
17
- ".gitignore",
18
- "Manifest",
19
- "README.rdoc",
20
- "Rakefile",
21
- "VERSION",
22
- "lib/progress.rb",
23
- "lib/progress/active_record.rb",
24
- "lib/progress/enumerable.rb",
25
- "lib/progress/integer.rb",
26
- "lib/progress/kernel.rb",
27
- "lib/progress/with_progress.rb",
28
- "progress.gemspec",
29
- "spec/progress_spec.rb",
30
- "spec/spec_helper.rb"
17
+ "Manifest",
18
+ "README.rdoc",
19
+ "Rakefile",
20
+ "VERSION",
21
+ "lib/progress.rb",
22
+ "lib/progress/active_record.rb",
23
+ "lib/progress/enumerable.rb",
24
+ "lib/progress/integer.rb",
25
+ "lib/progress/kernel.rb",
26
+ "lib/progress/with_progress.rb",
27
+ "progress.gemspec",
28
+ "spec/progress_spec.rb",
29
+ "spec/spec_helper.rb"
31
30
  ]
32
31
  s.homepage = %q{http://github.com/toy/progress}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
32
  s.require_paths = ["lib"]
35
33
  s.rubygems_version = %q{1.3.7}
36
34
  s.summary = %q{Show progress of long running tasks}
37
35
  s.test_files = [
38
36
  "spec/progress_spec.rb",
39
- "spec/spec_helper.rb"
37
+ "spec/spec_helper.rb"
40
38
  ]
41
39
 
42
40
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 0
9
8
  - 1
10
- version: 1.0.1
9
+ - 0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Boba Fat
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-14 00:00:00 +03:00
18
+ date: 2010-12-07 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,7 +28,6 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - README.rdoc
30
30
  files:
31
- - .gitignore
32
31
  - Manifest
33
32
  - README.rdoc
34
33
  - Rakefile
@@ -47,8 +46,8 @@ homepage: http://github.com/toy/progress
47
46
  licenses: []
48
47
 
49
48
  post_install_message:
50
- rdoc_options:
51
- - --charset=UTF-8
49
+ rdoc_options: []
50
+
52
51
  require_paths:
53
52
  - lib
54
53
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- .DS_Store
2
- pkg
3
- doc
4
- *.gem
5
- *.swp