diff options
| author | Mike McQuaid | 2018-02-27 12:07:30 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2018-02-27 12:07:30 +0000 |
| commit | 6302da37f66fe9bb04e95fe67e8529fe0086187d (patch) | |
| tree | 9e82c9878d286a3aab61a934f95b5bd2b687e764 /Library | |
| parent | 7b365262ff356a059bb812c9e34478e04095ca06 (diff) | |
| download | brew-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.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Homebrew/dev-cmd/prof.rb | 15 | ||||
| -rwxr-xr-x | Library/Homebrew/dev-cmd/ruby.rb | 13 |
2 files changed, 28 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 |
