rib 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa94deca610e9ec811983f478aed80825cc3e6d9
4
- data.tar.gz: a32394966d70f6fe678aa8f62b98acd2c4013123
3
+ metadata.gz: 2150377cb877771f501f288373ccf7750a786be5
4
+ data.tar.gz: 72a3bc6e08131e09ede6e1b81b16a904e8080244
5
5
  SHA512:
6
- metadata.gz: 44d64da0019490fb7b39ea1bfba0bd84114480e78a1ce57381bb2be4207517a3fa39085b679707e266e0e64f728a35315c008289bb96f90aa53390353911d258
7
- data.tar.gz: 47f165fc38f1bfbc5bb0509ae3aa71c12852ac24037a0f577f1048e4642ebfb1e716d2f0bdaab32f1f8f401f18d2c30f0d424835f5a56d72f8b6a0d2340075cb
6
+ metadata.gz: f9a3ac832fc847890ca41e7fbcf4760e0c1a1b46d1f07d71135bf5bc1e117af114be038319cb18a85bd348b074845e86bcf8d300ab260662f10239dca96229ca
7
+ data.tar.gz: 60f6eeeee1bb056cd56ca103c198c7cf7fcf0cfe1d288dcafe5ac2b8658ea75d96aad163dd735defd59af5065c30abd45b15ebd5e530edb2136d154d1efef21b
data/.travis.yml CHANGED
@@ -1,13 +1,15 @@
1
- before_install: 'git submodule update --init'
2
- script: 'ruby -r bundler/setup -S rake test'
3
1
 
2
+ language: ruby
4
3
  rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - ruby
8
- - rbx
4
+ - 1.9
5
+ - 2.0
6
+ - 2.1
7
+ - rbx-2
9
8
  - jruby
10
9
 
11
10
  matrix:
12
11
  allow_failures:
13
12
  - rvm: jruby
13
+
14
+ script: 'ruby -r bundler/setup -S rake test'
15
+ sudo: false
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGES
2
2
 
3
+ ## Rib 1.2.6 -- 2014-11-07
4
+
5
+ * [extra/autoindent] Now `module_function` would indent correctly.
6
+ * [extra/autoindent] Now `else` in `case` would indent correctly.
7
+ * [extra/autoindent] Fixed printing end clause twice. (performance fix)
8
+ * [extra/multiline] Fixed in some cases it's not recognized as multiline
9
+ in Rubinius (rbx).
10
+
3
11
  ## Rib 1.2.5 -- 2014-03-13
4
12
 
5
13
  * Fixed binding. Sorry my bad.
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- gem 'bacon'
7
+ gem 'pork'
8
8
  gem 'muack'
9
9
 
10
10
  gem 'bond'
data/README.md CHANGED
@@ -23,7 +23,7 @@ be simple, lightweight and modular so that everyone could customize Rib.
23
23
 
24
24
  ## REQUIREMENTS:
25
25
 
26
- * Tested with MRI (official CRuby) 1.9.3, 2.0.0, Rubinius and JRuby.
26
+ * Tested with MRI (official CRuby), Rubinius and JRuby.
27
27
  * All gem dependencies are optional, but it's highly recommended to use
28
28
  Rib with [bond][] for tab completion.
29
29
 
@@ -49,6 +49,9 @@ module Rib::Multiline
49
49
  "syntax error, unexpected \\$end" ,
50
50
  # rubinius
51
51
  "expecting keyword_end" ,
52
+ "expecting keyword_then" ,
53
+ "expecting keyword_when" ,
54
+ "expecting keyword_do_cond" ,
52
55
  "expecting \\$end" ,
53
56
  "expecting '.+'( or '.+')*" ,
54
57
  "missing '.+' for '.+' started on line \\d+"].join('|'))
@@ -24,21 +24,21 @@ module Rib::Autoindent
24
24
  # rescue E => e
25
25
  # rescue E=> e
26
26
  # rescue E =>e
