Module: Yap
- Defined in:
- lib/yap.rb,
lib/yap/shell.rb,
lib/yap/world.rb,
lib/yap/world/addons.rb,
lib/yap/configuration.rb,
lib/yap/shell/version.rb
Defined Under Namespace
Modules: Shell
Classes: Configuration, World
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
6
7
8
|
# File 'lib/yap/configuration.rb', line 6
def self.configuration
@configuration ||= Configuration.new
end
|
.parse_cli_args_for_configuration(args, configuration) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/yap.rb', line 13
def self.parse_cli_args_for_configuration(args, configuration)
OptionParser.new do |opts|
opts.on('-h', '--help', 'Prints this help') do
puts opts
exit
end
opts.on('--skip-first-time', 'Disables creating ~/.yap directory on shell startup') do
configuration.skip_first_time = true
end
opts.on('--no-addons', 'Disables auto-loading addons on shell startup') do
configuration.use_addons = false
end
opts.on('--no-history', 'Disables auto-loading or saving history') do
configuration.use_history = false
end
opts.on('--no-rcfiles', 'Disables auto-loading rcfiles on shell startup') do
configuration.use_rcfiles = false
end
end.parse!(args)
end
|
.run_shell(argv) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/yap.rb', line 38
def self.run_shell(argv)
Treefell['shell'].puts "#{self}.#{__callee__} booting shell"
parse_cli_args_for_configuration(argv, configuration)
addons_loaded = []
if configuration.use_addons?
Treefell['shell'].puts "#{self}.#{__callee__} loading addons"
addons_loaded.concat \
World::Addons.load_directories(configuration.addon_paths)
else
Treefell['shell'].puts "#{self}.#{__callee__} skipping addons"
end
if configuration.use_rcfiles?
Treefell['shell'].puts "#{self}.#{__callee__} loading rcfiles"
addons_loaded.concat \
World::Addons.load_rcfiles(configuration.rcfiles)
else
Treefell['shell'].puts "#{self}.#{__callee__} skipping rcfiles"
end
Shell::Impl.new(addons: addons_loaded).repl
end
|