boxing 0.10.0 → 0.11.0

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: e1a72179803fe3997bbc8ec057a4829bab1f10800b4bb29971b01303847a3c40
4
- data.tar.gz: 8f24d68d167994db0017674b4841e447863d8def7a21a37a9dd0d067e607dc20
3
+ metadata.gz: 9773fb28536f4bfb3f3e20e77cd648bcf5be7bd6d42f62eaf7e32a1e19296bcf
4
+ data.tar.gz: 54678763c575369965b2851c0bbeaa64270d8d7c393bbe53e4b1a2fcf212b0f7
5
5
  SHA512:
6
- metadata.gz: fcf0679493f741d8d76861a3dc1686bd15896a7b11061274729fab08cffe537d441850c059d6eed488c7dcab23df9df16bc5d367a36804717e5badb578cdce40
7
- data.tar.gz: a9a9e34b8c4c9f33c5d0e936279f10ac9010fe8b23050683b7eb2882bf3656a49b016ca06e268a3eef7c93dfe55d97f0d5ce01d9b50633dd149da67898631303
6
+ metadata.gz: dd4b4ef0a9a8f889358f7d79996b09c3f65129a439eb3c88f1e85862a766998508c041dbfbfcdbdc88c2a002bdd46ae67a01bb01d5aebfacaec4eaea04f1c2df
7
+ data.tar.gz: ead9627559679e296ecb1a6466bbcbccc6e2b71a85429a6dcdbef5abd7778dbd7eca7b0869c19c86cc1890dbb9f97f0ff79b12267cb63ab989e9096989455b58
data/Gemfile CHANGED
@@ -5,9 +5,9 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in boxing.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 13.0'
8
+ gem 'rake', '~> 13.1'
9
9
 
10
- gem 'rspec', '~> 3.0'
10
+ gem 'rspec', '~> 3.12'
11
11
 
12
12
  gem 'simplecov'
13
13
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxing (0.10.0)
4
+ boxing (0.11.0)
5
5
  bundler (~> 2.0)
6
- thor (~> 1.0)
6
+ zeitwerk (~> 2.6)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -16,7 +16,7 @@ GEM
16
16
  diff-lcs (1.5.0)
17
17
  docile (1.4.0)
18
18
  iniparse (1.5.0)
19
- overcommit (0.59.1)
19
+ overcommit (0.61.0)
20
20
  childprocess (>= 0.6.3, < 5)
21
21
  iniparse (~> 1.4)
22
22
  rexml (~> 3.2)
@@ -24,22 +24,22 @@ GEM
24
24
  parser (3.1.2.0)
25
25
  ast (~> 2.4.1)
26
26
  rainbow (3.1.1)
27
- rake (13.0.6)
27
+ rake (13.1.0)
28
28
  regexp_parser (2.4.0)
29
- rexml (3.2.5)
30
- rspec (3.11.0)
31
- rspec-core (~> 3.11.0)
32
- rspec-expectations (~> 3.11.0)
33
- rspec-mocks (~> 3.11.0)
34
- rspec-core (3.11.0)
35
- rspec-support (~> 3.11.0)
36
- rspec-expectations (3.11.0)
29
+ rexml (3.2.6)
30
+ rspec (3.12.0)
31
+ rspec-core (~> 3.12.0)
32
+ rspec-expectations (~> 3.12.0)
33
+ rspec-mocks (~> 3.12.0)
34
+ rspec-core (3.12.2)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-expectations (3.12.3)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.11.0)
39
- rspec-mocks (3.11.1)
38
+ rspec-support (~> 3.12.0)
39
+ rspec-mocks (3.12.6)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.11.0)
42
- rspec-support (3.11.0)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-support (3.12.1)
43
43
  rubocop (1.30.0)
44
44
  parallel (~> 1.10)
45
45
  parser (>= 3.1.0.0)
@@ -56,30 +56,33 @@ GEM
56
56
  rubocop-rspec (2.11.1)
57
57
  rubocop (~> 1.19)
58
58
  ruby-progressbar (1.11.0)
59
- simplecov (0.21.2)
59
+ simplecov (0.22.0)
60
60
  docile (~> 1.1)
61
61
  simplecov-html (~> 0.11)
62
62
  simplecov_json_formatter (~> 0.1)
