ruby-progressbar 1.0.2 → 1.1.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.
- data/.ruby-version +1 -0
 - data/Gemfile +2 -1
 - data/README.md +46 -12
 - data/lib/progress_bar/base.rb +9 -6
 - data/lib/progress_bar/components.rb +1 -0
 - data/lib/progress_bar/components/bar.rb +1 -3
 - data/lib/progress_bar/components/elapsed_timer.rb +1 -1
 - data/lib/progress_bar/components/estimated_timer.rb +6 -2
 - data/lib/progress_bar/components/progressable.rb +1 -1
 - data/lib/progress_bar/components/throttle.rb +19 -0
 - data/lib/progress_bar/components/timer.rb +6 -2
 - data/lib/progress_bar/length_calculator.rb +1 -0
 - data/lib/progress_bar/version.rb +1 -1
 - data/ruby-progressbar.gemspec +9 -13
 - data/spec/progress_bar/base_spec.rb +46 -14
 - data/spec/progress_bar/components/elapsed_timer_spec.rb +0 -1
 - data/spec/progress_bar/components/estimated_timer_spec.rb +38 -0
 - data/spec/progress_bar/components/throttle_spec.rb +101 -0
 - data/spec/spec_helper.rb +2 -5
 - data/spec/support/{timecop.rb → time.rb} +0 -0
 - metadata +23 -53
 - data/.rvmrc +0 -1
 - data/Guardfile +0 -10
 - data/spec/support/focused.rb +0 -7
 
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            1.9.3
         
     | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -28,19 +28,27 @@ Installation 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            First:
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 32 
     | 
    
         
            +
            gem install ruby-progressbar
         
     | 
| 
      
 33 
     | 
    
         
            +
            ```
         
     | 
| 
       32 
34 
     | 
    
         | 
| 
       33 
35 
     | 
    
         
             
            Then in your script:
         
     | 
| 
       34 
36 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 37 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 38 
     | 
    
         
            +
            require 'ruby-progressbar'
         
     | 
| 
      
 39 
     | 
    
         
            +
            ```
         
     | 
| 
       36 
40 
     | 
    
         | 
| 
       37 
41 
     | 
    
         
             
            or in your Gemfile
         
     | 
| 
       38 
42 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 43 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 44 
     | 
    
         
            +
            gem 'ruby-progressbar'
         
     | 
| 
      
 45 
     | 
    
         
            +
            ```
         
     | 
| 
       40 
46 
     | 
    
         | 
| 
       41 
47 
     | 
    
         
             
            or from IRB
         
     | 
| 
       42 
48 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 50 
     | 
    
         
            +
            irb -r 'ruby-progressbar'
         
     | 
| 
      
 51 
     | 
    
         
            +
            ```
         
     | 
| 
       44 
52 
     | 
    
         | 
| 
       45 
53 
     | 
    
         
             
            Basic Usage
         
     | 
| 
       46 
54 
     | 
    
         
             
            --------------------------------
         
     | 
| 
         @@ -49,7 +57,9 @@ Basic Usage 
     | 
|
| 
       49 
57 
     | 
    
         | 
| 
       50 
58 
     | 
    
         
             
            It's simple to get started:
         
     | 
| 
       51 
59 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 61 
     | 
    
         
            +
            ProgressBar.create
         
     | 
| 
      
 62 
     | 
    
         
            +
            ```
         
     | 
| 
       53 
63 
     | 
    
         | 
| 
       54 
64 
     | 
    
         
             
            Creates a basic progress bar beginning at `0`, a total capacity of `100` and tells it to start.
         
     | 
| 
       55 
65 
     | 
    
         | 
| 
         @@ -59,7 +69,9 @@ Creates a basic progress bar beginning at `0`, a total capacity of `100` and tel 
     | 
|
| 
       59 
69 
     | 
    
         | 
| 
       60 
70 
     | 
    
         
             
            Every call to `#increment` will advance the bar by `1`. Therefore:
         
     | 
| 
       61 
71 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 73 
     | 
    
         
            +
            50.times { progressbar.increment }
         
     | 
| 
      
 74 
     | 
    
         
            +
            ```
         
     | 
| 
       63 
75 
     | 
    
         | 
| 
       64 
76 
     | 
    
         
             
            Would output an advancing line which would end up here:
         
     | 
| 
       65 
77 
     | 
    
         | 
| 
         @@ -72,7 +84,9 @@ Advanced Usage 
     | 
|
| 
       72 
84 
     | 
    
         | 
| 
       73 
85 
     | 
    
         
             
            If you would like to customize your prompt, you can pass options when you call `.create`.
         
     | 
| 
       74 
86 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 88 
     | 
    
         
            +
            ProgressBar.create(:title => "Items", :starting_at => 20, :total => 200)
         
     | 
| 
      
 89 
     | 
    
         
            +
            ```
         
     | 
| 
       76 
90 
     | 
    
         | 
| 
       77 
91 
     | 
    
         
             
            Will output:
         
     | 
| 
       78 
92 
     | 
    
         | 
| 
         @@ -145,7 +159,9 @@ You can use as many bar flags as you'd like, but if you do weird things, weird t 
     | 
|
| 
       145 
159 
     | 
    
         | 
| 
       146 
160 
     | 
    
         
             
            If you would like a bar with the elapsed time on the left and the percentage complete followed by the title on the right, you'd do this:
         
     | 
| 
       147 
161 
     | 
    
         | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
      
 162 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 163 
     | 
    
         
            +
            ProgressBar.create(:format => '%a %B %p%% %t')
         
     | 
