brice 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to brice version 0.2.0
5
+ This documentation refers to brice version 0.2.1
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -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
 
@@ -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
- path = tempfile.path
97
-
98
- system(ENV['VISUAL'] || ENV['EDITOR'] || 'vi', path)
99
- return obj unless File.exists?(path)
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
@@ -4,7 +4,7 @@ module Brice
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  class << self
10
10
 
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
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/070_init.rb
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/080_prompt.rb
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.0)
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