brice 0.2.0 → 0.2.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.
- data/README +1 -1
- data/lib/brice/dsl.rb +4 -0
- data/lib/brice/rc/{070_init.rb → 060_init.rb} +0 -0
- data/lib/brice/rc/{080_prompt.rb → 070_prompt.rb} +0 -0
- data/lib/brice/rc/{090_rails.rb → 080_rails.rb} +0 -0
- data/lib/brice/rc/{100_devel.rb → 090_devel.rb} +0 -0
- data/lib/brice/shortcuts.rb +38 -5
- data/lib/brice/version.rb +1 -1
- metadata +8 -9
- data/lib/brice/rc/060_utility_belt.rb +0 -15
data/README
CHANGED
data/lib/brice/dsl.rb
CHANGED
@@ -81,6 +81,10 @@ module Brice
|
|
81
81
|
# rc file where the error occurred.
|
82
82
|
location = caller.find { |c| c !~ %r{(?:\A|/)lib/brice[/.]} }
|
83
83
|
warn "#{err.class}: #{err} [#{location}]"
|
84
|
+
|
85
|
+
warn err.backtrace.map { |line|
|
86
|
+
" from #{line}"
|
87
|
+
}.join("\n") if Brice.verbose
|
84
88
|
end
|
85
89
|
end
|
86
90
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/brice/shortcuts.rb
CHANGED
@@ -76,6 +76,29 @@ module Brice
|
|
76
76
|
|
77
77
|
module ObjectShortcuts
|
78
78
|
|
79
|
+
alias_method :x, :exit
|
80
|
+
|
81
|
+
def cgrep(needle)
|
82
|
+
needle = %r{#{Regexp.escape(needle)}}i unless needle.is_a?(Regexp)
|
83
|
+
|
84
|
+
res = []
|
85
|
+
|
86
|
+
ObjectSpace.each_object { |obj|
|
87
|
+
if obj.is_a?(Class) && obj <= self
|
88
|
+
name = obj.name
|
89
|
+
res << name if name =~ needle
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
res
|
94
|
+
end
|
95
|
+
|
96
|
+
def mgrep(needle)
|
97
|
+
methods.grep(
|
98
|
+
needle.is_a?(Regexp) ? needle : %r{#{Regexp.escape(needle)}}i
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
79
102
|
# Print object methods, sorted by name. (excluding methods that
|
80
103
|
# exist in the class Object)
|
81
104
|
def po(obj = self)
|
@@ -88,15 +111,25 @@ module Brice
|
|
88
111
|
end
|
89
112
|
|
90
113
|
# Cf. <http://rubyforge.org/snippet/detail.php?type=snippet&id=22>
|
91
|
-
def aorta(obj = self)
|
114
|
+
def aorta(obj = self, editor = nil)
|
92
115
|
tempfile = Tempfile.new('aorta')
|
93
116
|
YAML.dump(obj, tempfile)
|
94
117
|
tempfile.close
|
95
118
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
119
|
+
if editor ||= File.which_command(%W[
|
120
|
+
#{ENV['VISUAL']}
|
121
|
+
#{ENV['EDITOR']}
|
122
|
+
/usr/bin/sensible-editor
|
123
|
+
/usr/bin/xdg-open
|
124
|
+
open
|
125
|
+
vi
|
126
|
+
])
|
127
|
+
system(editor, path = tempfile.path)
|
128
|
+
return obj unless File.exists?(path)
|
129
|
+
else
|
130
|
+
warn 'No suitable editor found. Please specify.'
|
131
|
+
return obj
|
132
|
+
end
|
100
133
|
|
101
134
|
content = YAML.load_file(path)
|
102
135
|
tempfile.unlink
|
data/lib/brice/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -51,16 +51,15 @@ files:
|
|
51
51
|
- lib/brice/version.rb
|
52
52
|
- lib/brice/shortcuts.rb
|
53
53
|
- lib/brice/config.rb
|
54
|
+
- lib/brice/rc/090_devel.rb
|
54
55
|
- lib/brice/rc/010_added_methods.rb
|
55
|
-
- lib/brice/rc/060_utility_belt.rb
|
56
56
|
- lib/brice/rc/020_libs.rb
|
57
|
-
- lib/brice/rc/090_rails.rb
|
58
57
|
- lib/brice/rc/030_history.rb
|
59
|
-
- lib/brice/rc/
|
58
|
+
- lib/brice/rc/070_prompt.rb
|
60
59
|
- lib/brice/rc/040_colours.rb
|
61
|
-
- lib/brice/rc/100_devel.rb
|
62
60
|
- lib/brice/rc/050_shortcuts.rb
|
63
|
-
- lib/brice/rc/
|
61
|
+
- lib/brice/rc/060_init.rb
|
62
|
+
- lib/brice/rc/080_rails.rb
|
64
63
|
- lib/brice/dsl.rb
|
65
64
|
- README
|
66
65
|
- ChangeLog
|
@@ -79,7 +78,7 @@ rdoc_options:
|
|
79
78
|
- --charset
|
80
79
|
- UTF-8
|
81
80
|
- --title
|
82
|
-
- brice Application documentation (v0.2.
|
81
|
+
- brice Application documentation (v0.2.1)
|
83
82
|
require_paths:
|
84
83
|
- lib
|
85
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Load selected pieces from {Utility Belt}[http://utilitybelt.rubyforge.org/]
|
2
|
-
|
3
|
-
brice 'utility_belt' => %w[
|
4
|
-
utility_belt/interactive_editor
|
5
|
-
utility_belt/irb_verbosity_control
|
6
|
-
] do |config|
|
7
|
-
|
8
|
-
brice_require 'utility_belt/language_greps' do
|
9
|
-
|
10
|
-
alias :mgrep :grep_methods
|
11
|
-
alias :cgrep :grep_classes
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|