27
- /^begin$/ => /^(end)\b|^else$|^rescue *((\w+)? *(=> *\w+)?)?$/,
27
+ /^begin$/ => /^(end)\b|^else$|^rescue *((\w+)? *(=> *\w+)?)?$/,
28
28
  # elsif Expression
29
29
  # consider cases:
30
30
  # elsif(true)
31
31
  # elsif true
32
32
  # elsif true == true
33
33
  # elsif (a = true) && false
34
- /^if/ => /^(end)\b|^else$|^elsif\b/,
35
- /^unless/ => /^(end)\b|^else$|^elsif\b/,
36
- /^case/ => /^(end)\b|^when\b/ ,
37
- /^def/ => /^(end)\b/ ,
38
- /^class/ => /^(end)\b/ ,
39
- /^module/ => /^(end)\b/ ,
40
- /^while/ => /^(end)\b/ ,
41
- /^until/ => /^(end)\b/ ,
34
+ /^if\b/ => /^(end)\b|^else$|^elsif\b/,
35
+ /^unless\b/ => /^(end)\b|^else$|^elsif\b/,
36
+ /^case\b/ => /^(end)\b|^else$|when\b/ ,
37
+ /^def\b/ => /^(end)\b/ ,
38
+ /^class\b/ => /^(end)\b/ ,
39
+ /^module\b/ => /^(end)\b/ ,
40
+ /^while\b/ => /^(end)\b/ ,
41
+ /^until\b/ => /^(end)\b/ ,
42
42
  # consider cases:
43
43
  # 'do
44
44
  # ' do
@@ -88,11 +88,7 @@ module Rib::Autoindent
88
88
  return super if Autoindent.disabled?
89
89
  input = raw_input.strip
90
90
  indent = detect_autoindent(input)
91
- result, err = if indent.first.to_s.start_with?('left')
92
- super(handle_last_line(input))
93
- else
94
- super
95
- end
91
+ result, err = super
96
92
  handle_autoindent(input, indent, err)
97
93
  [result, err]
98
94
  end
@@ -128,6 +124,7 @@ module Rib::Autoindent
128
124
 
129
125
  when :left_end # we need to go back
130
126
  # could happen in either multiline or not
127
+ handle_last_line(input)
131
128
  autoindent_stack.pop
132
129
 
133
130
  when :left_tmp # temporarily go back
@@ -1,5 +1,5 @@
1
1
 
2
- shared :setup_multiline do
2
+ copy :setup_multiline do
3
3
  def setup_shell
4
4
  @shell = Rib::Shell.new(
5
5
  :binding => Object.new.instance_eval{binding}).before_loop
@@ -34,12 +34,12 @@ shared :setup_multiline do
34
34
  end
35
35
  end
36
36
 
37
- shared :multiline do
37
+ copy :multiline do
38
38
  before do
39
39
  setup_shell
40
40
  end
41
41
 
42
- should 'work with no prompt' do
42
+ would 'work with no prompt' do
43
43
  @shell.config[:prompt] = ''
44
44
  check <<-RUBY
45
45
  def f
@@ -48,7 +48,7 @@ shared :multiline do
48
48
  RUBY
49
49
  end
50
50
 
51
- should 'def f' do
51
+ would 'def f' do
52
52
  check <<-RUBY
53
53
  def f
54
54
  1
@@ -56,21 +56,21 @@ shared :multiline do
56
56
  RUBY
57
57
  end
58
58
 
59
- should 'class C' do
59
+ would 'class C' do
60
60
  check <<-RUBY
61
61
  class C
62
62
  end
63
63
  RUBY
64
64
  end
65
65
 
66
- should 'begin' do
66
+ would 'begin' do
67
67
  check <<-RUBY
68
68
  begin
69
69
  end
70
70
  RUBY
71
71
  end
72
72
 
73
- should 'begin with RuntimeError' do
73
+ would 'begin with RuntimeError' do
74
74
  check <<-RUBY, RuntimeError
75
75
  begin
76
76
  raise 'multiline raised an error'
