From 2ece8f8f43fb2126789bd439371c0f2435008ac5 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Sun, 24 Apr 2011 19:31:19 +0100 Subject: [PATCH 01/11] ensure idx isnt nil here --- lib/pry/pry_instance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 5d3b315e..0a6ed4f0 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -54,7 +54,7 @@ class Pry # @return [Pry] The parent of the current Pry session. def parent idx = Pry.sessions.index(self) - Pry.sessions[idx - 1] if idx > 0 + Pry.sessions[idx - 1] if idx && idx > 0 end # Execute the hook `hook_name`, if it is defined. From 55fd3b831d9215612b6401584f3a0242f4103ac9 Mon Sep 17 00:00:00 2001 From: John Mair Date: Thu, 28 Apr 2011 01:32:02 +1200 Subject: [PATCH 02/11] added info on using pry as rails 3 console to README --- README.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.markdown b/README.markdown index 5be14331..acb163f6 100644 --- a/README.markdown +++ b/README.markdown @@ -441,6 +441,11 @@ help that can be accessed via typing `command_name --help`. A command will typically say in its description if the `--help` option is avaiable. +### Use Pry as your Rails 3 Console + +This is currently a hack, but follow the gist kindly provided by +MyArtChannel: (https://gist.github.com/941174)[https://gist.github.com/941174] + ### Other Features and limitations From fde297e05be5c8e338688a89511df9693e9606b0 Mon Sep 17 00:00:00 2001 From: John Mair Date: Thu, 28 Apr 2011 02:04:45 +1200 Subject: [PATCH 03/11] hopefully fixed rubydoc issue --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index acb163f6..f8bcfd0f 100644 --- a/README.markdown +++ b/README.markdown @@ -444,7 +444,7 @@ avaiable. ### Use Pry as your Rails 3 Console This is currently a hack, but follow the gist kindly provided by -MyArtChannel: (https://gist.github.com/941174)[https://gist.github.com/941174] +MyArtChannel: [https://gist.github.com/941174](https://gist.github.com/941174) ### Other Features and limitations From fad6cf997704688d535a5b45e0c6a361a7c69cf1 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 15:55:35 +0100 Subject: [PATCH 04/11] simplify test running do not require rubygems inside tests shift test into load path move test logic into helper so any new tests just require this helper and can also be run independently --- Rakefile | 2 +- test/test.rb | 11 ++--------- test/test_helper.rb | 7 +++++++ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index 05aca9e9..22f8e6e1 100644 --- a/Rakefile +++ b/Rakefile @@ -31,7 +31,7 @@ def apply_spec_defaults(s) end task :test do - sh "bacon #{direc}/test/test.rb" + sh "bacon -Itest -rubygems test/test.rb" end desc "run pry" diff --git a/test/test.rb b/test/test.rb index fa4fd662..c212e25c 100644 --- a/test/test.rb +++ b/test/test.rb @@ -1,11 +1,4 @@ -direc = File.dirname(__FILE__) - -$LOAD_PATH.unshift "#{direc}/../lib" - -require 'rubygems' -require 'bacon' -require "pry" -require "#{direc}/test_helper" +require 'test_helper' puts "Ruby Version #{RUBY_VERSION}" puts "Testing Pry #{Pry::VERSION}" @@ -135,7 +128,7 @@ describe Pry do it "should run the rc file only once" do Pry.should_load_rc = true - Pry::RC_FILES << "#{direc}/testrc" + Pry::RC_FILES << File.expand_path("../testrc", __FILE__) Pry.start(self, :input => StringIO.new("exit\n"), :output => Pry::NullOutput) TEST_RC.should == [0] diff --git a/test/test_helper.rb b/test/test_helper.rb index 351e3d90..67594c19 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,10 @@ +unless Object.const_defined? 'Pry' + $:.unshift File.expand_path '../../lib', __FILE__ + require 'pry' +end + +require 'bacon' + # Ensure we do not execute any rc files Pry::RC_FILES.clear Pry.color = false From 164ff673322889098e52df01f6d490f9e44570cf Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:07:57 +0100 Subject: [PATCH 05/11] use git ls-files instead of globbing ourselves --- Rakefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 22f8e6e1..8a1ecb3f 100644 --- a/Rakefile +++ b/Rakefile @@ -26,8 +26,7 @@ def apply_spec_defaults(s) s.homepage = "http://banisterfiend.wordpress.com" s.has_rdoc = 'yard' s.executables = ["pry"] - s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*", "examples/**/*.rb", - "test/*.rb", "test/testrc", "CHANGELOG", "LICENSE", "README.markdown", "Rakefile", ".gemtest"] + s.files = `git ls-files`.split("\n") end task :test do From 8cccb4cc9e5ebefdad230890d8e2c20089d70435 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:08:29 +0100 Subject: [PATCH 06/11] added test_files to spec --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 8a1ecb3f..0e712d97 100644 --- a/Rakefile +++ b/Rakefile @@ -27,6 +27,7 @@ def apply_spec_defaults(s) s.has_rdoc = 'yard' s.executables = ["pry"] s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- test/*`.split("\n") end task :test do From f4b6a931a554d0954622afc9918f41a72df97488 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:09:29 +0100 Subject: [PATCH 07/11] remove require_path from spec as its already the default --- Rakefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Rakefile b/Rakefile index 0e712d97..84dc393d 100644 --- a/Rakefile +++ b/Rakefile @@ -18,7 +18,6 @@ def apply_spec_defaults(s) s.author = "John Mair (banisterfiend)" s.email = 'jrmair@gmail.com' s.description = s.summary - s.require_path = 'lib' s.add_dependency("ruby_parser",">=2.0.5") s.add_dependency("coderay",">=0.9.7") s.add_dependency("slop",">=1.5.3") From a6bf33e3595082a8e1048b11fe471c82e6cddc4f Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:10:44 +0100 Subject: [PATCH 08/11] move method_source dep to default gemspec --- Rakefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 84dc393d..e8f2b343 100644 --- a/Rakefile +++ b/Rakefile @@ -18,15 +18,16 @@ def apply_spec_defaults(s) s.author = "John Mair (banisterfiend)" s.email = 'jrmair@gmail.com' s.description = s.summary - s.add_dependency("ruby_parser",">=2.0.5") - s.add_dependency("coderay",">=0.9.7") - s.add_dependency("slop",">=1.5.3") - s.add_development_dependency("bacon",">=1.1.0") s.homepage = "http://banisterfiend.wordpress.com" s.has_rdoc = 'yard' s.executables = ["pry"] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- test/*`.split("\n") + s.add_dependency("ruby_parser",">=2.0.5") + s.add_dependency("coderay",">=0.9.7") + s.add_dependency("slop",">=1.5.3") + s.add_dependency("method_source",">=0.4.0") + s.add_development_dependency("bacon",">=1.1.0") end task :test do @@ -48,7 +49,6 @@ end namespace :ruby do spec = Gem::Specification.new do |s| apply_spec_defaults(s) - s.add_dependency("method_source",">=0.4.0") s.platform = Gem::Platform::RUBY end @@ -62,7 +62,6 @@ end namespace v do spec = Gem::Specification.new do |s| apply_spec_defaults(s) - s.add_dependency("method_source",">=0.4.0") s.add_dependency("win32console", ">=1.3.0") s.platform = "i386-#{v}" end @@ -77,7 +76,6 @@ end namespace :jruby do spec = Gem::Specification.new do |s| apply_spec_defaults(s) - s.add_dependency("method_source",">=0.4.0") s.platform = "java" end From 6866088863bfdfd874b98abff7debb3c35f5aade Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:11:54 +0100 Subject: [PATCH 09/11] remove extension specific globs from clean/clobber --- Rakefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index e8f2b343..225d26c9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,14 +1,11 @@ -dlext = Config::CONFIG['DLEXT'] direc = File.dirname(__FILE__) require 'rake/clean' require 'rake/gempackagetask' require "#{direc}/lib/pry/version" -CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o") -CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o", - "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*#*", "**/*#*.*", - "ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc") +CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log") +CLEAN.include("**/*#*", "**/*#*.*", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc") def apply_spec_defaults(s) s.name = "pry" From 71ac555fdfc77ec3493251f275feeceb79e1d43e Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:13:44 +0100 Subject: [PATCH 10/11] unshift lib into load path --- Rakefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 225d26c9..7aa9359d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,12 @@ +$:.unshift 'lib' + direc = File.dirname(__FILE__) require 'rake/clean' require 'rake/gempackagetask' -require "#{direc}/lib/pry/version" +require 'pry/version' -CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log") +CLOBBER.include("**/*~", "**/*#*", "**/*.log") CLEAN.include("**/*#*", "**/*#*.*", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc") def apply_spec_defaults(s) @@ -33,7 +35,6 @@ end desc "run pry" task :pry do - $LOAD_PATH.unshift "#{direc}/lib" require 'pry' binding.pry end From 7e59e5cc9187bdae9a2e3e3489f0e607bfaa7ca5 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 29 Apr 2011 16:16:53 +0100 Subject: [PATCH 11/11] no need for this variable, rearrange requires --- Rakefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 7aa9359d..7c166536 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,7 @@ -$:.unshift 'lib' - -direc = File.dirname(__FILE__) - require 'rake/clean' require 'rake/gempackagetask' + +$:.unshift 'lib' require 'pry/version' CLOBBER.include("**/*~", "**/*#*", "**/*.log")