Skip to content

Commit

Permalink
Use reline
Browse files Browse the repository at this point in the history
The current version of reline needs at least ruby 2.5, so we catch up
with that requirement.
  • Loading branch information
deivid-rodriguez committed Jan 20, 2020
1 parent 82ce64c commit e233fd7
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 127 deletions.
57 changes: 18 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ on:

jobs:
test:
container: deividrodriguez/byebug:${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}
container: deividrodriguez/byebug:${{ matrix.version }}-${{ matrix.compiler }}

runs-on: ubuntu-18.04

strategy:
matrix:
version: ["2.4.9", "2.5.7", "2.6.5", "2.7.0", "head"]
line_editor: ["libedit", "readline"]
version: ["2.5.7", "2.6.5", "2.7.0", "head"]
compiler: ["clang", "gcc"]

steps:
Expand All @@ -30,17 +29,17 @@ jobs:
bin/rake
- name: Save coverage
run: cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}.json
run: cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.version }}-${{ matrix.compiler }}.json

- uses: actions/upload-artifact@v1
with:
name: coverage-${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}
path: coverage/codeclimate.${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}.json
name: coverage-${{ matrix.version }}-${{ matrix.compiler }}
path: coverage/codeclimate.${{ matrix.version }}-${{ matrix.compiler }}.json

timeout-minutes: 15

coverage:
container: deividrodriguez/byebug:2.7.0-readline-gcc
container: deividrodriguez/byebug:2.7.0-gcc

runs-on: ubuntu-18.04

Expand All @@ -52,82 +51,62 @@ jobs:
steps:
- uses: actions/download-artifact@v1
with:
name: coverage-2.4.9-libedit-clang
name: coverage-2.5.7-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.4.9-libedit-gcc
name: coverage-2.5.7-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.4.9-readline-clang
name: coverage-2.5.7-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.4.9-readline-gcc
name: coverage-2.5.7-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.5.7-libedit-clang
name: coverage-2.6.5-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.5.7-libedit-gcc
name: coverage-2.6.5-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.5.7-readline-clang
name: coverage-2.6.5-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.5.7-readline-gcc
name: coverage-2.6.5-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.6.5-libedit-clang
name: coverage-2.7.0-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.6.5-libedit-gcc
name: coverage-2.7.0-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.6.5-readline-clang
name: coverage-2.7.0-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.6.5-readline-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.7.0-libedit-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.7.0-libedit-gcc
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.7.0-readline-clang
path: coverage

- uses: actions/download-artifact@v1
with:
name: coverage-2.7.0-readline-gcc
name: coverage-2.7.0-gcc
path: coverage

- name: Aggregate & upload results to Code Climate
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_head_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ on:

jobs:
build:
container: deividrodriguez/byebug:2.6.5-readline-gcc
container: deividrodriguez/byebug:2.6.5-gcc

runs-on: ubuntu-18.04

strategy:
matrix:
line_editor: ["libedit", "readline"]
compiler: ["clang", "gcc"]

steps:
Expand All @@ -30,7 +29,7 @@ jobs:
run: bin/setup.sh

- name: Build and push docker image
run: bin/rake docker:build_and_push_head[${{ matrix.line_editor }},${{ matrix.compiler }}]
run: bin/rake docker:build_and_push_head[${{ matrix.compiler }}]
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AllCops:

DisabledByDefault: true

TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Layout/AccessModifierIndentation:
Enabled: true
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

### Changed

* [#615](https://github.com/deivid-rodriguez/byebug/pull/615): Byebug now uses a [pure ruby readline implementation](https://github.com/ruby/reline).

### Removed

* Support for MRI 2.4. Byebug no longer installs on this platform.

## [11.1.0] - 2020-01-20

### Added
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PATH
remote: .
specs:
byebug (11.1.0)
reline (>= 0.1.2)

GEM
remote: https://rubygems.org/
Expand All @@ -16,6 +17,7 @@ GEM
docile (1.3.2)
faraday (1.0.0)
multipart-post (>= 1.2, < 3)
io-console (0.5.5)
jaro_winkler (1.5.4)
json (2.3.0)
kramdown (2.1.0)
Expand Down Expand Up @@ -47,6 +49,8 @@ GEM
rake (13.0.1)
rake-compiler (1.1.0)
rake
reline (0.1.2)
io-console (~> 0.5)
rexml (3.2.3)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Windows [![Vey][vey]][vey_url]

## Requirements

* _Required_: MRI 2.4.0 or higher.
* _Required_: MRI 2.5.0 or higher.
* _Recommended_: MRI 2.6.4 or higher (MRI 2.6.0 to 2.6.3 contain a regression
causing unbalanced call/return events in some cases, breaking the `next` command).

Expand Down
11 changes: 4 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ task "release:rubygem_push" => "chandler:push"
if Gem.win_platform?
desc "Activates DevKit"
task :devkit do
begin
require "devkit"
rescue LoadError
abort "Failed to load DevKit required for compilation"
end
require "devkit"
rescue LoadError
abort "Failed to load DevKit required for compilation"
end

task compile: :devkit
Expand Down Expand Up @@ -107,10 +105,9 @@ namespace :docker do
end

desc "Build a ruby trunk image"
task :build_and_push_head, %i[line_editor compiler] do |_t, opts|
task :build_and_push_head, %i[compiler] do |_t, opts|
manager = Docker::Manager.new(
version: "head",
line_editor: opts[:line_editor],
compiler: opts[:compiler]
)

Expand Down
11 changes: 0 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ install:
cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version
}
- git clone -q --depth=5 --no-tags --branch=byebug https://github.com/MSP-greg/rb-readline.git C:\rb-readline