@@ -78,118 +78,118 @@ shared :multiline do
78
78
  RUBY
79
79
  end
80
80
 
81
- should 'do end' do
81
+ would 'do end' do
82
82
  check <<-RUBY
83
83
  [].each do
84
84
  end
85
85
  RUBY
86
86
  end
87
87
 
88
- should 'block brace' do
88
+ would 'block brace' do
89
89
  check <<-RUBY
90
90
  [].each{
91
91
  }
92
92
  RUBY
93
93
  end
94
94
 
95
- should 'hash' do
95
+ would 'hash' do
96
96
  check <<-RUBY
97
97
  {
98
98
  }
99
99
  RUBY
100
100
  end
101
101
 
102
- should 'hash value' do
102
+ would 'hash value' do
103
103
  check <<-RUBY
104
104
  {1 =>
105
105
  2}
106
106
  RUBY
107
107
  end
108
108
 
109
- should 'array' do
109
+ would 'array' do
110
110
  check <<-RUBY
111
111
  [
112
112
  ]
113
113
  RUBY
114
114
  end
115
115
 
116
- should 'group' do
116
+ would 'group' do
117
117
  check <<-RUBY
118
118
  (
119
119
  )
120
120
  RUBY
121
121
  end
122
122
 
123
- should 'string double quote' do
123
+ would 'string double quote' do
124
124
  check <<-RUBY
125
125
  "
126
126
  "
127
127
  RUBY
128
128
  end
129
129
 
130
- should 'string single quote' do
130
+ would 'string single quote' do
131
131
  check <<-RUBY
132
132
  '
133
133
  '
134
134
  RUBY
135
135
  end
136
136
 
137
- should 'be hash treated as a block SyntaxError' do
137
+ would 'be hash treated as a block SyntaxError' do
138
138
  check <<-RUBY, SyntaxError
139
139
  puts { :x => 10 }.class
140
140
  RUBY
141
141
  end
142
142
 
143
- should 'begin with SyntaxError' do
143
+ would 'begin with SyntaxError' do
144
144
  check <<-RUBY, SyntaxError
145
145
  begin
146
146
  s-y n
147
147
  RUBY
148
148
  end
149
149
 
150
- should 'binary operator +' do
150
+ would 'binary operator +' do
151
151
  check <<-RUBY
152
152
  1/1.to_i +
153
153
  1
154
154
  RUBY
155
155
  end
156
156
 
157
- should 'binary operator -' do
157
+ would 'binary operator -' do
158
158
  check <<-RUBY
159
159
  1*1.to_i -
160
160
  1
161
161
  RUBY
162
162
  end
163
163
 
164
- should 'binary operator *' do
164
+ would 'binary operator *' do
165
165
  check <<-RUBY
166
166
  1-1.to_i *
167
167
  1
168
168
  RUBY
169
169
  end
170
170
 
171
- should 'binary operator /' do
171
+ would 'binary operator /' do
172
172
  check <<-RUBY
173
173
  1+1.to_i /
174
174
  1
175
175
  RUBY
176
176
  end
177
177
 
178
- should 'binary operator |' do
178
+ would 'binary operator |' do
179
179
  check <<-RUBY
180
180
  1+1.to_i |
181
181
  1
182
182
  RUBY
183
183
  end
184
184
 
185
- should 'binary operator &' do
185
+ would 'binary operator &' do
186
186
  check <<-RUBY
187
187
  1+1.to_i &
188
188
  1
189
189
  RUBY
190
190
  end
191
191
 
192
- should 'binary operator ^' do
192
+ would 'binary operator ^' do
193
193
  check <<-RUBY
194
194
  1+1.to_i ^
195
195
  1
data/lib/rib/test.rb CHANGED
@@ -1,13 +1,13 @@
1
1
 
2
- require 'bacon'
2
+ require 'pork/auto'
3
3
  require 'muack'
4
4
  require 'fileutils'
5
- Bacon.summary_on_exit
6
- include Muack::API
5
+
6
+ Pork::Executor.__send__(:include, Muack::API)
7
7
 
