docker_core 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docker_core.rb +43 -5
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 371e1413099d4658b296b5714e83e06812fe15afaf01cbbe7d01f5ed24268a21
|
4
|
+
data.tar.gz: afc6b37af0efa2efcba144acd5da64e8cdb2713e9b35c915103c5de73fa54793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb32fd0c0f6893dc79cbb37ad8b644d112d032a2183def70b903418346399369be0f1169ed4cb646bf1807f55f6fdadf6a4850916dd7cb3940977e21a0258c0
|
7
|
+
data.tar.gz: fdc17291808d10147b1b67aabd1ae202b12174fdb02bc661585e12cf9e8972a5a78be678e0c2393c97e9fa7ae4a44a470a2d14f6dc1ce3ef878f877807d82a27
|
data/lib/docker_core.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require('fileutils')
|
2
|
+
require('open-uri')
|
2
3
|
|
3
4
|
module DockerCore
|
4
5
|
COLOR_CODE = { error: 31, info: 32, warn: 33 }
|
@@ -23,9 +24,9 @@ module DockerCore
|
|
23
24
|
# @param [Array] argumets
|
24
25
|
def self.execute(title, run, *argumets)
|
25
26
|
code = self::COLOR_CODE[:warn]
|
26
|
-
self.echo("
|
27
|
+
self.echo("> #{title}", code)
|
27
28
|
run.call(*argumets)
|
28
|
-
self.echo("
|
29
|
+
self.echo("< #{title}", code)
|
29
30
|
end
|
30
31
|
|
31
32
|
# @param [String] command
|
@@ -56,16 +57,53 @@ module DockerCore
|
|
56
57
|
self.run("adduser --system --disabled-password --no-create-home --ingroup=core --gecos=core --shell=/bin/bash --uid=#{uid} core")
|
57
58
|
end
|
58
59
|
|
59
|
-
# @param [Array] arguments
|
60
|
+
# @param [Array<String>] arguments
|
61
|
+
def self.chown(*arguments)
|
62
|
+
arguments.each do |list|
|
63
|
+
FileUtils.chown_R('core', 'core', list)
|
64
|
+
end
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
# @param [Array<String>] arguments
|
60
69
|
def self.mkdir(*arguments)
|
61
70
|
arguments.each do |list|
|
62
71
|
FileUtils.mkdir_p(list)
|
63
|
-
FileUtils.chown_R('core', 'core', list)
|
64
72
|
end
|
73
|
+
self.chown(*arguments)
|
65
74
|
end
|
66
75
|
|
67
76
|
# @param [String] value
|
68
77
|
def self.to_boolean(value)
|
69
78
|
return %w[true yes on].include?(value.strip.downcase)
|
70
79
|
end
|
80
|
+
|
81
|
+
# @param [String] stdout
|
82
|
+
# @param [String] stderr
|
83
|
+
def self.link_log(stdout = '', stderr = '')
|
84
|
+
if '' != stdout
|
85
|
+
File.symlink('/dev/stdout', stdout)
|
86
|
+
end
|
87
|
+
|
88
|
+
if '' != stderr
|
89
|
+
File.symlink('/dev/stderr', stderr)
|
90
|
+
end
|
91
|
+
return
|
92
|
+
end
|
93
|
+
|
94
|
+
# @param [String] uri
|
95
|
+
# @param [String] file
|
96
|
+
def self.download(uri, file)
|
97
|
+
IO.copy_stream(URI.open(uri), file)
|
98
|
+
end
|
99
|
+
|
100
|
+
# @param [Array<String>] arguments
|
101
|
+
def self.clear_path(*arguments)
|
102
|
+
arguments.each do |list|
|
103
|
+
FileUtils.rm_rf(list)
|
104
|
+
end
|
105
|
+
|
106
|
+
self.mkdir(*arguments)
|
107
|
+
end
|
108
|
+
|
71
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agrozyme
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: open-uri
|
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
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
executables: []
|