45 Commits

Author SHA1 Message Date
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
Mike McQuaid
4f75a77b08
Update deprecations
Add more deprecations, disable deprecations and remove disabled code.
2020-05-18 13:50:46 +01:00
Bo Anderson
d0896d641a extend/string: match multiline make variables 2020-03-05 04:11:35 +00:00
Mike McQuaid
d15edf735a
extend/string: use unless to fix style. 2019-10-22 08:24:32 +01:00
David Griffith
11f322b61c Trying this to please brew test-bot. 2019-10-21 19:01:54 -07:00
David Griffith
5b58931ebd Fix stupid mistake in 6ff61909a91edf3f31adc608dcafd3f5f8e642d0
I forgot to alter the call to gsub() when breaking up the unless to shorten
the line.
2019-10-21 17:46:50 -07:00
David Griffith
6ff61909a9
Deal with Makefile conditional assignment operators.
Ordinarily variable assignments in Makefiles are done simply with an
unconditional assignment: the equals sign.  There are variants of this:

FOO := $(BAR)	Avoid recursively expand variables.
FOO ?= bar	Assign only if $(FOO) is not already set.
FOO += bar	Add more to a variable.
FOO != bar	Execute a shell script and assign result to $(FOO).

See also
https://www.gnu.org/software/make/manual/html_node/Conditional-Example.html
https://www.gnu.org/software/make/manual/html_node/Flavors.html
2019-10-21 09:21:30 +01:00
Mike McQuaid
a36f00ae8b
Ruby 2.6 (and remove backports) gems 2019-10-10 16:17:05 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
5dd571adeb Replace #chuzzle with ActiveSupport’s #presence. 2018-10-07 23:10:56 +02:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
3a0a9f9073 Add String#delete_prefix backport. 2018-09-16 20:07:34 +02:00
Mike McQuaid
d7eca0b57c
Use Bundler to manage vendor directory
Rather than having to manually keep track of what version each thing in
here is and copy files around by hand on update let's use Bundler's
standalone mode and careful use of `.gitignore` to help us do it.

This means a `bundle update --standalone` will allow us to update all
gems in vendor.

We could consider vendoring other gems this way in future but I'd
suggest only doing this for gems with no dependencies or at least gems
with no native extensions. The only gem this applies to that we
currently use is `ruby-prof` and I'm not convinced it's widely used
enough to warrant vendoring for everyone. Perhaps that's another
criteria: it should be functionality that's used by non-developer
commands and/or normal Homebrew usage.
2018-09-13 15:24:18 +01:00
Markus Reiter
487bec9570 Move String#undent to compat. 2017-10-18 14:39:09 +02:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Josh Soref
08e53870a6 spelling: definitions 2017-09-10 16:31:02 +00:00
Misty De Meo
ffa65c7498
String: backport #match? from 2.4.0 2017-06-03 20:47:39 -07:00
Mike McQuaid
4356016b4a Use parallel RuboCop
This requires updating to Rubocop 0.49.0 which will require some fixes
to rules, in Homebrew/brew and Homebrew/homebrew-core but opening this
for now so I remember.
2017-05-29 18:42:02 +01:00
Markus Reiter
58e36c7319 Fix Style/GuardClause. 2016-09-24 12:24:35 +02:00
Markus Reiter
e851c9bf6c Style/Alias: Prefer alias. 2016-09-23 18:19:53 +02:00
Xu Cheng
9755662e49 add String#strip_prefix 2015-12-03 13:46:58 +08:00
William Woodruff
b0d5e17906 tweak String#undent so that only leading whitespace up to the first indentation level is gsubbed, change test_undent to reflect change and add test_undent_nested to test new behavior 2015-08-28 18:02:04 +08: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
Jack Nagel
ec1727a1be Remove backports for Ruby 1.8.6
refs. Homebrew/linuxbrew#438, mistydemeo/tigerbrew#327,
mistydemeo/tigerbrew#334
2015-06-19 22:20:47 -04:00
Jack Nagel
aaaab946ec Make inreplace errors fatal
Closes Homebrew/homebrew#32649.
Closes Homebrew/homebrew#32703.
2014-09-28 01:11:31 -05:00
Jack Nagel
cb69f339b8 Intercept calls to sub! in inreplace blocks 2014-09-27 19:11:40 -05:00
Jack Nagel
e409aa3084 Clean up inreplace regexps
- use literal syntax
 - escape interpolated variables
 - remove intermediate variables
 - remove unnecessary capture
2014-09-26 22:35:37 -05:00
Baptiste Fontaine
74e4fdfce2 Fix for String#undent
Without it, String#undent would fail on unindented strings, e.g.:

    "foo".undent

NoMethodError: undefined method `length' for nil:NilClass`

Closes Homebrew/homebrew#28873.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2014-05-02 19:50:27 -07:00
Misty De Meo
38e26ed929 extend/string: backport #rpartition 2014-03-27 10:14:08 -07:00
Jack Nagel
8e0158b4d7 Add String#end_with?
I'm tired of not remembering if start_with?/end_with? are portable, so
just add them both if they're not defined.
2013-07-19 22:32:57 -05:00
Jack Nagel
b1e5f5ee81 Fix String#start_with? implementation
It is supposed to accept a variable number of prefixes, and also to
check if they are convertible to strings. This matches behavior
documented in RubySpec.
2013-07-19 22:31:07 -05:00
Jack Nagel
b8b014036e Remove redundant return 2013-02-15 00:36:03 -06:00
Jack Nagel
9fd5953ed9 Make this more idiomatic 2013-02-15 00:35:52 -06:00
Max Howell
50767c6077 Record HEAD SHA and date of installs in receipt 2012-08-29 12:41:33 -04:00
Max Howell
3dec84de8a Improve libiconv diagnostic and suggestion
This is coming up a lot at the moment, so here is an attempt to be more helpful.
2012-08-14 11:46:18 -04:00
Adam Vandenberg
42d44053ef inreplace: also warn on plain gsub! usage 2012-02-25 22:41:20 -06:00
Jack Nagel
a3edec8b88 inreplace: warn if no substitutions were made
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-25 22:37:29 -06:00
Trevor Wennblom
55791d4c10 Coerce flags to an array in remove_make_var!
This is needed for Ruby 1.9.x compatibility, but we still don't support
running Homebrew with anything other than a system provided 1.8.[67].

Fixes Homebrew/homebrew#6546

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-07-27 17:38:26 -07:00
Adam Vandenberg
e6bac8a8ea back-port start_with? from 1.8.7
This allows its use in Leopard, which has Ruby 1.8.6.
2011-06-19 21:32:37 -07:00
Adam Vandenberg
b13baedfd8 Move string extensions 2011-03-12 11:55:03 -08:00
Jamie Macey
1e41264f42 fix warnings: ambiguous first arg
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2010-10-30 14:47:44 -07:00
Michael Morgan
3ea550100f extract undent test to test case
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2010-10-17 21:13:16 -07:00
Max Howell
799dd7108e String.undent for prettier HEREDOCs 2010-03-07 17:57:05 +00:00