63
63
  simplecov-html (0.12.3)
64
64
  simplecov_json_formatter (0.1.4)
65
- thor (1.2.1)
65
+ thor (1.2.2)
66
66
  unicode-display_width (2.1.0)
67
+ zeitwerk (2.6.12)
67
68
 
68
69
  PLATFORMS
70
+ arm64-darwin-23
69
71
  x86_64-darwin-20
70
72
  x86_64-darwin-21
73
+ x86_64-darwin-22
71
74
  x86_64-linux
72
75
 
73
76
  DEPENDENCIES
74
77
  boxing!
75
78
  bundler-audit
76
79
  overcommit
77
- rake (~> 13.0)
78
- rspec (~> 3.0)
80
+ rake (~> 13.1)
81
+ rspec (~> 3.12)
79
82
  rubocop (~> 1.22)
80
83
  rubocop-rake
81
84
  rubocop-rspec
82
85
  simplecov
83
86
 
84
87
  BUNDLED WITH
85
- 2.3.14
88
+ 2.4.10
data/README.md CHANGED
@@ -42,6 +42,12 @@ The final Rails image will be around 100MB and can be flexible to delivery to an
42
42
 
43
43
  If your gem dependency included `bootsnap` the generated Dockerfile will add precompile options to speed up the application bootstrap.
44
44
 
45
+ ### AWS Lambda Runtime Interface Client
46
+
47
+ When the `aws_lambda_ric` gem is detected, the `boxing` will choose to use `bin/aws_lambda_ric` as entrypoint.
48
+
49
+ To make it works correctly, run `bundle binstub aws_lambda_ric` to make it can run it correctly.
50
+
45
51
  ### Revision
46
52
 
47
53
  To identity your image version, the default build argument `REVISION` will be configured by default.
data/boxing.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  # Uncomment to register a new dependency of your gem
32
32
  spec.add_dependency 'bundler', '~> 2.0'
33
- spec.add_dependency 'thor', '~> 1.0'
33
+ spec.add_dependency 'zeitwerk', '~> 2.6'
34
34
 
35
35
  # For more information and examples about making a new gem, checkout our
36
36
  # guide at: https://bundler.io/guides/creating_gem.html
data/exe/boxing CHANGED
@@ -2,5 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'boxing'
5
+ require 'rake'
5
6
 
6
- Boxing::Command.start(ARGV)
7
+ Rake.application = Boxing::Command.new
8
+ Rake.application.run
@@ -1,20 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
3
+ require 'rake'
4
4
 
5
5
  module Boxing
6
6
  # The Main Command
7
7
  #
8
8
  # @since 0.1.0
9
- class Command < Thor
10
- # :nodoc:
11
- def self.exit_on_failure?
12
- true
9
+ class Command < Rake::Application
10
+ # @since 0.11.0
11
+ TASK_ROOT = File.expand_path('./tasks', __dir__)
12
+
13
+ # @see Rake::Application#run
14
+ def run(argv = ARGV)
15
+ standard_exception_handling do
16
+ init('boxing', argv)
17
+ load_rakefile
18
+ top_level
19
+ end
13
20
  end
14
21
 
15
- require_relative 'commands/base'
16
- require_relative 'commands/generate'
17
- require_relative 'commands/compose'
18
- require_relative 'commands/update'
22
+ # @see Rake::Application#load_rakefile
23
+ def load_rakefile
24
+ glob("#{TASK_ROOT}/**/*.rake").each { |task| add_import task }
25
+ load_imports
26
+ end
19
27
  end
20
28
  end
data/lib/boxing/config.rb CHANGED
@@ -14,7 +14,8 @@ module Boxing
14
14
  :assets_precompile, :node_version,
15
15
  :build_packages, :runtime_packages,
16
16
  :revision, :sentry_release,
17
- :entrypoint, :command
17
+ :entrypoint, :command,
18
+ :exclude_groups
18
19
 
19
20
  # @since 0.5.0
20
21
  def initialize(&block)
@@ -23,8 +24,16 @@ module Boxing
23
24
  @port = 9292
24
25
  @health_check_path = '/status'
25
26
  @assets_precompile = false
27
+ @exclude_groups = default_exclude_groups
26
28
 
27
29
  instance_exec(self, &block) if defined?(yield)
28
30
  end
