kuby-prebundler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f7d463fee6e63a5f20acc3771a8a9b2d9f545b32d6f6cb9a0f9aae8478a75721
4
+ data.tar.gz: 194b616fac0ffca2102758cf6a639ef9e415bee951442fb4829e1fed366c04d5
5
+ SHA512:
6
+ metadata.gz: ba7f32361414c9b7b6757225f2171b31e66b7ef62399ee52857604a37b561bffe11e0d62d72c053d527062035cf04faae71b408eb774001407882a85c39be0af
7
+ data.tar.gz: 0ac60081f6d3de0d8889af5f454841a97b8ff2d3cdf2f1b165025b0c22a636b993810ad7899c5676d4788287dc978764e2c6ca17e6fb284d96eefafb1766f1f3
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ ## 0.1.0
2
+ * Birthday!
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'kuby-core'
7
+ gem 'pry-byebug'
8
+ gem 'rake'
9
+ end
10
+
11
+ group :test do
12
+ gem 'rspec', '~> 3.0'
13
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Cameron Dutro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubygems/package_task'
4
+
5
+ require 'kuby/prebundler'
6
+ require 'pry-byebug'
7
+
8
+ Bundler::GemHelper.install_tasks
9
+
10
+ task default: :spec
11
+
12
+ desc 'Run specs'
13
+ RSpec::Core::RakeTask.new do |t|
14
+ t.pattern = './spec/**/*_spec.rb'
15
+ end
@@ -0,0 +1,19 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require 'kuby/prebundler/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'kuby-prebundler'
6
+ s.version = ::Kuby::Prebundler::VERSION
7
+ s.authors = ['Cameron Dutro']
8
+ s.email = ['camertron@gmail.com']
9
+ s.homepage = 'http://github.com/getkuby/kuby-prebundler'
10
+
11
+ s.description = s.summary = 'Use Prebundler to install your bundle when building Docker images with Kuby.'
12
+
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'kuby-core', '>= 0.16.0', '< 1.0'
16
+
17
+ s.require_path = 'lib'
18
+ s.files = Dir['{lib,spec}/**/*', 'Gemfile', 'LICENSE', 'CHANGELOG.md', 'README.md', 'Rakefile', 'kuby-prebundler.gemspec']
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'kuby'
2
+
3
+ module Kuby
4
+ module Prebundler
5
+ class Plugin < ::Kuby::Plugin
6
+ def after_configuration
7
+ bundler_phase = docker.bundler_phase
8
+ docker.delete(:bundler_phase)
9
+ docker.insert(:bundler_phase, PrebundlerPhase.new(environment, bundler_phase), after: :package_phase)
10
+ end
11
+
12
+ private
13
+
14
+ def docker
15
+ environment.docker
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ require 'kuby'
2
+
3
+ module Kuby
4
+ module Prebundler
5
+ class PrebundlerPhase < ::Kuby::Docker::Layer
6
+ attr_accessor :prebundle_config, :bundler_phase
7
+
8
+ def initialize(environment, bundler_phase)
9
+ @bundler_phase = bundler_phase
10
+ @bundler_phase.executable = 'prebundle'
11
+
12
+ super(environment)
13
+ end
14
+
15
+ def method_missing(method_name, *args, **kwargs, &block)
16
+ bundler_phase.send(method_name, *args, **kwargs, &block)
17
+ end
18
+
19
+ def respond_to_missing?(method_name)
20
+ bundler_phase.respond_to?(method_name)
21
+ end
22
+
23
+ def apply_to(dockerfile)
24
+ dockerfile.arg('PREBUNDLER_ACCESS_KEY_ID')
25
+ dockerfile.arg('PREBUNDLER_SECRET_ACCESS_KEY')
26
+
27
+ dockerfile.copy(prebundle_config || '.prebundle_config', '.')
28
+ dockerfile.run('gem', 'install', 'prebundler', '-v', "'< 1'")
29
+
30
+ bundler_phase.apply_to(dockerfile)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ module Kuby
2
+ module Prebundler
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'kube-dsl'
2
+ require 'kuby/prebundler/plugin'
3
+ require 'kuby/prebundler/prebundler_phase'
4
+
5
+ Kuby.register_plugin(:prebundler, ::Kuby::Prebundler::Plugin)
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kuby-prebundler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Dutro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: kuby-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.16.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.16.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ description: Use Prebundler to install your bundle when building Docker images with
34
+ Kuby.
35
+ email:
36
+ - camertron@gmail.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - CHANGELOG.md
42
+ - Gemfile
43
+ - LICENSE
44
+ - Rakefile
45
+ - kuby-prebundler.gemspec
46
+ - lib/kuby/prebundler.rb
47
+ - lib/kuby/prebundler/plugin.rb
48
+ - lib/kuby/prebundler/prebundler_phase.rb
49
+ - lib/kuby/prebundler/version.rb
50
+ homepage: http://github.com/getkuby/kuby-prebundler
51
+ licenses: []
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.2.22
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Use Prebundler to install your bundle when building Docker images with Kuby.
72
+ test_files: []