pullbot 0.0.2 → 0.0.3
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.
- checksums.yaml +14 -6
- data/.gitignore +2 -1
- data/Gemfile +1 -3
- data/Gemfile.lock +9 -20
- data/lib/pull-bundle/base.rb +18 -21
- data/lib/pull-bundle/configr.rb +13 -0
- data/lib/pull-bundle/repository.rb +17 -13
- data/lib/pullbot.rb +3 -1
- data/pullbot.gemspec +2 -1
- data/test.sh +3 -0
- metadata +22 -8
- data/lib/progress-bar/bar.rb +0 -49
- data/pullbot-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODEzNjcxNWZlMGQwNDgxMmJkZGJhZDM5Zjg0MjZjYjNlYTVmZWY3Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmNlYjJmN2YzYWZjYWRmYTA5YzJjYzg3MDlmZTA1NTA5N2ZiNWM0OQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NTJiNTBmMmY3YmM1MDdlOGZkM2I2ZWRlNzYwOGMxYmZmZGMxODA1NzZjN2Y1
|
10
|
+
YTA5ODk2MWU3ZTQ2Y2ZmZmM4MDEyOTIxNmJkZDUzODI3NTU3ODVhZTAwZTBk
|
11
|
+
NTRmMjEyOGY5N2VmNjdiNWE2MjRmNjM0NGUzZGE2NzJjY2JjMWI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
N2IwNzUwZjdlNzNlNTAwNjhlNGEyZGJjY2UzMjBhZmE4MjJiNjBkMjQ1MTBk
|
14
|
+
ZmQ0MWEzNzc0MWY4YWYxNzJkZTA4MTQ4MjlkY2UwMTNhYjgxN2ZmNDc0YmNl
|
15
|
+
MmY3ODc0YWNhYjQ3NmIyOWQ4NjBkMTZiOGU2NWYyMzgxZjE5NTU=
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,29 +1,18 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pullbot (0.0.3)
|
5
|
+
formatador
|
6
|
+
open4
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: http://rubygems.org/
|
3
10
|
specs:
|
4
|
-
|
5
|
-
columnize (0.3.6)
|
6
|
-
debugger (1.6.2)
|
7
|
-
columnize (>= 0.3.1)
|
8
|
-
debugger-linecache (~> 1.2.0)
|
9
|
-
debugger-ruby_core_source (~> 1.2.3)
|
10
|
-
debugger-linecache (1.2.0)
|
11
|
-
debugger-ruby_core_source (1.2.3)
|
12
|
-
method_source (0.8.2)
|
11
|
+
formatador (0.2.4)
|
13
12
|
open4 (1.3.0)
|
14
|
-
pry (0.9.12.2)
|
15
|
-
coderay (~> 1.0.5)
|
16
|
-
method_source (~> 0.8)
|
17
|
-
slop (~> 3.4)
|
18
|
-
pry-debugger (0.2.2)
|
19
|
-
debugger (~> 1.3)
|
20
|
-
pry (~> 0.9.10)
|
21
|
-
slop (3.4.6)
|
22
13
|
|
23
14
|
PLATFORMS
|
24
15
|
ruby
|
25
16
|
|
26
17
|
DEPENDENCIES
|
27
|
-
|
28
|
-
pry
|
29
|
-
pry-debugger
|
18
|
+
pullbot!
|
data/lib/pull-bundle/base.rb
CHANGED
@@ -1,37 +1,34 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'progressbar'
|
2
|
+
require 'formatador'
|
3
3
|
|
4
4
|
module PullBundle
|
5
5
|
|
6
6
|
class Base
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(options = {})
|
11
|
-
@dir = options[:dir] || DEFAULT_DIRECTORY
|
12
|
-
@repositories = repositories(@dir)
|
13
|
-
run(@repositories)
|
8
|
+
def initialize
|
9
|
+
run(repositories)
|
14
10
|
end
|
15
11
|
|
16
12
|
def run(repositories)
|
17
|
-
repositories.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
13
|
+
pbar = ProgressBar.new('Running', repositories.size)
|
14
|
+
|
15
|
+
results = repositories.map do |repository|
|
16
|
+
result = repository.run
|
17
|
+
pbar.inc
|
18
|
+
result
|
24
19
|
end
|
20
|
+
|
21
|
+
pbar.finish
|
22
|
+
|
23
|
+
Formatador.display_table(results)
|
25
24
|
end
|
26
25
|
|
27
|
-
def repositories
|
28
|
-
repositories
|
29
|
-
|
30
|
-
next if dir == '.' or dir == '..'
|
31
|
-
repositories << Repository.new(base: dirs, name: dir)
|
26
|
+
def repositories
|
27
|
+
Configr.repositories.map do |dir|
|
28
|
+
Repository.new path: dir
|
32
29
|
end
|
33
|
-
repositories
|
34
30
|
end
|
35
31
|
|
36
32
|
end
|
33
|
+
|
37
34
|
end
|
@@ -4,16 +4,24 @@ module PullBundle
|
|
4
4
|
|
5
5
|
class Repository
|
6
6
|
|
7
|
-
attr_accessor :
|
8
|
-
|
9
|
-
ERRORS = ['ERROR', 'fatal']
|
7
|
+
attr_accessor :path
|
10
8
|
|
11
9
|
def initialize(options = {})
|
12
|
-
@
|
13
|
-
@address = "#{options[:base]}/#{@name}"
|
10
|
+
@path = options[:path]
|
14
11
|
end
|
15
12
|
|
16
13
|
def run
|
14
|
+
begin
|
15
|
+
do_run
|
16
|
+
{ path: path, result: 'Success' }
|
17
|
+
rescue CommandException => e
|
18
|
+
{ path: path, result: e }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def do_run
|
17
25
|
if is_git_repository? and is_clean?
|
18
26
|
update
|
19
27
|
else
|
@@ -28,11 +36,11 @@ module PullBundle
|
|
28
36
|
end
|
29
37
|
|
30
38
|
def is_ruby_repository?
|
31
|
-
File.exist?("#{@
|
39
|
+
File.exist?("#{@path}//Gemfile")
|
32
40
|
end
|
33
41
|
|
34
42
|
def is_git_repository?
|
35
|
-
Dir.exist?("#{@
|
43
|
+
Dir.exist?("#{@path}//.git")
|
36
44
|
end
|
37
45
|
|
38
46
|
def install_gems
|
@@ -50,15 +58,11 @@ module PullBundle
|
|
50
58
|
end
|
51
59
|
|
52
60
|
def run_command(command, condition, exception)
|
53
|
-
Dir.chdir(@
|
61
|
+
Dir.chdir(@path)
|
54
62
|
status = Open4::popen4(command)
|
55
63
|
message = status[2].read
|
56
64
|
error = status[3].read
|
57
|
-
raise exception
|
58
|
-
end
|
59
|
-
|
60
|
-
def include_error_message?(message)
|
61
|
-
not ERRORS.reduce(true) { |meta, error| meta and not message.include?(error) }
|
65
|
+
raise exception unless message.include?(condition) or error.empty?
|
62
66
|
end
|
63
67
|
|
64
68
|
class CommandException < Exception
|
data/lib/pullbot.rb
CHANGED
data/pullbot.gemspec
CHANGED
@@ -8,10 +8,11 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.description = 'Auto pull git repository and bundle ruby gems'
|
9
9
|
gem.name = 'pullbot'
|
10
10
|
gem.summary = 'pullbot'
|
11
|
-
gem.version = '0.0.
|
11
|
+
gem.version = '0.0.3'
|
12
12
|
gem.homepage = 'http://rubygems.org/gems/pullbot'
|
13
13
|
|
14
14
|
gem.add_runtime_dependency 'open4'
|
15
|
+
gem.add_runtime_dependency 'formatador'
|
15
16
|
|
16
17
|
gem.files = `git ls-files`.split($/)
|
17
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/test.sh
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pullbot
|
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
|
- biq
|
@@ -14,14 +14,28 @@ dependencies:
|
|
14
14
|
name: open4
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: formatador
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
description: Auto pull git repository and bundle ruby gems
|
@@ -36,12 +50,12 @@ files:
|
|
36
50
|
- Gemfile.lock
|
37
51
|
- README.md
|
38
52
|
- bin/pullbot
|
39
|
-
- lib/progress-bar/bar.rb
|
40
53
|
- lib/pull-bundle/base.rb
|
54
|
+
- lib/pull-bundle/configr.rb
|
41
55
|
- lib/pull-bundle/repository.rb
|
42
56
|
- lib/pullbot.rb
|
43
|
-
- pullbot-0.0.1.gem
|
44
57
|
- pullbot.gemspec
|
58
|
+
- test.sh
|
45
59
|
homepage: http://rubygems.org/gems/pullbot
|
46
60
|
licenses: []
|
47
61
|
metadata: {}
|
@@ -51,17 +65,17 @@ require_paths:
|
|
51
65
|
- lib
|
52
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
67
|
requirements:
|
54
|
-
- - '>='
|
68
|
+
- - ! '>='
|
55
69
|
- !ruby/object:Gem::Version
|
56
70
|
version: '0'
|
57
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - '>='
|
73
|
+
- - ! '>='
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
requirements: []
|
63
77
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.0.
|
78
|
+
rubygems_version: 2.0.7
|
65
79
|
signing_key:
|
66
80
|
specification_version: 4
|
67
81
|
summary: pullbot
|
data/lib/progress-bar/bar.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module ProgressBar
|
2
|
-
|
3
|
-
class Bar
|
4
|
-
|
5
|
-
DEFAULT_OUTPUT_STREAM = $stdout
|
6
|
-
DEFAULT_LENGTH = 100
|
7
|
-
attr_accessor :length, :output, :format_string, :steps
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
@output = options[:output] || DEFAULT_OUTPUT_STREAM
|
11
|
-
@length = options[:length] || DEFAULT_LENGTH
|
12
|
-
@steps = options[:steps] || 1
|
13
|
-
init_string
|
14
|
-
|
15
|
-
update(@output, @format_string)
|
16
|
-
end
|
17
|
-
|
18
|
-
def step sym
|
19
|
-
@format_string += "#{'=' * (step_length - 1) + sym}"
|
20
|
-
update @output, @format_string
|
21
|
-
end
|
22
|
-
|
23
|
-
def result
|
24
|
-
output.print @format_string
|
25
|
-
output.flush
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def init_string
|
31
|
-
@length = @length / @steps * @steps
|
32
|
-
@format_string = ""
|
33
|
-
end
|
34
|
-
|
35
|
-
def step_length
|
36
|
-
@length / @steps
|
37
|
-
end
|
38
|
-
|
39
|
-
def update(output, string)
|
40
|
-
output.print string
|
41
|
-
output.print "\r"
|
42
|
-
output.flush
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
ProgressBar::Bar.new
|
49
|
-
|
data/pullbot-0.0.1.gem
DELETED
Binary file
|