31 Commits

Author SHA1 Message Date
Jack Nagel
6fe2ccf854 Fix duplicated test methods 2014-12-02 11:15:20 -05:00
Mike McQuaid
02e10beb7c Add deprecated_option to software_spec.
Allows remapping one option name to another and updates build options
and flags accordingly.
2014-10-19 13:58:52 +01:00
Mike McQuaid
da0a65356d Add DeprecatedOption class.
Used to capture options that are being renamed.
2014-10-19 13:58:52 +01:00
Jack Nagel
750d7bb2c8 Options internals no longer need to support switches 2014-08-29 19:38:32 -05:00
Jack Nagel
6885f588d0 Move handling of leading dashes to Options.create 2014-08-29 19:38:32 -05:00
Jack Nagel
f7f8ca45fc Remove to_str from Option
We no longer need implicit conversion of options to strings.
2014-08-27 14:08:14 -05:00
Jack Nagel
af3d551de7 Options no longer needs deep-copy semantics
Follow-up to 23d90a6a187a57fbdf4eeac146993e3b37c3d4d9.
2014-08-20 19:05:49 -05:00
Jack Nagel
2311181b54 Remove Options#concat 2014-08-13 18:16:25 -05:00
Jack Nagel
eed8af9b80 Drop unnecessary parens in tests 2014-08-13 17:14:55 -05:00
Jack Nagel
e40143efd5 Drop unnecessary to_a calls in options tests 2014-08-13 11:09:57 -05:00
Jack Nagel
268cd143be Replace Options.coerce with an alternate constructor 2014-08-13 11:09:57 -05:00
Jack Nagel
094c184b12 Remove unused branches from Options.coerce 2014-08-13 11:09:57 -05:00
Mike McQuaid
00d1bb8d12 Revert "Remove unused branches from Options.coerce"
This reverts commit cee42c339e7632eab15111e2c4e6c121ace6f9e2.
2014-08-13 08:45:07 +01:00
Mike McQuaid
a61c3615d2 Revert "Replace Options.coerce with an alternate constructor"
This reverts commit 8d2ef974a3a87bf4207f71ccb8a7b4776e16a016.
2014-08-13 08:45:06 +01:00
Mike McQuaid
f93a9aafca Revert "Drop unnecessary to_a calls in options tests"
This reverts commit 6f29c36aed9d951499146054a4caca702fa33d1a.
2014-08-13 08:45:04 +01:00
Jack Nagel
445a512379 Drop unnecessary to_a calls in options tests 2014-08-13 00:33:18 -05:00
Jack Nagel
25395c6de6 Replace Options.coerce with an alternate constructor 2014-08-12 23:55:28 -05:00
Jack Nagel
0a2be32d80 Remove unused branches from Options.coerce 2014-08-12 23:55:28 -05:00
Jack Nagel
aad09a5a63 Option does not need to be Comparable 2014-07-03 19:29:18 -05:00
Jack Nagel
7d8a901f7a Add assert_eql to provide better failure messages for eql? tests 2014-07-03 16:55:13 -05:00
Jack Nagel
4b6abc7da2 Use assert_includes 2014-06-18 20:34:10 -05:00
Jack Nagel
06305e6211 Switch to Minitest 2014-06-18 20:34:09 -05:00
Jack Nagel
982e9239b8 Use a custom test class so we can avoid monkeypatching 2014-06-18 20:32:51 -05:00
Jack Nagel
f3e9c5c070 Fix up some assertions 2014-06-11 13:05:10 -05:00
Jack Nagel
b2ccbfe6af Add set union to Options 2014-02-27 14:22:42 -06:00
Jack Nagel
9b2e04593f Options: ensure copies do not share the underlying collection 2013-08-22 11:49:24 -05:00
Jack Nagel
7654077752 Demonstrate the Set-like nature of Options collections
Options collections are backed by Sets, and thus trying to push a new
option with a name that duplicates an existing option cannot succeed.

Later, we can exploit this behavior and remove some conditionals.
2013-08-22 11:35:00 -05:00
Jack Nagel
d6929f96a5 Use OkJson directly 2013-06-22 21:34:03 -05:00
Jack Nagel
3414b4d689 Fix passing multiple switches as a single word to the build
Fixes Homebrew/homebrew#17434.
2013-01-30 11:09:33 -06:00
Jack Nagel
cf08b71bf8 FormulaInstaller: construct new ARGV from an Options collection
The array of options that is passed to the spawned build process is a
combination of the current ARGV, options passed in by a dependent
formula, and an existing install receipt. The objects that are
interacting here each expect the resulting collection to have certain
properties, and the expectations are not consistent.

Clear up this confusing mess by only dealing with Options collections.
This keeps our representation of options uniform across the codebase.

We can remove BuildOptions dependency on HomebrewArgvExtension, which
allows us to pass any Array-like collection to Tab.create. The only
other site inside of FormulaInstaller that uses the array is the #exec
call, and there it is splatted and thus we can substitute our Options
collection there as well.
2013-01-26 12:14:47 -06:00
Jack Nagel
70ff06c827 Refactor option handling internals
Currently we handle options in several ways, and it is hard to remember
what code needs an option string ("--foo"), what needs only the name
("foo") and what needs an Option object.

Now that Option objects can act as strings and be converted to JSON, we
can start using them instead of passing around strings between Formula
objects, Tab objects, and ARGV-style arrays.

The Options class is a special collection that can be queried for the
inclusion of options in any form: '--foo', 'foo', or Option.new("foo").
2013-01-26 11:37:01 -06:00