31
+
32
+ # @since 0.11.0
33
+ def default_exclude_groups
34
+ return %w[development test cli] if defined?(Hanami)
35
+
36
+ %w[development test]
37
+ end
29
38
  end
30
39
  end
@@ -37,6 +37,15 @@ module Boxing
37
37
  )
38
38
  end
39
39
 
40
+ # Exclude Gems in container images
41
+ #
42
+ # @return [Array<String>]
43
+ #
44
+ # @since 0.11.0
45
+ def exclude_groups
46
+ @exclude_groups ||= config.exclude_groups || []
47
+ end
48
+
40
49
  # Check rubygems exists
41
50
  #
42
51
  # @param names [Array<String>]
@@ -77,7 +86,7 @@ module Boxing
77
86
  #
78
87
  # @since 0.6.0
79
88
  def extra_packages
80
- Array[config.build_packages, config.runtime_packages].flatten.map do |name|
89
+ [config.build_packages, config.runtime_packages].flatten.map do |name|
81
90
  next if name.nil?
82
91
 
83
92
  Package.new(name, mode: mode_of(name))
@@ -0,0 +1,177 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tempfile'
4
+
5
+ module Boxing
6
+ # Generate file from template
7
+ #
8
+ # @since 0.11.0
9
+ class Generator
10
+ ASCII_CLEAR = "\e[0m"
11
+ ASCII_BOLD = "\e[1m"
12
+ ASCII_RED = "\e[31m"
13
+
14
+ CREATED_MESSAGE = "#{ASCII_BOLD}create#{ASCII_CLEAR}\t%s"
15
+ IDENTICAL_MESSAGE = "#{ASCII_BOLD}identical#{ASCII_CLEAR}\t%s"
16
+ CONFLICT_MESSAGE = "#{ASCII_BOLD}#{ASCII_RED}conflict#{ASCII_CLEAR}\t%s"
17
+ OVERWRITE_MESSAGE = 'Overwrite %s? (enter "h" for help) [Ynqdhm] '
18
+ FORCE_MESSAGE = "#{ASCII_BOLD}force#{ASCII_CLEAR}\t%s"
19
+ SKIP_MESSAGE = "#{ASCII_BOLD}skip#{ASCII_CLEAR}\t%s"
20
+ MERGE_TOOL_NOT_FOUND = 'Please configure merge.tool in your Git config.'
21
+
22
+ attr_reader :destination, :path
23
+
24
+ include Utils
25
+
26
+ # @since 0.11.0
27
+ def initialize(destination, content)
28
+ @destination = destination
29
+ @path = current_path.join(@destination)
30
+ @content = content
31
+ end
32
+
33
+ # Generate file
34
+ #
35
+ # @since 0.11.0
36
+ def execute
37
+ with_conflict do
38
+ FileUtils.mkdir_p(File.dirname(path))
39
+ File.write(path, render)
40
+ end
41
+ end
42
+
43
+ # Render content
44
+ #
45
+ # @return [String]
46
+ #
47
+ # @since 0.11.0
48
+ def render
49
+ @render ||= if @content.is_a?(Proc)
50
+ @content.call
51
+ else
52
+ @content
53
+ end
54
+ end
55
+
56
+ # Check if file exists
57
+ #
58
+ # @return [TrueClass|FalseClass]
59
+ #
60
+ # @since 0.11.0
61
+ def exist?
62
+ path.exist?
63
+ end
64
+
65
+ # Check if file identical
66
+ #
67
+ # @return [TrueClass|FalseClass]
68
+ #
69
+ # @since 0.11.0
70
+ def identical?
71
+ exist? && File.binread(path) == String.new(render).force_encoding('ASCII-8BIT')
72
+ end
73
+
74
+ protected
75
+
76
+ # With conflict
77
+ #
78
+ # @param [Proc] block
79
+ #
80
+ # @since 0.11.0
81
+ def with_conflict(&block)
82
+ return on_conflict(&block) if exist?
83
+
84
+ yield
85
+ puts format(CREATED_MESSAGE, destination)
86
+ end
87
+
88
+ # On conflict
89
+ #
90
+ # @param [Proc] block
91
+ #
92
+ # @since 0.11.0
93
+ def on_conflict
94
+ return puts format(IDENTICAL_MESSAGE, destination) if identical?
95
+
96
+ puts format(CONFLICT_MESSAGE, destination)
97
+ return puts format(SKIP_MESSAGE, destination) unless do_overwrite
98
+
99
+ puts format(FORCE_MESSAGE, destination)
100
+ yield if block_given?
101
+ end
102
+
103
+ # Do overwrite
104
+ #
105
+ # @return [TrueClass|FalseClass]
106
+ # @raise [SystemExit] if user quits
107
+ #
108
+ # @api private
109
+ # @since 0.11.0
110
+ def do_overwrite # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
111
+ loop do
112
+ print format(OVERWRITE_MESSAGE, destination)
113
+
114
+ case $stdin.gets.chomp
115
+ when 'Y', 'y', '' then return true
116
+ when 'n', 'N' then return false
117
+ when 'd', 'D' then show_diff
118
+ when 'h', 'H' then show_help
119
+ when 'm', 'M'
120
+ puts MERGE_TOOL_NOT_FOUND unless do_merge
121
+ return false
122
+ when 'q', 'Q' then raise SystemExit
123
+ end
124
+ end
125
+ end
126
+
127
+ # Show diff
128
+ #
129
+ # @since 0.11.0
130
+ # @api private
131
+ def show_diff
132
+ Tempfile.open(destination) do |tempfile|
133
+ tempfile.write(render)
134
+ tempfile.rewind
135
+
136
+ system("diff -u --color #{path} #{tempfile.path}")
137
+ end
138
+ end
139
+
140
+ # Do merge
141
+ #
142
+ # @return [TrueClass|FalseClass]
143
+ #
144
+ # @since 0.11.0
145
+ # @api private
146
+ def do_merge # rubocop:disable Metrics/MethodLength
147
+ tool = begin
148
+ `git config merge.tool`.rstrip
149
+ rescue StandardError
150
+ ''
151
+ end
152
+ return false if tool.empty?
153
+
154
+ Tempfile.open(destination) do |tempfile|
155
+ tempfile.write(render)
156
+ tempfile.rewind
157
+
158
+ system("#{tool} #{tempfile.path} #{path}")
159
+ end
160
+ end
161
+
162
+ # Show help
163
+ #
164
+ # @since 0.11.0
165
+ # @api private
166
+ def show_help
167
+ puts <<-HELP
168
+ Y - yes, overwrite
169
+ n - no, do not overwrite
170
+ d - diff, show the differences between the old and the new
171
+ h - help, show this help
172
+ m - merge, run merge tool
173
+ q - quit, exit this program
174
+ HELP
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Hanami::CLI::RakeTasks.register_tasks do
4
+ namespace :boxing do
5
+ path = File.join(Boxing::Command::TASK_ROOT, '**/*.rake')
6
+ FileList.glob(path.tr('\\', '/')).each { |file| load file }
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boxing
4
+ # :nodoc:
5
+ class Railtie < ::Rails::Railtie
6
+ rake_tasks do
7
+ namespace :boxing do
8
+ path = File.join(Boxing::Command::TASK_ROOT, '**/*.rake')
9
+ FileList.glob(path.tr('\\', '/')).each { |file| load file }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Generate docker-compose.yml'
4
+ task compose: :config do
5
+ template('docker-compose.yml', 'docker-compose.yml.tt', context: Boxing.context)
6
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ task :config do
4
+ require 'hanami/setup' if defined?(Hanami::CLI)
5
+
6
+ include Boxing::Utils
7
+
8
+ config_file = current_path.join('config', 'boxing.rb')
9
+ load config_file if config_file.exist?
10
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Generate Dockerfile'
4
+ task generate: :config do
5
+ template('Dockerfile', 'Dockerfile.tt', context: Boxing.context)
6
+ template('.dockerignore', 'dockerignore.tt', context: Boxing.context)
7
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Update boxing database'
4
+ task :update do
5
+ puts 'Updating database...'
6
+
7
+ if Boxing::Database.exist?
8
+ Boxing::Database.new.update!
9
+ else
10
+ Boxing::Database.download!
11
+ end
12
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'erb'
4
+
5
+ module Boxing
6
+ # Generate file from template
7
+ #
8
+ # @since 0.11.0
9
+ class Template
10
+ # @since 0.11.0
11
+ TEMPLATE_DIR = File.expand_path('../../templates', __dir__)
12
+
13
+ # @param [String] template
14
+ # @param [Binding] context
15
+ #
16
+ # @since 0.11.0
17
+ def initialize(template)
18
+ @template = template
19
+ end
20
+
21
+ # Create template engine
22
+ #
23
+ # @return [ERB]
24
+ #
25
+ # @since 0.11.0
26
+ # @api private
27
+ def engine
28
+ @engine ||= ERB.new(content, trim_mode: '-')
29
+ end
30
+
31
+ # Get template content
32
+ #
33
+ # @return [String]
34
+ #
35
+ # @since 0.11.0
36
+ # @api private
37
+ def content
38
+ @content ||= File.read("#{TEMPLATE_DIR}/#{@template}")
39
+ end
40
+
41
+ # Render template
42
+ #
43
+ # @return [String]
44
+ #
45
+ # @since 0.11.0
46
+ # @api private
47
+ def render(context = nil)
48
+ context = context.to_binding if context.respond_to?(:to_binding)
49
+ engine.result(context)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module Boxing
6
+ # Utility methods
7
+ #
8
+ # @since 0.11.0
9
+ module Utils
10
+ # Get project root
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @since 0.11.0
15
+ def current_path
16
+ return Hanami.app.root if defined?(Hanami)
17
+ return Rails.root if defined?(Rails)
18
+
19
+ Pathname.new(Dir.pwd)
20
+ end
21
+
22
+ # Generate file from template
23
+ #
24
+ # @param [String] destination
25
+ # @param [String] template
26
+ # @param [Binding] context
27
+ #
28
+ # @since 0.11.0
29
+ def template(destination, template, context: nil)
30
+ Generator.new(destination, -> { Template.new(template).render(context) }).execute
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boxing
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
data/lib/boxing.rb CHANGED
@@ -1,11 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'boxing/version'
4
- require_relative 'boxing/config'
5
- require_relative 'boxing/package'
6
- require_relative 'boxing/database'
7
- require_relative 'boxing/context'
8
- require_relative 'boxing/command'
3
+ require 'zeitwerk'
9
4
 
