Sam Ford
dac82eb2c2
Options: Add #to_s method
...
`Options` objects are converted to a string in some circumstances but
this produces output like `#<Options:0x0000000102592c90>`.
For example, formulae.brew.sh contains analytics entries with
incomprehensible names like `adns #<Options:0x0000000102592c90>`.
This shortcoming is apparent when compared to other entries like
`adns --HEAD`.
The `Option` class has a `#to_s` method that returns the `flag`, so
this commit simply adds an `Options#to_s` method that calls `#to_s`
on each `Option` object in `@options` and joins them using spaces.
This should produce more useful output when an `Options` object is
converted to a string (e.g., `--first --second`).
2023-01-19 12:40:50 -05:00
Bo Anderson
abfbb46678
Freeze formula definition once first instance is created
2022-08-31 20:40:42 +01:00
Bo Anderson
e49a338896
Implement caching for dependency expansion
2021-03-20 16:56:00 +00:00
Markus Reiter
da9289eff0
Add more type signatures.
2020-11-13 12:26:36 +01:00
Markus Reiter
24ae318a3d
Move type annotations into files.
2020-10-10 14:59:39 +02:00
Mike McQuaid
dba1cfbec9
options: handle nil
array.
...
Fixes #8835
2020-10-02 13:48:26 +01:00
Mike McQuaid
2e5272d04c
Deprecate/disable code for Homebrew 2.5.0.
...
Do the usual "disable deprecations" and "uncomment pending deprecations"
dance and delete/deprecate/disable relevant/related code.
2020-09-03 10:34:22 +01:00
Markus Reiter
5540eac625
Refactor and document Options
.
2020-08-19 10:40:33 +02:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files.
2019-04-20 13:27:36 +09:00
Markus Reiter
e9b9ea49a1
Update to RuboCop 0.59.1.
2018-09-17 03:45:59 +02:00
Andrew Janke
e0a8a79921
Style fixes for Rubocop 0.57.1
2018-06-30 19:40:14 -04:00
Mike McQuaid
9fca172d03
Fix HOMEBREW_RUBY_WARNINGS="-w"
...
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Mike McQuaid
cf5fdeef1d
Rubocop: manual rule fixes.
2017-09-24 21:23:59 +01:00
Markus Reiter
0ab750bf24
Use module_function
for commands.
2016-10-02 00:24:47 +02:00
Markus Reiter
e851c9bf6c
Style/Alias: Prefer alias
.
2016-09-23 18:19:53 +02:00
Markus Reiter
52ff988530
Fix RuboCop CaseEquality.
2016-09-23 15:30:06 +02:00
Baptiste Fontaine
b7e98b129c
cmd/options.rb: move common code in options.rb
...
Closes Homebrew/homebrew#47423 .
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-12-27 22:16:46 +01:00
BrewTestBot
13d544e11e
Core files style updates.
...
Closes Homebrew/homebrew#42354 .
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Elliot Saba
6a1f829cfa
Ensure that equals options get parsed properly
...
Options such as --userimg=<path> should be parsed as an option with an
equals in its name ("userimg=") and without the path argument in
Option.name
Closes Homebrew/homebrew#34219 .
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-11-15 17:17:50 -06: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
977ae5f27d
Collapse iteration to a map
2014-08-29 19:38:32 -05: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
ae4b9fffd4
Avoid hardcoding the class name
2014-08-13 23:45:48 -05:00
Jack Nagel
2311181b54
Remove Options#concat
2014-08-13 18:16:25 -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
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
8039107afb
Default to the empty string instead of nil
2014-08-07 00:48:13 -05:00
Jack Nagel
9e7f5dc261
Merge instead of calling << in a loop
2014-07-07 09:15:56 -05:00
Jack Nagel
aad09a5a63
Option does not need to be Comparable
2014-07-03 19:29:18 -05:00
Jack Nagel
3f6827374f
Use to_a definition from Enumerable
2014-07-01 21:26:41 -05:00
Jack Nagel
fbefa76ce2
Always use class.name to build inspect strings
2014-07-01 18:39:15 -05:00
Jack Nagel
14aa1de33c
Fix warning under Ruby 2.2
2014-06-09 15:04:15 -05:00
Jack Nagel
b2ccbfe6af
Add set union to Options
2014-02-27 14:22:42 -06:00
Jack Nagel
95af184a0c
Add an accessor to make the intent more clear here
2013-08-22 17:45:08 -05:00
Jack Nagel
9b2e04593f
Options: ensure copies do not share the underlying collection
2013-08-22 11:49:24 -05:00
Jack Nagel
10949ad75d
Fix some #eql? correctness issues
...
The implementation of #eql? and #hash should ensure that if a.eql?(b),
then a.hash == b.hash, but #eql? itself should not *depend* on #hash.
For example, given
class Thingy
def eql?
instance_of?(other.class) && hash == other.hash
end
def hash
[name, *tags].hash
end
end
if #hash produces a collision for different values of [name, *tags], two
Thingy objects will appear to be eql?, even though this is not the case.
Instead, #eql? should depend on the equality of name and tags directly.
2013-06-27 01:18:45 -05:00
Jack Nagel
d6929f96a5
Use OkJson directly
2013-06-22 21:34:03 -05:00
Jack Nagel
d596303199
Simplify Options#inspect
2013-06-07 20:36:13 -05:00
Jack Nagel
92857a7bd8
Define inspect on Option and Options
2013-05-24 10:56:02 -05:00
Jack Nagel
5bf652ecdd
Avoid extra array allocations
2013-05-06 16:52:26 -05:00
Jack Nagel
0c27a8765e
Don't shadow outer local variable
2013-02-17 20:57:10 -06: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