8
8
  require 'rib'
9
9
 
10
- shared :rib do
10
+ copy :rib do
11
11
  before do
12
12
  end
13
13
 
@@ -15,48 +15,50 @@ shared :rib do
15
15
  Muack.verify
16
16
  end
17
17
 
18
- def test_for *plugins, &block
19
- require 'rib/all' # exhaustive tests
20
- rest = Rib.plugins - plugins
21
- Rib.enable_plugins(plugins)
22
- Rib.disable_plugins(rest)
23
- yield
18
+ singleton_class.module_eval do
19
+ def test_for *plugins, &block
20
+ require 'rib/all' # exhaustive tests
21
+ rest = Rib.plugins - plugins
22
+ Rib.enable_plugins(plugins)
23
+ Rib.disable_plugins(rest)
24
+ yield
24
25
 
25
- case ENV['TEST_LEVEL']
26
- when '0'
27
- when '1'
28
- test_level1(rest, block)
29
- when '2'
30
- test_level2(rest, block)
31
- when '3'
32
- test_level3(rest, block)
33
- else # test_level3 is too slow because of rr (i guess)
34
- test_level2(rest, block)
26
+ case ENV['TEST_LEVEL']
27
+ when '0'
28
+ when '1'
29
+ test_level1(rest, block)
30
+ when '2'
31
+ test_level2(rest, block)
32
+ when '3'
33
+ test_level3(rest, block)
34
+ else # test_level3 is too slow because of rr (i guess)
35
+ test_level2(rest, block)
36
+ end
35
37
  end
36
- end
37
38
 
38
- def test_level1 rest, block
39
- rest.each{ |target|
40
- target.enable
41
- block.call
42
- target.disable
43
- }
44
- end
39
+ def test_level1 rest, block
40
+ rest.each{ |target|
41
+ target.enable
42
+ block.call
43
+ target.disable
44
+ }
45
+ end
45
46
 
46
- def test_level2 rest, block
47
- rest.combination(2).each{ |targets|
48
- Rib.enable_plugins(targets)
49
- block.call
50
- Rib.disable_plugins(targets)
51
- }
52
- end
47
+ def test_level2 rest, block
48
+ rest.combination(2).each{ |targets|
49
+ Rib.enable_plugins(targets)
50
+ block.call
51
+ Rib.disable_plugins(targets)
52
+ }
53
+ end
53
54
 
54
- def test_level3 rest, block
55
- return block.call if rest.empty?
56
- rest[0].enable
57
- test_level3(rest[1..-1], block)
58
- rest[0].disable
59
- test_level3(rest[1..-1], block)
55
+ def test_level3 rest, block
56
+ return block.call if rest.empty?
57
+ rest[0].enable
58
+ test_level3(rest[1..-1], block)
59
+ rest[0].disable
60
+ test_level3(rest[1..-1], block)
61
+ end
60
62
  end
61
63
 
62
64
  def readline?
@@ -71,12 +73,6 @@ shared :rib do
71
73
  end
72
74
  end
73
75
 
74
- module Kernel
75
- def eq? rhs
76
- self == rhs
77
- end
78
- end
79
-
80
76
  def main
81
77
  'rib'
82
78
  end
data/lib/rib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rib
3
- VERSION = '1.2.5'
3
+ VERSION = '1.2.6'
4
4
  end
data/rib.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rib 1.2.5 ruby lib
2
+ # stub: rib 1.2.6 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rib"
6
- s.version = "1.2.5"
6
+ s.version = "1.2.6"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Lin Jen-Shin (godfat)"]
11
- s.date = "2014-03-13"
11
+ s.date = "2014-11-07"
12
12
  s.description = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell\n\nRib is based on the design of [ripl][] and the work of [ripl-rc][], some of\nthe features are also inspired by [pry][]. The aim of Rib is to be fully\nfeatured and yet very easy to opt-out or opt-in other features. It shall\nbe simple, lightweight and modular so that everyone could customize Rib.\n\n[ripl]: https://github.com/cldwalker/ripl\n[ripl-rc]: https://github.com/godfat/ripl-rc\n[pry]: https://github.com/pry/pry"
