heroku_hatchet 8.0.5 → 9.0.0
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 +4 -4
- data/.github/CODEOWNERS +2 -0
- data/.github/dependabot.yml +3 -0
- data/.github/workflows/check_changelog.yml +1 -1
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/hatchet_app_cleaner.yml +2 -2
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +105 -0
- data/Gemfile +1 -1
- data/README.md +2 -43
- data/Rakefile +0 -10
- data/SECURITY.md +7 -0
- data/bin/hatchet +34 -48
- data/hatchet.gemspec +7 -7
- data/hatchet.lock +2 -2
- data/lib/hatchet/tasks.rb +6 -2
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet.rb +0 -1
- data/spec/hatchet/app_spec.rb +1 -1
- data/spec/hatchet/ci_spec.rb +0 -1
- metadata +25 -55
- data/lib/hatchet/init_project.rb +0 -86
- data/lib/hatchet/templates/Gemfile.erb +0 -5
- data/lib/hatchet/templates/buildpack_spec.erb +0 -23
- data/lib/hatchet/templates/check_changelog.erb +0 -22
- data/lib/hatchet/templates/circleci_template.erb +0 -45
- data/lib/hatchet/templates/dependabot.erb +0 -9
- data/lib/hatchet/templates/hatchet_json.erb +0 -11
- data/lib/hatchet/templates/spec_helper.erb +0 -30
- data/spec/unit/init_spec.rb +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac8e3e1b567b419c9277a6f230d28e5896a0036f777db4a21b3f685e1208f29b
|
|
4
|
+
data.tar.gz: f24574264f9ddc0614ec10b610b89d69761de8c104656b2060ae0d8923dc0fec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a9b36cb93395c3d7b65a00b6f3875ded56b13dfe4948299869ab7ebb6a6b5f693d8833e086737ca9e9db677702d68d5b8ce89a6d359ac09f855cd196a596ccd
|
|
7
|
+
data.tar.gz: c67b7091d69fc9a455063536d6c5fc971cc4a3a84b4ab961a0927b232500962d381d02348284d749936d9be573d198fcb4f86766c2cd580ad83fd4232c866af1
|
data/.github/CODEOWNERS
CHANGED
data/.github/dependabot.yml
CHANGED
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
|
16
16
|
!contains(github.event.pull_request.labels.*.name, 'automation')
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
19
|
- name: Check that CHANGELOG is touched
|
|
20
20
|
run: |
|
|
21
21
|
git fetch origin ${{ github.base_ref }} --depth 1 && \
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -14,8 +14,8 @@ jobs:
|
|
|
14
14
|
strategy:
|
|
15
15
|
fail-fast: false
|
|
16
16
|
matrix:
|
|
17
|
-
ruby-version: ["
|
|
18
|
-
runs-on: ubuntu-
|
|
17
|
+
ruby-version: ["3.3", "3.4", "4.0"]
|
|
18
|
+
runs-on: ubuntu-26.04
|
|
19
19
|
env:
|
|
20
20
|
HATCHET_APP_LIMIT: 100
|
|
21
21
|
HATCHET_RETRIES: 3
|
|
@@ -26,7 +26,7 @@ jobs:
|
|
|
26
26
|
PARALLEL_SPLIT_TEST_PROCESSES: 25
|
|
27
27
|
steps:
|
|
28
28
|
- name: Checkout
|
|
29
|
-
uses: actions/checkout@
|
|
29
|
+
uses: actions/checkout@v7
|
|
30
30
|
- name: Set up Ruby ${{ matrix.ruby-version }} and dependencies
|
|
31
31
|
uses: ruby/setup-ruby@v1
|
|
32
32
|
with:
|
|
@@ -19,12 +19,12 @@ jobs:
|
|
|
19
19
|
HEROKU_DISABLE_AUTOUPDATE: 1
|
|
20
20
|
steps:
|
|
21
21
|
- name: Checkout
|
|
22
|
-
uses: actions/checkout@
|
|
22
|
+
uses: actions/checkout@v7
|
|
23
23
|
- name: Install Ruby and dependencies
|
|
24
24
|
uses: ruby/setup-ruby@v1
|
|
25
25
|
with:
|
|
26
26
|
bundler-cache: true
|
|
27
|
-
ruby-version: "
|
|
27
|
+
ruby-version: "4.0"
|
|
28
28
|
- name: Run Hatchet destroy
|
|
29
29
|
# Only apps older than 10 minutes are destroyed, to ensure that any
|
|
30
30
|
# in progress CI runs are not interrupted.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## HEAD
|
|
2
2
|
|
|
3
|
+
## 9.0.0
|
|
4
|
+
|
|
5
|
+
- Added support for Ruby 3.4 and 4.0, and removed support for EOL Ruby versions. ([#228](https://github.com/heroku/hatchet/pull/228))
|
|
6
|
+
- Fixed the `hatchet` CLI failing on Ruby 4.0 due to a transitive dependency missing its `logger` dependency. ([#228](https://github.com/heroku/hatchet/pull/228))
|
|
7
|
+
- Removed the `hatchet init` command. ([#229](https://github.com/heroku/hatchet/pull/229))
|
|
8
|
+
- Fixed `hatchet help` listing the `lock` command as `hatchet locks to specific git commits`. ([#230](https://github.com/heroku/hatchet/pull/230))
|
|
9
|
+
|
|
10
|
+
## 8.0.6
|
|
11
|
+
|
|
12
|
+
- Fix `hatchet:setup_ci` not printing output (https://github.com/heroku/hatchet/pull/220)
|
|
13
|
+
|
|
3
14
|
## 8.0.5
|
|
4
15
|
|
|
5
16
|
- Updated excon version requirements (https://github.com/heroku/hatchet/pull/215)
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Salesforce Open Source Community Code of Conduct
|
|
2
|
+
|
|
3
|
+
## About the Code of Conduct
|
|
4
|
+
|
|
5
|
+
Equality is a core value at Salesforce. We believe a diverse and inclusive
|
|
6
|
+
community fosters innovation and creativity, and are committed to building a
|
|
7
|
+
culture where everyone feels included.
|
|
8
|
+
|
|
9
|
+
Salesforce open-source projects are committed to providing a friendly, safe, and
|
|
10
|
+
welcoming environment for all, regardless of gender identity and expression,
|
|
11
|
+
sexual orientation, disability, physical appearance, body size, ethnicity, nationality,
|
|
12
|
+
race, age, religion, level of experience, education, socioeconomic status, or
|
|
13
|
+
other similar personal characteristics.
|
|
14
|
+
|
|
15
|
+
The goal of this code of conduct is to specify a baseline standard of behavior so
|
|
16
|
+
that people with different social values and communication styles can work
|
|
17
|
+
together effectively, productively, and respectfully in our open source community.
|
|
18
|
+
It also establishes a mechanism for reporting issues and resolving conflicts.
|
|
19
|
+
|
|
20
|
+
All questions and reports of abusive, harassing, or otherwise unacceptable behavior
|
|
21
|
+
in a Salesforce open-source project may be reported by contacting the Salesforce
|
|
22
|
+
Open Source Conduct Committee at ossconduct@salesforce.com.
|
|
23
|
+
|
|
24
|
+
## Our Pledge
|
|
25
|
+
|
|
26
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
27
|
+
contributors and maintainers pledge to making participation in our project and
|
|
28
|
+
our community a harassment-free experience for everyone, regardless of gender
|
|
29
|
+
identity and expression, sexual orientation, disability, physical appearance,
|
|
30
|
+
body size, ethnicity, nationality, race, age, religion, level of experience, education,
|
|
31
|
+
socioeconomic status, or other similar personal characteristics.
|
|
32
|
+
|
|
33
|
+
## Our Standards
|
|
34
|
+
|
|
35
|
+
Examples of behavior that contributes to creating a positive environment
|
|
36
|
+
include:
|
|
37
|
+
|
|
38
|
+
* Using welcoming and inclusive language
|
|
39
|
+
* Being respectful of differing viewpoints and experiences
|
|
40
|
+
* Gracefully accepting constructive criticism
|
|
41
|
+
* Focusing on what is best for the community
|
|
42
|
+
* Showing empathy toward other community members
|
|
43
|
+
|
|
44
|
+
Examples of unacceptable behavior by participants include:
|
|
45
|
+
|
|
46
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
47
|
+
advances
|
|
48
|
+
* Personal attacks, insulting/derogatory comments, or trolling
|
|
49
|
+
* Public or private harassment
|
|
50
|
+
* Publishing, or threatening to publish, others' private information—such as
|
|
51
|
+
a physical or electronic address—without explicit permission
|
|
52
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
53
|
+
professional setting
|
|
54
|
+
* Advocating for or encouraging any of the above behaviors
|
|
55
|
+
|
|
56
|
+
## Our Responsibilities
|
|
57
|
+
|
|
58
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
59
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
60
|
+
response to any instances of unacceptable behavior.
|
|
61
|
+
|
|
62
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
63
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
64
|
+
that are not aligned with this Code of Conduct, or to ban temporarily or
|
|
65
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
66
|
+
threatening, offensive, or harmful.
|
|
67
|
+
|
|
68
|
+
## Scope
|
|
69
|
+
|
|
70
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
71
|
+
when an individual is representing the project or its community. Examples of
|
|
72
|
+
representing a project or community include using an official project email
|
|
73
|
+
address, posting via an official social media account, or acting as an appointed
|
|
74
|
+
representative at an online or offline event. Representation of a project may be
|
|
75
|
+
further defined and clarified by project maintainers.
|
|
76
|
+
|
|
77
|
+
## Enforcement
|
|
78
|
+
|
|
79
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
80
|
+
reported by contacting the Salesforce Open Source Conduct Committee
|
|
81
|
+
at ossconduct@salesforce.com. All complaints will be reviewed and investigated
|
|
82
|
+
and will result in a response that is deemed necessary and appropriate to the
|
|
83
|
+
circumstances. The committee is obligated to maintain confidentiality with
|
|
84
|
+
regard to the reporter of an incident. Further details of specific enforcement
|
|
85
|
+
policies may be posted separately.
|
|
86
|
+
|
|
87
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
88
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
89
|
+
members of the project's leadership and the Salesforce Open Source Conduct
|
|
90
|
+
Committee.
|
|
91
|
+
|
|
92
|
+
## Attribution
|
|
93
|
+
|
|
94
|
+
This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home],
|
|
95
|
+
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
|
|
96
|
+
It includes adaptations and additions from [Go Community Code of Conduct][golang-coc],
|
|
97
|
+
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].
|
|
98
|
+
|
|
99
|
+
This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].
|
|
100
|
+
|
|
101
|
+
[contributor-covenant-home]: https://www.contributor-covenant.org
|
|
102
|
+
[golang-coc]: https://golang.org/conduct
|
|
103
|
+
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
|
|
104
|
+
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
|
|
105
|
+
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -57,8 +57,6 @@ In addition to speed, Hatchet provides isolation. Suppose you're executing `bin/
|
|
|
57
57
|
|
|
58
58
|
## Quicklinks
|
|
59
59
|
|
|
60
|
-
- Getting started
|
|
61
|
-
- [Add hatchet tests to a existing buildpack](#hatchet-init)
|
|
62
60
|
- Concepts
|
|
63
61
|
- [Tell Hatchet how to find your buildpack](#specify-buildpack)
|
|
64
62
|
- [Give Hatchet some example apps to deploy](#example-apps)
|
|
@@ -80,45 +78,6 @@ In addition to speed, Hatchet provides isolation. Suppose you're executing `bin/
|
|
|
80
78
|
- [Introduction to the Rspec testing framework for non-rubyists](#basic-rspec)
|
|
81
79
|
- [Introduction to Ruby for non-rubyists](#basic-ruby)
|
|
82
80
|
|
|
83
|
-
## Getting Started
|
|
84
|
-
|
|
85
|
-
### Hatchet Init
|
|
86
|
-
|
|
87
|
-
If you're working in a project that does not already have hatchet tests you can run this command to get started quickly:
|
|
88
|
-
|
|
89
|
-
Make sure you're in directory that contains your buildpack and run:
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
$ gem install heroku_hatchet
|
|
93
|
-
$ hatchet init
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
This will bootstrap your project with the necessarry files to test your buildpack. Including but not limited to:
|
|
97
|
-
|
|
98
|
-
- Gemfile
|
|
99
|
-
- hatchet.json
|
|
100
|
-
- spec/spec_helper.rb
|
|
101
|
-
- spec/hatchet/buildpack_spec.rb
|
|
102
|
-
- .circleci/config.yml
|
|
103
|
-
- .github/dependabot.yml
|
|
104
|
-
- .gitignore
|
|
105
|
-
|
|
106
|
-
Once this executes successfully then you can run your tests with:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
$ bundle exec rspec
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
> Note: You'll need to update the `buildpack_spec.rb` file to remove the exception
|
|
113
|
-
|
|
114
|
-
You can also focus a specific file or test by providing a path and line number:
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
$ bundle exec rspec spec/hatchet/buildpack_spec:5
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Keep reading to find out more about how hatchet works.
|
|
121
|
-
|
|
122
81
|
## Concepts
|
|
123
82
|
|
|
124
83
|
### Specify buildpack
|
|
@@ -466,7 +425,7 @@ end
|
|
|
466
425
|
|
|
467
426
|
## Running your buildpack tests on a CI service
|
|
468
427
|
|
|
469
|
-
Once you've got your tests working locally, you'll likely want to get them running on CI. For reference, see the [
|
|
428
|
+
Once you've got your tests working locally, you'll likely want to get them running on CI. For reference, see the [GitHub Actions config from this repo](https://github.com/heroku/hatchet/blob/main/.github/workflows/ci.yml) and the [GitHub Actions config from the Ruby buildpack](https://github.com/heroku/heroku-buildpack-ruby/blob/main/.github/workflows/ci.yml).
|
|
470
429
|
|
|
471
430
|
To make running on CI easier, there is a setup script in Hatchet that can be run on your CI server each time before your tests are executed:
|
|
472
431
|
|
|
@@ -587,7 +546,7 @@ app.get_config("DEPLOY_TASKS") # => "run:bloop"
|
|
|
587
546
|
|
|
588
547
|
- `app.set_lab()`: Enables the specified lab/feature on the app
|
|
589
548
|
- `app.add_database()`: adds a database to the app, defaults to the "dev" database
|
|
590
|
-
- `app.update_stack()`: Change the app's stack to that specified (for example `"heroku-
|
|
549
|
+
- `app.update_stack()`: Change the app's stack to that specified (for example `"heroku-24"`). Will take effect on the next build.
|
|
591
550
|
- `app.run()`: Runs a `heroku run bash` session with the arguments, covered above.
|
|
592
551
|
- `app.run_multi()`: Runs a `heroku run bash` session in the background and yields the results. This requires the `run_multi` flag of the app to be set to `true`, which will charge your application (the `HATCHET_EXPENSIVE_MODE` env var must also be set to use this feature). Example above.
|
|
593
552
|
- `app.create_app`: Can be used to manually create the app without deploying it (You probably want `setup!` though)
|
data/Rakefile
CHANGED
|
@@ -2,14 +2,4 @@
|
|
|
2
2
|
require 'bundler/gem_tasks'
|
|
3
3
|
|
|
4
4
|
require 'rake'
|
|
5
|
-
require 'rake/testtask'
|
|
6
5
|
require 'hatchet/tasks'
|
|
7
|
-
|
|
8
|
-
task :default => [:test]
|
|
9
|
-
|
|
10
|
-
test_task = Rake::TestTask.new(:test) do |t|
|
|
11
|
-
t.libs << 'lib'
|
|
12
|
-
t.libs << 'test'
|
|
13
|
-
t.pattern = 'test/hatchet/**/*_test.rb'
|
|
14
|
-
t.verbose = false
|
|
15
|
-
end
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
Please report any security issue to [https://www.sfdc.co/SubmitVuln](https://www.sfdc.co/SubmitVuln)
|
|
4
|
+
as soon as it is discovered. This project limits its runtime dependencies in
|
|
5
|
+
order to reduce the total cost of ownership as much as can be, but all consumers
|
|
6
|
+
should remain vigilant and have their security stakeholders review all third-party
|
|
7
|
+
products (3PP) like this one and their dependencies.
|
data/bin/hatchet
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
unless File.respond_to? :realpath
|
|
4
|
-
class File #:nodoc:
|
|
5
|
-
def self.realpath path
|
|
6
|
-
return realpath(File.readlink(path)) if symlink?(path)
|
|
7
|
-
path
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
3
|
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
|
12
4
|
|
|
13
5
|
require 'hatchet'
|
|
14
6
|
require 'thor'
|
|
15
|
-
require '
|
|
7
|
+
require 'parallel'
|
|
16
8
|
require 'date'
|
|
17
9
|
require 'yaml'
|
|
18
10
|
require 'pathname'
|
|
19
11
|
|
|
20
12
|
class HatchetCLI < Thor
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Hatchet::InitProject.new.call
|
|
24
|
-
end
|
|
13
|
+
# Limits how many git clone/pull operations run concurrently.
|
|
14
|
+
MAX_THREADS = 16
|
|
25
15
|
|
|
26
16
|
desc "ci:install_heroku", "installs the `heroku` cli"
|
|
27
17
|
define_method("ci:install_heroku") do
|
|
@@ -48,50 +38,46 @@ class HatchetCLI < Thor
|
|
|
48
38
|
puts "Installing repos for hatchet"
|
|
49
39
|
|
|
50
40
|
missing_commit = false
|
|
51
|
-
dirs
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
missing_commit = true
|
|
66
|
-
end
|
|
41
|
+
Parallel.each(dirs, in_threads: MAX_THREADS) do |directory, git_repo|
|
|
42
|
+
commit = lock_hash[directory]
|
|
43
|
+
directory = File.expand_path(directory)
|
|
44
|
+
if !(Dir[directory] && Dir[directory].empty?)
|
|
45
|
+
puts "== pulling '#{git_repo}' into '#{directory}'\n"
|
|
46
|
+
pull(directory, git_repo)
|
|
47
|
+
else
|
|
48
|
+
puts "== cloning '#{git_repo}' into '#{directory}'\n"
|
|
49
|
+
clone(directory, git_repo)
|
|
50
|
+
end
|
|
51
|
+
if commit
|
|
52
|
+
checkout_commit(directory, commit)
|
|
53
|
+
else
|
|
54
|
+
missing_commit = true
|
|
67
55
|
end
|
|
68
|
-
end
|
|
56
|
+
end
|
|
69
57
|
|
|
70
58
|
self.lock if missing_commit
|
|
71
59
|
end
|
|
72
60
|
|
|
73
|
-
desc "locks to specific git commits
|
|
61
|
+
desc "lock", "locks repos to specific git commits in hatchet.lock"
|
|
74
62
|
def lock
|
|
75
63
|
lock_hash = {}
|
|
76
64
|
lockfile_hash = load_lockfile(create_if_does_not_exist: true)
|
|
77
|
-
dirs
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
lock_hash[directory] = commit
|
|
92
|
-
end
|
|
65
|
+
Parallel.each(dirs, in_threads: MAX_THREADS) do |directory, git_repo|
|
|
66
|
+
puts "== locking #{directory}"
|
|
67
|
+
unless Dir.exist?(directory)
|
|
68
|
+
raise "Bad git repo #{git_repo.inspect}" if bad_repo?(git_repo)
|
|
69
|
+
clone(directory, git_repo, quiet: false)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if lockfile_hash[directory] == "master"
|
|
73
|
+
lock_hash[directory] = "master"
|
|
74
|
+
elsif lockfile_hash[directory] == "main"
|
|
75
|
+
lock_hash[directory] = "main"
|
|
76
|
+
else
|
|
77
|
+
commit = commit_at_directory(directory)
|
|
78
|
+
lock_hash[directory] = commit
|
|
93
79
|
end
|
|
94
|
-
end
|
|
80
|
+
end
|
|
95
81
|
|
|
96
82
|
lock_hash = lock_hash.sort
|
|
97
83
|
File.open('hatchet.lock', 'w') {|f| f << lock_hash.to_yaml }
|
data/hatchet.gemspec
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require 'hatchet/version'
|
|
@@ -8,26 +7,27 @@ Gem::Specification.new do |gem|
|
|
|
8
7
|
gem.version = Hatchet::VERSION
|
|
9
8
|
gem.authors = ["Richard Schneeman"]
|
|
10
9
|
gem.email = ["richard.schneeman+rubygems@gmail.com"]
|
|
11
|
-
gem.
|
|
12
|
-
gem.summary = %q{Hatchet is a an integration testing library for developing Heroku buildpacks.}
|
|
10
|
+
gem.summary = %q{Hatchet is an integration testing library for developing Heroku buildpacks.}
|
|
13
11
|
gem.homepage = "https://github.com/heroku/hatchet"
|
|
14
12
|
gem.license = "MIT"
|
|
13
|
+
gem.metadata = {
|
|
14
|
+
"changelog_uri" => "https://github.com/heroku/hatchet/blob/main/CHANGELOG.md",
|
|
15
|
+
"source_code_uri" => "https://github.com/heroku/hatchet",
|
|
16
|
+
}
|
|
15
17
|
|
|
16
18
|
gem.files = `git ls-files`.split($/)
|
|
17
19
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
18
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
19
20
|
gem.require_paths = ["lib"]
|
|
20
|
-
gem.required_ruby_version = '>=
|
|
21
|
+
gem.required_ruby_version = '>= 3.3.0'
|
|
21
22
|
|
|
22
23
|
gem.add_dependency "platform-api", "~> 3"
|
|
23
24
|
gem.add_dependency "rrrretry", "~> 1"
|
|
24
25
|
gem.add_dependency "excon", "< 2"
|
|
26
|
+
gem.add_dependency "parallel", ">= 1.10", "< 3"
|
|
25
27
|
gem.add_dependency "thor", "~> 1"
|
|
26
|
-
gem.add_dependency "threaded", "~> 0"
|
|
27
28
|
|
|
28
29
|
gem.add_development_dependency "rspec"
|
|
29
30
|
gem.add_development_dependency "rake", ">= 10"
|
|
30
|
-
gem.add_development_dependency "mocha", ">= 1"
|
|
31
31
|
gem.add_development_dependency "parallel_split_test"
|
|
32
32
|
gem.add_development_dependency "rspec-retry"
|
|
33
33
|
end
|
data/hatchet.lock
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
- - repo_fixtures/repos/ci/rails5_ci_fails_no_database
|
|
5
5
|
- 3044f05febdfbbe656f0f5113cf5968ca07e34fd
|
|
6
6
|
- - repo_fixtures/repos/ci/rails5_ruby_schema_format
|
|
7
|
-
-
|
|
7
|
+
- 8b8a3a7850bdba29bdefc70c0f80f35a9e6c96ae
|
|
8
8
|
- - repo_fixtures/repos/default/default_ruby
|
|
9
|
-
-
|
|
9
|
+
- aba4eba3b479b55e716c4b0ff13b25af95d0791d
|
|
10
10
|
- - repo_fixtures/repos/lock/lock_fail
|
|
11
11
|
- da748a59340be8b950e7bbbfb32077eb67d70c3c
|
|
12
12
|
- - repo_fixtures/repos/lock/lock_fail_main
|
data/lib/hatchet/tasks.rb
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
namespace :hatchet do
|
|
2
2
|
task :setup_ci do
|
|
3
3
|
script = File.expand_path(File.join(__dir__, "../../etc/ci_setup.rb"))
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
puts "Running script `#{script}`"
|
|
5
|
+
out = `#{script} 2>&1`
|
|
6
|
+
puts "Done"
|
|
7
|
+
puts "Output:\n"
|
|
8
|
+
puts out
|
|
9
|
+
raise "Command #{script.inspect} failed" unless $?.success?
|
|
6
10
|
end
|
|
7
11
|
|
|
8
12
|
task :setup_travis do
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet.rb
CHANGED
data/spec/hatchet/app_spec.rb
CHANGED
|
@@ -23,7 +23,7 @@ describe "AppTest" do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "create app with stack" do
|
|
26
|
-
stack = "heroku-
|
|
26
|
+
stack = "heroku-24"
|
|
27
27
|
app = Hatchet::App.new("default_ruby", stack: stack)
|
|
28
28
|
app.create_app
|
|
29
29
|
expect(app.platform_api.app.info(app.name)["build_stack"]["name"]).to eq(stack)
|
data/spec/hatchet/ci_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: heroku_hatchet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 9.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Schneeman
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: platform-api
|
|
@@ -52,33 +52,39 @@ dependencies:
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '2'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
55
|
+
name: parallel
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '1'
|
|
60
|
+
version: '1.10'
|
|
61
|
+
- - "<"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '3'
|
|
61
64
|
type: :runtime
|
|
62
65
|
prerelease: false
|
|
63
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
67
|
requirements:
|
|
65
|
-
- - "
|
|
68
|
+
- - ">="
|
|
66
69
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '1'
|
|
70
|
+
version: '1.10'
|
|
71
|
+
- - "<"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '3'
|
|
68
74
|
- !ruby/object:Gem::Dependency
|
|
69
|
-
name:
|
|
75
|
+
name: thor
|
|
70
76
|
requirement: !ruby/object:Gem::Requirement
|
|
71
77
|
requirements:
|
|
72
78
|
- - "~>"
|
|
73
79
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
80
|
+
version: '1'
|
|
75
81
|
type: :runtime
|
|
76
82
|
prerelease: false
|
|
77
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
84
|
requirements:
|
|
79
85
|
- - "~>"
|
|
80
86
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
87
|
+
version: '1'
|
|
82
88
|
- !ruby/object:Gem::Dependency
|
|
83
89
|
name: rspec
|
|
84
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -107,20 +113,6 @@ dependencies:
|
|
|
107
113
|
- - ">="
|
|
108
114
|
- !ruby/object:Gem::Version
|
|
109
115
|
version: '10'
|
|
110
|
-
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: mocha
|
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - ">="
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '1'
|
|
117
|
-
type: :development
|
|
118
|
-
prerelease: false
|
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - ">="
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '1'
|
|
124
116
|
- !ruby/object:Gem::Dependency
|
|
125
117
|
name: parallel_split_test
|
|
126
118
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -149,7 +141,6 @@ dependencies:
|
|
|
149
141
|
- - ">="
|
|
150
142
|
- !ruby/object:Gem::Version
|
|
151
143
|
version: '0'
|
|
152
|
-
description: Hatchet is a an integration testing library for developing Heroku buildpacks.
|
|
153
144
|
email:
|
|
154
145
|
- richard.schneeman+rubygems@gmail.com
|
|
155
146
|
executables:
|
|
@@ -164,10 +155,12 @@ files:
|
|
|
164
155
|
- ".github/workflows/hatchet_app_cleaner.yml"
|
|
165
156
|
- ".gitignore"
|
|
166
157
|
- CHANGELOG.md
|
|
158
|
+
- CODE_OF_CONDUCT.md
|
|
167
159
|
- Gemfile
|
|
168
160
|
- LICENSE.txt
|
|
169
161
|
- README.md
|
|
170
162
|
- Rakefile
|
|
163
|
+
- SECURITY.md
|
|
171
164
|
- bin/hatchet
|
|
172
165
|
- etc/ci_setup.rb
|
|
173
166
|
- etc/setup_heroku.sh
|
|
@@ -181,19 +174,11 @@ files:
|
|
|
181
174
|
- lib/hatchet/config.rb
|
|
182
175
|
- lib/hatchet/git_app.rb
|
|
183
176
|
- lib/hatchet/heroku_run.rb
|
|
184
|
-
- lib/hatchet/init_project.rb
|
|
185
177
|
- lib/hatchet/reaper.rb
|
|
186
178
|
- lib/hatchet/reaper/app_age.rb
|
|
187
179
|
- lib/hatchet/reaper/reaper_throttle.rb
|
|
188
180
|
- lib/hatchet/shell_throttle.rb
|
|
189
181
|
- lib/hatchet/tasks.rb
|
|
190
|
-
- lib/hatchet/templates/Gemfile.erb
|
|
191
|
-
- lib/hatchet/templates/buildpack_spec.erb
|
|
192
|
-
- lib/hatchet/templates/check_changelog.erb
|
|
193
|
-
- lib/hatchet/templates/circleci_template.erb
|
|
194
|
-
- lib/hatchet/templates/dependabot.erb
|
|
195
|
-
- lib/hatchet/templates/hatchet_json.erb
|
|
196
|
-
- lib/hatchet/templates/spec_helper.erb
|
|
197
182
|
- lib/hatchet/test_run.rb
|
|
198
183
|
- lib/hatchet/version.rb
|
|
199
184
|
- repo_fixtures/different-folder-for-checked-in-repos/default_ruby/Gemfile
|
|
@@ -211,14 +196,15 @@ files:
|
|
|
211
196
|
- spec/unit/app_spec.rb
|
|
212
197
|
- spec/unit/default_ci_branch_spec.rb
|
|
213
198
|
- spec/unit/heroku_run_spec.rb
|
|
214
|
-
- spec/unit/init_spec.rb
|
|
215
199
|
- spec/unit/reaper_spec.rb
|
|
216
200
|
- spec/unit/shell_throttle_spec.rb
|
|
217
201
|
- tmp/parallel_runtime_test.log
|
|
218
202
|
homepage: https://github.com/heroku/hatchet
|
|
219
203
|
licenses:
|
|
220
204
|
- MIT
|
|
221
|
-
metadata:
|
|
205
|
+
metadata:
|
|
206
|
+
changelog_uri: https://github.com/heroku/hatchet/blob/main/CHANGELOG.md
|
|
207
|
+
source_code_uri: https://github.com/heroku/hatchet
|
|
222
208
|
rdoc_options: []
|
|
223
209
|
require_paths:
|
|
224
210
|
- lib
|
|
@@ -226,30 +212,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
226
212
|
requirements:
|
|
227
213
|
- - ">="
|
|
228
214
|
- !ruby/object:Gem::Version
|
|
229
|
-
version:
|
|
215
|
+
version: 3.3.0
|
|
230
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
217
|
requirements:
|
|
232
218
|
- - ">="
|
|
233
219
|
- !ruby/object:Gem::Version
|
|
234
220
|
version: '0'
|
|
235
221
|
requirements: []
|
|
236
|
-
rubygems_version: 3.6.
|
|
222
|
+
rubygems_version: 3.6.9
|
|
237
223
|
specification_version: 4
|
|
238
|
-
summary: Hatchet is
|
|
239
|
-
test_files:
|
|
240
|
-
- spec/hatchet/allow_failure_git_spec.rb
|
|
241
|
-
- spec/hatchet/app_spec.rb
|
|
242
|
-
- spec/hatchet/ci_spec.rb
|
|
243
|
-
- spec/hatchet/config_spec.rb
|
|
244
|
-
- spec/hatchet/edit_repo_spec.rb
|
|
245
|
-
- spec/hatchet/git_spec.rb
|
|
246
|
-
- spec/hatchet/heroku_api_spec.rb
|
|
247
|
-
- spec/hatchet/local_repo_spec.rb
|
|
248
|
-
- spec/hatchet/lock_spec.rb
|
|
249
|
-
- spec/spec_helper.rb
|
|
250
|
-
- spec/unit/app_spec.rb
|
|
251
|
-
- spec/unit/default_ci_branch_spec.rb
|
|
252
|
-
- spec/unit/heroku_run_spec.rb
|
|
253
|
-
- spec/unit/init_spec.rb
|
|
254
|
-
- spec/unit/reaper_spec.rb
|
|
255
|
-
- spec/unit/shell_throttle_spec.rb
|
|
224
|
+
summary: Hatchet is an integration testing library for developing Heroku buildpacks.
|
|
225
|
+
test_files: []
|
data/lib/hatchet/init_project.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
require 'thor'
|
|
2
|
-
require 'yaml'
|
|
3
|
-
|
|
4
|
-
module Hatchet
|
|
5
|
-
# Bootstraps a project with files for running hatchet tests
|
|
6
|
-
#
|
|
7
|
-
# Hatchet::InitProject.new.call
|
|
8
|
-
#
|
|
9
|
-
# puts File.exist?("spec/spec_helper.rb") # => true
|
|
10
|
-
# puts File.exist?("") # => true
|
|
11
|
-
class InitProject
|
|
12
|
-
def initialize(dir: ".", io: STDOUT)
|
|
13
|
-
|
|
14
|
-
@target_dir = Pathname.new(dir)
|
|
15
|
-
raise "Must run in a directory with a buildpack, #{@target_dir} has no bin/ directory" unless @target_dir.join("bin").directory?
|
|
16
|
-
|
|
17
|
-
@template_dir = Pathname.new(__dir__).join("templates")
|
|
18
|
-
@thor_shell = ::Thor::Shell::Basic.new
|
|
19
|
-
@io = io
|
|
20
|
-
@git_ignore = @target_dir.join(".gitignore")
|
|
21
|
-
|
|
22
|
-
FileUtils.touch(@git_ignore)
|
|
23
|
-
FileUtils.touch(@target_dir.join("hatchet.lock"))
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def call
|
|
27
|
-
write_target(target: ".circleci/config.yml", template: "circleci_template.erb")
|
|
28
|
-
write_target(target: "Gemfile", template: "Gemfile.erb")
|
|
29
|
-
write_target(target: "hatchet.json", template: "hatchet_json.erb")
|
|
30
|
-
write_target(target: "spec/spec_helper.rb", template: "spec_helper.erb")
|
|
31
|
-
write_target(target: "spec/hatchet/buildpack_spec.rb", template: "buildpack_spec.erb")
|
|
32
|
-
write_target(target: ".github/dependabot.yml", template: "dependabot.erb")
|
|
33
|
-
write_target(target: ".github/workflows/check_changelog.yml", template: "check_changelog.erb")
|
|
34
|
-
|
|
35
|
-
add_gitignore(".rspec_status")
|
|
36
|
-
add_gitignore("repos/*")
|
|
37
|
-
|
|
38
|
-
stream("cd #{@target_dir} && bundle install")
|
|
39
|
-
stream("cd #{@target_dir} && hatchet install")
|
|
40
|
-
|
|
41
|
-
@io.puts
|
|
42
|
-
@io.puts "Done, run `bundle exec rspec` to execute your tests"
|
|
43
|
-
@io.puts
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
private def add_gitignore(statement)
|
|
47
|
-
@git_ignore.open("a") {|f| f.puts statement } unless @git_ignore.read.include?(statement)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
private def stream(command)
|
|
51
|
-
output = ""
|
|
52
|
-
IO.popen(command) do |io|
|
|
53
|
-
until io.eof?
|
|
54
|
-
buffer = io.gets
|
|
55
|
-
output << buffer
|
|
56
|
-
@io.puts(buffer)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
raise "Error running #{command}. Output:\n#{output}" unless $?.success?
|
|
60
|
-
output
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
private def write_target(template: nil, target:, contents: nil)
|
|
64
|
-
if template
|
|
65
|
-
template = @template_dir.join(template)
|
|
66
|
-
contents = ERB.new(template.read).result(binding)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
target = @target_dir.join(target)
|
|
70
|
-
target.dirname.mkpath # Create directory if it doesn't exist already
|
|
71
|
-
|
|
72
|
-
if target.exist?
|
|
73
|
-
return if contents === target.read # identical
|
|
74
|
-
target.write(contents) if @thor_shell.file_collision(target) { contents }
|
|
75
|
-
else
|
|
76
|
-
target.write(contents)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
private def cmd(command)
|
|
81
|
-
result = `#{command}`.chomp
|
|
82
|
-
raise "Command #{command} failed:\n#{result}" unless $?.success?
|
|
83
|
-
result
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require_relative "../spec_helper.rb"
|
|
2
|
-
|
|
3
|
-
RSpec.describe "This buildpack" do
|
|
4
|
-
it "has its own tests" do
|
|
5
|
-
raise "delete this and replace it with your own logic"
|
|
6
|
-
|
|
7
|
-
# Specify where you want your buildpack to go using :default
|
|
8
|
-
buildpacks = [:default, "heroku/ruby"]
|
|
9
|
-
|
|
10
|
-
# To deploy a different app modify the hatchet.json or
|
|
11
|
-
# commit an app to your source control and use a path
|
|
12
|
-
# instead of "default_ruby" here
|
|
13
|
-
Hatchet::Runner.new("default_ruby", buildpacks: buildpacks).tap do |app|
|
|
14
|
-
app.before_deploy do
|
|
15
|
-
# Modfiy the app here if you need
|
|
16
|
-
end
|
|
17
|
-
app.deploy do
|
|
18
|
-
# Assert the behavior you desire here
|
|
19
|
-
expect(app.output).to match("deployed to Heroku")
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Check Changelog
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, reopened, edited, labeled, unlabeled, synchronize]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
check-changelog:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
if: |
|
|
11
|
-
!contains(github.event.pull_request.body, '[skip changelog]') &&
|
|
12
|
-
!contains(github.event.pull_request.body, '[changelog skip]') &&
|
|
13
|
-
!contains(github.event.pull_request.body, '[skip ci]') &&
|
|
14
|
-
!contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
|
|
15
|
-
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
|
16
|
-
!contains(github.event.pull_request.labels.*.name, 'automation')
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v3
|
|
19
|
-
- name: Check that CHANGELOG is touched
|
|
20
|
-
run: |
|
|
21
|
-
git fetch origin ${{ github.base_ref }} --depth 1 && \
|
|
22
|
-
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
references:
|
|
3
|
-
unit: &unit
|
|
4
|
-
run:
|
|
5
|
-
name: Run test suite
|
|
6
|
-
command: PARALLEL_SPLIT_TEST_PROCESSES=25 IS_RUNNING_ON_CI=1 bundle exec parallel_split_test spec/
|
|
7
|
-
restore: &restore
|
|
8
|
-
restore_cache:
|
|
9
|
-
keys:
|
|
10
|
-
- v1_bundler_deps-{{ .Environment.CIRCLE_JOB }}
|
|
11
|
-
save: &save
|
|
12
|
-
save_cache:
|
|
13
|
-
paths:
|
|
14
|
-
- ./vendor/bundle
|
|
15
|
-
key: v1_bundler_deps-{{ .Environment.CIRCLE_JOB }} # CIRCLE_JOB e.g. "ruby-2.5"
|
|
16
|
-
hatchet_setup: &hatchet_setup
|
|
17
|
-
run:
|
|
18
|
-
name: Hatchet setup
|
|
19
|
-
command: |
|
|
20
|
-
bundle exec hatchet ci:setup
|
|
21
|
-
bundle: &bundle
|
|
22
|
-
run:
|
|
23
|
-
name: install dependencies
|
|
24
|
-
command: |
|
|
25
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
|
26
|
-
bundle update
|
|
27
|
-
bundle clean
|
|
28
|
-
jobs:
|
|
29
|
-
"ruby-2.7":
|
|
30
|
-
docker:
|
|
31
|
-
- image: circleci/ruby:2.7
|
|
32
|
-
steps:
|
|
33
|
-
- checkout
|
|
34
|
-
- <<: *restore
|
|
35
|
-
- <<: *bundle
|
|
36
|
-
- <<: *hatchet_setup
|
|
37
|
-
- <<: *unit
|
|
38
|
-
- <<: *save
|
|
39
|
-
|
|
40
|
-
workflows:
|
|
41
|
-
version: 2
|
|
42
|
-
build:
|
|
43
|
-
jobs:
|
|
44
|
-
- "ruby-2.7"
|
|
45
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "bundler/setup"
|
|
2
|
-
|
|
3
|
-
require 'rspec/retry'
|
|
4
|
-
|
|
5
|
-
ENV["HATCHET_BUILDPACK_BASE"] = "<%= cmd("git config --get remote.origin.url") %>"
|
|
6
|
-
|
|
7
|
-
require 'hatchet'
|
|
8
|
-
require 'pathname'
|
|
9
|
-
|
|
10
|
-
RSpec.configure do |config|
|
|
11
|
-
# Enable flags like --only-failures and --next-failure
|
|
12
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
|
13
|
-
config.verbose_retry = true # show retry status in spec process
|
|
14
|
-
config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again
|
|
15
|
-
|
|
16
|
-
config.expect_with :rspec do |c|
|
|
17
|
-
c.syntax = :expect
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def run!(cmd)
|
|
22
|
-
out = `#{cmd}`
|
|
23
|
-
raise "Error running #{cmd}, output: #{out}" unless $?.success?
|
|
24
|
-
out
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def spec_dir
|
|
28
|
-
Pathname.new(__dir__)
|
|
29
|
-
end
|
|
30
|
-
|
data/spec/unit/init_spec.rb
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe "Hatchet::Init" do
|
|
4
|
-
def fake_buildpack_dir
|
|
5
|
-
Dir.mktmpdir do |dir|
|
|
6
|
-
FileUtils.mkdir_p("#{dir}/bin")
|
|
7
|
-
yield dir
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
it "raises an error when not pointing at the right directory" do
|
|
11
|
-
Dir.mktmpdir do |dir|
|
|
12
|
-
expect {
|
|
13
|
-
Hatchet::InitProject.new(dir: dir)
|
|
14
|
-
}.to raise_error(/Must run in a directory with a buildpack/)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# write_target(target: ".circleci/config.yml", template: "circleci_template.erb")
|
|
19
|
-
# write_target(target: "Gemfile", template: "Gemfile.erb")
|
|
20
|
-
# write_target(target: "hatchet.json", contents: "{}")
|
|
21
|
-
# write_target(target: "hatchet.lock", contents: YAML.dump({}))
|
|
22
|
-
# write_target(target: "spec/spec_helper.rb", template: "spec_helper.erb")
|
|
23
|
-
# write_target(target: "spec/hatchet/buildpack_spec.rb", template: "buildpack_spec.erb")
|
|
24
|
-
# write_target(target: ".github/dependabot.yml", template: "dependabot.erb")
|
|
25
|
-
|
|
26
|
-
it "generates files" do
|
|
27
|
-
fake_buildpack_dir do |dir|
|
|
28
|
-
fake_stdout = StringIO.new
|
|
29
|
-
init = Hatchet::InitProject.new(dir: dir, io: fake_stdout)
|
|
30
|
-
init.call
|
|
31
|
-
|
|
32
|
-
circle_ci_file = Pathname.new(dir).join(".circleci/config.yml")
|
|
33
|
-
expect(circle_ci_file.read).to match("parallel_split_test")
|
|
34
|
-
|
|
35
|
-
%W{
|
|
36
|
-
.circleci/config.yml
|
|
37
|
-
Gemfile
|
|
38
|
-
hatchet.json
|
|
39
|
-
hatchet.lock
|
|
40
|
-
spec/spec_helper.rb
|
|
41
|
-
spec/hatchet/buildpack_spec.rb
|
|
42
|
-
.github/dependabot.yml
|
|
43
|
-
.github/workflows/check_changelog.yml
|
|
44
|
-
.gitignore
|
|
45
|
-
}.each do |path|
|
|
46
|
-
expect(Pathname.new(dir).join(path)).to exist
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
expect(fake_stdout.string).to match("Bundle complete")
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|