seedman 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 533244e078edd3f71a2df73233f0c77826d7a76b
4
- data.tar.gz: 234f86a9e59ceb8dc6aba28259bb884d5234f33f
3
+ metadata.gz: 7cf5d52b4e3b7e89ad10033f826e8adf002d92a0
4
+ data.tar.gz: 40d7027c4c363869063003814e80f1ed4623a657
5
5
  SHA512:
6
- metadata.gz: 94b6f690077790eb8fb044be13c611ac5d89cf41eed2180a510887e4145828bb9b49bff6aa165fffc30450d2bf43d398e5a2fe10e8601ed57c5ad3a131fcb6e0
7
- data.tar.gz: a86522ef369d8094f7b34a5b39d9349fe8b462296d7328536b93fa8c2887f0a1639926a18c45828ba4ba345cf9077b99e13666400ec6d471fb4a4cdac77aa27b
6
+ metadata.gz: 88cc148cae9ef3ab4253a441f43dff7448f49832efd408e878f3a440c2577904aa7a6ddb20b6dd8ce06906eb607b84b7aab44ee78799abcc463dfd49b1863fc0
7
+ data.tar.gz: 9fe8adcd4ad553366d94f18e632aa6462428700dd76cfd3184fcd04a9b31ac0462dac380cbf7dd157b3c7a3f1c6f3f5211ff5de0d9486a7d3f6dcfb8df70b1b7
@@ -1,4 +1,5 @@
1
1
  require 'seedman/engine'
2
+ require 'seedman/base'
2
3
 
3
4
  module Seedman
4
5
  end
@@ -0,0 +1,43 @@
1
+ module Seedman
2
+ require 'ruby-progressbar'
3
+ class Base
4
+ attr_reader :title, :total_count, :store
5
+
6
+ def initialize(title: 'Выполнение... ', format: '%t [%c/%C] |%b>%i %p%% %e')
7
+ @total_count = 0
8
+ @procs = []
9
+ @progress = nil
10
+ @title = title
11
+ @format = format
12
+ @store = OpenStruct.new
13
+ end
14
+
15
+ def add(title, steps_count, &block)
16
+ @total_count += steps_count
17
+ @procs << [title, steps_count, block]
18
+ end
19
+
20
+ def process
21
+ @progress.stop if @progress.present? and not @progress.stopped?
22
+ @progress = ProgressBar.create(
23
+ title: title,
24
+ total: total_count,
25
+ format: @format,
26
+ progress_mark: '=',
27
+ remainder_mark: ' ',
28
+ starting_at: 0,
29
+ )
30
+ @procs.each do |proc_params|
31
+ title, steps_count, block = proc_params
32
+ @progress.log(title)
33
+ block.call(steps_count, self)
34
+ end
35
+
36
+ nil
37
+ end
38
+
39
+ def inc
40
+ @progress.increment
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Seedman
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seedman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Gorbunov
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-progressbar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.4'
27
41
  description: Gem for add progressbar at seed
28
42
  email:
29
43
  - lexgorbunov@gmail.com
@@ -35,6 +49,7 @@ files:
35
49
  - Rakefile
36
50
  - app/assets/javascripts/focus_watcher.js.coffee
37
51
  - lib/seedman.rb
52
+ - lib/seedman/base.rb
38
53
  - lib/seedman/engine.rb
39
54
  - lib/seedman/version.rb
40
55
  homepage: https://github.com/lexgorbunov/seedman