Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
aa669fe
feat(api)!: define shared model ConversionRateConfig
stainless-app[bot] Sep 2, 2025
394af82
feat(api): api update
stainless-app[bot] Sep 2, 2025
3bd8a47
feat: extract minimum composite to type
stainless-app[bot] Sep 3, 2025
d7dd0b8
chore(internal): codegen related update
stainless-app[bot] Sep 3, 2025
bc6c8f9
feat(api): api update
stainless-app[bot] Sep 3, 2025
246283d
feat(api): api update
stainless-app[bot] Sep 5, 2025
8e3ac4b
feat(api): api update
stainless-app[bot] Sep 10, 2025
be80854
feat(api): api update
stainless-app[bot] Sep 12, 2025
b89ea6d
feat(api): api update
stainless-app[bot] Sep 16, 2025
cafba93
feat: expose response headers for both streams and errors
stainless-app[bot] Sep 17, 2025
c7d1331
chore: do not install brew dependencies in ./scripts/bootstrap by def…
stainless-app[bot] Sep 19, 2025
343fa0b
feat(api): api update
stainless-app[bot] Sep 19, 2025
9538971
perf: faster code formatting
stainless-app[bot] Sep 25, 2025
58f092f
fix(internal): use null byte as file separator in the fast formatting…
stainless-app[bot] Sep 26, 2025
984b6ad
fix: shorten multipart boundary sep to less than RFC specificed max l…
stainless-app[bot] Sep 26, 2025
6566897
chore: allow fast-format to use bsd sed as well
stainless-app[bot] Sep 26, 2025
aefe58f
fix: always send `filename=...` for multipart requests where a file i…
stainless-app[bot] Sep 29, 2025
83a6ffd
feat(api): api update
stainless-app[bot] Sep 29, 2025
b9d5318
codegen metadata
stainless-app[bot] Sep 29, 2025
a4faf55
fix: coroutine leaks from connection pool
stainless-app[bot] Sep 30, 2025
d1fc414
feat(api): api update
stainless-app[bot] Sep 30, 2025
f8c9f2c
feat(api): api update
stainless-app[bot] Oct 3, 2025
f8b2792
feat(api): api update
stainless-app[bot] Oct 3, 2025
dbeafc7
feat(api): api update
stainless-app[bot] Oct 6, 2025
87ab4bb
feat(api): api update
stainless-app[bot] Oct 7, 2025
717bc2e
chore: ignore linter error for tests having large collections
stainless-app[bot] Oct 8, 2025
182e255
feat(api): api update
stainless-app[bot] Oct 10, 2025
6778dfa
codegen metadata
stainless-app[bot] Oct 10, 2025
21271b0
feat(api): api update
stainless-app[bot] Oct 13, 2025
11db4b2
fix: should not reuse buffers for `IO.copy_stream` interop
stainless-app[bot] Oct 14, 2025
22b2593
fix: absolutely qualified uris should always override the default
stainless-app[bot] Oct 15, 2025
34d9e85
feat(api): api update
stainless-app[bot] Oct 15, 2025
b2f4ee7
codegen metadata
stainless-app[bot] Oct 16, 2025
6df80f0
feat(api): api update
stainless-app[bot] Oct 17, 2025
bd23d78
feat: handle thread interrupts in the core HTTP client
stainless-app[bot] Oct 23, 2025
863a72d
feat(api): api update
stainless-app[bot] Oct 23, 2025
9ffdf7e
codegen metadata
stainless-app[bot] Oct 27, 2025
5c9df30
codegen metadata
stainless-app[bot] Oct 27, 2025
b3fa16d
feat(api): api update
stainless-app[bot] Oct 29, 2025
c82723f
feat(api): api update
stainless-app[bot] Oct 30, 2025
e883731
feat(api): api update
stainless-app[bot] Oct 31, 2025
97803ff
feat(api): api update
stainless-app[bot] Oct 31, 2025
ed62aa3
chore(client): send user-agent header
stainless-app[bot] Nov 3, 2025
d677c86
feat(api): api update
stainless-app[bot] Nov 3, 2025
26ac9ce
chore: bump dependency version and update sorbet types
stainless-app[bot] Nov 3, 2025
024cfe9
feat(api): api update
stainless-app[bot] Nov 4, 2025
89f6a24
fix: better thread safety via early initializing SSL store during HTT…
stainless-app[bot] Nov 4, 2025
455c9c1
feat(api): api update
stainless-app[bot] Nov 5, 2025
fd9372e
codegen metadata
stainless-app[bot] Nov 6, 2025
6ada340
feat(api): api update
stainless-app[bot] Nov 7, 2025
4de7f17
feat(api): api update
stainless-app[bot] Nov 7, 2025
88e3262
feat(api): api update
stainless-app[bot] Nov 13, 2025
921d3c6
feat(api): api update
stainless-app[bot] Nov 16, 2025
98aaf7c
feat(api): api update
stainless-app[bot] Nov 16, 2025
9f52897
feat(api): api update
stainless-app[bot] Nov 18, 2025
2dc59bc
chore: explicitly require "base64" gem
stainless-app[bot] Nov 20, 2025
4cf9594
codegen metadata
stainless-app[bot] Nov 24, 2025
be086a4
feat(api): api update
stainless-app[bot] Nov 25, 2025
87a0726
feat(api): api update
stainless-app[bot] Dec 2, 2025
b6cd2e4
feat(api): api update
stainless-app[bot] Dec 3, 2025
0728baa
codegen metadata
stainless-app[bot] Dec 4, 2025
becbbfb
feat(api): api update
stainless-app[bot] Dec 6, 2025
e8ac579
codegen metadata
stainless-app[bot] Dec 12, 2025
c7f51d6
fix: calling `break` out of streams should be instantaneous
stainless-app[bot] Dec 16, 2025
90678c9
codegen metadata
stainless-app[bot] Dec 17, 2025
ecbf9f1
fix: issue where json.parse errors when receiving HTTP 204 with nobody
stainless-app[bot] Dec 18, 2025
58680e7
release: 1.12.0
stainless-app[bot] Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.11.2"
".": "1.12.0"
}
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Metrics/BlockLength:
Metrics/ClassLength:
Enabled: false

