Module: VimDo
- Defined in:
- lib/vimdo.rb,
lib/vimdo/ui.rb,
lib/vimdo/cli.rb,
lib/vimdo/friendly_error.rb
Defined Under Namespace
Classes: CLI, PathError, UI, VimDoError
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.rc ⇒ Object
24
25
26
|
# File 'lib/vimdo.rb', line 24
def rc
@rc ||= File.expand_path("~/.vimdorc")
end
|
.ui ⇒ Object
20
21
22
|
# File 'lib/vimdo.rb', line 20
def ui
@ui ||= UI.new
end
|
Class Method Details
.connect(options = {}) ⇒ Object
28
29
30
31
|
# File 'lib/vimdo.rb', line 28
def connect(options= {})
options[:name] = options[:servername]
Vimrunner::Server.new(options).connect
end
|
.load_recipes ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/vimdo.rb', line 33
def load_recipes
if File.exists?(rc)
settings = YAML::load( File.read(rc) )
settings.fetch(:recipes, []).map {|f| File.expand_path(f) }.each { |rp|
Dir[ File.join(rp, '*.vimdo') ].each { |r|
load r
}
}
end
end
|
.with_friendly_errors ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/vimdo/friendly_error.rb', line 2
def self.with_friendly_errors
yield
rescue VimDo::VimDoError => e
VimDo.ui.error e.message, :wrap => true
VimDo.ui.trace e
exit e.status_code
rescue LoadError => e
raise e unless e.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
VimDo.ui.error "\nCould not load OpenSSL."
VimDo.ui.warn <<-WARN, :wrap => true
You must recompile Ruby with OpenSSL support or change the sources in your \
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
using RVM are available at rvm.io/packages/openssl.
WARN
VimDo.ui.trace e
exit 1
rescue Interrupt => e
VimDo.ui.error "\nQuitting..."
VimDo.ui.trace e
exit 1
rescue SystemExit => e
exit e.status
rescue Exception => e
VimDo.ui.error <<-ERR, :wrap => true
Unfortunately, a fatal error has occurred. Please see the VimDo \
troubleshooting documentation or raise an issue in github. Thanks!
ERR
raise e
end
|