10
5
  # The tool to generate Dockerfile without config
11
6
  #
@@ -15,6 +10,19 @@ module Boxing
15
10
 
16
11
  module_function
17
12
 
13
+ # @since 0.11.0
14
+ # @api private
15
+ def loader
16
+ @loader ||= Zeitwerk::Loader.for_gem.tap do |loader|
17
+ loader.ignore("#{__dir__}/boxing/{railtie,hanami}.rb")
18
+ end
19
+ end
20
+
21
+ loader.setup
22
+
23
+ require_relative 'boxing/railtie' if defined?(Rails::Railtie)
24
+ require_relative 'boxing/hanami' if defined?(Hanami::CLI)
25
+
18
26
  # @return [Bundler::Dependency]
19
27
  #
20
28
  # @since 0.1.0
@@ -39,4 +47,22 @@ module Boxing
39
47
 
40
48
  @config
41
49
  end
50
+
51
+ # @return [Boxing::Database]
52
+ #
53
+ # @since 0.11.0
54
+ def database
55
+ @database ||= Database.new
56
+ end
57
+
58
+ # @return [Boxing::Context]
59
+ #
60
+ # @since 0.11.0
61
+ def context
62
+ @context ||= Context.new(
63
+ config,
64
+ database,
65
+ dependencies
66
+ )
67
+ end
42
68
  end
