rib 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGES.md +9 -0
- data/README.md +76 -7
- data/lib/rib/app/auto.rb +4 -6
- data/lib/rib/app/rails.rb +1 -1
- data/lib/rib/runner.rb +19 -19
- data/lib/rib/version.rb +1 -1
- data/lib/rib.rb +17 -25
- data/rib.gemspec +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2179819cb0fd07bfd02d5fff9313d0b72a6d3bfe
|
4
|
+
data.tar.gz: cb65c6407da421a2a6013bce9d3de585a73175f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d3e07839f36a11e48295a8b6b4fc605941acf1ad2dd0cfdc37b33d873393e287a3e62bcc69eae106ea8e5623c1a2250d01d8d367658adc629cb8947865a260b
|
7
|
+
data.tar.gz: b183b7adae908696abf296133f2cce5cecd21fa8a6cd7dffe0cc62fffb239e887ad8ba2edd8082b3aeccebe0cf7fa76352aaba4e25e5bbea579802cbf86c0d0d
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Rib 1.4.0 -- 2016-11-11
|
4
|
+
|
5
|
+
* Search Rib home by directories rather than config/history file.
|
6
|
+
* Respect prefix option for detecting Rib home.
|
7
|
+
* Update help message for `-n`, which won't load any config.
|
8
|
+
* Change `Rib.config[:config]` to `Rib.config_path`.
|
9
|
+
* [app/rails] Fix loading boot file when using prefix option.
|
10
|
+
* [app/auto] Fix two variable shadowing warnings.
|
11
|
+
|
3
12
|
## Rib 1.3.1 -- 2016-11-03
|
4
13
|
|
5
14
|
* [core/strip_backtrace], [more/color] No longer show `./` for current path.
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ by Lin Jen-Shin ([godfat](http://godfat.org))
|
|
7
7
|
* [github](https://github.com/godfat/rib)
|
8
8
|
* [rubygems](https://rubygems.org/gems/rib)
|
9
9
|
* [rdoc](http://rdoc.info/github/godfat/rib)
|
10
|
+
* [issues](https://github.com/godfat/rib/issues) (feel free to ask for support)
|
10
11
|
|
11
12
|
## DESCRIPTION:
|
12
13
|
|
@@ -87,12 +88,15 @@ As a fully featured app console (yes, some commands could be used together)
|
|
87
88
|
|
88
89
|
rib all auto # or `rib auto all`, the order doesn't really matter
|
89
90
|
|
91
|
+
#### Customization
|
92
|
+
|
90
93
|
You can customize Rib's behaviour by setting a config file located at
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
`$RIB_HOME/config.rb`, or `./.rib/config.rb`, or `~/.rib/config.rb`, or
|
95
|
+
`~/.config/rib/config.rb`, searched by respected order. The default
|
96
|
+
would be `~/.rib/config.rb`. Since it's merely a Ruby script which would
|
97
|
+
be loaded into memory before launching Rib shell session, You can put any
|
98
|
+
customization or monkey patch there. Personally, I use all plugins provided
|
99
|
+
by Rib.
|
96
100
|
|
97
101
|
My Personal [~/.config/rib/config](https://github.com/godfat/dev-tool/blob/master/.config/rib/config.rb)
|
98
102
|
|
@@ -132,12 +136,77 @@ file. To see a list of overridable API, please read [api.rb][]
|
|
132
136
|
|
133
137
|
[api.rb]: https://github.com/godfat/rib/blob/master/lib/rib/api.rb
|
134
138
|
|
139
|
+
#### Rib home and history file
|
140
|
+
|
141
|
+
Rib home is used to store a config file and a history file, which is
|
142
|
+
searched in this order:
|
143
|
+
|
144
|
+
* $RIB_HOME
|
145
|
+
* ./.rib
|
146
|
+
* ~/.rib
|
147
|
+
* ~/.config/rib
|
148
|
+
|
149
|
+
Rib would stop searching whenever the directory is found. If none could be
|
150
|
+
found, the default would be:
|
151
|
+
|
152
|
+
* ~/.rib
|
153
|
+
|
154
|
+
So the default history file would be located at `~/.rib/history.rb`.
|
155
|
+
|
156
|
+
#### Project config and history
|
157
|
+
|
158
|
+
Since `./.rib` would be searched before `~/.rib`, you could create project
|
159
|
+
level config at the project directory, and the history would also be
|
160
|
+
separated from each other, located at the respected `./.rib/history.rb`.
|
161
|
+
|
162
|
+
To do this, you don't really have to create a project config. Creating an
|
163
|
+
empty directory for Rib home at the project directory would also work.
|
164
|
+
|
165
|
+
#### Project directory and command line options
|
166
|
+
|
167
|
+
You could set the project directory by using `-p, --prefix` command line
|
168
|
+
option. So consider this:
|
169
|
+
|
170
|
+
cd ~/project
|
171
|
+
rib auto
|
172
|
+
|
173
|
+
Would work the same as:
|
174
|
+
|
175
|
+
cd /tmp
|
176
|
+
rib -p ~/project auto
|
177
|
+
|
178
|
+
And the project config and history would be located at `~/project/.rib`.
|
179
|
+
|
180
|
+
To check for more command line options, run `rib -h`:
|
181
|
+
|
182
|
+
```
|
183
|
+
Usage: rib [ruby OPTIONS] [rib OPTIONS] [rib COMMANDS]
|
184
|
+
ruby options:
|
185
|
+
-e, --eval LINE Evaluate a LINE of code
|
186
|
+
-d, --debug Set debugging flags (set $DEBUG to true)
|
187
|
+
-w, --warn Turn warnings on (set $-w and $VERBOSE to true)
|
188
|
+
-I, --include PATH Specify $LOAD_PATH (may be used more than once)
|
189
|
+
-r, --require LIBRARY Require the library, before executing your script
|
190
|
+
rib options:
|
191
|
+
-c, --config FILE Load config from FILE
|
192
|
+
-p, --prefix PATH Prefix to locate the app. Default to .
|
193
|
+
-n, --no-config Suppress loading ~/.config/rib/config.rb
|
194
|
+
-h, --help Print this message
|
195
|
+
-v, --version Print the version
|
196
|
+
rib commands:
|
197
|
+
min Run the minimum essence
|
198
|
+
auto Run as Rails or Ramaze console (auto-detect)
|
199
|
+
all Load all recommended plugins
|
200
|
+
rails Run as Rails console
|
201
|
+
rack Run as Rack console
|
202
|
+
ramaze Run as Ramaze console
|
203
|
+
```
|
204
|
+
|
135
205
|
#### Basic configuration
|
136
206
|
|
137
207
|
Rib.config | Functionality
|
138
208
|
-------------------------- | -------------------------------------------------
|
139
209
|
ENV['RIB_HOME'] | Specify where Rib should store config and history
|
140
|
-
Rib.config[:config] | The path where config should be located
|
141
210
|
Rib.config[:name] | The name of this shell
|
142
211
|
Rib.config[:result_prompt] | Default is "=>"
|
143
212
|
Rib.config[:prompt] | Default is ">>"
|
@@ -149,7 +218,7 @@ Rib.config[:exit] | Commands to exit, default [nil] # control+d
|
|
149
218
|
Rib.config | Functionality
|
150
219
|
------------------------------ | ---------------------------------------------
|
151
220
|
Rib.config[:completion] | Completion: Bond config
|
152
|
-
Rib.config[:history_file] | Default is "~/.rib/
|
221
|
+
Rib.config[:history_file] | Default is "~/.rib/history.rb"
|
153
222
|
Rib.config[:history_size] | Default is 500
|
154
223
|
Rib.config[:color] | A hash of Class => :color mapping
|
155
224
|
Rib.config[:autoindent_spaces] | How to indent? Default is two spaces: ' '
|
data/lib/rib/app/auto.rb
CHANGED
@@ -3,12 +3,10 @@ module Rib; end
|
|
3
3
|
module Rib::Auto
|
4
4
|
module_function
|
5
5
|
def load
|
6
|
-
app, name = %w[ramaze rails rack].find{ |
|
7
|
-
require "rib/app/#{
|
8
|
-
|
9
|
-
if
|
10
|
-
break app, name
|
11
|
-
end
|
6
|
+
app, name = %w[ramaze rails rack].find{ |n|
|
7
|
+
require "rib/app/#{n}"
|
8
|
+
a = Rib.const_get(n.capitalize)
|
9
|
+
break a, n if a.public_send("#{n}?")
|
12
10
|
}
|
13
11
|
|
14
12
|
if app
|
data/lib/rib/app/rails.rb
CHANGED
data/lib/rib/runner.rb
CHANGED
@@ -5,28 +5,28 @@ module Rib::Runner
|
|
5
5
|
module_function
|
6
6
|
def options
|
7
7
|
@options ||=
|
8
|
-
[['ruby options:' , ''
|
9
|
-
['-e, --eval LINE'
|
10
|
-
'Evaluate a LINE of code'
|
8
|
+
[['ruby options:' , '' ],
|
9
|
+
['-e, --eval LINE' ,
|
10
|
+
'Evaluate a LINE of code' ],
|
11
11
|
|
12
|
-
['-d, --debug'
|
13
|
-
'Set debugging flags (set $DEBUG to true)'
|
12
|
+
['-d, --debug' ,
|
13
|
+
'Set debugging flags (set $DEBUG to true)' ],
|
14
14
|
|
15
|
-
['-w, --warn'
|
16
|
-
'Turn warnings on (set $-w and $VERBOSE to true)'
|
15
|
+
['-w, --warn' ,
|
16
|
+
'Turn warnings on (set $-w and $VERBOSE to true)' ],
|
17
17
|
|
18
|
-
['-I, --include PATH'
|
19
|
-
'Specify $LOAD_PATH (may be used more than once)'
|
18
|
+
['-I, --include PATH' ,
|
19
|
+
'Specify $LOAD_PATH (may be used more than once)' ],
|
20
20
|
|
21
|
-
['-r, --require LIBRARY'
|
22
|
-
'Require the library, before executing your script'
|
21
|
+
['-r, --require LIBRARY' ,
|
22
|
+
'Require the library, before executing your script' ],
|
23
23
|
|
24
|
-
['rib options:' , ''
|
25
|
-
['-c, --config FILE', 'Load config from FILE'
|
26
|
-
['-p, --prefix PATH', 'Prefix to locate the app. Default to .'
|
27
|
-
['-n, --no-config' , 'Suppress loading
|
28
|
-
['-h, --help' , 'Print this message'
|
29
|
-
['-v, --version' , 'Print the version'
|
24
|
+
['rib options:' , '' ],
|
25
|
+
['-c, --config FILE', 'Load config from FILE' ],
|
26
|
+
['-p, --prefix PATH', 'Prefix to locate the app. Default to .'],
|
27
|
+
['-n, --no-config' , 'Suppress loading any config' ],
|
28
|
+
['-h, --help' , 'Print this message' ],
|
29
|
+
['-v, --version' , 'Print the version' ]] +
|
30
30
|
|
31
31
|
[['rib commands:' , '']] + commands
|
32
32
|
end
|
@@ -120,13 +120,13 @@ module Rib::Runner
|
|
120
120
|
require($1 || argv.shift)
|
121
121
|
|
122
122
|
when /^-c=?(.+)?/, /^--config=?(.+)?/
|
123
|
-
Rib.
|
123
|
+
Rib.config_path = $1 || argv.shift
|
124
124
|
|
125
125
|
when /^-p=?(.+)?/, /^--prefix=?(.+)?/
|
126
126
|
Rib.config[:prefix] = $1 || argv.shift
|
127
127
|
|
128
128
|
when /^-n/, '--no-config'
|
129
|
-
Rib.
|
129
|
+
Rib.config_path = Rib::Skip
|
130
130
|
parse_next(argv, arg)
|
131
131
|
|
132
132
|
when /^-h/, '--help'
|
data/lib/rib/version.rb
CHANGED
data/lib/rib.rb
CHANGED
@@ -11,9 +11,7 @@ module Rib
|
|
11
11
|
#
|
12
12
|
# @api public
|
13
13
|
def config
|
14
|
-
@config ||= {:name => 'rib',
|
15
|
-
:config => File.join(home, 'config.rb'),
|
16
|
-
:prefix => '.'}
|
14
|
+
@config ||= {:name => 'rib', :prefix => '.'}
|
17
15
|
end
|
18
16
|
|
19
17
|
# All shells in the memory
|
@@ -33,13 +31,11 @@ module Rib
|
|
33
31
|
#
|
34
32
|
# @api public
|
35
33
|
def home
|
36
|
-
ENV['RIB_HOME'] ||=
|
37
|
-
[
|
38
|
-
|
39
|
-
File.exist?(File.join(p, 'config.rb')) ||
|
40
|
-
File.exist?(File.join(p, 'history.rb'))
|
34
|
+
ENV['RIB_HOME'] ||= File.expand_path(
|
35
|
+
["#{config[:prefix]}/.rib", '~/.rib', '~/.config/rib'].find{ |path|
|
36
|
+
File.exist?(File.expand_path(path))
|
41
37
|
} || '~/.rib'
|
42
|
-
|
38
|
+
)
|
43
39
|
end
|
44
40
|
|
45
41
|
# Convenient shell accessor, which would just give you current last shell
|
@@ -49,7 +45,7 @@ module Rib
|
|
49
45
|
# @api public
|
50
46
|
def shell
|
51
47
|
shells.last || begin
|
52
|
-
require_config if config_path
|
48
|
+
require_config if config_path && config_path != Skip
|
53
49
|
(shells << Shell.new(config)).last
|
54
50
|
end
|
55
51
|
end
|
@@ -59,7 +55,7 @@ module Rib
|
|
59
55
|
#
|
60
56
|
# @api public
|
61
57
|
def plugins
|
62
|
-
Shell.ancestors
|
58
|
+
Shell.ancestors.drop(1).select{ |a| a.singleton_class < Plugin }
|
63
59
|
end
|
64
60
|
|
65
61
|
# Convenient way to disable all plugins in the memory.
|
@@ -85,29 +81,25 @@ module Rib
|
|
85
81
|
#
|
86
82
|
# @api public
|
87
83
|
def require_config
|
88
|
-
|
89
|
-
result = require(config_path)
|
84
|
+
result = require(config_path) if File.exist?(config_path)
|
90
85
|
Rib.say("Config loaded from: #{config_path}") if $VERBOSE && result
|
91
86
|
result
|
92
87
|
rescue StandardError, LoadError, SyntaxError => e
|
93
|
-
Rib.warn("Error loading #{
|
88
|
+
Rib.warn("Error loading #{config_path}\n" \
|
94
89
|
" #{Rib::API.format_error(e)}")
|
95
90
|
end
|
96
91
|
|
97
|
-
# The config path where Rib tries to load upon Rib.shell
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# line option. See also Rib.config.
|
92
|
+
# The config path where Rib tries to load upon Rib.shell.
|
93
|
+
# It is depending on where Rib.home was discovered if
|
94
|
+
# no specific config path was specified via -c or --config command
|
101
95
|
#
|
102
96
|
# @api public
|
103
97
|
def config_path
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
nil
|
110
|
-
end
|
98
|
+
@config_path ||= File.join(home, 'config.rb')
|
99
|
+
end
|
100
|
+
|
101
|
+
def config_path= new_path
|
102
|
+
@config_path = new_path
|
111
103
|
end
|
112
104
|
|
113
105
|
# Say (print to $stdout, with colors in the future, maybe)
|
data/rib.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rib 1.
|
2
|
+
# stub: rib 1.4.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rib".freeze
|
6
|
-
s.version = "1.
|
6
|
+
s.version = "1.4.0"
|
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 = "2016-11-
|
11
|
+
s.date = "2016-11-11"
|
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 = [
|
@@ -89,7 +89,7 @@ Gem::Specification.new do |s|
|
|
89
89
|
"test/test_shell.rb".freeze]
|
90
90
|
s.homepage = "https://github.com/godfat/rib".freeze
|
91
91
|
s.licenses = ["Apache License 2.0".freeze]
|
92
|
-
s.rubygems_version = "2.6.
|
92
|
+
s.rubygems_version = "2.6.8".freeze
|
93
93
|
s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell".freeze
|
94
94
|
s.test_files = [
|
95
95
|
"test/core/test_completion.rb".freeze,
|
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.
|
4
|
+
version: 1.4.0
|
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: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.6.
|
124
|
+
rubygems_version: 2.6.8
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|