-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.rb
87 lines (71 loc) · 1.43 KB
/
console.rb
1
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'core'
IRB.conf[:PROMPT][:CRCONSOLE] = {
:AUTO_INDENT => true,
:PROMPT_I => "~> ",
:PROMPT_C => ">",
:PROMPT_s => ">",
:RETURN => ""
}
def print_prompt
$stdout.write @project unless @project.nil?
$stdout.write " => " unless @runner.nil? or @project.nil?
$stdout.write @runner + " " unless @runner.nil?
end
print_prompt
IRB.conf[:PROMPT_MODE] = :CRCONSOLE
def runner r
@runner = r
print_prompt
end
def project p
@project = p
print_prompt
end
def setargs args
unless args.nil?
@project = args.keys.first.to_s
@runner = args.values.first.to_s
@same = args
end
end
def deploy args = nil, redir = :normal
setargs args
deploy_c @project, @runner, redir
print_prompt
end
def clean args = nil, redir = :normal
setargs args
clean_c @project, @runner
print_prompt
end
def run args = nil, redir = :redirect
setargs args
run_c @project, @runner, redir
print_prompt
end
def build args = nil, redir = :normal
setargs args
build_c @project, @runner, redir
print_prompt
end
def stdout args = nil
setargs args
get_stdout @project, @runner
print_prompt
end
def stderr args = nil
setargs args
get_stdout @project, @runner
print_prompt
end
def do_get_stdin args = nil
setargs args
get_stdin @project, @runner
print_prompt
end
def stdin filename = nil, args = nil
return do_get_stdin @args if filename.nil?
setargs args
send_stdin @project, @runner, filename
print_prompt
end