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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/docker_core.rb +43 -5
  3. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f39e96209cf9b5ec126018c163779b78d6f0ce3712672868459427f55517f00d
4
- data.tar.gz: 3e6957ad97206826ab0b2eed30d09c67ee24d8f8b1e61c75d573abb947051e81
3
+ metadata.gz: 371e1413099d4658b296b5714e83e06812fe15afaf01cbbe7d01f5ed24268a21
4
+ data.tar.gz: afc6b37af0efa2efcba144acd5da64e8cdb2713e9b35c915103c5de73fa54793
5
5
  SHA512:
6
- metadata.gz: 2ac2f12efd6a0aa3ba7593d945f5dbb6e0d4a7d8401e273495c77a557d1f878d86c461b24863b9805aa44f1e8c707a08dbb6099baacd1b9a4f5efdf1c29ce507
7
- data.tar.gz: e4de0a1b0a53f20430cb736a5153d2709c8d9d6feeb533d5ae26e25d1d40c376d2dc96f203188d4445061980050438a097d424b0925e1ffcd6d8c7dc825ef6d6
6
+ metadata.gz: dfb32fd0c0f6893dc79cbb37ad8b644d112d032a2183def70b903418346399369be0f1169ed4cb646bf1807f55f6fdadf6a4850916dd7cb3940977e21a0258c0
7
+ data.tar.gz: fdc17291808d10147b1b67aabd1ae202b12174fdb02bc661585e12cf9e8972a5a78be678e0c2393c97e9fa7ae4a44a470a2d14f6dc1ce3ef878f877807d82a27
data/lib/docker_core.rb CHANGED
@@ -1,4 +1,5 @@
1
- require 'fileutils'
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(">> #{title}", code)
27
+ self.echo("> #{title}", code)
27
28
  run.call(*argumets)
28
- self.echo("<< #{title}", code)
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.5
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: []