| 
      
 164 
     | 
    
         
            +
            ```
         
     | 
| 
       149 
165 
     | 
    
         | 
| 
       150 
166 
     | 
    
         
             
            Which will output something like this:
         
     | 
| 
       151 
167 
     | 
    
         | 
| 
         @@ -153,7 +169,9 @@ Which will output something like this: 
     | 
|
| 
       153 
169 
     | 
    
         | 
| 
       154 
170 
     | 
    
         
             
            Hard to see where the bar is?  Just add your own end caps, whatever you'd like.  Like so:
         
     | 
| 
       155 
171 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 172 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 173 
     | 
    
         
            +
            ProgressBar.create(:format => '%a <%B> %p%% %t')
         
     | 
| 
      
 174 
     | 
    
         
            +
            ```
         
     | 
| 
       157 
175 
     | 
    
         | 
| 
       158 
176 
     | 
    
         
             
            Becomes:
         
     | 
| 
       159 
177 
     | 
    
         | 
| 
         @@ -161,7 +179,9 @@ Becomes: 
     | 
|
| 
       161 
179 
     | 
    
         | 
| 
       162 
180 
     | 
    
         
             
            Want to put an end cap on your bar? Nothing special, just use the bar flag `%b` combined with the incomplete space flag `%i` like so:
         
     | 
| 
       163 
181 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
      
 182 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 183 
     | 
    
         
            +
            ProgressBar.create(:format => '%a |%b>>%i| %p%% %t', :starting_at => 10)
         
     | 
| 
      
 184 
     | 
    
         
            +
            ```
         
     | 
| 
       165 
185 
     | 
    
         | 
| 
       166 
186 
     | 
    
         
             
            Becomes:
         
     | 
| 
       167 
187 
     | 
    
         | 
| 
         @@ -173,7 +193,9 @@ Notice that the absolute length doesn't get any longer, the bar just shrinks to 
     | 
|
| 
       173 
193 
     | 
    
         | 
| 
       174 
194 
     | 
    
         
             
            By default, the progressbar will try to be as smart as possible about how wide it can be.  Under most Unix systems, it should be as wide as the terminal will allow while still fitting on one line.  If you wish to override this behavior, you can pass in the `:length` option when creating the bar like so:
         
     | 
| 
       175 
195 
     | 
    
         | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 196 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 197 
     | 
    
         
            +
            ProgressBar.create(:length => 40)
         
     | 
| 
      
 198 
     | 
    
         
            +
            ```
         
     | 
| 
       177 
199 
     | 
    
         | 
| 
       178 
200 
     | 
    
         
             
            Additionally, if you don't have access to the code calling the progressbar itself (say if you're using a gem like Fuubar), you can set the `RUBY_PROGRESS_BAR_LENGTH` environment variable and it will always override any other setting.
         
     | 
| 
       179 
201 
     | 
    
         | 
| 
         @@ -201,7 +223,9 @@ __RUBY PROGRESS BAR TO THE RESCUE!__ 
     | 
|
| 
       201 
223 
     | 
    
         | 
| 
       202 