@@ -15,7 +15,7 @@ RUN gem install bundler:<%= Bundler::VERSION %> \
15
15
  && bundle config --local deployment 'true' \
16
16
  && bundle config --local frozen 'true' \
17
17
  && bundle config --local no-cache 'true' \
18
- && bundle config --local without 'development test' \
18
+ && bundle config --local without '<%= exclude_groups.join(' ') %>' \
19
19
  && bundle install -j "$(getconf _NPROCESSORS_ONLN)" \
20
20
  && find ${APP_ROOT}/vendor/bundle -type f -name '*.c' -delete \
21
21
  && find ${APP_ROOT}/vendor/bundle -type f -name '*.h' -delete \
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-29 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: thor
28
+ name: zeitwerk
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '2.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '2.6'
41
41
  description: The zero-configuration Dockerfile generator for Ruby
42
42
  email:
43
43
  - contact@frost.tw
@@ -60,14 +60,19 @@ files:
60
60
  - exe/boxing
61
61
  - lib/boxing.rb
62
62
  - lib/boxing/command.rb
63
- - lib/boxing/commands/base.rb
64
- - lib/boxing/commands/compose.rb
65
- - lib/boxing/commands/generate.rb
66
- - lib/boxing/commands/update.rb
67
63
  - lib/boxing/config.rb
