mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
dont alter LOAD_PATH and require files relative to lib/
This commit is contained in:
parent
d52182c549
commit
169090cc02
5 changed files with 26 additions and 34 deletions
9
Rakefile
9
Rakefile
|
@ -36,7 +36,8 @@ end
|
|||
|
||||
desc "run pry"
|
||||
task :pry do
|
||||
require "#{direc}/lib/pry"
|
||||
$LOAD_PATH.unshift "#{direc}/lib"
|
||||
require 'pry'
|
||||
binding.pry
|
||||
end
|
||||
|
||||
|
@ -51,7 +52,7 @@ namespace :ruby do
|
|||
s.add_dependency("method_source",">=0.4.0")
|
||||
s.platform = Gem::Platform::RUBY
|
||||
end
|
||||
|
||||
|
||||
Rake::GemPackageTask.new(spec) do |pkg|
|
||||
pkg.need_zip = false
|
||||
pkg.need_tar = false
|
||||
|
@ -61,7 +62,7 @@ end
|
|||
[:mingw32, :mswin32].each do |v|
|
||||
namespace v do
|
||||
spec = Gem::Specification.new do |s|
|
||||
apply_spec_defaults(s)
|
||||
apply_spec_defaults(s)
|
||||
s.add_dependency("method_source",">=0.4.0")
|
||||
s.add_dependency("win32console", ">=1.3.0")
|
||||
s.platform = "i386-#{v}"
|
||||
|
@ -80,7 +81,7 @@ namespace :jruby do
|
|||
s.add_dependency("method_source",">=0.4.0")
|
||||
s.platform = "java"
|
||||
end
|
||||
|
||||
|
||||
Rake::GemPackageTask.new(spec) do |pkg|
|
||||
pkg.need_zip = false
|
||||
pkg.need_tar = false
|
||||
|
|
26
lib/pry.rb
26
lib/pry.rb
|
@ -1,10 +1,6 @@
|
|||
# (C) John Mair (banisterfiend) 2011
|
||||
# MIT License
|
||||
|
||||
direc = File.dirname(__FILE__)
|
||||
|
||||
$LOAD_PATH << File.expand_path(direc)
|
||||
|
||||
require "method_source"
|
||||
require 'shellwords'
|
||||
require "readline"
|
||||
|
@ -20,17 +16,17 @@ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
|
|||
end
|
||||
end
|
||||
|
||||
require "#{direc}/pry/version"
|
||||
require "#{direc}/pry/hooks"
|
||||
require "#{direc}/pry/print"
|
||||
require "#{direc}/pry/command_base"
|
||||
require "#{direc}/pry/commands"
|
||||
require "#{direc}/pry/prompts"
|
||||
require "#{direc}/pry/custom_completions"
|
||||
require "#{direc}/pry/completion"
|
||||
require "#{direc}/pry/core_extensions"
|
||||
require "#{direc}/pry/pry_class"
|
||||
require "#{direc}/pry/pry_instance"
|
||||
require "pry/version"
|
||||
require "pry/hooks"
|
||||
require "pry/print"
|
||||
require "pry/command_base"
|
||||
require "pry/commands"
|
||||
require "pry/prompts"
|
||||
require "pry/custom_completions"
|
||||
require "pry/completion"
|
||||
require "pry/core_extensions"
|
||||
require "pry/pry_class"
|
||||
require "pry/pry_instance"
|
||||
|
||||
|
||||
# TEMPORARY HACK FOR BUG IN JRUBY 1.9 REGEX (which kills CodeRay)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
direc = File.dirname(__FILE__)
|
||||
require 'rubygems/dependency_installer'
|
||||
require "#{direc}/command_base_helpers"
|
||||
require "pry/command_base_helpers"
|
||||
|
||||
class Pry
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
direc = File.dirname(__FILE__)
|
||||
|
||||
require "optparse"
|
||||
require "method_source"
|
||||
require 'slop'
|
||||
require 'rubygems/dependency_installer'
|
||||
require "#{direc}/command_base"
|
||||
require "#{direc}/pry_instance"
|
||||
require "#{direc}/command_helpers"
|
||||
require "pry/command_base"
|
||||
require "pry/pry_instance"
|
||||
require "pry/command_helpers"
|
||||
|
||||
class Pry
|
||||
|
||||
|
@ -118,7 +116,7 @@ e.g: stat hello_method
|
|||
else
|
||||
meth_name = meth_name_from_binding(target)
|
||||
end
|
||||
|
||||
|
||||
if (meth = get_method_object(meth_name, target, opts.to_hash(true))).nil?
|
||||
output.puts "Invalid method name: #{meth_name}. Type `stat --help` for help"
|
||||
next
|
||||
|
@ -145,7 +143,7 @@ e.g: stat hello_method
|
|||
|
||||
command "gist-method", "Gist a method to github. Type `gist-method --help` for more info.", :requires_gem => "gist" do |*args|
|
||||
target = target()
|
||||
|
||||
|
||||
opts = Slop.parse!(args) do |opts|
|
||||
opts.banner = %{Usage: gist-method [OPTIONS] [METH]
|
||||
Gist the method (doc or source) to github.
|
||||
|
@ -165,17 +163,17 @@ e.g: gist -d my_method
|
|||
next if opts.help?
|
||||
|
||||
# This needs to be extracted into its own method as it's shared
|
||||
# by show-method and show-doc and stat commands
|
||||
# by show-method and show-doc and stat commands
|
||||
meth_name = args.shift
|
||||
if meth_name
|
||||
if meth_name =~ /\A([^\.\#]+)[\.\#](.+)\z/
|
||||
if meth_name =~ /\A([^\.\#]+)[\.\#](.+)\z/
|
||||
context, meth_name = $1, $2
|
||||
target = Pry.binding_for(target.eval(context))
|
||||
end
|
||||
else
|
||||
meth_name = meth_name_from_binding(target)
|
||||
end
|
||||
|
||||
|
||||
if (meth = get_method_object(meth_name, target, opts.to_hash(true))).nil?
|
||||
output.puts "Invalid method name: #{meth_name}. Type `gist-method --help` for help"
|
||||
next
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
direc = File.dirname(__FILE__)
|
||||
|
||||
require "#{direc}/command_processor.rb"
|
||||
require "pry/command_processor.rb"
|
||||
|
||||
class Pry
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue