1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge branch 'master' of git://github.com/dvdplm/pry into dvdpalm

This commit is contained in:
John Mair 2011-06-01 20:40:54 +12:00
commit 58388a609c
5 changed files with 60 additions and 5 deletions

View file

@ -51,6 +51,13 @@ namespace :ruby do
pkg.need_zip = false pkg.need_zip = false
pkg.need_tar = false pkg.need_tar = false
end end
desc "Generate gemspec file"
task :gemspec do
File.open("#{spec.name}-#{spec.version}.gemspec", "w") do |f|
f << spec.to_ruby
end
end
end end
[:mingw32, :mswin32].each do |v| [:mingw32, :mswin32].each do |v|

View file

@ -19,14 +19,18 @@ class Pry
end end
command "gem-cd", "Change working directory to specified gem's directory.", :argument_required => true do |gem| command "gem-cd", "Change working directory to specified gem's directory.", :argument_required => true do |gem|
spec = Gem.source_index.find_name(gem).sort { |a,b| Gem::Version.new(b.version) <=> Gem::Version.new(a.version) }.first specs = Gem::Specification.respond_to?(:each) ? Gem::Specification.find_all_by_name(gem) : Gem.source_index.find_name(gem)
spec = specs.sort { |a,b| Gem::Version.new(b.version) <=> Gem::Version.new(a.version) }.first
spec ? Dir.chdir(spec.full_gem_path) : output.puts("Gem `#{gem}` not found.") spec ? Dir.chdir(spec.full_gem_path) : output.puts("Gem `#{gem}` not found.")
end end
command "gem-list", "List/search installed gems. (Optional parameter: a regexp to limit the search)" do |pattern| command "gem-list", "List/search installed gems. (Optional parameter: a regexp to limit the search)" do |pattern|
pattern = Regexp.new pattern.to_s, Regexp::IGNORECASE pattern = Regexp.new pattern.to_s, Regexp::IGNORECASE
gems = Gem.source_index.find_name(pattern).group_by(&:name) gems = if Gem::Specification.respond_to?(:each)
Gem::Specification.select{|spec| spec.name =~ pattern }.group_by(&:name)
else
Gem.source_index.gems.values.group_by(&:name).select { |gemname, specs| gemname =~ pattern }
end
gems.each do |gem, specs| gems.each do |gem, specs|
specs.sort! do |a,b| specs.sort! do |a,b|

View file

@ -23,7 +23,7 @@ class Pry
def gem_installed?(gem_name) def gem_installed?(gem_name)
require 'rubygems' require 'rubygems'
!!Gem.source_index.find_name(gem_name).first Gem::Specification.respond_to?(:find_all_by_name) ? !Gem::Specification.find_all_by_name(gem_name).empty? : Gem.source_index.find_name(gem_name).first
end end
def command_dependencies_met?(options) def command_dependencies_met?(options)

View file

@ -44,7 +44,7 @@ class Pry
# Find all installed Pry plugins and store them in an internal array. # Find all installed Pry plugins and store them in an internal array.
def locate_plugins def locate_plugins
Gem.refresh Gem.refresh
Gem.source_index.find_name('').each do |gem| (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|
next if gem.name !~ PRY_PLUGIN_PREFIX next if gem.name !~ PRY_PLUGIN_PREFIX
plugin_name = gem.name.split('-', 2).last plugin_name = gem.name.split('-', 2).last
@plugins << Plugin.new(plugin_name, gem.name, true) if !gem_located?(gem.name) @plugins << Plugin.new(plugin_name, gem.name, true) if !gem_located?(gem.name)

44
pry-0.8.3.gemspec Normal file
View file

@ -0,0 +1,44 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{pry}
s.version = "0.8.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["John Mair (banisterfiend)"]
s.date = %q{2011-05-31}
s.default_executable = %q{pry}
s.description = %q{attach an irb-like session to any object at runtime}
s.email = %q{jrmair@gmail.com}
s.executables = ["pry"]
s.files = [".document", ".gemtest", ".gitignore", ".yardopts", "CHANGELOG", "LICENSE", "README.markdown", "Rakefile", "TODO", "bin/pry", "examples/example_basic.rb", "examples/example_command_override.rb", "examples/example_commands.rb", "examples/example_hooks.rb", "examples/example_image_edit.rb", "examples/example_input.rb", "examples/example_input2.rb", "examples/example_output.rb", "examples/example_print.rb", "examples/example_prompt.rb", "lib/pry.rb", "lib/pry/command_context.rb", "lib/pry/command_processor.rb", "lib/pry/command_set.rb", "lib/pry/commands.rb", "lib/pry/completion.rb", "lib/pry/core_extensions.rb", "lib/pry/custom_completions.rb", "lib/pry/helpers.rb", "lib/pry/helpers/base_helpers.rb", "lib/pry/helpers/command_helpers.rb", "lib/pry/hooks.rb", "lib/pry/print.rb", "lib/pry/prompts.rb", "lib/pry/pry_class.rb", "lib/pry/pry_instance.rb", "lib/pry/version.rb", "test/test.rb", "test/test_helper.rb", "test/testrc", "wiki/Customizing-pry.md", "wiki/Home.md"]
s.homepage = %q{http://banisterfiend.wordpress.com}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{attach an irb-like session to any object at runtime}
s.test_files = ["test/test.rb", "test/test_helper.rb", "test/testrc"]
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<ruby_parser>, [">= 2.0.5"])
s.add_runtime_dependency(%q<coderay>, [">= 0.9.8"])
s.add_runtime_dependency(%q<slop>, [">= 1.5.5"])
s.add_runtime_dependency(%q<method_source>, [">= 0.4.0"])
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
else
s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
s.add_dependency(%q<coderay>, [">= 0.9.8"])
s.add_dependency(%q<slop>, [">= 1.5.5"])
s.add_dependency(%q<method_source>, [">= 0.4.0"])
s.add_dependency(%q<bacon>, [">= 1.1.0"])
end
else
s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
s.add_dependency(%q<coderay>, [">= 0.9.8"])
s.add_dependency(%q<slop>, [">= 1.5.5"])
s.add_dependency(%q<method_source>, [">= 0.4.0"])
s.add_dependency(%q<bacon>, [">= 1.1.0"])
end
end