Sha256: d11ef3c89537709449aa05c8f1e6a9099ea43beabe634222df60e5c29a8096a0
Contents?: true
Size: 1.8 KB
Versions: 4
Compression:
Stored size: 1.8 KB
Contents
#!/usr/bin/env ruby # ----------------------------------------------------------------------------------- # # Effects : inject PrivatePlease tracking in the command # # ----------------------------------------------------------------------------------- # # $ pp_ruby normal.rb # # $ bundle exec pp_ruby normal.rb # # become # # $ ruby -rubygems -e "require 'private_please' ; load 'normal.rb'" # # $ bundle exec ruby -e "require 'private_please' ; load 'normal.rb'" # # ----------------------------------------------------------------------------------- # ######################## # Extract command parts : ######################## switches, filename, arguments = [], nil, [] loop do case ARGV[0] when '-r' then switches << ARGV.shift << ARGV.shift when '-e' then switches << ARGV.shift << ARGV.shift.inspect when /^-\S/ then switches << ARGV.shift else break end end filename = ARGV.shift arguments = ARGV ###################### # Assemble new command : ###################### # ? called with `bundle exec ruby .....` in_bundler_mode = !!defined?(Bundler) program = in_bundler_mode ? 'bundle exec ruby' : 'ruby' command = if filename rubygems_or_not = in_bundler_mode ? nil : " -rubygems" [ program, switches, %|#{rubygems_or_not} -e "require 'private_please' ; load '#{filename}'"| , arguments ] else [ program, switches, arguments ] end.flatten.compact.join(' ') ############################# # Execute transformed command : ############################# puts "Executing: #{command}" puts `#{command}`
Version data entries
4 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
private_please-0.0.5 | bin/pp_ruby |
private_please-0.0.5 | bin/ruby_pp |
private_please-0.0.4 | bin/pp_ruby |
private_please-0.0.4 | bin/ruby_pp |