Commit bd85cd5
committed
Add support for a simple config file
As syntax_tree gains wider usage, it'll be very helpful to allow
projects to commit their particular configs within their repo for use by
any tool that uses `stree` instead of having to create wrapper scripts,
rely on rake tasks that come with their own overhead, or manually keep
settings up to date among all contributors.
This set of changes takes inspiration from sorbet to provide users with
a simple config file that's also easy to parse and use within the gem.
It's a text file that has the exact options you'd pass on the command
line, each on their own line. These are parsed and prepended to the
arguments array within `CLI.run`, still allowing for other options to
passed from the command line.
I decided to restrict this only to the command line options and avoid
the source files argument, opting to let other tools pass their own
source file from the command line, which is preferable for tools like
editor integrations that might interact with a single file at a time. If
users want to interact with all of their Ruby files at once, the rake
tasks are perfect for providing larger, static patterns of files. And
since they use `CLI.run` as well, they'll pick up options from a
.streerc file, if present.
I also opted for only supporting a single .streerc file at the project
root. If there's a need for multiple configs or config locations, this
can be easily extended to look up through a directory structure or
accept an option for a specific config file location (or even a
different filename). Those felt out of scope for this initial support.1 parent cf97c1b commit bd85cd5
3 files changed
+92
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
231 | 232 | | |
232 | 233 | | |
233 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
234 | 248 | | |
235 | 249 | | |
236 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
272 | 279 | | |
273 | 280 | | |
274 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
183 | 254 | | |
184 | 255 | | |
185 | 256 | | |
| |||
0 commit comments