r_dockerize 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/config/locales/en.yml +1 -0
- data/lib/r_dockerize/cli.rb +5 -2
- data/lib/r_dockerize/commands/base.rb +2 -0
- data/lib/r_dockerize/commands/dco.rb +4 -4
- data/lib/r_dockerize/commands/docker.rb +11 -5
- data/lib/r_dockerize/commands/dockerize.rb +2 -1
- data/lib/r_dockerize/config.rb +1 -3
- data/lib/r_dockerize/version.rb +6 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 150ba14ca5eda083ea568d40b5b897f21eaca257d3e9c37210f5c15a6d9cd077
|
4
|
+
data.tar.gz: 6a84c3b339ef7309190eefcc951a8dbafe09f1bd367d46297968ccc9866158db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 947daf45247848128be71e6cf58fc40f869256f9f3ae024cbd43cc1c5c8db9290703fb075a97eb7a2bbaefe911072d47ef7c4a44135a37a13aee65ae8679236c
|
7
|
+
data.tar.gz: 5e46bbbc0583445c95aecbfd5d3bd473318b5a69fc20646dcc7829121ae9ec9059788d6f268bfe44ee90d30909b51fb08798bcac9dfb7a1671bfdf5d5aaae240
|
data/README.md
CHANGED
@@ -34,9 +34,10 @@ Options:
|
|
34
34
|
-u, --user # Use saved user's template
|
35
35
|
-j, --javascript=JAVASCRIPT # Choose JavaScript approach [options: npm, yarn]
|
36
36
|
-r, --ruby=RUBY_VERSION # Choose version of ruby
|
37
|
-
-d, --database=DATABASE # Choose database [options: sqlite]
|
37
|
+
-d, --database=DATABASE # Choose database [options: postgresql, mysql, mongodb sqlite]
|
38
38
|
--standard # Standard template
|
39
39
|
-h, --help # Print help for command
|
40
|
+
-p, --port # Set port for expose
|
40
41
|
```
|
41
42
|
2. `r_dockerize dco ` / `compose`/ `docker-compose [options]` - for create docker-compose.yml
|
42
43
|
```bash
|
@@ -48,15 +49,15 @@ Usage:
|
|
48
49
|
Options:
|
49
50
|
-s, --show # Show assembled docker-compose file
|
50
51
|
-u, --user # Use saved user's template
|
51
|
-
-d, --database=DATABASE # Choose database [options: sqlite]
|
52
|
+
-d, --database=DATABASE # Choose database [options: postgresql, mysql, mongodb, sqlite]
|
52
53
|
-b, --subservice=SUBSERVICE # Choose subservice [options: redis rabbitmq sidekiq]
|
53
54
|
-h, --help # Print help for command
|
54
55
|
|
55
56
|
```
|
56
|
-
3. `r_dockerize dockerize
|
57
|
+
3. `r_dockerize dockerize` - for create both (Dockerfie and docker-compose.yml)
|
57
58
|
```bash
|
58
59
|
Usage:
|
59
|
-
rdockerize dockerize
|
60
|
+
rdockerize dockerize
|
60
61
|
```
|
61
62
|
|
62
63
|
## Development
|
data/lib/config/locales/en.yml
CHANGED
data/lib/r_dockerize/cli.rb
CHANGED
@@ -4,9 +4,10 @@ require "optionparser"
|
|
4
4
|
|
5
5
|
module RDockerize
|
6
6
|
class CLI
|
7
|
+
# Available commands
|
7
8
|
COMMANDS = {
|
8
|
-
"dco" => "RDockerize::Commands::Dco",
|
9
|
-
"compose" => "RDockerize::Commands::Dco",
|
9
|
+
"dco" => "RDockerize::Commands::Dco", # alias for docker-compose
|
10
|
+
"compose" => "RDockerize::Commands::Dco", # alias for docker-compose
|
10
11
|
"docker-compose" => "RDockerize::Commands::Dco",
|
11
12
|
"docker" => "RDockerize::Commands::Docker",
|
12
13
|
"dockerize" => "RDockerize::Commands::Dockerize",
|
@@ -18,6 +19,7 @@ module RDockerize
|
|
18
19
|
@print_help = false
|
19
20
|
end
|
20
21
|
|
22
|
+
# Build necessary class using command's pull of constants
|
21
23
|
def run(args = ARGV)
|
22
24
|
command = parse_command(args)
|
23
25
|
|
@@ -40,6 +42,7 @@ module RDockerize
|
|
40
42
|
|
41
43
|
private
|
42
44
|
|
45
|
+
# Initialize base options for r_dockerize command
|
43
46
|
def option_parser
|
44
47
|
@option_parser ||= OptionParser.new do |opts|
|
45
48
|
opts.banner = banner
|
@@ -4,8 +4,6 @@ module RDockerize
|
|
4
4
|
module Commands
|
5
5
|
# rubocop disable:Style/IfUnlessModifier
|
6
6
|
class Dco < Base
|
7
|
-
attr_reader :db, :js, :subservices, :volumes
|
8
|
-
|
9
7
|
def self.run(args)
|
10
8
|
new(args).run
|
11
9
|
end
|
@@ -18,6 +16,7 @@ module RDockerize
|
|
18
16
|
end
|
19
17
|
|
20
18
|
def parse(args)
|
19
|
+
# TODO: sqlite not generated!!!
|
21
20
|
@db = "sqlite"
|
22
21
|
|
23
22
|
parser = opt_parser do |opts|
|
@@ -31,11 +30,11 @@ module RDockerize
|
|
31
30
|
@user_temp = true
|
32
31
|
end
|
33
32
|
|
34
|
-
opts.on("-d", "--database=DATABASE", "# Choose database [options:
|
33
|
+
opts.on("-d", "--database=DATABASE", "# Choose database [options: #{DATABASE.join(", ")}]") do |val|
|
35
34
|
prepare_db(val)
|
36
35
|
end
|
37
36
|
|
38
|
-
opts.on("-b", "--subservice=SUBSERVICE", "# Choose subservice [options:
|
37
|
+
opts.on("-b", "--subservice=SUBSERVICE", "# Choose subservice [options: #{SUBSERVICES.join(", ")}]") do |val|
|
39
38
|
prepare_subservices(val)
|
40
39
|
end
|
41
40
|
end
|
@@ -83,6 +82,7 @@ module RDockerize
|
|
83
82
|
@subservices << option
|
84
83
|
end
|
85
84
|
|
85
|
+
# Create final text for docker-compose.yml file
|
86
86
|
def prepare_text
|
87
87
|
return I18n.t("#{BASE_KEY}.dco.user_template") if @user_temp
|
88
88
|
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module RDockerize
|
4
4
|
module Commands
|
5
5
|
class Docker < Base
|
6
|
-
attr_reader :db, :js_pm, :rv
|
7
|
-
|
8
6
|
def self.run(args)
|
9
7
|
new(args).run
|
10
8
|
end
|
@@ -13,6 +11,7 @@ module RDockerize
|
|
13
11
|
@user_temp = false
|
14
12
|
@show = false
|
15
13
|
@standard = false
|
14
|
+
@port = nil
|
16
15
|
super(args)
|
17
16
|
end
|
18
17
|
|
@@ -31,7 +30,7 @@ module RDockerize
|
|
31
30
|
@user_temp = true
|
32
31
|
end
|
33
32
|
|
34
|
-
opts.on("-j", "--javascript=JAVASCRIPT", "# Choose JavaScript approach [options:
|
33
|
+
opts.on("-j", "--javascript=JAVASCRIPT", "# Choose JavaScript approach [options: #{JAVASCRIPT_PM.join(", ")}]") do |val|
|
35
34
|
prepare_js_pm(val)
|
36
35
|
end
|
37
36
|
|
@@ -39,13 +38,17 @@ module RDockerize
|
|
39
38
|
@rv = val
|
40
39
|
end
|
41
40
|
|
42
|
-
opts.on("-d", "--database=DATABASE", "# Choose database [options:
|
41
|
+
opts.on("-d", "--database=DATABASE", "# Choose database [options: #{DATABASE.join(", ")}]") do |val|
|
43
42
|
prepare_db(val)
|
44
43
|
end
|
45
44
|
|
46
45
|
opts.on("--standard", "# Standard template") do
|
47
46
|
@standard = true
|
48
47
|
end
|
48
|
+
|
49
|
+
opts.on("-p", "--port=PORT", "# Set port") do |val|
|
50
|
+
@port = val
|
51
|
+
end
|
49
52
|
end
|
50
53
|
|
51
54
|
parser.parse!(args)
|
@@ -57,6 +60,7 @@ module RDockerize
|
|
57
60
|
return $stdout.puts text if @show
|
58
61
|
|
59
62
|
File.open("Dockerfile", "w+") { |f| f.write(text) }
|
63
|
+
|
60
64
|
end
|
61
65
|
|
62
66
|
protected
|
@@ -86,15 +90,17 @@ module RDockerize
|
|
86
90
|
@db = option
|
87
91
|
end
|
88
92
|
|
93
|
+
# Create final text for Dockerfile file
|
89
94
|
def prepare_text
|
90
95
|
return I18n.t("#{BASE_KEY}.docker.user_template") if @user_temp
|
91
96
|
return I18n.t("#{BASE_KEY}.docker.standard", ruby_version: @rv) if @standard
|
92
97
|
|
93
98
|
js_pm_text = I18n.t("#{BASE_KEY}.docker.js_pm.#{@js_pm}") if @js_pm
|
94
99
|
db_text = I18n.t("#{BASE_KEY}.docker.db.#{@db}") if @db
|
100
|
+
port_text = "EXPOSE #{@port}" if @port
|
95
101
|
|
96
102
|
I18n.t("#{BASE_KEY}.docker.template",
|
97
|
-
ruby_version: @rv, js_pm_option: js_pm_text, db_option: db_text)
|
103
|
+
ruby_version: @rv, js_pm_option: js_pm_text, db_option: db_text, port: port_text)
|
98
104
|
end
|
99
105
|
end
|
100
106
|
end
|
data/lib/r_dockerize/config.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_dockerize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keallar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
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
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/r_dockerize/errors/docker_filename_error.rb
|
84
84
|
- lib/r_dockerize/errors/js_not_found.rb
|
85
85
|
- lib/r_dockerize/errors/subservice_not_found.rb
|
86
|
+
- lib/r_dockerize/version.rb
|
86
87
|
- lib/rdockerize.rb
|
87
88
|
homepage: https://github.com/Keallar/r_dockerize
|
88
89
|
licenses:
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
|
-
rubygems_version: 3.5.
|
109
|
+
rubygems_version: 3.5.6
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: CLI app for creating ruby and rails Dockerfile and docker-compose.yml.
|