Module: Nib::History
Defined Under Namespace
Modules: ClassMethods
Classes: Compose, Config
Constant Summary
collapse
- PATH =
'/usr/local/history'.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.prepended(base) ⇒ Object
4
5
6
7
8
|
# File 'lib/nib/history.rb', line 4
def self.prepended(base)
base.instance_eval do
extend ClassMethods
end
end
|
Instance Method Details
#alternate_compose_file ⇒ Object
37
38
39
|
# File 'lib/nib/history.rb', line 37
def alternate_compose_file
"-f #{Compose.new.path}"
end
|
#command ⇒ Object
31
32
33
34
35
|
# File 'lib/nib/history.rb', line 31
def command
return if self.class.history_requires_command? && @command.to_s.empty?
wrap(super)
end
|
#irbrc ⇒ Object
41
42
43
44
45
46
|
# File 'lib/nib/history.rb', line 41
def irbrc
@irbrc ||= Config.new(
:irbrc,
"IRB.conf[:HISTORY_FILE] = '#{PATH}/irb_history'"
)
end
|
#pryrc ⇒ Object
48
49
50
51
52
53
|
# File 'lib/nib/history.rb', line 48
def pryrc
@pryrc ||= Config.new(
:pryrc,
"Pry.config.history.file = '#{PATH}/irb_history'"
)
end
|
#wrap(executable) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/nib/history.rb', line 20
def wrap(executable)
<<-COMMAND
/bin/sh -c \"
export HISTFILE=#{PATH}/shell_history
cp #{irbrc.container_path} /root/.irbrc 2>/dev/null
cp #{pryrc.container_path} /root/.pryrc 2>/dev/null
#{executable}
\"
COMMAND
end
|