summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Luis Leal Cardoso Junior <andrehjr@gmail.com>2022-06-11 10:27:02 -0300
committerGitHub <noreply@github.com>2022-06-11 10:27:02 -0300
commit6aab1351c919b49011e7fa98b4e5e31f3b5811ed (patch)
tree4c2236e56714695f5cdcec44e1b2db707118a22c
parent8bbbd11dbcf35f38c0a96ea069256a6ece8298f5 (diff)
parent668278cebeffc70f05a36a141f01989ef4934856 (diff)
downloadpry-6aab1351c919b49011e7fa98b4e5e31f3b5811ed.tar.gz
Merge pull request #2239 from andrehjr/drop-ruby-1-9-3
Drop support for Ruby 1.9.x
-rw-r--r--.circleci/config.yml15
-rw-r--r--.circleci/ruby-1.9.3p551/Dockerfile80
-rw-r--r--README.md4
-rw-r--r--lib/pry/code.rb8
-rw-r--r--lib/pry/warning.rb13
-rw-r--r--lib/pry/wrapped_module.rb9
-rw-r--r--pry.gemspec2
-rw-r--r--spec/commands/edit_spec.rb8
-rw-r--r--spec/editor_spec.rb8
-rw-r--r--spec/exception_handler_spec.rb2
-rw-r--r--spec/integration/hanami_spec.rb3
-rw-r--r--spec/pryrc_spec.rb13
12 files changed, 16 insertions, 149 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 84f20f5b..61e1e3d5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,18 +9,3 @@ jobs:
steps:
- checkout
-
- - run:
- name: Install Bundler dependencies
- command: bundle install
-
- - run:
- name: Install Nano text editor (required for some tests)
- command: apk add nano
-
- - run:
- name: Run unit tests
- command: bundle exec rake
- environment:
- # Make sure TERM is set so Pry can indent correctly inside tests.
- TERM: screen-256color
diff --git a/.circleci/ruby-1.9.3p551/Dockerfile b/.circleci/ruby-1.9.3p551/Dockerfile
deleted file mode 100644
index 2b066293..00000000
--- a/.circleci/ruby-1.9.3p551/Dockerfile
+++ /dev/null
@@ -1,80 +0,0 @@
-FROM alpine
-
-RUN mkdir -p /usr/local/etc \
- && { \
- echo 'install: --no-document'; \
- echo 'update: --no-document'; \
- } >> /usr/local/etc/gemrc
-
-ENV RUBY_MAJOR 1.9
-ENV RUBY_VERSION 1.9.3-p551
-ENV RUBYGEMS_VERSION 1.8.23.2
-ENV BUNDLER_VERSION 1.16.6
-
-RUN set -ex \
- && apk add --no-cache --virtual .ruby-builddeps \
- autoconf \
- bison \
- bzip2 \
- bzip2-dev \
- ca-certificates \
- coreutils \
- curl \
- gcc \
- gdbm-dev \
- glib-dev \
- libc-dev \
- libffi-dev \
- libxml2-dev \
- libxslt-dev \
- linux-headers \
- make \
- ncurses-dev \
- openssl-dev \
- procps \
- readline-dev \
- ruby \
- yaml-dev \
- zlib-dev \
- && curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
- && mkdir -p /usr/src \
- && tar -xzf ruby.tar.gz -C /usr/src \
- && rm ruby.tar.gz \
- && cd /usr/src/ruby-$RUBY_VERSION \
- && { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
- && { echo '#include <asm/ioctl.h>'; echo; cat io.c; } > io.c.new && mv io.c.new io.c \
- && autoconf \
- && ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --disable-install-doc \
- && make \
- && make install \
- && runDeps="$( \
- scanelf --needed --nobanner --recursive /usr/local \
- | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
- | sort -u \
- | xargs -r apk info --installed \
- | sort -u \
- )" \
- && apk add --virtual .ruby-rundeps $runDeps \
- bzip2 \
- ca-certificates \
- curl \
- libffi-dev \
- openssl-dev \
- yaml-dev \
- procps \
- zlib-dev \
- && apk del .ruby-builddeps \
- && gem update --system $RUBYGEMS_VERSION \
- && rm -r /usr/src/ruby-$RUBY_VERSION
-
-RUN apk add --no-cache git nano build-base
-
-RUN gem update --system 2.7.9
-
-RUN gem install bundler --version "$BUNDLER_VERSION" --force
-
-ENV GEM_HOME /usr/local/bundle
-ENV BUNDLE_PATH="$GEM_HOME" BUNDLE_BIN="$GEM_HOME/bin" BUNDLE_SILENCE_ROOT_WARNING=1 BUNDLE_APP_CONFIG="$GEM_HOME"
-ENV PATH $BUNDLE_BIN:$PATH
-RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
-CMD [ "irb" ]
diff --git a/README.md b/README.md
index 0ee69be1..29b447cd 100644
--- a/README.md
+++ b/README.md
@@ -442,8 +442,8 @@ putting the line `Pry.color = false` in your `pryrc` file.
Supported Rubies
----------------
-* CRuby >= 1.9.3
-* JRuby >= 1.7
+* CRuby >= 2.0.0
+* JRuby >= 9.0
Contact
-------
diff --git a/lib/pry/code.rb b/lib/pry/code.rb
index 1fb206c4..3f3f9238 100644
--- a/lib/pry/code.rb
+++ b/lib/pry/code.rb
@@ -346,14 +346,6 @@ class Pry
''.respond_to?(method_name, include_private) || super
end
- if RUBY_VERSION.start_with?('1.9')
- # @todo This is needed for Ruby 1.9 support where `lines` return an
- # Enumerator. Newer Rubies return an Array
- def lines
- super.to_a
- end
- end
-
protected
# An abstraction of the `dup.instance_eval` pattern used throughout this
diff --git a/lib/pry/warning.rb b/lib/pry/warning.rb
index 14c119ed..c65279f7 100644
--- a/lib/pry/warning.rb
+++ b/lib/pry/warning.rb
@@ -10,16 +10,9 @@ class Pry
# @param [String] message
# @return [void]
def self.warn(message)
- if Kernel.respond_to?(:caller_locations)
- location = caller_locations(2..2).first
- path = location.path
- lineno = location.lineno
- else
- # Ruby 1.9.3 support.
- frame = caller[1].split(':') # rubocop:disable Performance/Caller
- path = frame.first
- lineno = frame[1]
- end
+ location = caller_locations(2..2).first
+ path = location.path
+ lineno = location.lineno
Kernel.warn("#{path}:#{lineno}: warning: #{message}")
end
diff --git a/lib/pry/wrapped_module.rb b/lib/pry/wrapped_module.rb
index c07ba682..89173dcd 100644
--- a/lib/pry/wrapped_module.rb
+++ b/lib/pry/wrapped_module.rb
@@ -246,19 +246,14 @@ class Pry
method_candidates.count
end
- # @note On JRuby 1.9 and higher, in certain conditions, this method chucks
- # away its ability to be quick (when there are lots of monkey patches,
- # like in Rails). However, it should be efficient enough on other rubies.
- # @see https://github.com/jruby/jruby/issues/525
- # @return [Enumerator, Array] on JRuby 1.9 and higher returns Array, on
- # other rubies returns Enumerator
+ # @return [Array]
def candidates
enum = Enumerator.new do |y|
(0...number_of_candidates).each do |num|
y.yield candidate(num)
end
end
- Helpers::Platform.jruby_19? ? enum.to_a : enum
+ enum
end
# @return [Boolean] Whether YARD docs are available for this module.
diff --git a/pry.gemspec b/pry.gemspec
index 1df03dfc..db5826d3 100644
--- a/pry.gemspec
+++ b/pry.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.name = "pry"
s.version = Pry::VERSION
- s.required_ruby_version = '>= 1.9.3'
+ s.required_ruby_version = '>= 2.0'
s.authors = [
'John Mair (banisterfiend)',
diff --git a/spec/commands/edit_spec.rb b/spec/commands/edit_spec.rb
index c51cc59d..cc40bd0e 100644
--- a/spec/commands/edit_spec.rb
+++ b/spec/commands/edit_spec.rb
@@ -23,13 +23,7 @@ describe "edit" do
before do
# OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's
# something "Temp".
- @tf_dir =
- if Pry::Helpers::Platform.mri_19?
- Pathname.new(Dir::Tmpname.tmpdir)
- else
- Pathname.new(Dir.tmpdir)
- end
-
+ @tf_dir = Pathname.new(Dir.tmpdir)
@tf_path = File.expand_path(File.join(@tf_dir.to_s, 'bar.rb'))
FileUtils.touch(@tf_path)
end
diff --git a/spec/editor_spec.rb b/spec/editor_spec.rb
index 2005bf1c..a89edfd9 100644
--- a/spec/editor_spec.rb
+++ b/spec/editor_spec.rb
@@ -6,13 +6,7 @@ describe Pry::Editor do
before do
# OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's
# something "Temp".
- @tf_dir =
- if Pry::Helpers::Platform.mri_19?
- Pathname.new(Dir::Tmpname.tmpdir)
- else
- Pathname.new(Dir.tmpdir)
- end
-
+ @tf_dir = Pathname.new(Dir.tmpdir)
@tf_path = File.join(@tf_dir.to_s, 'hello world.rb')
@editor = Pry::Editor.new(Pry.new)
diff --git a/spec/exception_handler_spec.rb b/spec/exception_handler_spec.rb
index b1608509..c9f082f6 100644
--- a/spec/exception_handler_spec.rb
+++ b/spec/exception_handler_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe Pry::ExceptionHandler do
end
before do
- if RUBY_VERSION.start_with?('1.9', '2.0')
+ if RUBY_VERSION.start_with?('2.0')
skip("Ruby #{RUBY_VERSION} doesn't support nested exceptions")
end
end
diff --git a/spec/integration/hanami_spec.rb b/spec/integration/hanami_spec.rb
index 5fae6ef8..71f89ab9 100644
--- a/spec/integration/hanami_spec.rb
+++ b/spec/integration/hanami_spec.rb
@@ -10,9 +10,6 @@ RSpec.describe "Hanami integration" do
end
it "does not enter an infinite loop (#1471, #1621)" do
- if RUBY_VERSION.start_with? "1.9"
- skip "prepend is not supported on this version of Ruby"
- end
code = <<-RUBY
require "pry"
require "timeout"
diff --git a/spec/pryrc_spec.rb b/spec/pryrc_spec.rb
index 59f2eed9..e5bfe259 100644
--- a/spec/pryrc_spec.rb
+++ b/spec/pryrc_spec.rb
@@ -24,16 +24,13 @@ describe Pry do
expect(TEST_RC).to eq [0]
end
- # Resolving symlinks doesn't work on jruby 1.9 [jruby issue #538]
- unless Pry::Helpers::Platform.jruby_19?
- it "should not load the rc file twice if it's symlinked differently" do
- Pry.config.rc_file = 'spec/fixtures/testrc'
- stub_const('Pry::LOCAL_RC_FILE', 'spec/fixtures/testlinkrc')
+ it "should not load the rc file twice if it's symlinked differently" do
+ Pry.config.rc_file = 'spec/fixtures/testrc'
+ stub_const('Pry::LOCAL_RC_FILE', 'spec/fixtures/testlinkrc')
- Pry.start(self, input: StringIO.new("exit-all\n"), output: StringIO.new)
+ Pry.start(self, input: StringIO.new("exit-all\n"), output: StringIO.new)
- expect(TEST_RC).to eq [0]
- end
+ expect(TEST_RC).to eq [0]
end
it "should not load the pryrc if pryrc's directory permissions do not allow this" do