- ps: $env:ruby_abi_vers = (&ruby.exe -e "puts RbConfig::CONFIG['ruby_version']" | Out-String).Trim()
- set n_dir=C:\Ruby%ruby_version%\lib\ruby\site_ruby\%ruby_abi_vers%
- attrib.exe -r %n_dir%\*.rb
- del /q %n_dir%\readline.rb
- del /q %n_dir%\rbreadline.rb
- copy C:\rb-readline\lib\readline.rb %n_dir%\readline.rb
- copy C:\rb-readline\lib\rbreadline.rb %n_dir%\rbreadline.rb

- echo %PATH%

- ruby --version
Expand All @@ -38,7 +28,6 @@ test_script:

environment:
matrix:
- ruby_version: 24-x64
- ruby_version: 25-x64
- ruby_version: 26-x64
- ruby_version: head-x64
Expand Down
4 changes: 3 additions & 1 deletion byebug.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
can build on. It provides breakpoint handling and bindings for stack frames
among other things and it comes with an easy to use command line interface."

s.required_ruby_version = ">= 2.4.0"
s.required_ruby_version = ">= 2.5.0"

s.files = Dir["lib/**/*.rb", "lib/**/*.yml", "ext/**/*.[ch]", "LICENSE"]
s.bindir = "exe"
Expand All @@ -25,5 +25,7 @@ Gem::Specification.new do |s|
s.extensions = ["ext/byebug/extconf.rb"]
s.require_path = "lib"

s.add_dependency "reline", ">= 0.1.2"

s.add_development_dependency "bundler", "~> 2.0"
end
4 changes: 0 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ RUN mkdir -p /usr/local/etc \

ARG ruby_download_url=
ARG ruby_download_sha256=
ARG line_edit_lib=
ARG line_edit_config=
ARG compiler=

ENV CC $compiler
Expand Down Expand Up @@ -39,7 +37,6 @@ RUN set -ex \
libc-dev \
libxml2-dev \
libxslt-dev \
$line_edit_lib \
linux-headers \
ncurses-dev \
ruby \
Expand All @@ -61,7 +58,6 @@ RUN set -ex \
--disable-werror \
--build="$gnuArch" \
--disable-install-doc \
$line_edit_config \
--enable-shared \
&& make -j "$(nproc)" \
&& make install \
Expand Down
38 changes: 9 additions & 29 deletions docker/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,20 @@ module Docker
#
class Manager
VERSIONS = %w[
2.4.9
2.5.7
2.6.5
2.7.0
].freeze

LINE_EDITORS = %w[
readline
libedit
].freeze

COMPILERS = %w[
gcc
clang
].freeze

attr_reader :version, :line_editor, :compiler
attr_reader :version, :compiler

def initialize(version:, line_editor:, compiler:)
def initialize(version:, compiler:)
@version = version
@line_editor = line_editor
@compiler = compiler
end

Expand All @@ -45,8 +38,6 @@ def build
--build-arg "ruby_download_url=#{download_url}" \
--build-arg "ruby_download_sha256=#{download_sha256}" \
--build-arg "compiler=#{compiler}" \
--build-arg "line_edit_lib=#{line_editor_package}" \
--build-arg "line_edit_config=#{line_editor_configure_flag}" \
--file "docker/Dockerfile" \
.
COMMAND
Expand Down Expand Up @@ -154,29 +145,18 @@ def for_last_version_variants(&block)

def for_variants_of(version)
COMPILERS.each do |compiler|
LINE_EDITORS.each do |line_editor|
manager = new(
version: version,
line_editor: line_editor,
compiler: compiler
)

yield(manager)
end
manager = new(
version: version,
compiler: compiler
)

yield(manager)
end
end
end

private

def line_editor_package
line_editor == "readline" ? "readline-dev" : "libedit-dev"
end

def line_editor_configure_flag
line_editor == "readline" ? "" : "--enable-libedit"
end

def download_url
if version == "head"
"#{download_url_base}/snapshot.tar.xz"
Expand Down Expand Up @@ -209,7 +189,7 @@ def run(*command)
end

def tag
"deividrodriguez/byebug:#{version}-#{line_editor}-#{compiler}"
"deividrodriguez/byebug:#{version}-#{compiler}"
end

def squish(command)
Expand Down

0 comments on commit e233fd7

Please sign in to comment.