diff options
| -rw-r--r-- | .travis.yml | 5 | ||||
| -rw-r--r-- | Library/Homebrew/brew.sh | 10 | ||||
| -rwxr-xr-x | Library/Homebrew/dev-cmd/prof.rb | 15 | ||||
| -rwxr-xr-x | Library/Homebrew/dev-cmd/ruby.rb | 13 | ||||
| -rw-r--r-- | docs/Manpage.md | 8 | ||||
| -rw-r--r-- | manpages/brew.1 | 8 | 
6 files changed, 53 insertions, 6 deletions
| diff --git a/.travis.yml b/.travis.yml index 1c8524d81..fef0f91ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,11 +37,6 @@ before_install:        sudo rm -rf "$HOMEBREW_REPOSITORY";        sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";      fi -  - if [ "$MACOS" ]; then -      travis_retry git -C Library/Taps/homebrew/homebrew-core fetch --depth=1 origin; -    else -      travis_retry git clone --depth=1 https://github.com/Homebrew/homebrew-core Library/Taps/homebrew/homebrew-core; -    fi    - travis_retry git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot  script: diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 77a60dfc7..590dde363 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -253,6 +253,14 @@ then    then      export HOMEBREW_DEV_CMD_RUN="1"    fi + +  # Don't allow non-developers to customise Ruby warnings. +  unset HOMEBREW_RUBY_WARNINGS +fi + +if [[ -z "$HOMEBREW_RUBY_WARNINGS" ]] +then +  export HOMEBREW_RUBY_WARNINGS="-W0"  fi  if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]] @@ -371,5 +379,5 @@ else    # Unshift command back into argument list (unless argument list was empty).    [[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@" -  { update-preinstall; exec "$HOMEBREW_RUBY_PATH" -W0 "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; } +  { update-preinstall; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_RUBY_WARNINGS "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }  fi diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb new file mode 100755 index 000000000..c7121f6e8 --- /dev/null +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -0,0 +1,15 @@ +#:  * `prof` [<ruby options>]: +#:    Run Homebrew with the Ruby profiler. +#:    For example: +#       brew prof readall + +module Homebrew +  module_function + +  def prof +    Homebrew.install_gem_setup_path! "ruby-prof" +    FileUtils.mkdir_p "prof" +    brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path +    exec "ruby-prof", "--printer=multi", "--file=prof", brew_rb, "--", *ARGV +  end +end diff --git a/Library/Homebrew/dev-cmd/ruby.rb b/Library/Homebrew/dev-cmd/ruby.rb new file mode 100755 index 000000000..2df212301 --- /dev/null +++ b/Library/Homebrew/dev-cmd/ruby.rb @@ -0,0 +1,13 @@ +#:  * `ruby` [<ruby options>]: +#:    Run a Ruby instance with Homebrew's libraries loaded. +#:    For example: +#       brew ruby -e "puts :gcc.f.deps" +#       brew ruby script.rb + +module Homebrew +  module_function + +  def ruby +    exec ENV["HOMEBREW_RUBY_PATH"], "-I#{HOMEBREW_LIBRARY_PATH}", "-rglobal", "-rcmd/irb", *ARGV +  end +end diff --git a/docs/Manpage.md b/docs/Manpage.md index 91f9e0414..6b6dc91ab 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -782,6 +782,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note      Additionally, the date used in new manpages will match those in the existing      manpages (to allow comparison without factoring in the date). +  * `prof` [`ruby options`]: +    Run Homebrew with the Ruby profiler. +    For example: +    * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=``bintray-org`] [`--test-bot-user=``test-bot-user`] `patch-source` [`patch-source`]:      Gets a patch from a GitHub commit or pull request and applies it to Homebrew. @@ -839,6 +843,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note      If `--markdown` is passed, output as a Markdown list. +  * `ruby` [`ruby options`]: +    Run a Ruby instance with Homebrew's libraries loaded. +    For example: +    * `tap-new` `user``/``repo`:      Generate the template files for a new tap. diff --git a/manpages/brew.1 b/manpages/brew.1 index 56ae23677..0f99f3af6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -801,6 +801,10 @@ Generate Homebrew\'s manpages\.  If \fB\-\-fail\-if\-changed\fR is passed, the command will return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date)\.  .  .TP +\fBprof\fR [\fIruby options\fR] +Run Homebrew with the Ruby profiler\. For example: +. +.TP  \fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] [\fB\-\-warn\-on\-publish\-failure\fR] [\fB\-\-bintray\-org=\fR\fIbintray\-org\fR] [\fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR] \fIpatch\-source\fR [\fIpatch\-source\fR]:  .  .IP @@ -862,6 +866,10 @@ Output the merged pull requests on Homebrew/brew between two Git refs\. If no \f  If \fB\-\-markdown\fR is passed, output as a Markdown list\.  .  .TP +\fBruby\fR [\fIruby options\fR] +Run a Ruby instance with Homebrew\'s libraries loaded\. For example: +. +.TP  \fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR  Generate the template files for a new tap\.  . | 
