aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2018-02-27 12:07:30 +0000
committerMike McQuaid2018-02-27 12:07:30 +0000
commit6302da37f66fe9bb04e95fe67e8529fe0086187d (patch)
tree9e82c9878d286a3aab61a934f95b5bd2b687e764
parent7b365262ff356a059bb812c9e34478e04095ca06 (diff)
downloadbrew-6302da37f66fe9bb04e95fe67e8529fe0086187d.tar.bz2
Add prof and ruby commands.
These are imported from Homebrew/homebrew-dev-tools and are both used by maintainers so may be useful for contributors too.
-rwxr-xr-xLibrary/Homebrew/dev-cmd/prof.rb15
-rwxr-xr-xLibrary/Homebrew/dev-cmd/ruby.rb13
-rw-r--r--docs/Manpage.md8
-rw-r--r--manpages/brew.18
4 files changed, 44 insertions, 0 deletions
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\.
.