cutlass 0.1.0 → 0.1.5

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: 4e4919b3ae4b9ca86167db61346a78a53b2502c0405b1e0d0f2e9b0568f29453
4
- data.tar.gz: 6b69081ae0e60fafe6ae5a5e06af8f2f35aef1e4a425af6bfc4a6231fc71217b
3
+ metadata.gz: 746dcb9487d8f83d93a3195f4d933d494eff593f4308170e5d29f2a57c226597
4
+ data.tar.gz: c239092e284958eca4e0533d8e187ea865adc0fd93958fc92df63c9e534b6700
5
5
  SHA512:
6
- metadata.gz: fe65cc9cf7765ca5b4229b62e0003c783cda266a8fb0f684ed7889c4e4284820d2839781b3dab6f8c57a69d07c73b097817180bfc3dd332206a33b1a0ec3b585
7
- data.tar.gz: be0f8a81aa6a6e728c78b009b73bb42a57ff0fe406c3de89e12ce988a57e40fbc420abfc93c44089b2f036d575595bc4419dbd40ceef8f993f11e9d48fb5fcbd
6
+ metadata.gz: 93567e242b02a379b1521389038fbdbd0e48c67f462246589f4ad95ceaee6d90e6a4b90cb72ae1e91d9f030850b69b2586ed41be10e43c39a6785631682e6a35
7
+ data.tar.gz: d81805bbb176004b418aa1b8de608afa95966dfa10d9c5b26cdfd2722935a4950ffe617b7cc7a1101d0f57941bb1f518fe222895b19a1ae2d0f7d35f939b892c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## 0.1.5
4
+
5
+ - Expect build.sh scripts to produce a directory named "target" https://github.com/heroku/cutlass/pull/7
6
+
7
+ ## 0.1.4
8
+
9
+ - Cutlass.default_buildpack_paths= now accepts a LocalBuildpack https://github.com/heroku/cutlass/pull/6
10
+
11
+ ## 0.1.3
12
+
13
+ - Do not connect to docker if it's not needed https://github.com/heroku/cutlass/pull/5
14
+
15
+ ## 0.1.2
16
+
17
+ - 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
18
+ - `Cutlass.default_buildpack_paths=` raises an error if you pass in a path that does not exist. https://github.com/heroku/cutlass/pull/4
19
+
20
+ ## 0.1.1
21
+
22
+ - Fix App#pack_build with no block https://github.com/heroku/cutlass/pull/3
23
+
3
24
  ## [0.1.0] - 2021-03-29
4
25
 
5
26
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cutlass (0.1.0)
4
+ cutlass (0.1.5)
5
5
  docker-api (>= 2.0)
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  docker-api (2.1.0)
14
14
  excon (>= 0.47.0)
15
15
  multi_json
16
- excon (0.79.0)
16
+ excon (0.80.1)
17
17
  multi_json (1.15.0)
18
18
  parallel (1.20.1)
19
19
  parallel_split_test (0.9.1)
@@ -38,7 +38,7 @@ GEM
38
38
  diff-lcs (>= 1.2.0, < 2.0)
39
39
  rspec-support (~> 3.10.0)
40
40
  rspec-support (3.10.2)
41
- rubocop (1.11.0)
41
+ rubocop (1.12.1)
42
42
  parallel (~> 1.10)
43
43
  parser (>= 3.0.0.0)
44
44
  rainbow (>= 2.2.2, < 4.0)
@@ -53,8 +53,8 @@ GEM
53
53
  rubocop (>= 0.90.0, < 2.0)
54
54
  rubocop-ast (>= 0.4.0)
55
55
  ruby-progressbar (1.11.0)
56
- standard (1.0.4)
57
- rubocop (= 1.11.0)
56
+ standard (1.0.5)
57
+ rubocop (= 1.12.1)
58
58
  rubocop-performance (= 1.10.1)
59
59
  unicode-display_width (2.0.0)
60
60
  yard (0.9.26)
@@ -74,4 +74,4 @@ DEPENDENCIES
74
74
  yard
75
75
 
76
76
  BUNDLED WITH
77
- 2.1.4
77
+ 2.2.15
data/README.md CHANGED
@@ -33,7 +33,7 @@ Cutlass.config do |config|
33
33
  config.default_builder = "heroku/buildpacks:18"
34
34
 
35
35
  # Where do your test fixtures live?
36
- config.default_repos_dir = [File.join(__dir__, "..", "repos", "ruby_apps")]
36
+ config.default_repo_dirs = [File.join(__dir__, "..", "repos", "ruby_apps")]
37
37
 
38
38
  # Where does your buildpack live?
39
39
  # Can be a directory or a Cutlass:LocalBuildpack instance
@@ -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,23 @@ 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
+ paths.each do |path|
30
+ raise "Path must exist on disk #{path}" unless path.exist?
31
+ end
32
+
33
+ @default_buildpack_paths = paths
34
+ end
35
+
36
+ def self.default_buildpack_paths
37
+ raise "Must set Cutlass.default_buildpack_paths to a non-empty value" if @default_buildpack_paths.empty? || @default_buildpack_paths.nil?
38
+
39
+ @default_buildpack_paths
25
40
  end
26
41
 
27
42
  @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
@@ -110,7 +110,9 @@ module Cutlass
110
110
  on_teardown { build.teardown }
111
111
 
112
112
  @builds << build
113
- yield build.call
113
+ build.call
114
+
115
+ yield build if block_given?
114
116
  end
115
117
 
116
118
  def transaction
@@ -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"])
@@ -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.0"
5
+ VERSION = "0.1.5"
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.0
4
+ version: 0.1.5
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