zambezi / ez-build

Zambezi build tool
MIT License
2 stars 1 forks source link

Add option to read build options from file #37

Closed mstade closed 8 years ago

mstade commented 8 years ago

Description

Apologies for the somewhat ironic PR title. This change allows users to specify options in a file, which then gets read whenever ez-build is invoked and pointed to that file. There is no magic to how these files are found and loaded – it's entirely explicit. Whenever ez-build encounters a CLI option that starts with @, it will assume the rest of the string is a path to a file (relative to the current working dir) and load it under the assumption that the data within are more options. Files can include @ references themselves, to nest the loading of options. This means there can be any number of options files, making this a pretty flexible feature.

Motivation and Context

It came about when thinking about #27, and specifically when I wrote this comment. We've had a mounting problem of having to be increasingly wordy in our npm scripts, and as we invoke ez-build in different contexts with slightly different options, it is clear we need some way of re-using this configuration. I believe this is a good solution for that.

How Was This Tested?

These tests were added in opts-file.bats.

Types of changes

mstade commented 8 years ago

Bumped minor version because of the feature change.

codecov-io commented 8 years ago

Current coverage is 85.21% (diff: 100%)

Merging #37 into master will increase coverage by 4.06%

@@             master        #37   diff @@
==========================================
  Files            15         15          
  Lines           244        257    +13   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            198        219    +21   
+ Misses           46         38     -8   
  Partials          0          0          

Powered by Codecov. Last update d017e6b...9c50241

mstade commented 8 years ago

@mamapitufo – a penny for your thoughts!

mstade commented 8 years ago

@DimitarChristoff, @Poetro – would love to hear your thoughts on this as well!

mamapitufo commented 8 years ago

I like it! Good decision on going explicit, and the implementation is very simple.

mstade commented 8 years ago

@mamapitufo I miss working with you on a daily basis man, thanks for the feedback! :o)