13
13
  s.email = ["godfat (XD) godfat.org"]
14
14
  s.executables = [
@@ -54,7 +54,6 @@ Gem::Specification.new do |s|
54
54
  "lib/rib/core/underscore.rb",
55
55
  "lib/rib/debug.rb",
56
56
  "lib/rib/extra/autoindent.rb",
57
- "lib/rib/extra/debugger.rb",
58
57
  "lib/rib/extra/hirb.rb",
59
58
  "lib/rib/extra/paging.rb",
60
59
  "lib/rib/more.rb",
@@ -63,7 +62,6 @@ Gem::Specification.new do |s|
63
62
  "lib/rib/more/edit.rb",
64
63
  "lib/rib/more/multiline_history.rb",
65
64
  "lib/rib/more/multiline_history_file.rb",
66
- "lib/rib/patch/debugger.rb",
67
65
  "lib/rib/plugin.rb",
68
66
  "lib/rib/runner.rb",
69
67
  "lib/rib/shell.rb",
@@ -80,6 +78,7 @@ Gem::Specification.new do |s|
80
78
  "test/core/test_readline.rb",
81
79
  "test/core/test_squeeze_history.rb",
82
80
  "test/core/test_underscore.rb",
81
+ "test/extra/test_autoindent.rb",
83
82
  "test/more/test_color.rb",
84
83
  "test/more/test_multiline_history.rb",
85
84
  "test/test_api.rb",
@@ -88,7 +87,7 @@ Gem::Specification.new do |s|
88
87
  "test/test_shell.rb"]
89
88
  s.homepage = "https://github.com/godfat/rib"
90
89
  s.licenses = ["Apache License 2.0"]
91
- s.rubygems_version = "2.2.2"
90
+ s.rubygems_version = "2.4.2"
92
91
  s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell"
