rib 1.5.0 → 1.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2754a503227af3de8a1ce5be17d51953c5660c66
4
- data.tar.gz: 82d087ef01b20d8ff6c23300a734cdf48c97d144
3
+ metadata.gz: e1c625bc0da2b14df1f4856299b5f5c44d79915a
4
+ data.tar.gz: 30688e5296926f1e38a67c3695181c796a0bbb7d
5
5
  SHA512:
6
- metadata.gz: 2013ad9a9dfe0e067d4c753364cc64650e92cf0e4a423c0451016e109ddadd6c1837fc863df6c83abfb9a30d1d27fe25ae536dbabca9507901845cff6ecae5a6
7
- data.tar.gz: c46d5ac3913b05d761c67b8138ec5f970dad67af9b14a6e36b5d9bf01419e805b603df1cec73dd4a184d18ccaf9960b0d6d632a70d2380291450d22828fd01bd
6
+ metadata.gz: 41a078427da34028fbbed7f377c9e906e5b6e2a8cc53c2f30d0ac7fa5c888667fc1ab0aa0ef2f5c6927306c35887a81db0b6ba50eabb6ef2af147d0d6b84797d
7
+ data.tar.gz: 1c600c0587d555cf031130be807e46a29057ae99538e239f7b0d4ab5a23eaf1c9d169504fb928930f8296ff04fbad92126df705e8bd1928ec28336dae542469a
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # CHANGES
2
2
 
3
- ## Rib 1.5.0 -- 2016-02-27
3
+ ## Rib 1.5.1 -- 2017-03-09
4
+
5
+ * [more/beep] This plugin would beep via `print "\a"` when the application
6
+ was loaded and it's been too long. Configure the time via
7
+ `Rib.config[:beep_threshold]`, default is 5 seconds.
8
+
9
+ ## Rib 1.5.0 -- 2017-02-27
4
10
 
5
11
  * Removed Ramaze direct support. Use Rack instead.
6
12
  * Introduced API#format_backtrace
data/README.md CHANGED
@@ -217,6 +217,7 @@ Rib.config[:history_file] | Default is "~/.rib/history.rb"
217
217
  Rib.config[:history_size] | Default is 500
218
218
  Rib.config[:color] | A hash of Class => :color mapping
219
219
  Rib.config[:autoindent_spaces] | How to indent? Default is two spaces: ' '
220
+ Rib.config[:beep_threshold] | When it should beep? Default is 5 seconds
220
221
 
221
222
  #### List of core plugins
222
223
 
@@ -275,6 +276,11 @@ require 'rib/more' # You get all of the followings:
275
276
 
276
277
  Make readline aware of multiline history.
277
278
 
279
+ * `require 'rib/more/beep'`
280
+
281
+ Print "\a" when the application was loaded and it's been too long.
282
+ Configure the threshold via `Rib.config[:beep_threshold]`.
283
+
278
284
  * `require 'rib/more/anchor'`
279
285
 
280
286
  See _As a debugging/interacting tool_.
data/lib/rib.rb CHANGED
@@ -11,7 +11,7 @@ module Rib
11
11
  #
12
12
  # @api public
13
13
  def config
14
- @config ||= {:name => 'rib', :prefix => '.'}
14
+ @config ||= {:name => 'rib', :prefix => '.', :started_at => Time.now}
15
15
  end
16
16
 
17
17
  # All shells in the memory
data/lib/rib/more.rb CHANGED
@@ -13,3 +13,6 @@ require 'rib/more/multiline_history'
13
13
  require 'rib/more/anchor'
14
14
  require 'rib/more/caller'
15
15
  require 'rib/more/edit'
16
+
17
+ # upon application loads
18
+ require 'rib/more/beep'
@@ -0,0 +1,26 @@
1
+
2
+ require 'rib'
3
+
4
+ module Rib::Beep
5
+ extend Rib::Plugin
6
+ Shell.use(self)
7
+
8
+ # --------------- Rib API ---------------
9
+
10
+ def before_loop
11
+ super
12
+ return self if Beep.disabled?
13
+ beep if (Time.now - config[:started_at]) > beep_threshold
14
+ Beep.disable
15
+ self
16
+ end
17
+
18
+ private
19
+ def beep
20
+ print "\a"
21
+ end
22
+
23
+ def beep_threshold
24
+ config[:beep_threshold] ||= 5
25
+ end
26
+ end
data/lib/rib/test.rb CHANGED
@@ -11,8 +11,12 @@ copy :rib do
11
11
  Muack.verify
12
12
  end
13
13
 
14
- def new_shell
15
- Rib::Shell.new(:binding => Object.new.instance_eval{binding}).before_loop
14
+ def new_shell opts={}
15
+ shell = Rib::Shell.new(
16
+ {:binding => Object.new.instance_eval{binding}}.merge(opts)
17
+ )
18
+ yield(shell) if block_given?
19
+ shell.before_loop
16
20
  end
17
21
 
18
22
  singleton_class.module_eval do
data/lib/rib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rib
3
- VERSION = '1.5.0'
3
+ VERSION = '1.5.1'
4
4
  end
