mysql_in_docker 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b24d134cf5f191f9f1baccc9ed8878bfede58ad1c485e55c2af588a6459b01bf
4
- data.tar.gz: c1c48b30cba52960dfd2e7d12d8686b574c24c5f42dccd747210c8f12d7a9e84
3
+ metadata.gz: 6a20304825a647b19b445ef478c2e0669c601fae18abd804c412481bf1ac5b1b
4
+ data.tar.gz: 0dfc6453132f63ec36c7c5658ed2e3f68bee2debc7a2185453459078fce41004
5
5
  SHA512:
6
- metadata.gz: 892daac96097e4c0abfc5f6179f54e9e5efb5d201e2cbf9b577c45824c1463e4c71d5a6fed4372c1e5362d82e8eb52d8b4265f40cbecc50c3af5cf0cbb762570
7
- data.tar.gz: dd93ffd065973e8eeef8f53cbc3c89b8b1cf519e86e1c7958be63b9fe0559203c1598435b4d24d21f172a6958f4a42cb5bbc31ca71b956b80071a818b39cba09
6
+ metadata.gz: 22789a1b94b68a5e6c6368e3a9733514ebafa2e209ede922d7aba185b823fdd681f5a8197c21b9cd4b2ccc3cc94ea61e2f8ec69e884391860ffb47d79d741828
7
+ data.tar.gz: 728b10cbe380287fc28263eceb3de6fdf303a5488350dfa077742496052065b61960852aad4e38d0f52a73143842858490b857470d8ca5e21447dfd7fbfb287f
data/.bundle/config CHANGED
@@ -1,4 +1,6 @@
1
1
  ---
2
2
  BUNDLE_PATH: "vendor/bundle"
3
- BUNDLE_JOBS: "4"
4
3
  BUNDLE_BIN: "vendor/bundle/bin"
4
+ BUNDLE_JOBS: "4"
5
+ BUNDLE_CLEAN: "true"
6
+ BUNDLE_DISABLE_SHARED_GEMS: "true"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mysql_in_docker (0.0.1)
4
+ mysql_in_docker (0.0.4)
5
5
  thor
6
6
 
7
7
  GEM
@@ -39,6 +39,7 @@ GEM
39
39
  unicode-display_width (2.1.0)
40
40
 
41
41
  PLATFORMS
42
+ arm64-darwin-21
42
43
  x86_64-linux
43
44
 
44
45
  DEPENDENCIES
data/lib/commands.rb CHANGED
@@ -34,8 +34,8 @@ module MysqlInDocker
34
34
  end
35
35
  end
36
36
 
37
- desc "rm ID", "Remove mysql container and volume."
38
- def rm(id)
37
+ desc "remove ID", "Remove mysql container and volume."
38
+ def remove(id)
39
39
  stop id
40
40
 
41
41
  status = docker_command "volume rm #{get_container_name(id)}"
@@ -61,18 +61,35 @@ module MysqlInDocker
61
61
  "mysql_in_docker_#{id}"
62
62
  end
63
63
 
64
+ def arm?
65
+ RUBY_PLATFORM.start_with? "arm"
66
+ end
67
+
68
+ def get_image_name(version)
69
+ image = arm? ? "mysql/mysql-server" : "mysql"
70
+
71
+ return "#{image}:8.0" if arm? && version == "8"
72
+
73
+ "#{image}:#{version}"
74
+ end
75
+
76
+ def get_envs(mysql_root_password)
77
+ arr = ["--env", "MYSQL_ROOT_PASSWORD=#{mysql_root_password}"]
78
+ arr.concat ["--env", "MYSQL_ROOT_HOST=%"] if arm?
79
+ arr
80
+ end
81
+
64
82
  def up_command(id, version, port, mysql_root_password) # rubocop:disable Metrics/MethodLength
65
83
  [
66
84
  "run",
67
85
  "--name", get_container_name(id),
68
- "--env",
69
- "MYSQL_ROOT_PASSWORD=#{mysql_root_password}",
86
+ *get_envs(mysql_root_password),
70
87
  "--publish",
71
88
  "#{port}:3306",
72
89
  "--volume",
73
90
  "#{get_container_name(id)}:/var/lib/mysql",
74
91
  "-d",
75
- "mysql:#{version}"
92
+ get_image_name(version)
76
93
  ].join(" ")
77
94
  end
78
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MysqlInDocker
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_in_docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sijia Wang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-23 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.2.32
75
+ rubygems_version: 3.3.7
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: Easly use mysql with docker.