rib 1.2.1 → 1.2.2
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 +4 -4
- data/CHANGES.md +11 -0
- data/lib/rib.rb +42 -9
- data/lib/rib/extra/paging.rb +2 -1
- data/lib/rib/runner.rb +1 -1
- data/lib/rib/version.rb +1 -1
- data/rib.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f4bd09ed661c3e6344b4370d4611ed34e230ce
|
4
|
+
data.tar.gz: 036e0c2191ac6edac8ef36465474d22347519e90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c40b597bbe06db537996568524f21f17789db421e6a15dbc9f269057003f7f037d4d2f3ad38f92ed1d7678cd373f5c5aabbedf8a0a749e94cab8190af23363e3
|
7
|
+
data.tar.gz: 74934c6bf5916c62ad455cde90a4abe3bc6aa72cd57c9a5792b749a0fb0cb65d516b9bc757db14af656116b4f099033b84489b91c87a69edba1c9fcea48105fa
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Rib 1.2.2 -- 2014-01-23
|
4
|
+
|
5
|
+
* From now on, we support project specific config file located on
|
6
|
+
"./.rib/config.rb". Note that if there's a project specific config file,
|
7
|
+
your home config would not be loaded at all. The history file would also
|
8
|
+
be put into "./.rib/history.rb". You might want to ignore it from your
|
9
|
+
repository to avoid leaking confidential information.
|
10
|
+
|
11
|
+
* [extra/paging] Now we strip ANSI sequences before calculating if we need
|
12
|
+
a pager. This should make it much more accurate.
|
13
|
+
|
3
14
|
## Rib 1.2.1 -- 2014-01-18
|
4
15
|
|
5
16
|
* Fixed a bug where it cannot properly elegantly handle errors when loading
|
data/lib/rib.rb
CHANGED
@@ -8,6 +8,8 @@ module Rib
|
|
8
8
|
module_function
|
9
9
|
# All default Rib configs, would be passed to Shell.new in Rib.shell,
|
10
10
|
# but calling Shell.new directly won't bring this in.
|
11
|
+
#
|
12
|
+
# @api public
|
11
13
|
def config
|
12
14
|
@config ||= {:config => File.join(home, 'config.rb'), :name => 'rib'}
|
13
15
|
end
|
@@ -22,10 +24,15 @@ module Rib
|
|
22
24
|
@vars ||= {}
|
23
25
|
end
|
24
26
|
|
25
|
-
# Rib.home is where Rib storing things
|
27
|
+
# Rib.home is where Rib storing things. By default, it goes to '~/.rib',
|
28
|
+
# or somewhere containing a 'config.rb' or 'history.rb' in the order of
|
29
|
+
# './.rib' (project specific config), or '~/.rib' (home config), or
|
30
|
+
# '~/.config/rib' (home config, residing in ~/.config)
|
31
|
+
#
|
32
|
+
# @api public
|
26
33
|
def home
|
27
34
|
ENV['RIB_HOME'] ||= begin
|
28
|
-
['~/.rib', '~/.config/rib'].find{ |path|
|
35
|
+
['./.rib', '~/.rib', '~/.config/rib'].find{ |path|
|
29
36
|
p = File.expand_path(path)
|
30
37
|
File.exist?(File.join(p, 'config.rb')) ||
|
31
38
|
File.exist?(File.join(p, 'history.rb'))
|
@@ -34,8 +41,10 @@ module Rib
|
|
34
41
|
end
|
35
42
|
|
36
43
|
# Convenient shell accessor, which would just give you current last shell
|
37
|
-
# or create one and load
|
38
|
-
#
|
44
|
+
# or create one and load the config file. If you need a clean shell which
|
45
|
+
# does not load config file, use Shell.new instead.
|
46
|
+
#
|
47
|
+
# @api public
|
39
48
|
def shell
|
40
49
|
shells.last || begin
|
41
50
|
require_config if config_path
|
@@ -45,24 +54,34 @@ module Rib
|
|
45
54
|
|
46
55
|
# All plugins which have been loaded into the memory regardless
|
47
56
|
# it's enabled or not.
|
57
|
+
#
|
58
|
+
# @api public
|
48
59
|
def plugins
|
49
60
|
Shell.ancestors[1..-1].select{ |a| a.singleton_class < Plugin }
|
50
61
|
end
|
51
62
|
|
52
63
|
# Convenient way to disable all plugins in the memory.
|
53
64
|
# This could also take a list of plugins and disable them.
|
65
|
+
#
|
66
|
+
# @api public
|
67
|
+
# @param plugs [Array] (Rib.plugins) Plugins which would be disabled.
|
54
68
|
def disable_plugins plugs=plugins
|
55
69
|
plugs.each(&:disable)
|
56
70
|
end
|
57
71
|
|
58
72
|
# Convenient way to enable all plugins in the memory.
|
59
73
|
# This could also take a list of plugins and enable them.
|
74
|
+
#
|
75
|
+
# @api public
|
76
|
+
# @param plugs [Array] (Rib.plugins) Plugins which would be enabled.
|
60
77
|
def enable_plugins plugs=plugins
|
61
78
|
plugs.each(&:enable)
|
62
79
|
end
|
63
80
|
|
64
|
-
# Load (actually require)
|
81
|
+
# Load (actually require) the config file if it exists.
|
65
82
|
# This might emit warnings if there's some error while loading it.
|
83
|
+
#
|
84
|
+
# @api public
|
66
85
|
def require_config
|
67
86
|
return unless config_path
|
68
87
|
result = require(config_path)
|
@@ -73,7 +92,12 @@ module Rib
|
|
73
92
|
" #{Rib::API.format_error(e)}")
|
74
93
|
end
|
75
94
|
|
76
|
-
# The config path where Rib tries to load upon Rib.shell
|
95
|
+
# The config path where Rib tries to load upon Rib.shell or
|
96
|
+
# Rib.require_config. It is depending on where Rib.home was discovered
|
97
|
+
# if no specific config path was specified via -c or --config command
|
98
|
+
# line option. See also Rib.config.
|
99
|
+
#
|
100
|
+
# @api public
|
77
101
|
def config_path
|
78
102
|
return nil unless config[:config]
|
79
103
|
path = File.expand_path(config[:config])
|
@@ -85,19 +109,28 @@ module Rib
|
|
85
109
|
end
|
86
110
|
|
87
111
|
# Say (print to $stdout, with colors in the future, maybe)
|
88
|
-
# something by the name of Rib
|
112
|
+
# something by the name of Rib.
|
113
|
+
#
|
114
|
+
# @api public
|
115
|
+
# @param words [Array[String]] Words you want to say.
|
89
116
|
def say *words
|
90
117
|
$stdout.puts(Rib.prepare(words))
|
91
118
|
end
|
92
119
|
|
93
120
|
# Warn (print to $stderr, with colors in the future, maybe)
|
94
|
-
# something by the name of Rib
|
121
|
+
# something by the name of Rib.
|
122
|
+
#
|
123
|
+
# @api public
|
124
|
+
# @param words [Array[String]] Words you want to warn.
|
95
125
|
def warn *words
|
96
126
|
$stderr.puts(Rib.prepare(words))
|
97
127
|
end
|
98
128
|
|
99
129
|
# Warn (print to $stderr, with colors in the future, maybe)
|
100
|
-
# something by the name of Rib and then exit(1)
|
130
|
+
# something by the name of Rib and then exit(1).
|
131
|
+
#
|
132
|
+
# @api public
|
133
|
+
# @param words [Array[String]] Words you want to warn before aborting.
|
101
134
|
def abort *words
|
102
135
|
warn(words)
|
103
136
|
exit(1)
|
data/lib/rib/extra/paging.rb
CHANGED
@@ -24,7 +24,8 @@ module Rib::Paging
|
|
24
24
|
# `less -X` would mess up the buffers, so it's not desired, either.
|
25
25
|
def one_screen? output
|
26
26
|
cols, lines = `tput cols`.to_i, `tput lines`.to_i
|
27
|
-
output.count("\n") <= lines &&
|
27
|
+
output.count("\n") <= lines &&
|
28
|
+
output.gsub(/\e\[[^m]*m/, '').size <= cols * lines
|
28
29
|
end
|
29
30
|
|
30
31
|
def page_result output
|
data/lib/rib/runner.rb
CHANGED
@@ -13,7 +13,7 @@ module Rib::Runner
|
|
13
13
|
'Set debugging flags (set $DEBUG to true)' ],
|
14
14
|
|
15
15
|
['-w, --warn' ,
|
16
|
-
'Turn warnings on
|
16
|
+
'Turn warnings on (set $-w and $VERBOSE to true)' ],
|
17
17
|
|
18
18
|
['-I, --include PATH' ,
|
19
19
|
'Specify $LOAD_PATH (may be used more than once)' ],
|
data/lib/rib/version.rb
CHANGED
data/rib.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rib 1.2.
|
2
|
+
# stub: rib 1.2.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rib"
|
6
|
-
s.version = "1.2.
|
6
|
+
s.version = "1.2.2"
|
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-01-
|
11
|
+
s.date = "2014-01-23"
|
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 = [
|
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.2.
|
4
|
+
version: 1.2.2
|
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: 2014-01-
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|