cutlass 0.1.1 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37d5a2eca394ec89a59906c1c5146b73596912198f8eea6e8cc9f97604512907
4
- data.tar.gz: 46f89fb2766576f84958aa163de11d9fe661829641a9b2c2f814b1aa9b74271d
3
+ metadata.gz: cdb173928f27587c6c7773c14449d42c074eab3903234d8d4721a67b0a99ffdf
4
+ data.tar.gz: abe99ef36a53e6225facc87cdcf941abfd4a10eae84ca350c9f8f6f69e2b6483
5
5
  SHA512:
6
- metadata.gz: 634836ec72d9c6e0dd3acbd04c4b9dbcbb678ebfa9245ed9f5b1118096293e574b6e603e748575b02c85fc4d7a7ad81c805f5b6566d66d3bbdc144725cca8e04
7
- data.tar.gz: 31f373061f0a75ef9efa2eaa2d332f7aa98b856ab7408070bfcb37302f7e38d459b1b96a13566d44ef0ca2c9d3c7b390de77cf6f0453b6b09e90502e0e579e0f
6
+ metadata.gz: 1c87fc56443a756fdbd26d4130b594d3e6f6133e85d1b5713bc37a01f6d26c3f6c2d198805eb92e6afa1f06c0f9a3f62a709d1a6f05a8162b33730e331b28e58
7
+ data.tar.gz: 362930d0ae55e20b08628a979e83965ea5d91fca9a0406c026c581e342b720ef0447a2cae2f46af4ebbed8e6d608406856474d613600ad57268fc53be10c0170
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## 0.1.6
4
+
5
+ - Remove premature error checking from Cutlass.default_buildpack_paths
6
+
7
+ ## 0.1.5
8
+
9
+ - Expect build.sh scripts to produce a directory named "target" https://github.com/heroku/cutlass/pull/7
10
+
11
+ ## 0.1.4
12
+
13
+ - Cutlass.default_buildpack_paths= now accepts a LocalBuildpack https://github.com/heroku/cutlass/pull/6
14
+
15
+ ## 0.1.3
16
+
17
+ - Do not connect to docker if it's not needed https://github.com/heroku/cutlass/pull/5
18
+
19
+ ## 0.1.2
20
+
21
+ - App.new accepts a buildpack array with the `:default` symbol which acts as a shortcut for `Cutlass.default_buildpack_paths` https://github.com/heroku/cutlass/pull/4
22
+ - `Cutlass.default_buildpack_paths=` raises an error if you pass in a path that does not exist. https://github.com/heroku/cutlass/pull/4
23
+
3
24
  ## 0.1.1
4
25
 
5
26
  - Fix App#pack_build with no block https://github.com/heroku/cutlass/pull/3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cutlass (0.1.1)
4
+ cutlass (0.1.6)
5
5
  docker-api (>= 2.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -135,7 +135,7 @@ In additon to the standard `package.toml` interface, if this directory has a `bu
135
135
 
136
136
  - @param repo_name [String] the path to a directory on disk, or the name of a directory inside of the `config.default_repos_dir`.
137
137
  - @param builder [String] the name of a CNB "builder" used to build the app against. Defaults to `config.default_builder`.
138
- - @param buildpacks [Array<String>] the array of buildpacks to build the app against. Defaults to `config.default_buildpack_paths`.
138
+ - @param buildpacks [Array<String>] the array of buildpacks to build the app against. Defaults to `config.default_buildpack_paths`. If you pass in a symbol of `:default` it will substitute `Cutlass.default_buildpack_paths`. That means passing in `["heroku/nodejs", :default]` is a shortcut for `["heroku/nodejs, Cutlass.default_buildpack_paths].flatten`.
139
139
  - @param config [Hash{Symbol => String}, Hash{String => String}] env vars to set against the app before it is built.
140
140
  - @param exception_on_failure: [Boolean] when truthy failures on `app.pack_build` will result in an exception. Default is true.
141
141
 
data/lib/cutlass.rb CHANGED
@@ -20,8 +20,19 @@ module Cutlass
20
20
 
21
21
  class << self
22
22
  # Cutlass.default_builder
23
- # Cutlass.default_buildpack_paths
24
- attr_accessor :default_builder, :default_buildpack_paths
23
+ attr_accessor :default_builder
24
+ end
25
+
26
+ def self.default_buildpack_paths=(paths)
27
+ paths = Array(paths).map { |path| path.respond_to?(:exist?) ? path : Pathname(path) }
28
+
29
+ @default_buildpack_paths = paths
30
+ end
31
+
32
+ def self.default_buildpack_paths
33
+ raise "Must set Cutlass.default_buildpack_paths to a non-empty value" if @default_buildpack_paths.empty? || @default_buildpack_paths.nil?
34
+
35
+ @default_buildpack_paths
25
36
  end
26
37
 
27
38
  @default_buildpack_paths = []
data/lib/cutlass/app.rb CHANGED
@@ -34,7 +34,7 @@ module Cutlass
34
34
  @warn_io = warn_io
35
35
  @builder = builder
36
36
  @image_name = image_name
37
- @buildpacks = buildpacks
37
+ @buildpacks = Array(buildpacks).map { |buildpack| buildpack == :default ? Cutlass.default_buildpack_paths : buildpack }.flatten
38
38
  @source_path_name = source_path_name
39
39
  @exception_on_failure = exception_on_failure
40
40
  end
@@ -35,9 +35,9 @@ module Cutlass
35
35
  @skip_keys << key
36
36
  end
37
37
 
38
- def self.record
38
+ def self.record(docker: ENV["CUTLASS_CHECK_DOCKER"])
39
39
  @env_diff = EnvDiff.new(skip_keys: @skip_keys)
40
- @docker_diff = DockerDiff.new
40
+ @docker_diff = DockerDiff.new if docker
41
41
  end
42
42
 
43
43
  def self.check(docker: ENV["CUTLASS_CHECK_DOCKER"])
@@ -29,8 +29,9 @@ module Cutlass
29
29
 
30
30
  def bash_exec(cmd, exception_on_failure: true)
31
31
  stdout_ish, stderr, status = @container.exec(["bash", "-c", cmd])
32
+ stdout = stdout_ish.first
32
33
 
33
- result = BashResult.new(stdout: stdout_ish.first, stderr: stderr, status: status)
34
+ result = BashResult.new(stdout: stdout, stderr: stderr, status: status)
34
35
 
35
36
  return result if result.success?
36
37
  return result unless exception_on_failure
@@ -31,6 +31,10 @@ module Cutlass
31
31
  @image_name = "cutlass_local_buildpack_#{SecureRandom.hex(10)}"
32
32
  end
33
33
 
34
+ def exist?
35
+ @directory.exist?
36
+ end
37
+
34
38
  def teardown
35
39
  return unless built?
36
40
 
@@ -86,7 +90,11 @@ module Cutlass
86
90
  puts result.stdout if Cutlass.debug?
87
91
  puts result.stderr if Cutlass.debug?
88
92
 
89
- return if result.success?
93
+ if result.success?
94
+ @directory = @directory.join("target")
95
+ raise "Expected #{build_sh} to produce a directory #{@directory} but it did not" unless @directory.exist?
96
+ return
97
+ end
90
98
 
91
99
  raise <<~EOM
92
100
  Buildpack build step failed!
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Cutlass
4
4
  # Version
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.6"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutlass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api