68
64
  - lib/boxing/context.rb
69
65
  - lib/boxing/database.rb
66
+ - lib/boxing/generator.rb
67
+ - lib/boxing/hanami.rb
70
68
  - lib/boxing/package.rb
69
+ - lib/boxing/railtie.rb
70
+ - lib/boxing/tasks/compose.rake
71
+ - lib/boxing/tasks/config.rake
72
+ - lib/boxing/tasks/generate.rake
73
+ - lib/boxing/tasks/update.rake
74
+ - lib/boxing/template.rb
75
+ - lib/boxing/utils.rb
71
76
  - lib/boxing/version.rb
72
77
  - templates/Dockerfile.tt
73
78
  - templates/docker-compose.yml.tt
@@ -91,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
96
  - !ruby/object:Gem::Version
92
97
  version: '0'
93
98
  requirements: []
94
- rubygems_version: 3.1.6
99
+ rubygems_version: 3.5.3
95
100
  signing_key:
96
101
  specification_version: 4
97
102
  summary: The zero-configuration Dockerfile generator for Ruby
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Boxing
4
- # :nodoc:
5
- module Commands
6
- # The Base Command
7
- #
8
- # @since 0.5.0
9
- class Base < Thor::Group
10
- include Thor::Actions
11
-
12
- # :nodoc:
13
- def self.source_root
14
- Pathname.new(File.dirname(__FILE__)).join('../../..')
15
- end
16
-
17
- # Prepare command environment
18
- #
19
- # @since 0.5.0
20
- def prepare
21
- config = Bundler.root.join('config/boxing.rb')
22
- return unless config.exist?
23
-
24
- load config
25
- end
26
-
27
- private
28
-
29
- # :nodoc:
30
- def context
31
- @context = Context.new(
32
- Boxing.config,
33
- Database.new,
34
- Boxing.dependencies
35
- )
36
- end
37
- end
38
- end
39
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Boxing
4
- # :nodoc:
5
- module Commands
6
- # The Docker Compose Generator
7
- #
8
- # @since 0.1.0
9
- class Compose < Base
10
- # Create Dockerfile
11
- #
12
- # @since 0.1.0
13
- def execute
14
- Database.download! unless Database.exist?
15
-
16
- # TODO: Allow set image registry
17
- # TODO: Allow set application name
18
- template('templates/docker-compose.yml.tt', 'docker-compose.yml', context: context.to_binding)
19
- end
20
- end
21
-
22
- Boxing::Command.register(Compose, 'compose', 'compose', 'Generate docker-compose.yml')
23
- end
24
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pathname'
4
- require 'set'
5
-
6
- module Boxing
7
- # :nodoc:
8
- module Commands
9
- # The Dockerfle Generator
10
- #
11
- # @since 0.1.0
12
- class Generate < Base
13
- # Create Dockerfile
14
- #
15
- # @since 0.1.0
16
- def execute
17
- Database.download! unless Database.exist?
18
-
19
- template('templates/Dockerfile.tt', 'Dockerfile', context: context.to_binding)
20
- template('templates/dockerignore.tt', '.dockerignore', context: context.to_binding)
21
- end
22
- end
23
-
24
- Boxing::Command.register(Generate, 'generate', 'generate', 'Generate Dockerfile')
25
- end
26
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Boxing
4
- # :nodoc:
5
- module Commands
6
- # The Database Updater
7
- #
8
- # @since 0.3.0
9
- class Update < Base
10
- # Update Database
11
- #
12
- # @since 0.3.0
13
- def execute
14
- if Database.exist?
15
- Database.new.update!
16
- else
17
- Database.download!
18
- end
19
- end
20
- end
21
-
22
- Boxing::Command.register(Update, 'update', 'update', 'Update Database')
23
- end
24
- end