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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a29329d0689f46f4d984668ed76e49cb432ed09477ad8f4c2a12b349bf0aa63
4
- data.tar.gz: 7ce5791980da3acec05f4c4737814b6bb618c0982a0d45f3096cd8faf056c1d1
3
+ metadata.gz: 0bd83af3cdfae878c742b5a959d8573a571c4752484a2fd4eced4c73c9f00356
4
+ data.tar.gz: f8c1f4bbc692d6966acae0abd7f19fc64f76c542e24e21bd2032e66a557105ce
5
5
  SHA512:
6
- metadata.gz: 47364165578af22beb5f4fcf623ea25ddb2cae999206f5267e854fb189cb1ad22136e3e9153484ec98015701c1b925a6c956c3c9736b13151d10d5ffcf466754
7
- data.tar.gz: 7e284acd53693d53e92c00deebed6ece05396ff5976f85a176c0c30a7099038de7bb34f0f8d293970f7bb1a15a35f802fbfa367a35f9c993edcbd61670586b44
6
+ metadata.gz: 70877829eeabf2136b8767173a1991ccd452099bac25476e3fbdb44e91657788f047d7f871fe3327cb19fe3649ebd872f3e37a9d943d07fba6f993639a7303f7
7
+ data.tar.gz: '06258bf4b49ca1630fdef1172dc01a469ef2b68c40e67bccd9f1fb35b883bb83ac5ce8b665435b5088852f3d9ea6d401b58ba258e006cdbe75751096ef6341bb'
@@ -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(:rails).each do |file_path|
23
- if file_path =~ %r{./templates/rails/kubernetes} && !@kubernetes
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
- all_file_paths(:react).each do |file_path|
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
- @type = :gatsby
58
- run(options, @type)
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
- @type = :strapi
75
- run(options, @type)
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
@@ -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(template_folder)
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 render_template!(template_file)
61
- result = ERB.new(File.read("#{template_folder}/#{template_file}")).result(binding)
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 all_file_paths(type)
66
- Dir.glob("./templates/#{type}/**/{*,.?*}").reject { |x| File.directory?(x) }
64
+ def template_type_path
65
+ "#{template_folder}/#{@template_type}"
67
66
  end
68
67
 
69
- def template_folder
70
- @options[:template_folder] || "#{File.dirname(__FILE__)}/../templates/#{@template_type}"
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DockerizeStack
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerize-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Savignano