216 Commits

Author SHA1 Message Date
Mike McQuaid
ef95b59ed4
Remove HomebrewArgvExtension
Fixes #5730
2020-05-23 19:39:11 +01:00
Mike McQuaid
20a1199375
Refactor CLI to remove unless args_parsed
Refactor the CLI::Args module so it doesn't have different paths to
check arguments depending on whether the arguments have been parsed or
not. Instead, set the values we need from the global ARGV at
first, global initialisation time where they will be thrown away when
the actual arguments are parsed.

To do this some other general refactoring was needed:
- more methods made private when possible
- e.g. `HEAD?` used consistently instead of `head` before arguments
  are parsed.
- formula options are only parsed after named arguments are extracted
2020-05-05 17:47:51 +01:00
Mike McQuaid
af8091a279
Remove ARGV_WITHOUT_MONKEY_PATCHING
Our usage of `ARGV` will go away soon enough and maintaining state
between `ARGV` and `ARGV_WITHOUT_MONKEY_PATCHING` is futile.

Fixes #7397
2020-04-20 10:27:14 +01:00
Mike McQuaid
8d868b739c
cli/args: simplify initialisation.
Move some logic from `CLI::Parser` to `CLI::Args` to simplify and make
more consistent the initialisation process.
2020-04-18 21:14:35 +01:00
Gautham G
b05c72b98b cli/args: Make build_from_source public instance method 2020-04-12 19:12:16 +05:30
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Gautham G
96e1d7e1b2 Initialize Homebrew.args with CLI::Args instance
If we initialize it with OpenStruct, then methods defined in CLI::Args
cannot be called and they would always return nil leading to bugs
2020-04-05 20:12:13 +05:30
Mike McQuaid
8a9dcad2c7
Move more command handling logic to commands.rb. 2020-02-02 17:05:45 +01:00
Mike McQuaid
355626ac51
Tweak/fix Git remote configuration behaviour. 2019-12-30 10:38:47 +00:00
hyuraku
e6e0d1128c create new envoronments 2019-12-03 00:45:11 +09:00
Mike McQuaid
6670ae6202
global: require rubygems for activesupport. 2019-11-06 10:36:40 +00:00
Issy Long
341ea60807
Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Dawid Dziurla
8ff7601a92
define default prefix constants
also use them to detect if prefix line in bottle block is needed
2019-09-30 16:46:53 +02:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d1ea6f38d3
Fix mutable constants violations. 2019-04-19 21:46:20 +09:00
Mike McQuaid
34a8ab74af
global: provide unpatched ARGV. 2019-04-17 22:16:58 +09:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
00dbb221b7
brew.sh: make update --preinstall exec.
This means that any new environment variables or changes to `bin/brew`
or `brew.sh` will be used in the new process. This also allows the
removal of various fallbacks from autoupdates from old versions.
2018-12-29 19:06:18 +00:00
Mike McQuaid
109e974c38
Cleanup rubocop-cask references. 2018-11-08 15:54:47 +00:00
Mike McQuaid
549b02f20a
Manual brew style fixes. 2018-11-02 17:29:26 +00:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Mike McQuaid
51af87f85f
Add HOMEBREW_FORCE_HOMEBREW_ON_LINUX
This serves a similar purpose to the HOMEBREW_FORCE_HOMEBREW_ORG
variable but applies to more settings.
2018-10-20 13:58:27 +01: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
16618d0fc7 Use ActiveSupport’s #pluralize and #to_sentence. 2018-10-07 23:10:56 +02:00
Markus Reiter
72f350e757 Use ActiveSupport’s #second_to_last. 2018-10-07 23:10:56 +02:00
Markus Reiter
a9128c543c Use ActiveSupport’s #days. 2018-10-07 23:10:56 +02:00
Mike McQuaid
ead23d1f4c
Use ActiveSupport File.atomic_write
nd delete our own implementation.
2018-09-18 09:20:40 +01:00
Mike McQuaid
0c6331878f
Use ActiveSupport Hash#deep_merge
And delete our own implementation.
2018-09-17 14:53:01 +01:00
Mike McQuaid
955214abc0
Use ActiveSupport Object#blank? and #present? 2018-09-14 17:02:19 +01:00
Shaun Jackman
a37d46f195
Merge pull request #4772 from alebcay/linuxbrew-merge
Set HOMEBREW_BOTTLE_DEFAULT_DOMAIN based on operating system
2018-09-12 11:11:13 -07:00
Shaun Jackman
3c4f9c746e Elide prefix "/usr/local" in bottle block
brew test-bot --ci-upload is run on a Linux machine.
The macOS bottles have a prefix of "/usr/local".
The default prefix on Linux is /home/linuxbrew/.linuxbrew.
Elide prefix "/usr/local" in the bottle block, even it does not match
the default prefix. Ditto for cellar.
2018-09-11 14:21:33 -07:00
Shaun Jackman
f6093961ef Add Homebrew::DEFAULT_PREFIX for Linux
The default prefix is /usr/local on macOS
and /home/linuxbrew/.linuxbrew on Linux.
2018-09-11 09:57:08 -07:00
Caleb Xu
25817d3589 Set HOMEBREW_BOTTLE_DEFAULT_DOMAIN based on operating system 2018-09-09 15:29:27 -04:00
Markus Reiter
eca488a966 Add $LOAD_PATH for RuboCop cops. 2018-09-06 01:10:47 +02:00
William Woodruff
eacdca872e
Merge pull request #4819 from woodruffw/error-pipe
utils: Use JSON to marshal child errors
2018-09-04 21:02:29 -04:00
William Woodruff
367629d289
utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.

