cutlass 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: 4e4919b3ae4b9ca86167db61346a78a53b2502c0405b1e0d0f2e9b0568f29453
4
+ data.tar.gz: 6b69081ae0e60fafe6ae5a5e06af8f2f35aef1e4a425af6bfc4a6231fc71217b
5
+ SHA512:
6
+ metadata.gz: fe65cc9cf7765ca5b4229b62e0003c783cda266a8fb0f684ed7889c4e4284820d2839781b3dab6f8c57a69d07c73b097817180bfc3dd332206a33b1a0ec3b585
7
+ data.tar.gz: be0f8a81aa6a6e728c78b009b73bb42a57ff0fe406c3de89e12ce988a57e40fbc420abfc93c44089b2f036d575595bc4419dbd40ceef8f993f11e9d48fb5fcbd
@@ -0,0 +1,58 @@
1
+ version: 2.1
2
+ orbs:
3
+ pack: buildpacks/pack@0.2.2
4
+ ruby: circleci/ruby@1.1.2
5
+
6
+ references:
7
+ fast_specs: &fast_specs
8
+ run:
9
+ name: Run tests
10
+ command: PARALLEL_SPLIT_TEST_PROCESSES="4" IS_RUNNING_ON_CI=1 bundle exec parallel_split_test spec/ --tag \~slow
11
+ slow_specs: &slow_specs
12
+ run:
13
+ name: Run tests
14
+ command: PARALLEL_SPLIT_TEST_PROCESSES="4" IS_RUNNING_ON_CI=1 bundle exec parallel_split_test spec/ --tag slow
15
+ docker_pre_pull: &docker_pre_pull
16
+ run:
17
+ name: Pre-pull layers we don't intentd to clean up
18
+ command: docker pull heroku/heroku:18 && docker pull heroku/pack:18 && docker pull heroku/buildpacks:18
19
+ standardrb: &standardrb
20
+ run:
21
+ name: Linting
22
+ command: bundle exec standardrb
23
+
24
+ jobs:
25
+ fast_specs:
26
+ machine:
27
+ image: ubuntu-2004:202010-01
28
+ steps:
29
+ - checkout
30
+ - pack/install-pack:
31
+ version: 0.16.0
32
+ - ruby/install-deps
33
+ - <<: *fast_specs
34
+ slow_specs:
35
+ machine:
36
+ image: ubuntu-2004:202010-01
37
+ steps:
38
+ - checkout
39
+ - pack/install-pack:
40
+ version: 0.16.0
41
+ - ruby/install-deps
42
+ - <<: *slow_specs
43
+ standardrb:
44
+ docker:
45
+ - image: circleci/ruby:2.7
46
+ steps:
47
+ - checkout
48
+ - ruby/install-deps
49
+ - <<: *standardrb
50
+
51
+ workflows:
52
+ version: 2
53
+ build:
54
+ jobs:
55
+ - fast_specs
56
+ - slow_specs
57
+ - standardrb
58
+
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ open-pull-requests-limit: 1 # Limit concurrent CI runs from executing
6
+ schedule:
7
+ interval: "weekly"
8
+ labels:
9
+ - "dependencies"
@@ -0,0 +1,16 @@
1
+ name: Check Changelog
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, reopened, edited, synchronize]
6
+ jobs:
7
+ build:
8
+ if: |
9
+ !contains(github.event.pull_request.labels.*.name, 'dependencies') &&
10
+ !contains(github.event.pull_request.labels.*.name, 'automation')
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v1
14
+ - name: Check that CHANGELOG is touched
15
+ run: |
16
+ cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .DS_Store
13
+
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --require dead_end
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-03-29
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at richard.schneeman+foo@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in cutlass.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "rspec", "~> 3.0"
10
+ gem "yard"
11
+ gem "dead_end"
12
+ gem "standard"
13
+ gem "parallel_split_test"
data/Gemfile.lock ADDED
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cutlass (0.1.0)
5
+ docker-api (>= 2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ dead_end (1.1.6)
12
+ diff-lcs (1.4.4)
13
+ docker-api (2.1.0)
14
+ excon (>= 0.47.0)
15
+ multi_json
16
+ excon (0.79.0)
17
+ multi_json (1.15.0)
18
+ parallel (1.20.1)
19
+ parallel_split_test (0.9.1)
20
+ parallel (>= 0.5.13)
21
+ rspec-core (>= 3.9.0)
22
+ parser (3.0.1.0)
23
+ ast (~> 2.4.1)
24
+ rainbow (3.0.0)
25
+ rake (13.0.3)
26
+ regexp_parser (2.1.1)
27
+ rexml (3.2.5)
28
+ rspec (3.10.0)
29
+ rspec-core (~> 3.10.0)
30
+ rspec-expectations (~> 3.10.0)
31
+ rspec-mocks (~> 3.10.0)
32
+ rspec-core (3.10.1)
33
+ rspec-support (~> 3.10.0)
34
+ rspec-expectations (3.10.1)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-mocks (3.10.2)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.10.0)
40
+ rspec-support (3.10.2)
41
+ rubocop (1.11.0)
42
+ parallel (~> 1.10)
43
+ parser (>= 3.0.0.0)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ regexp_parser (>= 1.8, < 3.0)
46
+ rexml
47
+ rubocop-ast (>= 1.2.0, < 2.0)
48
+ ruby-progressbar (~> 1.7)
49
+ unicode-display_width (>= 1.4.0, < 3.0)
50
+ rubocop-ast (1.4.1)
51
+ parser (>= 2.7.1.5)
52
+ rubocop-performance (1.10.1)
53
+ rubocop (>= 0.90.0, < 2.0)
54
+ rubocop-ast (>= 0.4.0)
55
+ ruby-progressbar (1.11.0)
56
+ standard (1.0.4)
57
+ rubocop (= 1.11.0)
58
+ rubocop-performance (= 1.10.1)
59
+ unicode-display_width (2.0.0)
60
+ yard (0.9.26)
61
+
62
+ PLATFORMS
63
+ ruby
64
+ x86_64-darwin-19
65
+ x86_64-linux
66
+
67
+ DEPENDENCIES
68
+ cutlass!
69
+ dead_end
70
+ parallel_split_test
71
+ rake (~> 13.0)
72
+ rspec (~> 3.0)
73
+ standard
74
+ yard
75
+
76
+ BUNDLED WITH
77
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ copyright (c) 2021, Salesforce.com, Inc.
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # Cutlass
2
+
3
+ Hack and slash your way to Cloud Native Buildpack (CNB) stability with cutlass! This library is similar in spirit to [heroku_hatchet](https://github.com/heroku/hatchet), but instead of building on Heroku infrastructure cutlass utilizes [pack](https://buildpacks.io/docs/tools/pack/) to locally build and verify buildpack behavior.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'cutlass'
11
+ ```
12
+
13
+ ## Setup
14
+
15
+
16
+ It's assumed you've already got your project set up with rspec. If not see https://github.com/heroku/hatchet#hatchet-init, though using Hatchet is not required to use Cutlass.
17
+
18
+ You'll want to set up your app to run on CircleCI. Here's reference configs:
19
+
20
+ - [buildpacks-jvm](https://github.com/heroku/buildpacks-jvm/blob/main/.circleci/config.yml) note the versions of pack, the pack orb, and the executor. If you want to use the `start_container` interface your executor options are limited.
21
+
22
+
23
+ TODO: `cutlass init` command
24
+
25
+ ## Initial Config
26
+
27
+ In your `spec_helper.rb` configure your default stack:
28
+
29
+ ```ruby
30
+ # spec/spec_helper.rb
31
+
32
+ Cutlass.config do |config|
33
+ config.default_builder = "heroku/buildpacks:18"
34
+
35
+ # Where do your test fixtures live?
36
+ config.default_repos_dir = [File.join(__dir__, "..", "repos", "ruby_apps")]
37
+
38
+ # Where does your buildpack live?
39
+ # Can be a directory or a Cutlass:LocalBuildpack instance
40
+ config.default_buildpack_paths = [File.join(__dir__, "..")]
41
+ end
42
+ ```
43
+
44
+
45
+ ## Use
46
+
47
+ Initialize an instance with `Cutlass::App.new`
48
+
49
+ ```ruby
50
+ Cutlass::App.new(
51
+ "ruby-getting-started" # Directory name in your default repos dir
52
+ config: { RAILS_ENV: "production" },
53
+ builder: "heroku/buildpacks:18",
54
+ buildpacks: ["heroku/nodejs-engine", File.join("..")],
55
+ exception_on_failure: false
56
+ )
57
+ ```
58
+
59
+ Once initialized call methods on the instance:
60
+
61
+ ```ruby
62
+ Cutlass::App.new("ruby-getting-started").transaction do |app|
63
+ # Safely modify files on disk before building the project
64
+ Pathname(app.tmpdir).join("Procfile").write("web: rails s")
65
+
66
+
67
+ # Build the app with `pack_build` using a block or regular method call
68
+ app.pack_build do |result|
69
+ expect(result.stdout).to include("SUCCESS")
70
+ end
71
+
72
+ # Build the app again with the non-block form of this method
73
+ app.pack_build
74
+ app.stdout # Grabs stdout from last build
75
+ app.stderr # Grabs stdout from last build
76
+
77
+ # Executes a `docker run` command in a background thread
78
+ app.run_multi("ruby -v") do |result|
79
+ expect(result.stdout).to match("2.7.2")
80
+ expect(result.status).to eq(0)
81
+ end
82
+
83
+ # Binds the port 8080 inside of the container to a port on your host's localhost
84
+ # so you can make network requests to the instance. This requires the app
85
+ # to have an ENTRYPOINT in the docker file, such as an app with a `web` declaration
86
+ # that also uses the `heroku/procfile` buildpack. The entrypoint must not exit
87
+ # or the container will shut down.
88
+ #
89
+ # Another caveat to using this feature is that your "host" machine needs to be running on
90
+ # a machine, not inside of a docker instance otherwise the networking will not bind correctly to the
91
+ # child docker instance
92
+ #
93
+ # Basically there's a ton of caveats to using this feature. Tread lightly.
94
+ app.start_container(expose_ports: [8080]) do |container|
95
+ response = Excon.get("http://localhost:#{container.port(8080)}/", :idempotent => true, :retry_limit => 5, :retry_interval => 1)
96
+ expect(response.body).to eq("Welcome to rails")
97
+
98
+ # Warning, this does not use the CNB entrypoint so it's in a different dir
99
+ # and doesn't have env vars set
100
+ expect(container.bash_exec("pwd")).to eq("/workspace")
101
+ expect(container.get_file_contents("/workspace/Gemfile.lock")).to_not include("BUNDLED WITH")
102
+ end
103
+ end
104
+ ```
105
+
106
+ ## Initial Config (LocalBuildpack for package.toml)
107
+
108
+ If your needs a `package.toml` to function, then you can use Cutlass::LocalBuildpack. In your config:
109
+
110
+ ```ruby
111
+ # spec/spec_helper.rb
112
+ MY_BUILDPACK = LocalBuildpack.new(directory: "/tmp/muh_buildpack_dir_with_packagetoml").call
113
+
114
+ Cutlass.config do |config|
115
+ config.default_buildapacks = [MY_BUILDPACK]
116
+ end
117
+ ```
118
+
119
+ Then you'll need to tear down the buildpack at the end of the test suite so the resulting docker image doesn't leak:
120
+
121
+ ```ruby
122
+ # spec/spec_helper.rb
123
+ RSpec.configure do |config|
124
+ config.after(:suite) do
125
+ MY_BUIDLPACK.teardown
126
+ end
127
+ end
128
+ ```
129
+
130
+ In additon to the standard `package.toml` interface, if this directory has a `build.sh` file that file will be executed.
131
+
132
+ ## API
133
+
134
+ ### Cutlass::App Init options:
135
+
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
+ - @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`.
139
+ - @param config [Hash{Symbol => String}, Hash{String => String}] env vars to set against the app before it is built.
140
+ - @param exception_on_failure: [Boolean] when truthy failures on `app.pack_build` will result in an exception. Default is true.
141
+
142
+ ### Cutlass::App object API
143
+
144
+ The app object acts as the main interface between your test suite and much of the behavior of cutlass. Here are the suggested methods:
145
+
146
+
147
+ - `app.transaction` Yields a block with itself. Copies over the example repo to a temporary path. When the block is finished executing, the path is cleaned up and the `teardown` callbacks are called on the application. If an image has been built using `pack_build` the end of the transaction will clean it up.
148
+ - `app.pack_build` Yields a block with a `Cutlass::BashResult`. Triggers a build via the `pack` CLI. It can be invoked multiple times inside of a transaction for testing cache behavior.
149
+ - `app.start_container` boots a container instance and connects it to a local port. Yields a `Cutlass::ContainerControl` instance with information about the container such as the port it is connected to.
150
+ - `app.run` Takes a string with a shell command and executes it in docker syncronously, returns a BashResult object. By default will raise an error if the status code returns non-zero. Can be disabled with kwarg `exception_on_failure: false`
151
+ - `app.run_multi` takes a string with a shell command and executes it async inside of docker. Yields a `Cutlass::BashResult` object. By default will raise an error if the status code returns non-zero. Can be disabled with kwarg `exception_on_failure: false`
152
+
153
+ These methods can also be used, but they're lower level and are not needed when using `app.transaction`:
154
+
155
+ - `app.in_dir` Yields a block with itself. Copies over example repo to a temporary path. When the block is finished executing the path is cleaned up.
156
+ - `app.teardown` Triggers any "teardown" callbacks, such as waiting on `run_mutli` blocks to complete. This is called automatically via `app.transaction`
157
+
158
+ ### Cutlass::BashResult
159
+
160
+ An instance of BashResult is returned whenever Cutlass interacts with the shell or a shell-like object. For instance `app.pack_build` runs the `pack` command on the CLI and yelds a BashResult object with the results
161
+
162
+ - `result.stdout` Stdout from the command that was run
163
+ - `result.stderr` Stderr from the command that was run
164
+ - `result.status` Status code integer from the command that was run
165
+ - `result.success?` Truthy is status code was zero
166
+ - `result.fail?` Falsey if status code was zero
167
+
168
+ ### Cutlass::ContainerControl
169
+
170
+ Once built an app can `app.start_container` to yield a ContainerControl object.
171
+
172
+ - `container.port(<port>)` Returns the port on the host machine (your computer, not docker) that docker is bound to
173
+ - Warning: These following commands do not use the CNB entry point so CNB env vars are not loaded and it my be a different dir than you're expecting
174
+ - `container.bash_exec(<command>)` Executes a bash command inside of a running container. Returns a BashResult object. By default this will raise an exception if the command returns non-zero exit code. Use kwarg `container.bash_exec(<command>, exception_on_failure: false)` to disable. Returns a BashResult object.
175
+ - `container.contains_file?(<file path>)` Checks to see if a given file exists on disk. Returns a BashResult object
176
+ - `container.file_contents(<file path>)` Runs `cat` on a given file. Returns a BashResult object
177
+
178
+ ## Test Help
179
+
180
+ ### Clean ENV check
181
+
182
+ Make sure that environment variables do not leak from one test to another by configuring a check to run after your suite finishes:
183
+
184
+ ```ruby
185
+ # spec/spec_helper.rb
186
+
187
+ RSpec.configure do |config|
188
+ config.before(:suite) do
189
+ Cutlass::CleanTestEnv.record
190
+ end
191
+
192
+ config.after(:suite) do
193
+ Cutlass::CleanTestEnv.check
194
+ end
195
+ end
196
+ ```
197
+
198
+ ### Clean ENV
199
+
200
+ If one of your tests does modify your local process memory and you can't change that, then you can wrap that code inside:
201
+
202
+ ```ruby
203
+ Cutlass.in_fork do
204
+ # Code here is executed in a fork
205
+ # non-zero exit code will result in errors being re-raised
206
+ end
207
+ ```
208
+
209
+ ## Debugging
210
+
211
+ To get a firehose of info including the `pack` command used to build your app, you can set env vars `CUTLASS_DEBUG=1` or `DEBUG=1`.
212
+
213
+ ## Ruby Protips:
214
+
215
+ - [Rspec basics](https://github.com/heroku/hatchet#basic-rspec)
216
+ - [Ruby basics](https://github.com/heroku/hatchet#basic-ruby)
217
+ - My favorite way to manipualate things on disk is through the [Pathname](https://docs.ruby-lang.org/en/3.0.0/Pathname.html) object which wraps many `File` and `FileUtils` commands.
218
+
219
+ ## Development
220
+
221
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
222
+
223
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
224
+
225
+ Be sensitive about test time. If a fixture needs a docker image, but not a CNB built image...use a simple dockerfile as a fixture as it's faster.
226
+
227
+ All tests locally that take more than a second are tagged with `slow: true`. The test suite is pretty snappy, but you can iterate faster by running tests tagged without slow first and then if they pass running the slow ones:
228
+
229
+ ```
230
+ alias fast="bundle exec rspec --tag \~slow && bundle exec rspec --tag slow"
231
+ ```
232
+
233
+ Tests on CI are runn with `parallel_split_test` which you can also use locally. All flags given to pst are passed to rspec.
234
+
235
+ ## Contributing
236
+
237
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cutlass. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/cutlass/blob/main/CODE_OF_CONDUCT.md).
238
+
239
+ ## License
240
+
241
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
242
+
243
+ ## Code of Conduct
244
+
245
+ Everyone interacting in the Cutlass project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cutlass/blob/main/CODE_OF_CONDUCT.md).