93
92
  s.test_files = [
94
93
  "test/core/test_completion.rb",
@@ -97,6 +96,7 @@ Gem::Specification.new do |s|
97
96
  "test/core/test_readline.rb",
98
97
  "test/core/test_squeeze_history.rb",
99
98
  "test/core/test_underscore.rb",
99
+ "test/extra/test_autoindent.rb",
100
100
  "test/more/test_color.rb",
101
101
  "test/more/test_multiline_history.rb",
102
102
  "test/test_api.rb",
data/task/gemgem.rb CHANGED
@@ -34,7 +34,7 @@ module Gemgem
34
34
  s.executables = bin_files
35
35
  end
36
36
  spec_create.call(spec)
37
- spec.homepage = "https://github.com/godfat/#{spec.name}"
37
+ spec.homepage ||= "https://github.com/godfat/#{spec.name}"
38
38
  self.spec = spec
39
39
  end
40
40
 
@@ -227,10 +227,6 @@ end # of gem namespace
227
227
  desc 'Run tests'
228
228
  task :test do
229
229
  next if Gemgem.test_files.empty?
230
-
231
- require 'bacon'
232
- Bacon.extend(Bacon::TestUnitOutput)
233
- Bacon.summary_on_exit
234
230
  Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
235
231
  end
236
232
 
@@ -3,7 +3,7 @@ require 'rib/test'
3
3
  require 'rib/core/completion'
4
4
 
5
5
  describe Rib::Completion do
6
- behaves_like :rib
6
+ paste :rib
7
7
 
8
8
  before do
9
9
  @completion = Class.new do
@@ -11,7 +11,7 @@ describe Rib::Completion do
11
11
  end.new
12
12
  end
13
13
 
14
- should 'find correct ripl plugins' do
14
+ would 'find correct ripl plugins' do
15
15
  $LOADED_FEATURES << '/dir/ripl/some_plugin.rb'
16
16
  @completion.send(:ripl_plugins).should.eq ['ripl/some_plugin.rb']
17
17
  end
@@ -2,8 +2,8 @@
2
2
  require 'rib/test'
3
3
  require 'rib/core/history'
4
4
 
5
- shared :history do
6
- should '#after_loop save history' do
5
+ copy :history do
6
+ would '#after_loop save history' do
7
7
  inputs = %w[blih blah]
8
8
  @shell.history.clear
9
9
  @shell.history.push(*inputs)
@@ -12,18 +12,18 @@ shared :history do
12
12
  File.read(@history_file).should.eq "#{inputs.join("\n")}\n"
13
13
  end
14
14
 
15
- should '#before_loop load previous history' do
15
+ would '#before_loop load previous history' do
16
16
  File.open(@history_file, 'w'){ |f| f.write "check\nthe\nmike" }
17
17
  @shell.before_loop
18
18
  @shell.history.to_a.should.eq %w[check the mike]
19
19
  end
20
20
 
21
- should '#before_loop have empty history if no history file exists' do
21
+ would '#before_loop have empty history if no history file exists' do
22
22
  @shell.before_loop
23
23
  @shell.history.to_a.should.eq []
24
24
  end
25
25
 
26
- should '#read_history be accessible to plugins in #before_loop' do
26
+ would '#read_history be accessible to plugins in #before_loop' do
27
27
  mod = Module.new do
28
28
  def read_history
29
29
  config[:history] = ['pong_read_history']
@@ -34,7 +34,7 @@ shared :history do
34
34
  shell.new.before_loop.history.should.eq ['pong_read_history']
35
35
  end
36
36
 
37
- should '#write_history be accessible to plugins in #after_loop' do
37
+ would '#write_history be accessible to plugins in #after_loop' do
38
38
  mod = Module.new do
39
39
  def write_history
40
40
  config[:history] = ['pong_write_history']
@@ -47,7 +47,7 @@ shared :history do
47
47
  end
48
48
 
49
49
  describe Rib::History do
50
- behaves_like :rib
50
+ paste :rib
51
51
 
52
52
  before do
53
53
  if readline?
@@ -63,6 +63,6 @@ describe Rib::History do
63
63
  end
64
64
 
65
65
  test_for Rib::History do
66
- behaves_like :history
66
+ paste :history
67
67
  end
68
68
  end
@@ -4,8 +4,8 @@ require 'rib/test/multiline'
4
4
  require 'rib/core/multiline'
5
5
 
6
6
  describe Rib::Multiline do
7
- behaves_like :rib
8
- behaves_like :setup_multiline
7
+ paste :rib
8
+ paste :setup_multiline
9
9
 
10
10
  def check str, err=nil
11
11
  lines = str.split("\n")
@@ -17,6 +17,6 @@ describe Rib::Multiline do
17
17
  end
18
18
 
19
19
  test_for Rib::Multiline do
20
- behaves_like :multiline
20
+ paste :multiline
21
21
  end
22
22
  end
@@ -2,25 +2,25 @@
2
2
  require 'rib/test'
3
3
  require 'rib/core/readline'
4
4
 
5
- shared :readline do
6
- should '#before_loop set @history' do
5
+ copy :readline do
6
+ would '#before_loop set @history' do
7
7
  @shell.history.should.eq Readline::HISTORY
8
8
  end
9
9
 
10
- should '#get_input calling Readline.readline' do
10
+ would '#get_input calling Readline.readline' do
11
11
  mock(Readline).readline(@shell.prompt, true){'ok'}
12
12
  @shell.get_input.should.eq 'ok'
13
13
  end
14
14
  end
15
15
 
16
16
  describe Rib::Readline do
17
- behaves_like :rib
17
+ paste :rib
18
18
 
19
19
  before do
20
20
  @shell = Rib::Shell.new.before_loop
21
21
  end
22
22
 
23
23
  test_for Rib::Readline do
24
- behaves_like :readline
24
+ paste :readline
25
25
  end
26
26
  end