Additionally, adds tests for the new behavior.
2018-09-04 11:03:32 -04:00
Mike McQuaid
90b3a13909
cask: move cask/lib/hbc/* to cask/*.
Fix the load path, requires and some filenames accordingly.
2018-09-04 09:56:57 +01:00
Mike McQuaid
088730c6f1
Revert "Use JSON to marshal errors from children" 2018-09-04 08:37:08 +01:00
William Woodruff
86b9647450
utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.

Additionally, adds tests for the new behavior.
2018-09-03 18:42:59 -04:00
Mike McQuaid
bcb1ec5499
Improve Homebrew/brew line length.
Use 124 max line length everywhere. Also, reduce tap max line length to
189 as Homebrew/homebrew-core has that as a maximum now. In future
Homebrew/homebrew-core will also be reduced to 124 maximum line length.
2018-09-02 16:15:09 +01:00
Markus Reiter
eccd20e276 Merge Hbc::Container classes into UnpackStrategy. 2018-07-24 16:44:27 +02:00
Markus Reiter
5841b992ac Refactor $LOAD_PATH. 2018-07-17 23:38:57 +02:00
Mike McQuaid
256dfc1af9 Move methods from FileUtils to Formula
These don't need to live on FileUtils and don't really make sense there
either.
2018-07-14 18:13:23 +01:00
Andrew Janke
c644392a85 Display collected caveats at end of install or upgrade 2018-07-12 20:41:32 -04:00
Mike McQuaid
f080ebebbb global: handle HOMEBREW_BOTTLE_DOMAIN fallback.
If users have auto-updated then these variables may not be set.
2018-07-10 21:58:20 +01:00
Mike McQuaid
facd76bc51 portable-ruby: respect HOMEBREW_BOTTLE_DOMAIN variable.
This was requested in:
https://discourse.brew.sh/t/adding-additional-download-sources-to-homebrew/2446

With this change you can use e.g. Artifactory for Homebrew's portable
ruby.
2018-06-29 19:51:18 +01:00
Markus Reiter
c53a52daee Move --version logic into cmd/--version.rb. 2018-05-21 05:35:44 +02:00
Gautham Goli
d22b750e17 Store common switch as Homebrew.args global var 2018-04-10 00:00:35 +05:30
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00