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 +4 -4
- data/lib/seedman.rb +1 -0
- data/lib/seedman/base.rb +43 -0
- data/lib/seedman/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cf5d52b4e3b7e89ad10033f826e8adf002d92a0
|
4
|
+
data.tar.gz: 40d7027c4c363869063003814e80f1ed4623a657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88cc148cae9ef3ab4253a441f43dff7448f49832efd408e878f3a440c2577904aa7a6ddb20b6dd8ce06906eb607b84b7aab44ee78799abcc463dfd49b1863fc0
|
7
|
+
data.tar.gz: 9fe8adcd4ad553366d94f18e632aa6462428700dd76cfd3184fcd04a9b31ac0462dac380cbf7dd157b3c7a3f1c6f3f5211ff5de0d9486a7d3f6dcfb8df70b1b7
|
data/lib/seedman.rb
CHANGED
data/lib/seedman/base.rb
ADDED
@@ -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
|
data/lib/seedman/version.rb
CHANGED
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.
|
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
|