pinject 0.1.4 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6293b6a2f22310c72541366bf812eb455f22db3307afefba4ffb67e0a056a7fc
4
- data.tar.gz: fec64406a61766a15878a45f6d5cf7acbc36a9e45760230370f3f9deaa8bb965
3
+ metadata.gz: 19ddcd032bf4c9affc73250e33d5ab22afea6c679b8cccb6011ad586b5c76d2a
4
+ data.tar.gz: 0566bbf5a3e3f9276f9c49d275286a194906f2471ec213539167d35673504b86
5
5
  SHA512:
6
- metadata.gz: 994efa80463cb79dce5962677a2854a2ef2541576d3d95d86a32ad4353bb66673328416c6e701594051979aa573d07d4a2976c38bfcca4cd70613161fd5309be
7
- data.tar.gz: b82c6361b15d71aa4c4e4f8a96d19d35653409309ae80f0c115cedbb5ee776f66143fd52152270b7b3dc0bb25d86b2767a2cb7ce6fbecf65fc786d00b6a16482
6
+ metadata.gz: a720988e622493ab9b31b715db9ffb2415ef4f909eae670eec7ac113cc7ac264ed7801e6d5d2d7a11040807a7874378f59fa92a874dd058c0d6710a5816f467f
7
+ data.tar.gz: 9e269983fc58c5e4771fbc9d49ecd3eb6027789d19f2733b3853d3ca9c2d7b00028e670882ea3db6d5dcb9cf5f552c9016cd3829109d2d7003550a66bf8a3849
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-12-22 01:50:28 UTC using RuboCop version 1.23.0.
3
+ # on 2021-12-27 07:20:52 UTC using RuboCop version 1.23.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -23,17 +23,17 @@ Lint/AssignmentInCondition:
23
23
  # Offense count: 3
24
24
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
25
25
  Metrics/AbcSize:
26
- Max: 21
26
+ Max: 19
27
27
 
28
28
  # Offense count: 1
29
29
  # Configuration parameters: CountComments, CountAsOne.
30
30
  Metrics/ClassLength:
31
- Max: 112
31
+ Max: 122
32
32
 
33
33
  # Offense count: 4
34
34
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
35
35
  Metrics/MethodLength:
36
- Max: 21
36
+ Max: 20
37
37
 
38
38
  # Offense count: 2
39
39
  # Configuration parameters: ForbiddenDelimiters.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pinject (0.1.2)
4
+ pinject (0.1.6)
5
5
  docker-api
6
6
 
7
7
  GEM
@@ -11,7 +11,7 @@ GEM
11
11
  docker-api (2.2.0)
12
12
  excon (>= 0.47.0)
13
13
  multi_json
14
- excon (0.89.0)
14
+ excon (0.92.4)
15
15
  multi_json (1.15.0)
16
16
  parallel (1.21.0)
17
17
  parser (3.0.3.2)
@@ -35,6 +35,7 @@ GEM
35
35
  unicode-display_width (2.1.0)
36
36
 
37
37
  PLATFORMS
38
+ arm64-darwin-21
38
39
  x86_64-darwin-20
39
40
  x86_64-linux
40
41
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  you can inject os update command to some docker images.
24
24
 
25
25
  ```ruby
26
- image = Pinject.new("ubuntu:latest")
26
+ image = Pinject::Docker.new("ubuntu:latest")
27
27
  inject_image = image.inject_build("pyama:ubuntu_inject") # run apt-get upgrade
28
28
  inject_image.push
29
29
  ```
data/example.rb ADDED
@@ -0,0 +1,4 @@
1
+ require './lib/pinject'
2
+ image = Pinject::Docker.new('mysql:8', log: true)
3
+ inject_image = image.inject_build('pyama:test') # run apt-get upgrade
4
+ # inject_image.push
@@ -7,6 +7,14 @@ module Pinject
7
7
  class Docker
8
8
  attr_reader :log
9
9
 
10
+ if %w[DOCKER_USER DOCKER_PASSWORD DOCKER_REGISTRY].all? { |a| ENV[a] }
11
+ ::Docker.authenticate!(
12
+ 'username' => ENV['DOCKER_USER'],
13
+ 'password' => ENV['DOCKER_PASSWORD'],
14
+ 'serveraddress' => ENV['DOCKER_REGISTRY']
15
+ )
16
+ end
17
+
10
18
  def initialize(image_name, log: false)
11
19
  @image_name = image_name
12
20
  @log = log
@@ -45,9 +53,8 @@ module Pinject
45
53
  })
46
54
 
47
55
  result = nil
48
- t = Thread.new { container.attach { |stream, chunk| result = chunk.chomp if stream == :stdout } }
49
56
  container.start
50
- t.join
57
+ container.streaming_logs(stdout: true) { |stream, chunk| result = chunk.chomp if stream == :stdout }
51
58
 
52
59
  if result
53
60
  dist, version, user = result.split(%r{:|/})
@@ -98,6 +105,13 @@ module Pinject
98
105
  ['apt-get update -qqy', 'apt-get upgrade -qqy', 'apt-get clean', 'rm -rf /var/lib/apt/lists/*']
99
106
  when 'alpine'
100
107
  ['apk update', 'apk upgrade --no-cache']
108
+ when 'oracle'
109
+ case version
110
+ when '7'
111
+ ['yum update -y']
112
+ when '8'
113
+ ['microdnf update -y']
114
+ end
101
115
  when 'centos'
102
116
  case version
103
117
  when '5', '6'
@@ -119,6 +133,9 @@ module Pinject
119
133
  elif [ -f /etc/debian_version ]; then
120
134
  OS=debian
121
135
  VER=`cat /etc/debian_version | awk -F. '{ print $1 }'`
136
+ elif [ -f /etc/oracle-release ]; then
137
+ OS=oracle
138
+ VER=`cat /etc/oracle-release | sed -e 's/.*\\s\\([0-9]\\)\\..*/\\1/'`
122
139
  elif [ -f /etc/redhat-release ]; then
123
140
  OS=centos
124
141
  VER=`cat /etc/redhat-release | sed -e 's/.*\\s\\([0-9]\\)\\..*/\\1/'`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pinject
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.7'
5
5
  end
data/pinject.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.metadata['source_code_uri'] = 'https://github.com/pyama86/pinject'
19
19
  spec.metadata['changelog_uri'] = 'https://github.com/pyama86/pinject/CHANGELOG.md'
20
20
 
21
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
22
  spec.bindir = 'exe'
23
23
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -46,6 +46,7 @@ files:
46
46
  - Rakefile
47
47
  - bin/console
48
48
  - bin/setup
49
+ - example.rb
49
50
  - exe/pinject
50
51
  - lib/pinject.rb
51
52
  - lib/pinject/docker.rb
@@ -59,7 +60,7 @@ metadata:
59
60
  homepage_uri: https://github.com/pyama86/pinject
60
61
  source_code_uri: https://github.com/pyama86/pinject
61
62
  changelog_uri: https://github.com/pyama86/pinject/CHANGELOG.md
62
- post_install_message:
63
+ post_install_message:
63
64
  rdoc_options: []
64
65
  require_paths:
65
66
  - lib
@@ -74,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
- rubygems_version: 3.2.32
78
- signing_key:
78
+ rubygems_version: 3.3.3
79
+ signing_key:
79
80
  specification_version: 4
80
81
  summary: inject package update commands to your docker images
81
82
  test_files: []