data/rib.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rib 1.5.0 ruby lib
2
+ # stub: rib 1.5.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rib".freeze
6
- s.version = "1.5.0"
6
+ s.version = "1.5.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Lin Jen-Shin (godfat)".freeze]
11
- s.date = "2017-02-27"
11
+ s.date = "2017-03-09"
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".freeze
13
13
  s.email = ["godfat (XD) godfat.org".freeze]
14
14
  s.executables = [
@@ -56,6 +56,7 @@ Gem::Specification.new do |s|
56
56
  "lib/rib/extra/spring.rb".freeze,
57
57
  "lib/rib/more.rb".freeze,
58
58
  "lib/rib/more/anchor.rb".freeze,
59
+ "lib/rib/more/beep.rb".freeze,
59
60
  "lib/rib/more/bottomup_backtrace.rb".freeze,
60
61
  "lib/rib/more/caller.rb".freeze,
61
62
  "lib/rib/more/color.rb".freeze,
@@ -80,6 +81,7 @@ Gem::Specification.new do |s|
80
81
  "test/core/test_strip_backtrace.rb".freeze,
81
82
  "test/extra/test_anchor.rb".freeze,
82
83
  "test/extra/test_autoindent.rb".freeze,
84
+ "test/more/test_beep.rb".freeze,
83
85
  "test/more/test_caller.rb".freeze,
84
86
  "test/more/test_color.rb".freeze,
85
87
  "test/more/test_multiline_history.rb".freeze,
@@ -89,7 +91,7 @@ Gem::Specification.new do |s|
89
91
  "test/test_shell.rb".freeze]
90
92
  s.homepage = "https://github.com/godfat/rib".freeze
91
93
  s.licenses = ["Apache License 2.0".freeze]
92
- s.rubygems_version = "2.6.8".freeze
94
+ s.rubygems_version = "2.6.10".freeze
93
95
  s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell".freeze
94
96
  s.test_files = [
95
97
  "test/core/test_completion.rb".freeze,
@@ -101,6 +103,7 @@ Gem::Specification.new do |s|
101
103
  "test/core/test_strip_backtrace.rb".freeze,
102
104
  "test/extra/test_anchor.rb".freeze,
103
105
  "test/extra/test_autoindent.rb".freeze,
106
+ "test/more/test_beep.rb".freeze,
104
107
  "test/more/test_caller.rb".freeze,
105
108
  "test/more/test_color.rb".freeze,
106
109
  "test/more/test_multiline_history.rb".freeze,
@@ -0,0 +1,48 @@
1
+
2
+ require 'rib/test'
3
+ require 'rib/more/beep'
4
+
5
+ describe Rib::Beep do
6
+ paste :rib
7
+
8
+ before do
9
+ Rib::Beep.enable
10
+ end
11
+
12
+ after do
13
+ expect(Rib::Beep).disabled?
14
+ end
15
+
16
+ def verify delay, threshold=nil, &block
17
+ new_shell(:started_at => Time.now - delay,
18
+ :beep_threshold => threshold, &block)
19
+ end
20
+
21
+ def expect_beep shell
22
+ mock(shell).print("\a")
23
+ end
24
+
25
+ def unexpect_beep shell
26
+ stub(shell).print.with_any_args{ flunk }
27
+ end
28
+
29
+ describe 'beep' do
30
+ would 'beep if loading too long' do
31
+ verify(10, &method(:expect_beep))
32
+ end
33
+
34
+ would 'be configurable via beep_threshold' do
35
+ verify(2, 1, &method(:expect_beep))
36
+ end
37
+ end
38
+
39
+ describe 'not beep' do
40
+ would 'not beep if not loading long' do
41
+ verify(2, &method(:unexpect_beep))
42
+ end
43
+
44
+ would 'be configurable via beep_threshold' do
45
+ verify(10, 15, &method(:unexpect_beep))
46
+ end
47
+ end
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-27 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
@@ -70,6 +70,7 @@ files:
70
70
  - lib/rib/extra/spring.rb
71
71
  - lib/rib/more.rb
72
72
  - lib/rib/more/anchor.rb
73
+ - lib/rib/more/beep.rb
73
74
  - lib/rib/more/bottomup_backtrace.rb
74
75
  - lib/rib/more/caller.rb
75
76
  - lib/rib/more/color.rb
@@ -94,6 +95,7 @@ files:
94
95
  - test/core/test_strip_backtrace.rb
95
96
  - test/extra/test_anchor.rb
96
97
  - test/extra/test_autoindent.rb
98
+ - test/more/test_beep.rb
97
99
  - test/more/test_caller.rb
98
100
  - test/more/test_color.rb
99
101
  - test/more/test_multiline_history.rb
@@ -121,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
123
  version: '0'
122
124
  requirements: []
123
125
  rubyforge_project:
124
- rubygems_version: 2.6.8
126
+ rubygems_version: 2.6.10
125
127
  signing_key:
126
128
  specification_version: 4
127
129
  summary: Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
@@ -135,6 +137,7 @@ test_files:
135
137
  - test/core/test_strip_backtrace.rb
136
138
  - test/extra/test_anchor.rb
137
139
  - test/extra/test_autoindent.rb
140
+ - test/more/test_beep.rb
138
141
  - test/more/test_caller.rb
139
142
  - test/more/test_color.rb
140
143
  - test/more/test_multiline_history.rb