dockerize-stack 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dockerize_stack.rb +7 -19
- data/lib/thor_extend.rb +20 -8
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd83af3cdfae878c742b5a959d8573a571c4752484a2fd4eced4c73c9f00356
|
4
|
+
data.tar.gz: f8c1f4bbc692d6966acae0abd7f19fc64f76c542e24e21bd2032e66a557105ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70877829eeabf2136b8767173a1991ccd452099bac25476e3fbdb44e91657788f047d7f871fe3327cb19fe3649ebd872f3e37a9d943d07fba6f993639a7303f7
|
7
|
+
data.tar.gz: '06258bf4b49ca1630fdef1172dc01a469ef2b68c40e67bccd9f1fb35b883bb83ac5ce8b665435b5088852f3d9ea6d401b58ba258e006cdbe75751096ef6341bb'
|
data/lib/dockerize_stack.rb
CHANGED
@@ -19,11 +19,10 @@ module DockerizeStack
|
|
19
19
|
desc 'rails', 'generate docker files for rails application'
|
20
20
|
def rails
|
21
21
|
run(options, :rails)
|
22
|
-
all_file_paths
|
23
|
-
if
|
22
|
+
all_file_paths.each do |file_name|
|
23
|
+
if file_name =~ %r{kubernetes/} && !@kubernetes
|
24
24
|
return false
|
25
25
|
end
|
26
|
-
file_name = file_path.gsub('/templates/rails', '')
|
27
26
|
template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
|
28
27
|
end
|
29
28
|
|
@@ -39,10 +38,7 @@ module DockerizeStack
|
|
39
38
|
desc 'react', 'generate docker files for create react app'
|
40
39
|
def react
|
41
40
|
run(options, :react)
|
42
|
-
|
43
|
-
file_name = file_path.gsub('/templates/react', '')
|
44
|
-
template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
|
45
|
-
end
|
41
|
+
render_all
|
46
42
|
end
|
47
43
|
|
48
44
|
option :template_folder, aliases: 't', desc: 'Template folder path'
|
@@ -54,12 +50,8 @@ module DockerizeStack
|
|
54
50
|
|
55
51
|
desc 'gatsby', 'generate docker files for gatsby app'
|
56
52
|
def gatsby
|
57
|
-
|
58
|
-
|
59
|
-
all_file_paths(@type).each do |file_path|
|
60
|
-
file_name = file_path.gsub("/templates/#{@type}", '')
|
61
|
-
template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
|
62
|
-
end
|
53
|
+
run(options, :gatsby)
|
54
|
+
render_all
|
63
55
|
end
|
64
56
|
|
65
57
|
option :template_folder, aliases: 't', desc: 'Template folder path'
|
@@ -71,12 +63,8 @@ module DockerizeStack
|
|
71
63
|
|
72
64
|
desc 'strapi', 'generate docker files for strapi app'
|
73
65
|
def strapi
|
74
|
-
|
75
|
-
|
76
|
-
all_file_paths(@type).each do |file_path|
|
77
|
-
file_name = file_path.gsub("/templates/#{@type}", '')
|
78
|
-
template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
|
79
|
-
end
|
66
|
+
run(options, :strapi)
|
67
|
+
render_all
|
80
68
|
end
|
81
69
|
end
|
82
70
|
end
|
data/lib/thor_extend.rb
CHANGED
@@ -16,7 +16,7 @@ module ThorActionsExtend
|
|
16
16
|
@options = options
|
17
17
|
@output_folder = options['output_folder']
|
18
18
|
@config = CONFIG[@template_type]
|
19
|
-
self.class.source_root(
|
19
|
+
self.class.source_root(template_type_path)
|
20
20
|
|
21
21
|
fetch_template_variables
|
22
22
|
end
|
@@ -57,17 +57,29 @@ module ThorActionsExtend
|
|
57
57
|
|
58
58
|
private
|
59
59
|
|
60
|
-
def
|
61
|
-
|
62
|
-
File.write("#{@output_folder}/#{template_file.gsub('.erb', '')}", result)
|
60
|
+
def template_folder
|
61
|
+
@options[:template_folder] || "#{File.dirname(__FILE__)}/../templates"
|
63
62
|
end
|
64
63
|
|
65
|
-
def
|
66
|
-
|
64
|
+
def template_type_path
|
65
|
+
"#{template_folder}/#{@template_type}"
|
67
66
|
end
|
68
67
|
|
69
|
-
def
|
70
|
-
|
68
|
+
def render_all
|
69
|
+
all_file_paths.each do |file_name|
|
70
|
+
template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def all_file_paths
|
75
|
+
Dir.glob("#{template_type_path}/**/{*,.?*}")
|
76
|
+
.reject { |x| File.directory?(x) }
|
77
|
+
.map { |file_path| file_path.gsub("#{template_type_path}/", '') }
|
78
|
+
end
|
79
|
+
|
80
|
+
def render_template!(template_file)
|
81
|
+
result = ERB.new(File.read("#{template_type_path}/#{template_file}")).result(binding)
|
82
|
+
File.write("#{@output_folder}/#{template_file.gsub('.erb', '')}", result)
|
71
83
|
end
|
72
84
|
|
73
85
|
def append_or_create(file_path, file_content)
|
data/lib/version.rb
CHANGED