irb 1.0.0 → 1.1.0.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/irb/version.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
 
13
13
  module IRB # :nodoc:
14
- VERSION = "1.0.0"
14
+ VERSION = "1.1.0.pre.1"
15
15
  @RELEASE_VERSION = VERSION
16
- @LAST_UPDATE_DATE = "2018-12-18"
16
+ @LAST_UPDATE_DATE = "2019-05-31"
17
17
  end
data/lib/irb/workspace.rb CHANGED
@@ -49,7 +49,7 @@ EOF
49
49
  @binding = BINDING_QUEUE.pop
50
50
 
51
51
  when 3 # binding in function on TOPLEVEL_BINDING(default)
52
- @binding = eval("def irb_binding; private; binding; end; irb_binding",
52
+ @binding = eval("self.class.send(:remove_method, :irb_binding) if defined?(irb_binding); def irb_binding; private; binding; end; irb_binding",
53
53
  TOPLEVEL_BINDING,
54
54
  __FILE__,
55
55
  __LINE__ - 3)
@@ -116,25 +116,43 @@ EOF
116
116
  end
117
117
 
118
118
  def code_around_binding
119
- file, pos = @binding.source_location
119
+ if @binding.respond_to?(:source_location)
120
+ file, pos = @binding.source_location
121
+ else
122
+ file, pos = @binding.eval('[__FILE__, __LINE__]')
123
+ end
120
124
 
121
- unless defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
125
+ if defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
126
+ code = ::SCRIPT_LINES__[file].join('')
127
+ else
122
128
  begin
123
- lines = File.readlines(file)
129
+ code = File.read(file)
124
130
  rescue SystemCallError
125
131
  return
126
132
  end
127
133
  end
134
+
135
+ # NOT using #use_colorize? of IRB.conf[:MAIN_CONTEXT] because this method may be called before IRB::Irb#run
136
+ use_colorize = IRB.conf.fetch(:USE_COLORIZE, true)
137
+ if use_colorize
138
+ lines = Color.colorize_code(code).lines
139
+ else
140
+ lines = code.lines
141
+ end
128
142
  pos -= 1
129
143
 
130
144
  start_pos = [pos - 5, 0].max
131
145
  end_pos = [pos + 5, lines.size - 1].min
132
146
 
133
- fmt = " %2s %#{end_pos.to_s.length}d: %s"
147
+ if use_colorize
148
+ fmt = " %2s #{Color.colorize("%#{end_pos.to_s.length}d", [:BLUE, :BOLD])}: %s"
149
+ else
150
+ fmt = " %2s %#{end_pos.to_s.length}d: %s"
151
+ end
134
152
  body = (start_pos..end_pos).map do |current_pos|
135
153
  sprintf(fmt, pos == current_pos ? '=>' : '', current_pos + 1, lines[current_pos])
136
154
  end.join("")
137
- "\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}\n"
155
+ "\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n"
138
156
  end
139
157
 
140
158
  def IRB.delete_caller
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiju ISHITSUKA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-18 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,14 +46,8 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".gitignore"
50
- - ".travis.yml"
51
- - Gemfile
52
49
  - LICENSE.txt
53
50
  - README.md
54
- - Rakefile
55
- - bin/console
56
- - bin/setup
57
51
  - exe/irb
58
52
  - irb.gemspec
59
53
  - lib/irb.rb
@@ -113,12 +107,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
107
  version: '0'
114
108
  required_rubygems_version: !ruby/object:Gem::Requirement
115
109
  requirements:
116
- - - ">="
110
+ - - ">"
117
111
  - !ruby/object:Gem::Version
118
- version: '0'
112
+ version: 1.3.1
119
113
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.7.6
114
+ rubygems_version: 3.0.4
122
115
  signing_key:
123
116
  specification_version: 4
124
117
  summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- - ruby-head
6
- before_install: gem install bundler -v 1.16.2
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test" << "test/lib"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- task :default => :test
data/bin/console DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require_relative "../lib/irb"
5
-
6
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install