progress 0.1.1.0 → 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
+ require 'pathname'
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
  require 'rake/clean'
4
5
  require 'fileutils'
5
6
  require 'echoe'
6
7
 
7
- version = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml')).join('.') rescue nil
8
+ version = YAML.load_file(Pathname(__FILE__).dirname + 'VERSION.yml').join('.') rescue nil
8
9
 
9
10
  echoe = Echoe.new('progress', version) do |p|
10
11
  p.author = 'toy'
@@ -12,8 +13,10 @@ echoe = Echoe.new('progress', version) do |p|
12
13
  end
13
14
 
14
15
  desc "Replace system gem with symlink to this folder"
15
- task :ghost do
16
- path = Gem.searcher.find(echoe.name).full_gem_path
17
- system 'sudo', 'rm', '-r', path
18
- symlink File.expand_path('.'), path
16
+ task 'ghost' do
17
+ gem_path = Pathname(Gem.searcher.find(echoe.name).full_gem_path)
18
+ current_path = Pathname('.').expand_path
19
+ cmd = gem_path.writable? && gem_path.parent.writable? ? %w() : %w(sudo)
20
+ system(*cmd + %W[rm -r #{gem_path}])
21
+ system(*cmd + %W[ln -s #{current_path} #{gem_path}])
19
22
  end
@@ -1 +1 @@
1
- [0, 1, 1, 0]
1
+ [0, 1, 1, 1]
@@ -131,10 +131,13 @@ class Progress
131
131
 
132
132
  def print_message
133
133
  messages = []
134
+ messages_hl = []
134
135
  inner = 0
135
136
  levels.reverse.each do |l|
136
137
  current = l.to_f(inner)
137
- messages << "#{l.title}: #{(current == 0 ? '......' : '%5.1f%%' % (current * 100.0))[0, 6]}"
138
+ value = current == 0 ? '......' : '%5.1f%%' % (current * 100.0)
139
+ messages << "#{l.title}: #{value}"
140
+ messages_hl << "#{l.title}: #{value == '100.0' ? value : "\e[1m#{value}\e[0m"}" if highlight?
138
141
  inner = current
139
142
  end
140
143
  message = messages.reverse * ' > '
@@ -145,7 +148,7 @@ class Progress
145
148
  message = message.ljust(previous_length, ' ') + "\r"
146
149
  end
147
150
 
148
- message.gsub!(/\d+\.\d+/){ |s| s == '100.0' ? s : "\e[1m#{s}\e[0m" } if highlight?
151
+ message = messages_hl.reverse * ' > ' if highlight?
149
152
 
150
153
  lines? ? io.puts(message) : io.print(message)
151
154
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{progress}
5
- s.version = "0.1.1.0"
5
+ s.version = "0.1.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["toy"]
9
- s.date = %q{2009-09-21}
9
+ s.date = %q{2009-09-28}
10
10
  s.description = %q{A library to show progress of long running tasks.}
11
11
  s.email = %q{}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/progress.rb", "lib/progress/enumerable.rb", "lib/progress/integer.rb", "lib/progress/with_progress.rb"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.0
4
+ version: 0.1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-21 00:00:00 +04:00
12
+ date: 2009-09-28 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15