224 
     | 
    
         
             
            Thanks to [@L2G](https://github.com/L2G) and 'the maths' you can pass the `:smoothing` option when creating a new bar and it will use an exponentially smoothed average rather than a linear one.  A value of `0.0` means no smoothing and is equivalent to the classic behavior.  A value of `1.0` is the maximum amount of smoothing.  Any values between those two are valid. `0.1` is the default.
         
     | 
| 
       203 
225 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 226 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 227 
     | 
    
         
            +
            ProgressBar.create(:smoothing => 0.6)
         
     | 
| 
      
 228 
     | 
    
         
            +
            ```
         
     | 
| 
       205 
229 
     | 
    
         | 
| 
       206 
230 
     | 
    
         
             
            #### Time Mocking Support
         
     | 
| 
       207 
231 
     | 
    
         | 
| 
         @@ -210,6 +234,16 @@ When mocking time, the concept of when `now` is becomes distorted.  You can imag 
     | 
|
| 
       210 
234 
     | 
    
         
             
              * [Timecop](https://github.com/jtrupiano/timecop)
         
     | 
| 
       211 
235 
     | 
    
         
             
              * [Delorean](https://github.com/bebanjo/delorean)
         
     | 
| 
       212 
236 
     | 
    
         | 
| 
      
 237 
     | 
    
         
            +
            ### Throttling
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
            When reporting progress of large amounts of very fast operations, whose duration is comparable to the output time of a progress bar, it becomes desirable to throttle output to the console and only perform it once in a set period. ProgressBar supports throttling if given `:throttle_rate` option:
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                ProgressBar.create(:throttle_rate => 0.1)
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
            The above progress bar will output at most 10 times a second.
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            The default throttling rate if none is specified is 100 times per second (or 0.01)
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
       213 
247 
     | 
    
         
             
            Road Map
         
     | 
| 
       214 
248 
     | 
    
         
             
            --------------------------------
         
     | 
| 
       215 
249 
     | 
    
         
             
            We're planning on adding a bunch of really nice features to this gem over the next few weeks.  We want to keep the simple usage simple but allow for powerful features if they're needed.  Our `1.0` release is the first step in that direction.
         
     | 
    
        data/lib/progress_bar/base.rb
    CHANGED
    
    | 
         @@ -16,6 +16,7 @@ class ProgressBar 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  @bar                = Components::Bar.new(options)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  @estimated_time     = Components::EstimatedTimer.new(options)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  @elapsed_time       = Components::ElapsedTimer.new
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @throttle           = Components::Throttle.new(options)
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
                  start :at => options[:starting_at]
         
     | 
| 
       21 
22 
     | 
    
         
             
                end
         
     | 
| 
         @@ -150,13 +151,15 @@ class ProgressBar 
     | 
|
| 
       150 
151 
     | 
    
         
             
                def update
         
     | 
| 
       151 
152 
     | 
    
         
             
                  with_timers(:stop) if finished?
         
     | 
| 
       152 
153 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
                   
     | 
| 
       154 
     | 
    
         
            -
                     
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 154 
     | 
    
         
            +
                  @throttle.choke( finished? ) do
         
     | 
| 
      
 155 
     | 
    
         
            +
                    if length_changed?
         
     | 
| 
      
 156 
     | 
    
         
            +
                      clear
         
     | 
| 
      
 157 
     | 
    
         
            +
                      reset_length
         
     | 
| 
      
 158 
     | 
    
         
            +
                    end
         
     | 
| 
       157 
159 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
      
 160 
     | 
    
         
            +
                    output.print self.to_s + eol
         
     | 
| 
      
 161 
     | 
    
         
            +
                    output.flush
         
     | 
| 
      
 162 
     | 
    
         
            +
                  end
         
     | 
| 
       160 
163 
     | 
    
         
             
                end
         
     | 
| 
       161 
164 
     | 
    
         | 
| 
       162 
165 
     | 
    
         
             
                def eol
         
     | 
| 
         @@ -16,9 +16,7 @@ class ProgressBar 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                  def to_s(options = {:format => :standard})
         
     | 
| 
       18 
18 
     | 
    
         
             
                    completed_string = send(:"#{options[:format]}_complete_string")
         
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    "#{completed_string}#{empty_string}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    completed_string.ljust(length, ' ')
         
     | 
| 
       22 
20 
     | 
    
         
             
                  end
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
22 
     | 
    
         
             
                  def integrated_percentage_complete_string
         
     | 
| 
         @@ -11,7 +11,7 @@ class ProgressBar 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  def elapsed_time
         
     | 
| 
       12 
12 
     | 
    
         
             
                    return '--:--:--' unless started?
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                    hours, minutes, seconds = divide_seconds( 
     | 
| 
      
 14 
     | 
    
         
            +
                    hours, minutes, seconds = divide_seconds(elapsed_whole_seconds)
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                    sprintf TIME_FORMAT, hours, minutes, seconds
         
     | 
| 
       17 
17 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -46,11 +46,11 @@ class ProgressBar 
     | 
|
| 
       46 
46 
     | 
    
         
             
                  def average_seconds_per_each
         
     | 
| 
       47 
47 
     | 
    
         
             
                    return 0 if self.running_average.zero?
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                     
     | 
| 
      
 49 
     | 
    
         
            +
                    elapsed_whole_seconds.to_f / self.running_average
         
     | 
| 
       50 
50 
     | 
    
         
             
                  end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                  def estimated_seconds_remaining
         
     | 
| 
       53 
     | 
    
         
            -
                    ((average_seconds_per_each * self.total) -  
     | 
| 
      
 53 
     | 
    
         
            +
                    ((average_seconds_per_each * self.total) - elapsed_whole_seconds.to_f).floor
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                  def out_of_bounds_time
         
     | 
| 
         @@ -79,6 +79,10 @@ class ProgressBar 
     | 
|
| 
       79 
79 
     | 
    
         
             
                      @ancestor = ancestor
         
     | 
| 
       80 
80 
     | 
    
         
             
                    end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
      
 82 
     | 
    
         
            +
                    def start(*args, &blk)
         
     | 
| 
      
 83 
     | 
    
         
            +
                      @ancestor.instance_method(:start).bind(@subject).call(*args,&blk)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       82 
86 
     | 
    
         
             
                    def method_missing(sym, *args, &blk)
         
     | 
| 
       83 
87 
     | 
    
         
             
                      @ancestor.instance_method(sym).bind(@subject).call(*args,&blk)
         
     | 
| 
       84 
88 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class ProgressBar
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Components
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Throttle
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include Timer
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize(options = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @period = options.delete(:throttle_rate) { 0.01 }
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def choke(force = false, &block)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    if !started? || @period.nil? || force || elapsed_seconds >= @period
         
     | 
| 
      
 12 
     | 
    
         
            +
                      yield
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                      start
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -41,13 +41,17 @@ class ProgressBar 
     | 
|
| 
       41 
41 
     | 
    
         
             
                  end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                  def elapsed_seconds
         
     | 
| 
       44 
     | 
    
         
            -
                    ((@stopped_at || now) - @started_at) 
     | 
| 
      
 44 
     | 
    
         
            +
                    ((@stopped_at || now) - @started_at)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  def elapsed_whole_seconds
         
     | 
| 
      
 48 
     | 
    
         
            +
                    elapsed_seconds.floor
         
     | 
| 
       45 
49 
     | 
    
         
             
                  end
         
     | 
| 
       46 
50 
     | 
    
         | 
| 
       47 
51 
     | 
    
         
             
                  def elapsed_time
         
     | 
| 
       48 
52 
     | 
    
         
             
                    return '--:--:--' unless started?
         
     | 
| 
       49 
53 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                    hours, seconds =  
     | 
| 
      
 54 
     | 
    
         
            +
                    hours, seconds = elapsed_whole_seconds.divmod(3600)
         
     | 
| 
       51 
55 
     | 
    
         
             
                    minutes, seconds = seconds.divmod(60)
         
     | 
| 
       52 
56 
     | 
    
         | 
| 
       53 
57 
     | 
    
         
             
                    sprintf TIME_FORMAT, hours, minutes, seconds
         
     | 
    
        data/lib/progress_bar/version.rb
    CHANGED
    
    
    
        data/ruby-progressbar.gemspec
    CHANGED
    
    | 
         @@ -13,7 +13,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              s.authors               = ["thekompanee", "jfelchner"]
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.email                 = 'support@thekompanee.com'
         
     | 
| 
       16 
     | 
    
         
            -
              s.date                  =  
     | 
| 
      
 16 
     | 
    
         
            +
              s.date                  = Time.now
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.homepage              = 'https://github.com/jfelchner/ruby-progressbar'
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              s.summary               = 'Ruby/ProgressBar is a flexible text progress bar library for Ruby.'
         
     | 
| 
         @@ -23,21 +23,17 @@ The output can be customized with a flexible formatting system including: 
     | 
|
| 
       23 
23 
     | 
    
         
             
            percentage, bars of various formats, elapsed time and estimated time remaining.
         
     | 
| 
       24 
24 
     | 
    
         
             
            THEDOCTOR
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              s.rdoc_options          = [ 
     | 
| 
      
 26 
     | 
    
         
            +
              s.rdoc_options          = ['--charset', 'UTF-8']
         
     | 
| 
       27 
27 
     | 
    
         
             
              s.extra_rdoc_files      = %w[README.md LICENSE]
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
              #= Manifest =#
         
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
       31 
     | 
    
         
            -
              s.executables           =  
     | 
| 
       32 
     | 
    
         
            -
              s. 
     | 
| 
       33 
     | 
    
         
            -
              s.test_files            = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
      
 30 
     | 
    
         
            +
              s.files                 = `git ls-files`.split($/)
         
     | 
| 
      
 31 
     | 
    
         
            +
              s.executables           = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 32 
     | 
    
         
            +
              s.test_files            = s.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       34 
33 
     | 
    
         
             
              s.require_paths         = ["lib"]
         
     | 
| 
       35 
     | 
    
         
            -
              #= Manifest =#
         
     | 
| 
       36 
34 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
              s.add_development_dependency('rspec', 
     | 
| 
       38 
     | 
    
         
            -
              s.add_development_dependency(' 
     | 
| 
       39 
     | 
    
         
            -
              s.add_development_dependency(' 
     | 
| 
       40 
     | 
    
         
            -
              s.add_development_dependency(' 
     | 
| 
       41 
     | 
    
         
            -
              s.add_development_dependency('guard-rspec', '~> 2.1')
         
     | 
| 
       42 
     | 
    
         
            -
              s.add_development_dependency('rb-fsevent',  '~> 0.9')
         
     | 
| 
      
 35 
     | 
    
         
            +
              s.add_development_dependency('rspec',         '~> 2.13')
         
     | 
| 
      
 36 
     | 
    
         
            +
              s.add_development_dependency('rspectacular',  '~> 0.13')
         
     | 
| 
      
 37 
     | 
    
         
            +
              s.add_development_dependency('timecop',       '~> 0.6')
         
     | 
| 
      
 38 
     | 
    
         
            +
              s.add_development_dependency('simplecov',     '~> 0.8pre')
         
     | 
| 
       43 
39 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,11 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'stringio'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'timecop'
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
4 
     | 
    
         
             
            describe ProgressBar::Base do
         
     | 
| 
       6 
5 
     | 
    
         
             
              before do
         
     | 
| 
       7 
6 
     | 
    
         
             
                @output = StringIO.new('', 'w+')
         
     | 
| 
       8 
     | 
    
         
            -
                @progressbar = ProgressBar::Base.new(:output => @output, :length => 80)
         
     | 
| 
      
 7 
     | 
    
         
            +
                @progressbar = ProgressBar::Base.new(:output => @output, :length => 80, :throttle_rate => 0.0)
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              describe 'terminal width dropping below title length' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                it 'should not crash' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @progressbar = ProgressBar::Base.new(:output => @output)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @progressbar.stub(:terminal_width).and_return(100)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @progressbar.title = 'a'*95
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @progressbar.stub(:terminal_width).and_return(60)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @progressbar.title = 'a'*95
         
     | 
| 
      
 18 
     | 
    
         
            +
                  }.to_not raise_error
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
       9 
20 
     | 
    
         
             
              end
         
     | 
| 
       10 
21 
     | 
    
         | 
| 
       11 
22 
     | 
    
         
             
              context 'when a new bar is created' do
         
     | 
| 
         @@ -25,18 +36,39 @@ describe ProgressBar::Base do 
     | 
|
| 
       25 
36 
     | 
    
         
             
                  end
         
     | 
| 
       26 
37 
     | 
    
         | 
| 
       27 
38 
     | 
    
         
             
                  describe '#length' do
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
                       
     | 
| 
       30 
     | 
    
         
            -
                       
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                    context 'when the RUBY_PROGRESS_BAR_LENGTH environment variable exists' do
         
     | 
| 
      
 40 
     | 
    
         
            +
                      before  { ENV['RUBY_PROGRESS_BAR_LENGTH'] = '44' }
         
     | 
| 
      
 41 
     | 
    
         
            +
                      after   { ENV['RUBY_PROGRESS_BAR_LENGTH'] = nil }
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                      it 'returns the length of the environment variable as an integer' do
         
     | 
| 
      
 44 
     | 
    
         
            +
                        @progressbar = ProgressBar::Base.new
         
     | 
| 
      
 45 
     | 
    
         
            +
                        @progressbar.send(:length).should eql 44
         
     | 
| 
      
 46 
     | 
    
         
            +
                      end
         
     | 
| 
       32 
47 
     | 
    
         
             
                    end
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
48 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                       
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
                    context 'when the RUBY_PROGRESS_BAR_LENGTH environment variable does not exist' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                      before  { ENV['RUBY_PROGRESS_BAR_LENGTH'] = nil }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                      context 'but the length option was passed in' do
         
     | 
| 
      
 53 
     | 
    
         
            +
                        it 'returns the length specified in the option' do
         
     | 
| 
      
 54 
     | 
    
         
            +
                          @progressbar = ProgressBar::Base.new(:length => 88)
         
     | 
| 
      
 55 
     | 
    
         
            +
                          @progressbar.send(:length).should eql 88
         
     | 
| 
      
 56 
     | 
    
         
            +
                        end
         
     | 
| 
      
 57 
     | 
    
         
            +
                      end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                      context 'and no length option was passed in' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                        it 'returns the width of the terminal if it is a Unix environment' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                          @progressbar.stub(:terminal_width).and_return(99)
         
     | 
| 
      
 62 
     | 
    
         
            +
                          @progressbar.send(:reset_length)
         
     | 
| 
      
 63 
     | 
    
         
            +
                          @progressbar.send(:length).should eql 99
         
     | 
| 
      
 64 
     | 
    
         
            +
                        end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                        it 'returns 80 if it is not a Unix environment' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                          @progressbar.stub(:unix?).and_return(false)
         
     | 
| 
      
 68 
     | 
    
         
            +
                          @progressbar.send(:reset_length)
         
     | 
| 
      
 69 
     | 
    
         
            +
                          @progressbar.send(:length).should eql 80
         
     | 
| 
      
 70 
     | 
    
         
            +
                        end
         
     | 
| 
      
 71 
     | 
    
         
            +
                      end
         
     | 
| 
       40 
72 
     | 
    
         
             
                    end
         
     | 
| 
       41 
73 
     | 
    
         
             
                  end
         
     | 
| 
       42 
74 
     | 
    
         
             
                end
         
     | 
| 
         @@ -122,7 +154,7 @@ describe ProgressBar::Base do 
     | 
|
| 
       122 
154 
     | 
    
         | 
| 
       123 
155 
     | 
    
         
             
              context 'when a bar is started' do
         
     | 
| 
       124 
156 
     | 
    
         
             
                before do
         
     | 
| 
       125 
     | 
    
         
            -
                  @progressbar = ProgressBar::Base.new(:starting_at => 0, :total => 100, :output => @output, :length => 80)
         
     | 
| 
      
 157 
     | 
    
         
            +
                  @progressbar = ProgressBar::Base.new(:starting_at => 0, :total => 100, :output => @output, :length => 80, :throttle_rate  => 0.0)
         
     | 
| 
       126 
158 
     | 
    
         
             
                end
         
     | 
| 
       127 
159 
     | 
    
         | 
| 
       128 
160 
     | 
    
         
             
                context 'and it is incremented any number of times' do
         
     | 
| 
         @@ -218,7 +250,7 @@ describe ProgressBar::Base do 
     | 
|
| 
       218 
250 
     | 
    
         
             
              end
         
     | 
| 
       219 
251 
     | 
    
         | 
| 
       220 
252 
     | 
    
         
             
              context 'when the bar has not been completed' do
         
     | 
| 
       221 
     | 
    
         
            -
                before { @progressbar = ProgressBar::Base.new(:length => 112, :starting_at => 0, :total => 50, :output => @output) }
         
     | 
| 
      
 253 
     | 
    
         
            +
                before { @progressbar = ProgressBar::Base.new(:length => 112, :starting_at => 0, :total => 50, :output => @output, :throttle_rate => 0.0) }
         
     | 
| 
       222 
254 
     | 
    
         | 
| 
       223 
255 
     | 
    
         
             
                describe '#increment' do
         
     | 
| 
       224 
256 
     | 
    
         
             
                  before { @progressbar.increment }
         
     | 
| 
         @@ -170,4 +170,42 @@ describe ProgressBar::Components::EstimatedTimer do 
     | 
|
| 
       170 
170 
     | 
    
         
             
                  end
         
     | 
| 
       171 
171 
     | 
    
         
             
                end
         
     | 
| 
       172 
172 
     | 
    
         
             
              end
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
              describe '#start' do
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                ###
         
     | 
| 
      
 177 
     | 
    
         
            +
                # Using ruby-debug under jruby pulls in ruby-debug-base, which defines
         
     | 
| 
      
 178 
     | 
    
         
            +
                # Kernel.start. This causes a bug, as EstimatedTimer::As::method_missing calls
         
     | 
| 
      
 179 
     | 
    
         
            +
                # Kernel.start instead of EstimatedTimer.start. This spec duplicates the bug.
         
     | 
| 
      
 180 
     | 
    
         
            +
                # Without the fix, this results in the following exception:
         
     | 
| 
      
 181 
     | 
    
         
            +
                #
         
     | 
| 
      
 182 
     | 
    
         
            +
                # 1) ruby-debug-base doesn't stop the progressbar from working
         
     | 
| 
      
 183 
     | 
    
         
            +
                #    Failure/Error: COUNT.times { bar.increment }
         
     | 
| 
      
 184 
     | 
    
         
            +
                #    NoMethodError:
         
     | 
| 
      
 185 
     | 
    
         
            +
                #      undefined method `+' for nil:NilClass
         
     | 
| 
      
 186 
     | 
    
         
            +
                #    # ./lib/progress_bar/components/progressable.rb:33:in `increment'
         
     | 
| 
      
 187 
     | 
    
         
            +
                #
         
     | 
| 
      
 188 
     | 
    
         
            +
                it 'properly delegates' do
         
     | 
| 
      
 189 
     | 
    
         
            +
                  @output = StringIO.new('', 'w+')
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                  module Kernel
         
     | 
| 
      
 192 
     | 
    
         
            +
                    def start(options={}, &block)
         
     | 
| 
      
 193 
     | 
    
         
            +
                      puts "Kernel.start has been called"
         
     | 
| 
      
 194 
     | 
    
         
            +
                      return nil
         
     | 
| 
      
 195 
     | 
    
         
            +
                    end
         
     | 
| 
      
 196 
     | 
    
         
            +
                  end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 199 
     | 
    
         
            +
                    COUNT = 100
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                    bar = ProgressBar.create(:output => @output, :title => 'ruby-debug-base', :total => COUNT)
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                    COUNT.times { bar.increment }
         
     | 
| 
      
 204 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 205 
     | 
    
         
            +
                    module Kernel
         
     | 
| 
      
 206 
     | 
    
         
            +
                      remove_method :start
         
     | 
| 
      
 207 
     | 
    
         
            +
                    end
         
     | 
| 
      
 208 
     | 
    
         
            +
                  end
         
     | 
| 
      
 209 
     | 
    
         
            +
                end
         
     | 
| 
      
 210 
     | 
    
         
            +
              end
         
     | 
| 
       173 
211 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,101 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'timecop'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe ProgressBar::Components::Throttle do
         
     | 
| 
      
 5 
     | 
    
         
            +
              context 'given a numeric period' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                before do
         
     | 
| 
      
 7 
     | 
    
         
            +
                  Timecop.freeze(0) {
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @throttle = ProgressBar::Components::Throttle.new(:throttle_rate => 10)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  }
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                describe '#choke' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  it 'yields the first time' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                    yielded = false
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                    @throttle.choke { yielded = true }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    yielded.should be_true
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  context 'after initial yield' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 23 
     | 
    
         
            +
                      Timecop.freeze(0) { @throttle.choke { } }
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    it "doesn't yield if period hasn't passed yet" do
         
     | 
| 
      
 27 
     | 
    
         
            +
                      yielded = false
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                      (1..9).each do |t|
         
     | 
| 
      
 30 
     | 
    
         
            +
                        Timecop.freeze(t) { @throttle.choke { yielded = true } }
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                        yielded.should be_false
         
     | 
| 
      
 33 
     | 
    
         
            +
                      end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    it 'always yields if passed true' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                      yielded = -1
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                      (0..25).each do |t|
         
     | 
| 
      
 40 
     | 
    
         
            +
                        Timecop.freeze(t) { @throttle.choke(true) { yielded += 1 } }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                        yielded.should == t
         
     | 
| 
      
 43 
     | 
    
         
            +
                      end
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    it "yields after period has passed" do
         
     | 
| 
      
 47 
     | 
    
         
            +
                      yielded = false
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                      Timecop.freeze(15) { @throttle.choke { yielded = true } }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                      yielded.should be_true
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  context 'after a yield' do
         
     | 
| 
      
 56 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 57 
     | 
    
         
            +
                      Timecop.freeze(0) { @throttle.choke { } }
         
     | 
| 
      
 58 
     | 
    
         
            +
                      Timecop.freeze(15) { @throttle.choke { } }
         
     | 
| 
      
 59 
     | 
    
         
            +
                    end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                    it "doesn't yield if period hasn't passed yet" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                      yielded = false
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                      (16..24).each do |t|
         
     | 
| 
      
 65 
     | 
    
         
            +
                        Timecop.freeze(t) { @throttle.choke { yielded = true } }
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                        yielded.should be_false
         
     | 
| 
      
 68 
     | 
    
         
            +
                      end
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                    it "yields after period has passed" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                      yielded = false
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                      Timecop.freeze(25) { @throttle.choke { yielded = true } }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                      yielded.should be_true
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
              context 'given no throttle period' do
         
     | 
| 
      
 83 
     | 
    
         
            +
                before do
         
     | 
| 
      
 84 
     | 
    
         
            +
                  Timecop.freeze(0) {
         
     | 
| 
      
 85 
     | 
    
         
            +
                    @throttle = ProgressBar::Components::Throttle.new()
         
     | 
| 
      
 86 
     | 
    
         
            +
                  }
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                describe '#choke' do
         
     | 
| 
      
 90 
     | 
    
         
            +
                  it 'yields every time' do
         
     | 
| 
      
 91 
     | 
    
         
            +
                    yielded = -1
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                    (0..25).each do |t|
         
     | 
| 
      
 94 
     | 
    
         
            +
                      Timecop.freeze(t) { @throttle.choke { yielded += 1 } }
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                      yielded.should == t
         
     | 
| 
      
 97 
     | 
    
         
            +
                    end
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
      
 101 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,13 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'simplecov'
         
     | 
| 
       2 
2 
     | 
    
         
             
            SimpleCov.start
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            require 'mathn'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'rspec'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            Dir[File.join(File.dirname(__FILE__), '..', 'lib', 'ruby-progressbar.rb')].each {|f| require f}
         
     | 
| 
       7 
8 
     | 
    
         
             
            Dir[File.join(File.dirname(__FILE__), '..', 'spec', 'support', '**', '*.rb')].each {|f| require f}
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              c.treat_symbols_as_metadata_keys_with_true_values = true
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              c.mock_with :rspec
         
     | 
| 
       13 
     | 
    
         
            -
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'rspectacular'
         
     | 
| 
         
            File without changes
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ruby-progressbar
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date:  
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2013-05-29 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: rspec
         
     | 
| 
         @@ -19,7 +19,7 @@ dependencies: 
     | 
|
| 
       19 
19 
     | 
    
         
             
                requirements:
         
     | 
| 
       20 
20 
     | 
    
         
             
                - - ~>
         
     | 
| 
       21 
21 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
     | 
    
         
            -
                    version: '2. 
     | 
| 
      
 22 
     | 
    
         
            +
                    version: '2.13'
         
     | 
| 
       23 
23 
     | 
    
         
             
              type: :development
         
     | 
| 
       24 
24 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
25 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -27,31 +27,15 @@ dependencies: 
     | 
|
| 
       27 
27 
     | 
    
         
             
                requirements:
         
     | 
| 
       28 
28 
     | 
    
         
             
                - - ~>
         
     | 
| 
       29 
29 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       30 
     | 
    
         
            -
                    version: '2. 
     | 
| 
      
 30 
     | 
    
         
            +
                    version: '2.13'
         
     | 
| 
       31 
31 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       32 
     | 
    
         
            -
              name:  
     | 
| 
       33 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       34 
     | 
    
         
            -
                none: false
         
     | 
| 
       35 
     | 
    
         
            -
                requirements:
         
     | 
| 
       36 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       37 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       38 
     | 
    
         
            -
                    version: '0.5'
         
     | 
| 
       39 
     | 
    
         
            -
              type: :development
         
     | 
| 
       40 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       41 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       42 
     | 
    
         
            -
                none: false
         
     | 
| 
       43 
     | 
    
         
            -
                requirements:
         
     | 
| 
       44 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       45 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       46 
     | 
    
         
            -
                    version: '0.5'
         
     | 
| 
       47 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
     | 
    
         
            -
              name: simplecov
         
     | 
| 
      
 32 
     | 
    
         
            +
              name: rspectacular
         
     | 
| 
       49 
33 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       50 
34 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
35 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
36 
     | 
    
         
             
                - - ~>
         
     | 
| 
       53 
37 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 38 
     | 
    
         
            +
                    version: '0.13'
         
     | 
| 
       55 
39 
     | 
    
         
             
              type: :development
         
     | 
| 
       56 
40 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
41 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -59,31 +43,15 @@ dependencies: 
     | 
|
| 
       59 
43 
     | 
    
         
             
                requirements:
         
     | 
| 
       60 
44 
     | 
    
         
             
                - - ~>
         
     | 
| 
       61 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       62 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 46 
     | 
    
         
            +
                    version: '0.13'
         
     | 
| 
       63 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       64 
     | 
    
         
            -
              name:  
     | 
| 
       65 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       66 
     | 
    
         
            -
                none: false
         
     | 
| 
       67 
     | 
    
         
            -
                requirements:
         
     | 
| 
       68 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       69 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       70 
     | 
    
         
            -
                    version: '1.4'
         
     | 
| 
       71 
     | 
    
         
            -
              type: :development
         
     | 
| 
       72 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       73 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       74 
     | 
    
         
            -
                none: false
         
     | 
| 
       75 
     | 
    
         
            -
                requirements:
         
     | 
| 
       76 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       77 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       78 
     | 
    
         
            -
                    version: '1.4'
         
     | 
| 
       79 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       80 
     | 
    
         
            -
              name: guard-rspec
         
     | 
| 
      
 48 
     | 
    
         
            +
              name: timecop
         
     | 
| 
       81 
49 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       82 
50 
     | 
    
         
             
                none: false
         
     | 
| 
       83 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       84 
52 
     | 
    
         
             
                - - ~>
         
     | 
| 
       85 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       86 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0.6'
         
     | 
| 
       87 
55 
     | 
    
         
             
              type: :development
         
     | 
| 
       88 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       89 
57 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -91,15 +59,15 @@ dependencies: 
     | 
|
| 
       91 
59 
     | 
    
         
             
                requirements:
         
     | 
| 
       92 
60 
     | 
    
         
             
                - - ~>
         
     | 
| 
       93 
61 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       94 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 62 
     | 
    
         
            +
                    version: '0.6'
         
     | 
| 
       95 
63 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       96 
     | 
    
         
            -
              name:  
     | 
| 
      
 64 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
       97 
65 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       98 
66 
     | 
    
         
             
                none: false
         
     | 
| 
       99 
67 
     | 
    
         
             
                requirements:
         
     | 
| 
       100 
68 
     | 
    
         
             
                - - ~>
         
     | 
| 
       101 
69 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
     | 
    
         
            -
                    version:  
     | 
| 
      
 70 
     | 
    
         
            +
                    version: 0.8pre
         
     | 
| 
       103 
71 
     | 
    
         
             
              type: :development
         
     | 
| 
       104 
72 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       105 
73 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -107,7 +75,7 @@ dependencies: 
     | 
|
| 
       107 
75 
     | 
    
         
             
                requirements:
         
     | 
| 
       108 
76 
     | 
    
         
             
                - - ~>
         
     | 
| 
       109 
77 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version:  
     | 
| 
      
 78 
     | 
    
         
            +
                    version: 0.8pre
         
     | 
| 
       111 
79 
     | 
    
         
             
            description: ! 'Ruby/ProgressBar is an extremely flexible text progress bar library
         
     | 
| 
       112 
80 
     | 
    
         
             
              for Ruby.
         
     | 
| 
       113 
81 
     | 
    
         | 
| 
         @@ -125,11 +93,10 @@ extra_rdoc_files: 
     | 
|
| 
       125 
93 
     | 
    
         
             
            files:
         
     | 
| 
       126 
94 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       127 
95 
     | 
    
         
             
            - .rspec
         
     | 
| 
       128 
     | 
    
         
            -
            - . 
     | 
| 
      
 96 
     | 
    
         
            +
            - .ruby-version
         
     | 
| 
       129 
97 
     | 
    
         
             
            - .travis.yml
         
     | 
| 
       130 
98 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       131 
99 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       132 
     | 
    
         
            -
            - Guardfile
         
     | 
| 
       133 
100 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       134 
101 
     | 
    
         
             
            - README.md
         
     | 
| 
       135 
102 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -139,6 +106,7 @@ files: 
     | 
|
| 
       139 
106 
     | 
    
         
             
            - lib/progress_bar/components/elapsed_timer.rb
         
     | 
| 
       140 
107 
     | 
    
         
             
            - lib/progress_bar/components/estimated_timer.rb
         
     | 
| 
       141 
108 
     | 
    
         
             
            - lib/progress_bar/components/progressable.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/progress_bar/components/throttle.rb
         
     | 
| 
       142 
110 
     | 
    
         
             
            - lib/progress_bar/components/timer.rb
         
     | 
| 
       143 
111 
     | 
    
         
             
            - lib/progress_bar/depreciable.rb
         
     | 
| 
       144 
112 
     | 
    
         
             
            - lib/progress_bar/format.rb
         
     | 
| 
         @@ -158,17 +126,18 @@ files: 
     | 
|
| 
       158 
126 
     | 
    
         
             
            - spec/progress_bar/components/elapsed_timer_spec.rb
         
     | 
| 
       159 
127 
     | 
    
         
             
            - spec/progress_bar/components/estimated_timer_spec.rb
         
     | 
| 
       160 
128 
     | 
    
         
             
            - spec/progress_bar/components/progressable_spec.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - spec/progress_bar/components/throttle_spec.rb
         
     | 
| 
       161 
130 
     | 
    
         
             
            - spec/progress_bar/format/molecule_spec.rb
         
     | 
| 
       162 
131 
     | 
    
         
             
            - spec/progress_bar/running_average_calculator_spec.rb
         
     | 
| 
       163 
132 
     | 
    
         
             
            - spec/progress_bar/time_spec.rb
         
     | 
| 
       164 
133 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       165 
     | 
    
         
            -
            - spec/support/ 
     | 
| 
       166 
     | 
    
         
            -
            - spec/support/timecop.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - spec/support/time.rb
         
     | 
| 
       167 
135 
     | 
    
         
             
            homepage: https://github.com/jfelchner/ruby-progressbar
         
     | 
| 
       168 
136 
     | 
    
         
             
            licenses: []
         
     | 
| 
       169 
137 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       170 
138 
     | 
    
         
             
            rdoc_options:
         
     | 
| 
       171 
     | 
    
         
            -
            - --charset 
     | 
| 
      
 139 
     | 
    
         
            +
            - --charset
         
     | 
| 
      
 140 
     | 
    
         
            +
            - UTF-8
         
     | 
| 
       172 
141 
     | 
    
         
             
            require_paths:
         
     | 
| 
       173 
142 
     | 
    
         
             
            - lib
         
     | 
| 
       174 
143 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -185,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       185 
154 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       186 
155 
     | 
    
         
             
            requirements: []
         
     | 
| 
       187 
156 
     | 
    
         
             
            rubyforge_project: ruby-progressbar
         
     | 
| 
       188 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 157 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
       189 
158 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       190 
159 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       191 
160 
     | 
    
         
             
            summary: Ruby/ProgressBar is a flexible text progress bar library for Ruby.
         
     | 
| 
         @@ -196,9 +165,10 @@ test_files: 
     | 
|
| 
       196 
165 
     | 
    
         
             
            - spec/progress_bar/components/elapsed_timer_spec.rb
         
     | 
| 
       197 
166 
     | 
    
         
             
            - spec/progress_bar/components/estimated_timer_spec.rb
         
     | 
| 
       198 
167 
     | 
    
         
             
            - spec/progress_bar/components/progressable_spec.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - spec/progress_bar/components/throttle_spec.rb
         
     | 
| 
       199 
169 
     | 
    
         
             
            - spec/progress_bar/format/molecule_spec.rb
         
     | 
| 
       200 
170 
     | 
    
         
             
            - spec/progress_bar/running_average_calculator_spec.rb
         
     | 
| 
       201 
171 
     | 
    
         
             
            - spec/progress_bar/time_spec.rb
         
     | 
| 
       202 
172 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       203 
     | 
    
         
            -
            - spec/support/ 
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 173 
     | 
    
         
            +
            - spec/support/time.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            has_rdoc: 
         
     | 
    
        data/.rvmrc
    DELETED
    
    | 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            rvm ruby-1.9.3-p125@progressbar
         
     | 
    
        data/Guardfile
    DELETED
    
    
    
        data/spec/support/focused.rb
    DELETED
    
    | 
         @@ -1,7 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            RSpec.configure do |config|
         
     | 
| 
       2 
     | 
    
         
            -
              # Configure RSpec to run focused specs, and also respect the alias 'fit' for focused specs
         
     | 
| 
       3 
     | 
    
         
            -
              config.filter_run       :focused => true
         
     | 
| 
       4 
     | 
    
         
            -
              config.alias_example_to :fit, :focused => true
         
     | 
| 
       5 
     | 
    
         
            -
              config.alias_example_to :pit, :pending => true
         
     | 
| 
       6 
     | 
    
         
            -
              config.run_all_when_everything_filtered = true
         
     | 
| 
       7 
     | 
    
         
            -
            end
         
     |