Metrics/CollectionLiteralLength:
Exclude:
- "test/**/*"

Metrics/CyclomaticComplexity:
Enabled: false

Expand Down
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 118
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4f31d46f5ba187fc4d702c9f9f1573dacb891edbd086f935707578d7c4f5fed8.yml
openapi_spec_hash: 25b1019f20a47b8af665aae5f8fd0025
config_hash: d8a0d696f3250ab096fac87b6b0eab53
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-59c57f1cbc067a477f6bf673882c28065e01418b86fcff390bba0d4438c58105.yml
openapi_spec_hash: 4da2681664f766985d1c20df40240cd9
config_hash: 05c94c0e6dbeab2c9b554c2e0d6371a0
79 changes: 79 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
# Changelog

## 1.12.0 (2025-12-18)

Full Changelog: [v1.11.2...v1.12.0](https://github.com/orbcorp/orb-ruby/compare/v1.11.2...v1.12.0)

### ⚠ BREAKING CHANGES

* **api:** define shared model ConversionRateConfig

### Features

* **api:** api update ([becbbfb](https://github.com/orbcorp/orb-ruby/commit/becbbfbda376e7262edc85e8b62033c900802aa3))
* **api:** api update ([b6cd2e4](https://github.com/orbcorp/orb-ruby/commit/b6cd2e48e6f93bd9c35a03370bf2bcaec81dfe40))
* **api:** api update ([87a0726](https://github.com/orbcorp/orb-ruby/commit/87a07260f66116747a5e9fc1fef8b04e2ed2ce73))
* **api:** api update ([be086a4](https://github.com/orbcorp/orb-ruby/commit/be086a41778e92515daa377fd87f6f0abfca72ae))
* **api:** api update ([9f52897](https://github.com/orbcorp/orb-ruby/commit/9f528979375caa801a1cf91f8bf5d3918a09c4ef))
* **api:** api update ([98aaf7c](https://github.com/orbcorp/orb-ruby/commit/98aaf7c01983329fe7900895b91f79192b38e15e))
* **api:** api update ([921d3c6](https://github.com/orbcorp/orb-ruby/commit/921d3c6a87d758ce6a1cc3fcfd7f4b81e0482d86))
* **api:** api update ([88e3262](https://github.com/orbcorp/orb-ruby/commit/88e32624c94e7de29738f086c90e41b07dcdd760))
* **api:** api update ([4de7f17](https://github.com/orbcorp/orb-ruby/commit/4de7f17ac1c5fe9b440348e06529528ef41a317e))
* **api:** api update ([6ada340](https://github.com/orbcorp/orb-ruby/commit/6ada3406fbcb73e97da781bffaa5c0dcc81d3ad1))
* **api:** api update ([455c9c1](https://github.com/orbcorp/orb-ruby/commit/455c9c18b77ee41a6b9c27fc791cc622553b83f8))
* **api:** api update ([024cfe9](https://github.com/orbcorp/orb-ruby/commit/024cfe9ce8ec66066224003fd8476cde441dfcba))
* **api:** api update ([d677c86](https://github.com/orbcorp/orb-ruby/commit/d677c8652f13f00ab40e63799223f64807d4d624))
* **api:** api update ([97803ff](https://github.com/orbcorp/orb-ruby/commit/97803ffbb43d1730ebb2f23386b241a3e9f99ee4))
* **api:** api update ([e883731](https://github.com/orbcorp/orb-ruby/commit/e8837312b28020f32d984bc83003be7c5d0bbe58))
* **api:** api update ([c82723f](https://github.com/orbcorp/orb-ruby/commit/c82723f6b075de5b8b806f4523437c31bc3f4d36))
* **api:** api update ([b3fa16d](https://github.com/orbcorp/orb-ruby/commit/b3fa16d2ae0fa06ed8c04f7c10634d240152e8b5))
* **api:** api update ([863a72d](https://github.com/orbcorp/orb-ruby/commit/863a72d5bc1ed22405334019d51e987daadedff4))
* **api:** api update ([6df80f0](https://github.com/orbcorp/orb-ruby/commit/6df80f039a079ed7c9c15201e6693ac88e64ee12))
* **api:** api update ([34d9e85](https://github.com/orbcorp/orb-ruby/commit/34d9e857f7863e718aaa844dcf0c299e234e9ab7))
* **api:** api update ([21271b0](https://github.com/orbcorp/orb-ruby/commit/21271b04f2b4b3af856b02dd156542770683f6d8))
* **api:** api update ([182e255](https://github.com/orbcorp/orb-ruby/commit/182e255a2ed9a39f774afb700320ff762da40e6d))
* **api:** api update ([87ab4bb](https://github.com/orbcorp/orb-ruby/commit/87ab4bb08910a9c6e5a7995ca307e8a80c737c39))
* **api:** api update ([dbeafc7](https://github.com/orbcorp/orb-ruby/commit/dbeafc76cc391a10d8cb21f5db2ef8bb825aee1c))
* **api:** api update ([f8b2792](https://github.com/orbcorp/orb-ruby/commit/f8b27927f181b45c2196de229a35b5eae6122f46))
* **api:** api update ([f8c9f2c](https://github.com/orbcorp/orb-ruby/commit/f8c9f2c57e94d09130d68b080b0adc5ae38bbd30))
* **api:** api update ([d1fc414](https://github.com/orbcorp/orb-ruby/commit/d1fc414cb976afe6bb19dc284dceb7ed7bfa38c2))
* **api:** api update ([83a6ffd](https://github.com/orbcorp/orb-ruby/commit/83a6ffda9613b6571029f01235d673d179294c94))
* **api:** api update ([343fa0b](https://github.com/orbcorp/orb-ruby/commit/343fa0b8a9a724b73f8abe5e9de34795f232e065))
* **api:** api update ([b89ea6d](https://github.com/orbcorp/orb-ruby/commit/b89ea6d10a12909e77c76617d11068ade5cf6fc8))
* **api:** api update ([be80854](https://github.com/orbcorp/orb-ruby/commit/be80854305b7dd24350c0a955de536d37233bc35))
* **api:** api update ([8e3ac4b](https://github.com/orbcorp/orb-ruby/commit/8e3ac4b248b2aca6ac6d5360f34be8521b05bc83))
* **api:** api update ([246283d](https://github.com/orbcorp/orb-ruby/commit/246283dc41fd3d9b128ac44ccd8550ae7b987578))
* **api:** api update ([bc6c8f9](https://github.com/orbcorp/orb-ruby/commit/bc6c8f9914220783adeb80fa6a9eb87d009fa58d))
* **api:** api update ([394af82](https://github.com/orbcorp/orb-ruby/commit/394af826a5ba3cd462447304c8ec659038e67617))
* **api:** define shared model ConversionRateConfig ([aa669fe](https://github.com/orbcorp/orb-ruby/commit/aa669fef9079dbac856be83d56cabd826e3c47c0))
* expose response headers for both streams and errors ([cafba93](https://github.com/orbcorp/orb-ruby/commit/cafba93f8798a84815c9c9d1183327e498cb6b95))
* extract minimum composite to type ([3bd8a47](https://github.com/orbcorp/orb-ruby/commit/3bd8a47a7c0601ccb9c43b472131562319a59e51))
* handle thread interrupts in the core HTTP client ([bd23d78](https://github.com/orbcorp/orb-ruby/commit/bd23d789ed205441ea6f6d76324278867eaf59eb))


### Bug Fixes

* absolutely qualified uris should always override the default ([22b2593](https://github.com/orbcorp/orb-ruby/commit/22b25937df7cf77dbf1e1a9836e5cd822087d338))
* always send `filename=...` for multipart requests where a file is expected ([aefe58f](https://github.com/orbcorp/orb-ruby/commit/aefe58f92b1296aa30172ce8206f84723a3a326c))
* better thread safety via early initializing SSL store during HTTP client creation ([89f6a24](https://github.com/orbcorp/orb-ruby/commit/89f6a24e6ed1147c45a583c91ac368932cf37ddb))
* calling `break` out of streams should be instantaneous ([c7f51d6](https://github.com/orbcorp/orb-ruby/commit/c7f51d6d47678f33015fdffc78e6cff826a90a2c))
* coroutine leaks from connection pool ([a4faf55](https://github.com/orbcorp/orb-ruby/commit/a4faf55a381bcdaae01f0a22cd8922038af38f69))
* **internal:** use null byte as file separator in the fast formatting script ([58f092f](https://github.com/orbcorp/orb-ruby/commit/58f092f32214ae8deb17db5e002f10fafd60378e))
* issue where json.parse errors when receiving HTTP 204 with nobody ([ecbf9f1](https://github.com/orbcorp/orb-ruby/commit/ecbf9f18b8229cb9d9c729a346a5f00dc1be2427))
* shorten multipart boundary sep to less than RFC specificed max length ([984b6ad](https://github.com/orbcorp/orb-ruby/commit/984b6ad403302ab97275136e145dce322ce82e9b))
* should not reuse buffers for `IO.copy_stream` interop ([11db4b2](https://github.com/orbcorp/orb-ruby/commit/11db4b2e6edf33581a21c6eacfbdaf347af418ea))


### Performance Improvements

* faster code formatting ([9538971](https://github.com/orbcorp/orb-ruby/commit/95389713d7c3b97ec3cf0963b86211d5fba72fe4))


### Chores

* allow fast-format to use bsd sed as well ([6566897](https://github.com/orbcorp/orb-ruby/commit/6566897b0797bdbad69e21ed05d97f4ce1509f07))
* bump dependency version and update sorbet types ([26ac9ce](https://github.com/orbcorp/orb-ruby/commit/26ac9ce1b4ae0315417ece34fc02b63b569db0c6))
* **client:** send user-agent header ([ed62aa3](https://github.com/orbcorp/orb-ruby/commit/ed62aa37562af4ddca14635d87bc44fe049df745))
* do not install brew dependencies in ./scripts/bootstrap by default ([c7d1331](https://github.com/orbcorp/orb-ruby/commit/c7d13317194914b406f35048eb198c715e3645da))
* explicitly require "base64" gem ([2dc59bc](https://github.com/orbcorp/orb-ruby/commit/2dc59bc83506fbb02785f784023a217e0472513e))
* ignore linter error for tests having large collections ([717bc2e](https://github.com/orbcorp/orb-ruby/commit/717bc2e5e09f3c6cea641189a2a9eb516dcbf0ec))
* **internal:** codegen related update ([d7dd0b8](https://github.com/orbcorp/orb-ruby/commit/d7dd0b8380fd9ec066388c3327ed16fdba9f7fa6))

## 1.11.2 (2025-08-29)

Full Changelog: [v1.11.1...v1.11.2](https://github.com/orbcorp/orb-ruby/compare/v1.11.1...v1.11.2)
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ group :development do
gem "sorbet"
gem "steep"
gem "syntax_tree"
# TODO: using a fork for now, the prettier below has a bug
gem "syntax_tree-rbs", github: "stainless-api/syntax_tree-rbs", branch: "main"
gem "syntax_tree-rbs", github: "ruby-syntax-tree/syntax_tree-rbs", branch: "main"
gem "tapioca"
end

Expand Down
84 changes: 42 additions & 42 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/stainless-api/syntax_tree-rbs.git
revision: c30b50219918be7cfe3ef803a00b59d1e77fcada
remote: https://github.com/ruby-syntax-tree/syntax_tree-rbs.git
revision: f94bc3060682ffbd126e4d5086ffedc89073d626
branch: main
specs:
syntax_tree-rbs (1.0.0)
Expand All @@ -11,20 +11,20 @@ GIT
PATH
remote: .
specs:
orb-billing (1.11.2)
orb-billing (1.12.0)
connection_pool

GEM
remote: https://rubygems.org/
specs:
activesupport (8.0.2.1)
activesupport (8.1.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
Expand All @@ -33,22 +33,22 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
async (2.27.3)
async (2.34.0)
console (~> 1.29)
fiber-annotation
io-event (~> 1.11)
metrics (~> 0.12)
traces (~> 0.15)
traces (~> 0.18)
base64 (0.3.0)
benchmark (0.4.1)
bigdecimal (3.2.2)
benchmark (0.5.0)
bigdecimal (3.3.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
console (1.33.0)
connection_pool (2.5.4)
console (1.34.2)
fiber-annotation
fiber-local (~> 1.1)
json
crack (1.0.0)
crack (1.0.1)
bigdecimal
rexml
csv (3.3.5)
Expand All @@ -64,20 +64,20 @@ GEM
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.1)
fileutils (1.7.3)
hashdiff (1.2.0)
fileutils (1.8.0)
hashdiff (1.2.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.11.2)
json (2.13.2)
json (2.15.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
metrics (0.13.0)
minitest (5.25.5)
metrics (0.15.0)
minitest (5.26.0)
minitest-focus (1.4.0)
minitest (>= 4, < 6)
minitest-hooks (1.5.2)
Expand All @@ -89,51 +89,51 @@ GEM
mutex_m (0.3.0)
netrc (0.11.0)
parallel (1.27.0)
parser (3.3.9.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.4.0)
prism (1.6.0)
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.0)
rake (13.3.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rbi (0.3.6)
rbi (0.3.7)
prism (~> 1.0)
rbs (>= 3.4.4)
rbs (3.9.4)
rbs (3.9.5)
logger
redcarpet (3.6.1)
regexp_parser (2.11.2)
rexml (3.4.1)
rubocop (1.79.2)
regexp_parser (2.11.3)
rexml (3.4.4)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.46.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
sorbet (0.5.12424)
sorbet-static (= 0.5.12424)
sorbet-runtime (0.5.12424)
sorbet-static (0.5.12424-aarch64-linux)
sorbet-static (0.5.12424-universal-darwin)
sorbet-static (0.5.12424-x86_64-linux)
sorbet-static-and-runtime (0.5.12424)
sorbet (= 0.5.12424)
sorbet-runtime (= 0.5.12424)
sorbet (0.6.12690)
sorbet-static (= 0.6.12690)
sorbet-runtime (0.6.12690)
sorbet-static (0.6.12690-aarch64-linux)
sorbet-static (0.6.12690-universal-darwin)
sorbet-static (0.6.12690-x86_64-linux)
sorbet-static-and-runtime (0.6.12690)
sorbet (= 0.6.12690)
sorbet-runtime (= 0.6.12690)
spoom (1.6.3)
erubi (>= 1.10.0)
prism (>= 0.28.0)
Expand Down Expand Up @@ -174,14 +174,14 @@ GEM
terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4)
thor (1.4.0)
traces (0.17.0)
traces (0.18.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webmock (3.25.1)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.0)
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "orb-billing", "~> 1.11.2"
gem "orb-billing", "~> 1.12.0"
```

<!-- x-release-please-end -->
Expand Down
28 changes: 20 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ tapioca = "sorbet/tapioca"
examples = "examples"
ignore_file = ".ignore"

FILES_ENV = "FORMAT_FILE"

CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file)

CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca)
Expand All @@ -38,6 +40,14 @@ end
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}

filtered = ->(ext, dirs) do
if ENV.key?(FILES_ENV)
%w[sed -E -n -e] << "/\\.#{ext}$/p" << "--" << ENV.fetch(FILES_ENV)
else
(%w[find] + dirs + %w[-type f -and -name]) << "*.#{ext}" << "-print0"
end
end

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0]
Expand All @@ -52,24 +62,26 @@ multitask(:"lint:rubocop") do
sh("#{find.shelljoin} | #{lint.shelljoin}")
end

norm_lines = %w[tr -- \n \0].shelljoin

desc("Format `*.rb`")
multitask(:"format:rb") do
# while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support
find = %w[find ./lib ./test ./examples -type f -and -name *.rb -print0]
files = filtered["rb", %w[./lib ./test ./examples]]
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
sh("#{find.shelljoin} | #{fmt.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
files = filtered["rbi", %w[./rbi]]
fmt = xargs + %w[stree write --]
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
multitask(:"format:rbs") do
find = %w[find ./sig -type f -name *.rbs -print0]
files = filtered["rbs", %w[./sig]]
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
uuid = SecureRandom.uuid

Expand Down Expand Up @@ -98,13 +110,13 @@ multitask(:"format:rbs") do
success = false

# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
sh("#{find.shelljoin} | #{pst.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pst.shelljoin}")

# always run post-processing to remove comment marker
fail unless success
Expand Down
Loading
Loading