brice 0.2.8 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog +18 -0
- data/README +6 -8
- data/Rakefile +12 -9
- data/lib/brice.rb +28 -26
- data/lib/brice/colours.rb +234 -232
- data/lib/brice/config.rb +2 -3
- data/lib/brice/dsl.rb +1 -3
- data/lib/brice/history.rb +8 -8
- data/lib/brice/loud.rb +1 -1
- data/lib/brice/rc/{010_added_methods.rb → 010_added_methods_.rb} +0 -0
- data/lib/brice/rc/{040_colours.rb → 040_colours_.rb} +0 -0
- data/lib/brice/rc/060_init.rb +3 -3
- data/lib/brice/rc/070_prompt.rb +13 -13
- data/lib/brice/rc/080_rails.rb +6 -6
- data/lib/brice/really_loud.rb +1 -1
- data/lib/brice/shortcuts.rb +14 -13
- data/lib/brice/version.rb +2 -2
- data/spec/brice/history_spec.rb +11 -13
- data/spec/spec_helper.rb +3 -2
- metadata +80 -28
- data/.rspec +0 -3
data/lib/brice/config.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# #
|
4
4
|
# A component of brice, the extra cool IRb goodness donator #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2008-
|
6
|
+
# Copyright (C) 2008-2014 Jens Wille #
|
7
7
|
# #
|
8
8
|
# Authors: #
|
9
9
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -25,7 +25,6 @@
|
|
25
25
|
#++
|
26
26
|
|
27
27
|
require 'ostruct'
|
28
|
-
require 'brice'
|
29
28
|
|
30
29
|
module Brice
|
31
30
|
|
@@ -62,7 +61,7 @@ module Brice
|
|
62
61
|
|
63
62
|
def initialize(packages = [])
|
64
63
|
@packages = Hash.new { |h, k| h[k] = PackageConfig.new }
|
65
|
-
packages
|
64
|
+
self.include(*packages)
|
66
65
|
end
|
67
66
|
|
68
67
|
# call-seq:
|
data/lib/brice/dsl.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# #
|
4
4
|
# A component of brice, the extra cool IRb goodness donator #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2008-
|
6
|
+
# Copyright (C) 2008-2014 Jens Wille #
|
7
7
|
# #
|
8
8
|
# Authors: #
|
9
9
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -27,8 +27,6 @@
|
|
27
27
|
require 'nuggets/object/silence_mixin'
|
28
28
|
require 'nuggets/env/set'
|
29
29
|
|
30
|
-
require 'brice'
|
31
|
-
|
32
30
|
module Brice
|
33
31
|
|
34
32
|
# Certain global helper methods for use inside IRb extensions. Also
|
data/lib/brice/history.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# #
|
4
4
|
# A component of brice, the extra cool IRb goodness donator #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2008-
|
6
|
+
# Copyright (C) 2008-2014 Jens Wille #
|
7
7
|
# #
|
8
8
|
# Authors: #
|
9
9
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -24,8 +24,6 @@
|
|
24
24
|
###############################################################################
|
25
25
|
#++
|
26
26
|
|
27
|
-
require 'brice'
|
28
|
-
|
29
27
|
module Brice
|
30
28
|
|
31
29
|
# IRb history support.
|
@@ -45,11 +43,11 @@ module Brice
|
|
45
43
|
class History
|
46
44
|
|
47
45
|
DEFAULTS = {
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
|
52
|
-
:
|
46
|
+
path: ENV['IRB_HISTORY_FILE'] || File.join(ENV.user_home, '.irb_history'),
|
47
|
+
size: (ENV['IRB_HISTORY_SIZE'] || 1000).to_i,
|
48
|
+
perms: File::WRONLY | File::CREAT | File::TRUNC,
|
49
|
+
uniq: :reverse,
|
50
|
+
merge: true
|
53
51
|
}
|
54
52
|
|
55
53
|
def self.init(opt = {})
|
@@ -93,6 +91,8 @@ module Brice
|
|
93
91
|
end
|
94
92
|
|
95
93
|
def load_history(history = @history)
|
94
|
+
@first_line = nil
|
95
|
+
|
96
96
|
return unless File.readable?(@path)
|
97
97
|
read_history { |line| history << line }
|
98
98
|
|
data/lib/brice/loud.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'brice'
|
2
|
-
Brice.init(:
|
2
|
+
Brice.init(quiet: false)
|
File without changes
|
File without changes
|
data/lib/brice/rc/060_init.rb
CHANGED
data/lib/brice/rc/070_prompt.rb
CHANGED
@@ -17,8 +17,8 @@ brice 'prompt' => nil do |config|
|
|
17
17
|
alias_method :_brice_original_evaluate, :evaluate
|
18
18
|
|
19
19
|
# Capture execution time
|
20
|
-
def evaluate(*a)
|
21
|
-
@_brice_tms = Benchmark.measure { _brice_original_evaluate(*a) }
|
20
|
+
def evaluate(*a, **o)
|
21
|
+
@_brice_tms = Benchmark.measure { _brice_original_evaluate(*a, **o) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -39,20 +39,20 @@ brice 'prompt' => nil do |config|
|
|
39
39
|
lambda { |rt| "#{rt} => %s\n" } : "=> %s\n"
|
40
40
|
|
41
41
|
IRB.conf[:PROMPT].update(
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
42
|
+
BRICE_SIMPLE: {
|
43
|
+
PROMPT_I: ' ',
|
44
|
+
PROMPT_S: ' ',
|
45
|
+
PROMPT_C: ' ',
|
46
|
+
RETURN: prompt_return
|
47
47
|
},
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
48
|
+
BRICE_VERBOSE: {
|
49
|
+
PROMPT_I: "#{prefix}> ",
|
50
|
+
PROMPT_S: "#{prefix}> ",
|
51
|
+
PROMPT_C: "#{prefix}> ",
|
52
|
+
RETURN: prompt_return
|
53
53
|
}
|
54
54
|
)
|
55
55
|
|
56
|
-
IRB.conf[:PROMPT_MODE] =
|
56
|
+
IRB.conf[:PROMPT_MODE] = :BRICE_VERBOSE if IRB.conf[:PROMPT_MODE] == :DEFAULT
|
57
57
|
|
58
58
|
end
|
data/lib/brice/rc/080_rails.rb
CHANGED
@@ -24,10 +24,10 @@ brice 'rails' => nil do |config|
|
|
24
24
|
IRB.conf[:PROMPT] ||= {}
|
25
25
|
|
26
26
|
IRB.conf[:PROMPT][:BRICE_RAILS] = {
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
27
|
+
PROMPT_I: prompt,
|
28
|
+
PROMPT_S: prompt,
|
29
|
+
PROMPT_C: prompt,
|
30
|
+
RETURN: IRB.conf[:PROMPT][:BRICE_SIMPLE] ?
|
31
31
|
IRB.conf[:PROMPT][:BRICE_SIMPLE][:RETURN] : "=> %s\n"
|
32
32
|
}
|
33
33
|
|
@@ -40,7 +40,7 @@ brice 'rails' => nil do |config|
|
|
40
40
|
Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
|
41
41
|
}
|
42
42
|
|
43
|
-
define_irb_method(:logger) { |*args|
|
43
|
+
define_irb_method(:logger) { |*args, &block|
|
44
44
|
if args.empty?
|
45
45
|
RAILS_DEFAULT_LOGGER
|
46
46
|
else
|
@@ -51,7 +51,7 @@ brice 'rails' => nil do |config|
|
|
51
51
|
|
52
52
|
if block_given?
|
53
53
|
begin
|
54
|
-
|
54
|
+
block.call
|
55
55
|
ensure
|
56
56
|
logger.level = previous_level
|
57
57
|
end
|
data/lib/brice/really_loud.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'brice'
|
2
|
-
Brice.init(:
|
2
|
+
Brice.init(quiet: false, verbose: true)
|
data/lib/brice/shortcuts.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# #
|
4
4
|
# A component of brice, the extra cool IRb goodness donator #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2008-
|
6
|
+
# Copyright (C) 2008-2014 Jens Wille #
|
7
7
|
# #
|
8
8
|
# Authors: #
|
9
9
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -25,14 +25,22 @@
|
|
25
25
|
#++
|
26
26
|
|
27
27
|
require 'nuggets/file/which'
|
28
|
-
require 'brice'
|
29
28
|
|
30
29
|
module Brice
|
31
30
|
|
31
|
+
EDITORS = %W[
|
32
|
+
#{ENV['VISUAL']}
|
33
|
+
#{ENV['EDITOR']}
|
34
|
+
/usr/bin/sensible-editor
|
35
|
+
/usr/bin/xdg-open
|
36
|
+
open
|
37
|
+
vi
|
38
|
+
]
|
39
|
+
|
32
40
|
# Convenient shortcut methods.
|
33
41
|
#
|
34
|
-
# Set <tt>config.shortcuts.opt = { :
|
35
|
-
# ObjectShortcuts, or <tt>config.shortcuts.opt = { :
|
42
|
+
# Set <tt>config.shortcuts.opt = { object: false }</tt> to disable
|
43
|
+
# ObjectShortcuts, or <tt>config.shortcuts.opt = { ri: false }</tt>
|
36
44
|
# to disable #ri shortcuts.
|
37
45
|
|
38
46
|
module Shortcuts
|
@@ -55,7 +63,7 @@ module Brice
|
|
55
63
|
end
|
56
64
|
|
57
65
|
def ri!(*args)
|
58
|
-
opts, args = args.partition { |arg| arg.to_s
|
66
|
+
opts, args = args.partition { |arg| arg.to_s.start_with?('--') }
|
59
67
|
|
60
68
|
args.empty? ? args << name : args.map! { |arg|
|
61
69
|
arg, method = arg.to_s, nil
|
@@ -124,14 +132,7 @@ module Brice
|
|
124
132
|
YAML.dump(obj, tempfile)
|
125
133
|
tempfile.close
|
126
134
|
|
127
|
-
if editor ||= File.which_command(
|
128
|
-
#{ENV['VISUAL']}
|
129
|
-
#{ENV['EDITOR']}
|
130
|
-
/usr/bin/sensible-editor
|
131
|
-
/usr/bin/xdg-open
|
132
|
-
open
|
133
|
-
vi
|
134
|
-
])
|
135
|
+
if editor ||= File.which_command(EDITORS)
|
135
136
|
system(editor, path = tempfile.path)
|
136
137
|
return obj unless File.exists?(path)
|
137
138
|
else
|
data/lib/brice/version.rb
CHANGED
data/spec/brice/history_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'brice/history'
|
2
|
-
|
3
1
|
describe Brice::History do
|
4
2
|
|
5
3
|
def hist
|
@@ -7,7 +5,7 @@ describe Brice::History do
|
|
7
5
|
end
|
8
6
|
|
9
7
|
def init_hist(opt = {})
|
10
|
-
@hist = Brice::History.new(opt.merge(:
|
8
|
+
@hist = Brice::History.new(opt.merge(path: @path), hist)
|
11
9
|
end
|
12
10
|
|
13
11
|
def saved_hist
|
@@ -23,8 +21,8 @@ describe Brice::History do
|
|
23
21
|
|
24
22
|
describe 'no uniq, no merge' do
|
25
23
|
|
26
|
-
before
|
27
|
-
init_hist(:
|
24
|
+
before do
|
25
|
+
init_hist(uniq: false, merge: false)
|
28
26
|
end
|
29
27
|
|
30
28
|
example { compare_hist(%w[]) }
|
@@ -37,8 +35,8 @@ describe Brice::History do
|
|
37
35
|
|
38
36
|
describe 'uniq, no merge' do
|
39
37
|
|
40
|
-
before
|
41
|
-
init_hist(:
|
38
|
+
before do
|
39
|
+
init_hist(uniq: true, merge: false)
|
42
40
|
end
|
43
41
|
|
44
42
|
example { compare_hist(%w[]) }
|
@@ -51,8 +49,8 @@ describe Brice::History do
|
|
51
49
|
|
52
50
|
describe 'uniq, merge' do
|
53
51
|
|
54
|
-
before
|
55
|
-
init_hist(:
|
52
|
+
before do
|
53
|
+
init_hist(uniq: true, merge: true)
|
56
54
|
end
|
57
55
|
|
58
56
|
example { compare_hist(%w[]) }
|
@@ -66,8 +64,8 @@ describe Brice::History do
|
|
66
64
|
|
67
65
|
describe 'reverse uniq, no merge' do
|
68
66
|
|
69
|
-
before
|
70
|
-
init_hist(:
|
67
|
+
before do
|
68
|
+
init_hist(uniq: :reverse, merge: false)
|
71
69
|
end
|
72
70
|
|
73
71
|
example { compare_hist(%w[]) }
|
@@ -80,8 +78,8 @@ describe Brice::History do
|
|
80
78
|
|
81
79
|
describe 'reverse uniq, merge' do
|
82
80
|
|
83
|
-
before
|
84
|
-
init_hist(:
|
81
|
+
before do
|
82
|
+
init_hist(uniq: :reverse, merge: true)
|
85
83
|
end
|
86
84
|
|
87
85
|
example { compare_hist(%w[]) }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'brice'
|
3
2
|
require 'tempfile'
|
4
3
|
|
5
4
|
RSpec.configure { |config|
|
5
|
+
config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
|
6
|
+
|
6
7
|
config.before(:each) { open_tempfile }
|
7
8
|
config.after(:each) { close_tempfile }
|
8
9
|
|
metadata
CHANGED
@@ -1,29 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: nuggets
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hen
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.9.1
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.9'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.9.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
27
75
|
description: Extra cool IRb goodness for the masses
|
28
76
|
email: jens.wille@gmail.com
|
29
77
|
executables: []
|
@@ -33,6 +81,11 @@ extra_rdoc_files:
|
|
33
81
|
- COPYING
|
34
82
|
- ChangeLog
|
35
83
|
files:
|
84
|
+
- COPYING
|
85
|
+
- ChangeLog
|
86
|
+
- README
|
87
|
+
- Rakefile
|
88
|
+
- TODO
|
36
89
|
- lib/brice.rb
|
37
90
|
- lib/brice/colours.rb
|
38
91
|
- lib/brice/config.rb
|
@@ -40,10 +93,10 @@ files:
|
|
40
93
|
- lib/brice/history.rb
|
41
94
|
- lib/brice/init.rb
|
42
95
|
- lib/brice/loud.rb
|
43
|
-
- lib/brice/rc/
|
96
|
+
- lib/brice/rc/010_added_methods_.rb
|
44
97
|
- lib/brice/rc/020_libs.rb
|
45
98
|
- lib/brice/rc/030_history.rb
|
46
|
-
- lib/brice/rc/
|
99
|
+
- lib/brice/rc/040_colours_.rb
|
47
100
|
- lib/brice/rc/050_shortcuts.rb
|
48
101
|
- lib/brice/rc/060_init.rb
|
49
102
|
- lib/brice/rc/070_prompt.rb
|
@@ -52,42 +105,41 @@ files:
|
|
52
105
|
- lib/brice/really_loud.rb
|
53
106
|
- lib/brice/shortcuts.rb
|
54
107
|
- lib/brice/version.rb
|
55
|
-
- COPYING
|
56
|
-
- ChangeLog
|
57
|
-
- README
|
58
|
-
- Rakefile
|
59
|
-
- TODO
|
60
108
|
- spec/brice/history_spec.rb
|
61
109
|
- spec/spec_helper.rb
|
62
|
-
- .rspec
|
63
110
|
homepage: http://github.com/blackwinter/brice
|
64
|
-
licenses:
|
111
|
+
licenses:
|
112
|
+
- AGPL-3.0
|
65
113
|
metadata: {}
|
66
|
-
post_install_message:
|
114
|
+
post_install_message: |2+
|
115
|
+
|
116
|
+
brice-0.4.2 [2020-09-17]:
|
117
|
+
|
118
|
+
* Ruby 2.7 compatibility.
|
119
|
+
|
67
120
|
rdoc_options:
|
68
|
-
- --
|
121
|
+
- "--title"
|
122
|
+
- brice Application documentation (v0.4.2)
|
123
|
+
- "--charset"
|
69
124
|
- UTF-8
|
70
|
-
- --line-numbers
|
71
|
-
- --all
|
72
|
-
- --
|
73
|
-
- brice Application documentation (v0.2.8)
|
74
|
-
- --main
|
125
|
+
- "--line-numbers"
|
126
|
+
- "--all"
|
127
|
+
- "--main"
|
75
128
|
- README
|
76
129
|
require_paths:
|
77
130
|
- lib
|
78
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
132
|
requirements:
|
80
|
-
- -
|
133
|
+
- - ">="
|
81
134
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
135
|
+
version: 1.9.3
|
83
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
137
|
requirements:
|
85
|
-
- -
|
138
|
+
- - ">="
|
86
139
|
- !ruby/object:Gem::Version
|
87
140
|
version: '0'
|
88
141
|
requirements: []
|
89
|
-
|
90
|
-
rubygems_version: 2.0.3
|
142
|
+
rubygems_version: 3.1.2
|
91
143
|
signing_key:
|
92
144
|
specification_version: 4
|
93
145
|
summary: Extra cool IRb goodness for the masses
|