packwerk 1.1.3 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/Gemfile.lock +8 -6
- data/README.md +4 -4
- data/TROUBLESHOOT.md +2 -2
- data/USAGE.md +31 -31
- data/bin/m +29 -0
- data/bin/rake +29 -0
- data/bin/rubocop +29 -0
- data/bin/srb +29 -0
- data/bin/tapioca +29 -0
- data/dev.yml +6 -6
- data/lib/packwerk/application_load_paths.rb +18 -8
- data/lib/packwerk/application_validator.rb +25 -26
- data/lib/packwerk/association_inspector.rb +0 -3
- data/lib/packwerk/checker.rb +2 -8
- data/lib/packwerk/cli.rb +29 -109
- data/lib/packwerk/configuration.rb +6 -1
- data/lib/packwerk/const_node_inspector.rb +0 -2
- data/lib/packwerk/constant_discovery.rb +2 -0
- data/lib/packwerk/constant_name_inspector.rb +0 -1
- data/lib/packwerk/dependency_checker.rb +2 -15
- data/lib/packwerk/deprecated_references.rb +13 -12
- data/lib/packwerk/file_processor.rb +0 -4
- data/lib/packwerk/formatters/offenses_formatter.rb +13 -9
- data/lib/packwerk/formatters/progress_formatter.rb +5 -4
- data/lib/packwerk/generators/configuration_file.rb +0 -1
- data/lib/packwerk/inflector.rb +0 -2
- data/lib/packwerk/node.rb +1 -0
- data/lib/packwerk/node_processor.rb +14 -32
- data/lib/packwerk/node_processor_factory.rb +0 -5
- data/lib/packwerk/node_visitor.rb +1 -4
- data/lib/packwerk/offense.rb +0 -4
- data/lib/packwerk/offense_collection.rb +84 -0
- data/lib/packwerk/offenses_formatter.rb +19 -0
- data/lib/packwerk/package.rb +17 -1
- data/lib/packwerk/package_set.rb +0 -2
- data/lib/packwerk/parse_run.rb +106 -0
- data/lib/packwerk/parsed_constant_definitions.rb +0 -2
- data/lib/packwerk/parsers/erb.rb +0 -2
- data/lib/packwerk/parsers/factory.rb +0 -2
- data/lib/packwerk/parsers.rb +0 -2
- data/lib/packwerk/privacy_checker.rb +2 -15
- data/lib/packwerk/reference_extractor.rb +0 -8
- data/lib/packwerk/reference_offense.rb +49 -0
- data/lib/packwerk/result.rb +9 -0
- data/lib/packwerk/run_context.rb +4 -21
- data/lib/packwerk/sanity_checker.rb +0 -2
- data/lib/packwerk/version.rb +1 -1
- data/lib/packwerk/violation_type.rb +0 -2
- data/lib/packwerk.rb +71 -36
- data/packwerk.gemspec +1 -0
- data/service.yml +1 -4
- data/sorbet/rbi/gems/parallel@1.20.1.rbi +111 -2
- data/sorbet/tapioca/require.rb +1 -0
- metadata +27 -16
- data/lib/packwerk/cache_deprecated_references.rb +0 -55
- data/lib/packwerk/checking_deprecated_references.rb +0 -43
- data/lib/packwerk/commands/detect_stale_violations_command.rb +0 -60
- data/lib/packwerk/commands/offense_progress_marker.rb +0 -24
- data/lib/packwerk/commands/result.rb +0 -13
- data/lib/packwerk/commands/update_deprecations_command.rb +0 -81
- data/lib/packwerk/detect_stale_deprecated_references.rb +0 -14
- data/lib/packwerk/generators/application_validation.rb +0 -62
- data/lib/packwerk/generators/templates/packwerk +0 -23
- data/lib/packwerk/generators/templates/packwerk_validator_test.rb +0 -11
- data/lib/packwerk/reference_lister.rb +0 -23
- data/lib/packwerk/spring_command.rb +0 -28
- data/lib/packwerk/updating_deprecated_references.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd7c65bd8c7e2c9448f0c0ab3dffc69291c0a379d7da46b7deb7a70e87b805f
|
4
|
+
data.tar.gz: ddfeb4e7d17a5deba8ab1319897adefe77462d64f088e3ae8ddfbfa0ecefa1d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 784b0938aae086fc90d362542b3b372fa235790f40983be1172c3563be4c82f13052642638447496043c94e68e72dcdb8adc344ee8336130e2130b92afb9bccc
|
7
|
+
data.tar.gz: e464eb8f88b8827cace5a7c38a4cf653d686bd19327e1b1123a6828d075be8919f9a73cbca57413a8ed859225525d9b64e57406b9d4b25ebac3f5b3c91703b03
|
data/.github/workflows/ci.yml
CHANGED
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
run: |
|
31
31
|
gem install bundler
|
32
32
|
bundle install --jobs 4 --retry 3
|
33
|
-
|
33
|
+
bin/rake
|
34
34
|
lint:
|
35
35
|
runs-on: ubuntu-latest
|
36
36
|
steps:
|
@@ -43,7 +43,7 @@ jobs:
|
|
43
43
|
run: |
|
44
44
|
gem install bundler
|
45
45
|
bundle install --jobs 4 --retry 3
|
46
|
-
|
46
|
+
bin/rubocop
|
47
47
|
static-type-checking:
|
48
48
|
runs-on: ubuntu-latest
|
49
49
|
steps:
|
@@ -56,4 +56,4 @@ jobs:
|
|
56
56
|
run: |
|
57
57
|
gem install bundler
|
58
58
|
bundle install --jobs 4 --retry 3
|
59
|
-
|
59
|
+
bin/srb tc
|
data/Gemfile.lock
CHANGED
@@ -87,11 +87,12 @@ GIT
|
|
87
87
|
PATH
|
88
88
|
remote: .
|
89
89
|
specs:
|
90
|
-
packwerk (1.
|
90
|
+
packwerk (1.3.2)
|
91
91
|
activesupport (>= 5.2)
|
92
92
|
ast
|
93
93
|
better_html
|
94
94
|
constant_resolver
|
95
|
+
parallel
|
95
96
|
parser
|
96
97
|
sorbet-runtime
|
97
98
|
|
@@ -134,16 +135,16 @@ GEM
|
|
134
135
|
marcel (1.0.0)
|
135
136
|
method_source (1.0.0)
|
136
137
|
mini_mime (1.0.3)
|
137
|
-
mini_portile2 (2.5.
|
138
|
+
mini_portile2 (2.5.1)
|
138
139
|
minitest (5.14.4)
|
139
140
|
minitest-focus (1.2.1)
|
140
141
|
minitest (>= 4, < 6)
|
141
142
|
mocha (1.12.0)
|
142
143
|
nio4r (2.5.7)
|
143
|
-
nokogiri (1.11.
|
144
|
+
nokogiri (1.11.5)
|
144
145
|
mini_portile2 (~> 2.5.0)
|
145
146
|
racc (~> 1.4)
|
146
|
-
nokogiri (1.11.
|
147
|
+
nokogiri (1.11.5-x86_64-darwin)
|
147
148
|
racc (~> 1.4)
|
148
149
|
parallel (1.20.1)
|
149
150
|
parlour (6.0.0)
|
@@ -168,7 +169,7 @@ GEM
|
|
168
169
|
rainbow (3.0.0)
|
169
170
|
rake (13.0.3)
|
170
171
|
regexp_parser (2.1.1)
|
171
|
-
rexml (3.2.
|
172
|
+
rexml (3.2.5)
|
172
173
|
rubocop (1.12.0)
|
173
174
|
parallel (~> 1.10)
|
174
175
|
parser (>= 3.0.0.0)
|
@@ -232,6 +233,7 @@ GEM
|
|
232
233
|
|
233
234
|
PLATFORMS
|
234
235
|
ruby
|
236
|
+
x86_64-darwin
|
235
237
|
x86_64-darwin-20
|
236
238
|
|
237
239
|
DEPENDENCIES
|
@@ -253,4 +255,4 @@ DEPENDENCIES
|
|
253
255
|
tapioca
|
254
256
|
|
255
257
|
BUNDLED WITH
|
256
|
-
2.2.
|
258
|
+
2.2.22
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
## NOTE: Packwerk is considered to be feature-complete for Shopify's uses. We are currently accepting bug fixes only, and it is not being actively developed. Please fork this project if you are interested in adding new features.
|
4
4
|
|
5
|
-
> "I know who you are and because of that I know what you do."
|
6
|
-
> This knowledge is a dependency that raises the cost of change.
|
5
|
+
> "I know who you are and because of that I know what you do."
|
6
|
+
> This knowledge is a dependency that raises the cost of change.
|
7
7
|
|
8
8
|
-- _Sandi Metz, Practical Object-Oriented Design in Ruby_
|
9
9
|
|
@@ -47,7 +47,7 @@ Or install it yourself as:
|
|
47
47
|
|
48
48
|
$ gem install packwerk
|
49
49
|
|
50
|
-
3. Run `
|
50
|
+
3. Run `packwerk init` to generate the configuration files
|
51
51
|
|
52
52
|
## Usage
|
53
53
|
|
@@ -59,7 +59,7 @@ Read [USAGE.md](USAGE.md) for usage once Packwerk is installed on your project.
|
|
59
59
|
|
60
60
|
## Development
|
61
61
|
|
62
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
62
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
63
63
|
|
64
64
|
## Limitations
|
65
65
|
|
data/TROUBLESHOOT.md
CHANGED
@@ -14,9 +14,9 @@ Packwerk can give feedback via continuous integration (CI) if you have it set up
|
|
14
14
|
|
15
15
|
You can specify folders or packages in Packwerk commands for a shorter run time:
|
16
16
|
|
17
|
-
|
17
|
+
packwerk check components/your_package
|
18
18
|
|
19
|
-
|
19
|
+
packwerk update-deprecations components/your_package
|
20
20
|
|
21
21
|
_Note: You cannot specify folders or packages for `packwerk validate` because the command runs for the entire application._
|
22
22
|
|
data/USAGE.md
CHANGED
@@ -1,29 +1,32 @@
|
|
1
1
|
# Packwerk usage
|
2
2
|
|
3
3
|
## Table of Contents
|
4
|
-
|
5
|
-
* [What
|
6
|
-
|
7
|
-
* [
|
8
|
-
* [
|
9
|
-
|
10
|
-
* [
|
11
|
-
* [
|
12
|
-
|
13
|
-
* [
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
* [
|
18
|
-
* [
|
19
|
-
|
4
|
+
|
5
|
+
* [What problem does Packwerk solve?](#what-problem-does-packwerk-solve)
|
6
|
+
* [What is a package?](#what-is-a-package)
|
7
|
+
* [Package principles](#package-principles)
|
8
|
+
* [Getting started](#getting-started)
|
9
|
+
* [Setting up the configuration file](#setting-up-the-configuration-file)
|
10
|
+
* [Inflections](#inflections)
|
11
|
+
* [Validating the package system](#validating-the-package-system)
|
12
|
+
* [Defining packages](#defining-packages)
|
13
|
+
* [Package metadata](#package-metadata)
|
14
|
+
* [Types of boundary checks](#types-of-boundary-checks)
|
15
|
+
* [Enforcing privacy boundary](#enforcing-privacy-boundary)
|
16
|
+
* [Using public folders](#using-public-folders)
|
17
|
+
* [Enforcing dependency boundary](#enforcing-dependency-boundary)
|
18
|
+
* [Checking for violations](#checking-for-violations)
|
19
|
+
* [Recording existing violations](#recording-existing-violations)
|
20
|
+
* [Understanding the list of deprecated references](#understanding-the-list-of-deprecated-references)
|
20
21
|
|
21
22
|
## What problem does Packwerk solve?
|
23
|
+
|
22
24
|
Large applications need clear boundaries to avoid turning into a [ball of mud](https://en.wikipedia.org/wiki/Big_ball_of_mud). However, Ruby does not provide a good solution to enforcing boundaries between code.
|
23
25
|
|
24
26
|
Packwerk is a gem that can be used to enforce boundaries between groups of code we call packages.
|
25
27
|
|
26
28
|
## What is a package?
|
29
|
+
|
27
30
|
A package is a folder containing autoloaded code. To decide whether code belongs together in a package, these are some design best practices:
|
28
31
|
|
29
32
|
- We should package things together that have high functional [cohesion](https://en.wikipedia.org/wiki/Cohesion_(computer_science)).
|
@@ -41,7 +44,7 @@ The [package principles](https://en.wikipedia.org/wiki/Package_principles) page
|
|
41
44
|
|
42
45
|
After including Packwerk in the Gemfile, you can generate the necessary files to get Packwerk running by executing:
|
43
46
|
|
44
|
-
|
47
|
+
packwerk init
|
45
48
|
|
46
49
|
Here is a list of files generated:
|
47
50
|
|
@@ -49,8 +52,6 @@ Here is a list of files generated:
|
|
49
52
|
|-----------------------------|--------------|------------|
|
50
53
|
| Packwerk configuration | packwerk.yml | See [Setting up the configuration file](#Setting-up-the-configuration-file) |
|
51
54
|
| Root package | package.yml | A package for the root folder |
|
52
|
-
| Bin script | bin/packwerk | For Rails applications to run Packwerk validation on CI, see [Validating the package system](#Validating-the-package-system) |
|
53
|
-
| Validation test | test/packwerk_validator_test.rb | For Ruby projects to run Packwerk validation using tests, see [Validating the package system](#Validating-the-package-system) |
|
54
55
|
| Custom inflections | config/inflections.yml | A custom inflections file is only required if you have custom inflections in `inflections.rb`, see [Inflections](#Inflections) |
|
55
56
|
|
56
57
|
After that, you may begin creating packages for your application. See [Defining packages](#Defining-packages)
|
@@ -66,6 +67,7 @@ Packwerk reads from the `packwerk.yml` configuration file in the root directory.
|
|
66
67
|
| package_paths | **/ | a single pattern or a list of patterns to find package configuration files, see: [Defining packages](#Defining-packages) |
|
67
68
|
| load_paths | All application autoload paths | list of load paths |
|
68
69
|
| custom_associations | N/A | list of custom associations, if any |
|
70
|
+
| parallel | true | when true, fork code parsing out to subprocesses |
|
69
71
|
|
70
72
|
### Using a custom ERB parser
|
71
73
|
|
@@ -132,18 +134,14 @@ Any new inflectors should be added to `config/inflections.yml`.
|
|
132
134
|
|
133
135
|
There are some criteria that an application must meet in order to have a valid package system. These criteria include having a valid autoload path cache, package definition files, and application folder structure. The dependency graph within the package system also has to be acyclic.
|
134
136
|
|
135
|
-
The package system can be validated through a series of built in validation checks. Currently, the validation checks require the application to be booted either through `spring` or as part of its test suite.
|
136
|
-
|
137
137
|
We recommend setting up the package system validation for your Rails application in a CI step (or through a test suite for Ruby projects) separate from `packwerk check`.
|
138
138
|
|
139
|
-
|
139
|
+
Use the following command to validate the application:
|
140
140
|
|
141
|
-
|
141
|
+
packwerk validate
|
142
142
|
|
143
143
|
![](static/packwerk_validate.gif)
|
144
144
|
|
145
|
-
If running `packwerk init` on your Ruby project generates `test/packwerk_validator_test.rb`, you can use this test as validation.
|
146
|
-
|
147
145
|
## Defining packages
|
148
146
|
|
149
147
|
You can create a `package.yml` in any folder to make it a package. The package name is the path to the folder from the project root.
|
@@ -151,6 +149,7 @@ You can create a `package.yml` in any folder to make it a package. The package n
|
|
151
149
|
_Note: It is helpful to define a namespace that corresponds to the package name and contains at least all the public constants of the package. This makes it more obvious which package a constant is defined in._
|
152
150
|
|
153
151
|
### Package metadata
|
152
|
+
|
154
153
|
Package metadata can be included in the `package.yml`. Metadata won't be validated, and can thus be anything. We recommend including information on ownership and stewardship of the package.
|
155
154
|
|
156
155
|
Example:
|
@@ -168,6 +167,7 @@ Example:
|
|
168
167
|
Packwerk can perform two types of boundary checks: privacy and dependency.
|
169
168
|
|
170
169
|
#### Enforcing privacy boundary
|
170
|
+
|
171
171
|
A package's privacy boundary is violated when there is a reference to the package's private constants from a source outside the package.
|
172
172
|
|
173
173
|
There are two ways you can enforce privacy for your package:
|
@@ -227,13 +227,13 @@ It will be a dependency violation when `components/shop_identity` tries to refer
|
|
227
227
|
|
228
228
|
After enforcing the boundary checks for a package, you may execute:
|
229
229
|
|
230
|
-
|
230
|
+
packwerk check
|
231
231
|
|
232
|
-
Packwerk will check the entire codebase for any violations.
|
232
|
+
Packwerk will check the entire codebase for any new or stale violations.
|
233
233
|
|
234
|
-
You can also specify folders
|
234
|
+
You can also specify folders for a shorter run time:
|
235
235
|
|
236
|
-
|
236
|
+
packwerk check components/your_package
|
237
237
|
|
238
238
|
![](static/packwerk_check.gif)
|
239
239
|
|
@@ -247,11 +247,11 @@ For existing codebases, packages are likely to have existing boundary violations
|
|
247
247
|
|
248
248
|
If so, you will want to stop the bleeding and prevent more violations from occuring. The existing violations in the codebase can be recorded in a [deprecated references list](#Understanding_the_list_of_deprecated_references) by executing:
|
249
249
|
|
250
|
-
|
250
|
+
packwerk update-deprecations
|
251
251
|
|
252
252
|
Similar to `packwerk check`, you may also run `packwerk update-deprecations` on folders or packages:
|
253
253
|
|
254
|
-
|
254
|
+
packwerk update-deprecations components/your_package
|
255
255
|
|
256
256
|
![](static/packwerk_update.gif)
|
257
257
|
|
data/bin/m
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'm' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("m", "m")
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/srb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'srb' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("sorbet", "srb")
|
data/bin/tapioca
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'tapioca' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("tapioca", "tapioca")
|
data/dev.yml
CHANGED
@@ -12,21 +12,21 @@ commands:
|
|
12
12
|
if [[ "$*" =~ ":"[0-9]+ ]];
|
13
13
|
then
|
14
14
|
# run test by its line number
|
15
|
-
|
15
|
+
bin/m "$@"
|
16
16
|
elif [[ "$#" -eq 1 && -f "$1" ]];
|
17
17
|
then
|
18
18
|
# run all tests in given file(s)
|
19
|
-
|
19
|
+
bin/rake test TEST="$@"
|
20
20
|
else
|
21
21
|
# run all tests
|
22
|
-
|
22
|
+
bin/rake test
|
23
23
|
fi
|
24
|
-
style: "
|
24
|
+
style: "bin/rubocop -D --auto-correct"
|
25
25
|
typecheck:
|
26
26
|
desc: "run Sorbet typechecking"
|
27
|
-
run: "
|
27
|
+
run: "bin/srb tc"
|
28
28
|
aliases: ['tc']
|
29
29
|
subcommands:
|
30
30
|
update:
|
31
31
|
desc: "update RBIs for gems"
|
32
|
-
run: "
|
32
|
+
run: "bin/tapioca sync -c 'dev typecheck update'"
|