vedeu 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -4
- data/lib/vedeu/configuration.rb +2 -2
- data/lib/vedeu/launcher.rb +2 -2
- data/lib/vedeu/models/command.rb +1 -1
- data/lib/vedeu/models/interface.rb +4 -0
- data/lib/vedeu/output/interface_renderer.rb +1 -1
- data/lib/vedeu/output/template.rb +23 -0
- data/lib/vedeu/output/text_adaptor.rb +1 -1
- data/lib/vedeu/process/process.rb +5 -1
- data/lib/vedeu/repository/command_repository.rb +3 -5
- data/lib/vedeu/repository/event_repository.rb +27 -0
- data/lib/vedeu/repository/interface_repository.rb +8 -6
- data/lib/vedeu/repository/storage.rb +2 -0
- data/lib/vedeu/support/esc.rb +2 -1
- data/lib/vedeu/support/geometry.rb +11 -23
- data/lib/vedeu/support/parser.rb +1 -1
- data/lib/vedeu/support/queue.rb +3 -1
- data/lib/vedeu.rb +18 -1
- data/test/example_app/bin/app +9 -0
- data/test/example_app/lib/app.rb +63 -0
- data/test/lib/vedeu/application_test.rb +6 -36
- data/test/lib/vedeu/configuration_test.rb +5 -31
- data/test/lib/vedeu/input/input_test.rb +4 -16
- data/test/lib/vedeu/launcher_test.rb +6 -15
- data/test/lib/vedeu/models/background_test.rb +5 -21
- data/test/lib/vedeu/models/colour_test.rb +18 -49
- data/test/lib/vedeu/models/command_test.rb +19 -83
- data/test/lib/vedeu/models/composition_test.rb +78 -175
- data/test/lib/vedeu/models/foreground_test.rb +4 -21
- data/test/lib/vedeu/models/interface_collection_test.rb +13 -45
- data/test/lib/vedeu/models/interface_test.rb +71 -195
- data/test/lib/vedeu/models/line_collection_test.rb +13 -52
- data/test/lib/vedeu/models/line_test.rb +17 -61
- data/test/lib/vedeu/models/presentation_test.rb +6 -19
- data/test/lib/vedeu/models/stream_collection_test.rb +10 -42
- data/test/lib/vedeu/models/stream_test.rb +16 -54
- data/test/lib/vedeu/models/style_collection_test.rb +1 -10
- data/test/lib/vedeu/output/interface_renderer_test.rb +7 -38
- data/test/lib/vedeu/output/output_test.rb +1 -18
- data/test/lib/vedeu/output/template.rb +20 -0
- data/test/lib/vedeu/output/text_adaptor_test.rb +9 -46
- data/test/lib/vedeu/process/process_test.rb +36 -38
- data/test/lib/vedeu/repository/command_repository_test.rb +16 -45
- data/test/lib/vedeu/repository/interface_repository_test.rb +36 -74
- data/test/lib/vedeu/repository/repository_test.rb +9 -33
- data/test/lib/vedeu/repository/storage_test.rb +7 -42
- data/test/lib/vedeu/support/esc_test.rb +46 -130
- data/test/lib/vedeu/support/event_repository_test.rb +31 -0
- data/test/lib/vedeu/support/exit_test.rb +1 -9
- data/test/lib/vedeu/support/geometry_test.rb +81 -105
- data/test/lib/vedeu/support/parser_test.rb +10 -54
- data/test/lib/vedeu/support/parsing/hash_parser_test.rb +18 -33
- data/test/lib/vedeu/support/parsing/json_parser_test.rb +4 -23
- data/test/lib/vedeu/support/queue_test.rb +33 -57
- data/test/lib/vedeu/support/terminal_test.rb +21 -52
- data/test/lib/vedeu/support/translator_test.rb +16 -33
- data/test/lib/vedeu/support/wordwrap_test.rb +29 -46
- data/test/lib/vedeu_test.rb +3 -5
- data/test/support/template.erb +3 -0
- data/test/test_helper.rb +1 -12
- data/vedeu.gemspec +8 -10
- metadata +26 -38
- data/lib/vedeu/support/events.rb +0 -21
- data/lib/vedeu/version.rb +0 -3
- data/test/lib/vedeu/support/events_test.rb +0 -45
- data/test/lib/vedeu/version_test.rb +0 -12
- data/test/support/output_1.json +0 -9
- data/test/support/output_1.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a2d43ab7e7d773c5ad3fcd3d223462808fe191
|
4
|
+
data.tar.gz: 428e31c1b5fb377a92741f3cf7ccaeafd081fe24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b19757abb7a24b5e3c27db48950075536bd3b85b1d6b448f0041fa206c91af01405e76618f3d5b7644da86d08b0c7cd7a30de2d3438354d755c4d436f11342de
|
7
|
+
data.tar.gz: 0feb617271ee83bf0f3caa26c7adfb294ac6651ddbd3aa014bf14ac2f660f746ae172e568e4cf0407320f63e9ac97c5a6b1eb890bc8cb3ea5d6dfc00ac08fc59
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:minitest) do |t|
|
5
5
|
t.libs << 'lib/vedeu'
|
6
|
-
t.test_files = FileList[
|
7
|
-
|
6
|
+
t.test_files = FileList['test/lib/vedeu/*_test.rb',
|
7
|
+
'test/lib/vedeu/**/*_test.rb']
|
8
8
|
# t.options = '-v' # verbose mode
|
9
9
|
end
|
10
10
|
|
data/lib/vedeu/configuration.rb
CHANGED
@@ -7,7 +7,7 @@ module Vedeu
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def initialize(args = [])
|
10
|
-
@args = args
|
10
|
+
@args = args
|
11
11
|
@options = {}
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ module Vedeu
|
|
15
15
|
parser = OptionParser.new do |opts|
|
16
16
|
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
17
17
|
|
18
|
-
opts.on(
|
18
|
+
opts.on('-1', '--run-once', 'Run application once.') do
|
19
19
|
@options[:interactive] = false
|
20
20
|
end
|
21
21
|
end
|
data/lib/vedeu/launcher.rb
CHANGED
@@ -22,17 +22,17 @@ module Vedeu
|
|
22
22
|
Application.start(configuration)
|
23
23
|
|
24
24
|
@exit_code = 0
|
25
|
+
rescue StandardError => uncaught_exception
|
26
|
+
Vedeu.error(uncaught_exception)
|
25
27
|
ensure
|
26
28
|
$stdin, $stdout, $stderr = STDIN, STDOUT, STDERR
|
27
29
|
@kernel.exit(@exit_code)
|
28
30
|
end
|
29
|
-
# :nocov:
|
30
31
|
|
31
32
|
private
|
32
33
|
|
33
34
|
attr_reader :argv
|
34
35
|
|
35
|
-
# :nocov:
|
36
36
|
def configuration
|
37
37
|
Configuration.configure(argv)
|
38
38
|
end
|
data/lib/vedeu/models/command.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Vedeu
|
2
|
+
class Template
|
3
|
+
def self.parse(object, path)
|
4
|
+
new(object, path).parse
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(object, path)
|
8
|
+
@object, @path = object, path
|
9
|
+
end
|
10
|
+
|
11
|
+
def parse
|
12
|
+
ERB.new(load, nil, '-').result(binding)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_reader :object, :path
|
18
|
+
|
19
|
+
def load
|
20
|
+
File.read(File.dirname(__FILE__) + path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -11,7 +11,7 @@ module Vedeu
|
|
11
11
|
def initialize; end
|
12
12
|
|
13
13
|
def evaluate
|
14
|
-
return false if
|
14
|
+
return false if no_input?
|
15
15
|
|
16
16
|
fail StopIteration if stop_requested?
|
17
17
|
|
@@ -28,6 +28,10 @@ module Vedeu
|
|
28
28
|
result.nil? || result.empty?
|
29
29
|
end
|
30
30
|
|
31
|
+
def no_input?
|
32
|
+
input.nil? || input.empty?
|
33
|
+
end
|
34
|
+
|
31
35
|
def result
|
32
36
|
@result ||= command.execute(*args) if command
|
33
37
|
end
|
@@ -7,13 +7,11 @@ module Vedeu
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def by_input(input)
|
10
|
-
return nil unless input
|
11
|
-
|
12
10
|
by_keypress(input) || by_keyword(input)
|
13
11
|
end
|
14
12
|
|
15
13
|
def create(attributes)
|
16
|
-
super(
|
14
|
+
super(entity.new(attributes))
|
17
15
|
end
|
18
16
|
|
19
17
|
def entity
|
@@ -23,11 +21,11 @@ module Vedeu
|
|
23
21
|
private
|
24
22
|
|
25
23
|
def by_keypress(input)
|
26
|
-
query(entity, :keypress, input)
|
24
|
+
query(entity, :keypress, input) || false
|
27
25
|
end
|
28
26
|
|
29
27
|
def by_keyword(input)
|
30
|
-
query(entity, :keyword, input)
|
28
|
+
query(entity, :keyword, input) || false
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Vedeu
|
2
|
+
module EventRepository
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def handlers
|
6
|
+
@handlers ||= Hash.new { |h, k| h[k] = [] }.merge(defaults)
|
7
|
+
end
|
8
|
+
|
9
|
+
def register(event, &block)
|
10
|
+
handlers[event] << block
|
11
|
+
end
|
12
|
+
|
13
|
+
def trigger(event, *args)
|
14
|
+
handlers[event].each do |handler|
|
15
|
+
handler.call(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def defaults
|
22
|
+
{
|
23
|
+
:_exit_ => [ proc { :exit } ],
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -9,12 +9,12 @@ module Vedeu
|
|
9
9
|
extend self
|
10
10
|
|
11
11
|
def create(attributes = {})
|
12
|
-
super(
|
12
|
+
super(entity.new(attributes))
|
13
13
|
end
|
14
14
|
|
15
15
|
def find(name)
|
16
16
|
result = super
|
17
|
-
|
17
|
+
fail UndefinedInterface, "#{name.to_s} could not be found." unless result
|
18
18
|
result
|
19
19
|
end
|
20
20
|
|
@@ -30,12 +30,14 @@ module Vedeu
|
|
30
30
|
by_layer.map { |interface| interface.refresh }.compact
|
31
31
|
end
|
32
32
|
|
33
|
-
def by_layer
|
34
|
-
all.sort_by { |interface| interface.z }
|
35
|
-
end
|
36
|
-
|
37
33
|
def entity
|
38
34
|
Interface
|
39
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def by_layer
|
40
|
+
all.sort_by { |interface| interface.z }
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
data/lib/vedeu/support/esc.rb
CHANGED
@@ -28,13 +28,14 @@ module Vedeu
|
|
28
28
|
["\e[", row, ';', column, 'H'].join
|
29
29
|
end
|
30
30
|
|
31
|
-
def string(value = '
|
31
|
+
def string(value = '')
|
32
32
|
case value
|
33
33
|
when 'blink' then "\e[5m"
|
34
34
|
when 'blink_off' then "\e[25m"
|
35
35
|
when 'bold' then "\e[1m"
|
36
36
|
when 'bold_off' then "\e[21m"
|
37
37
|
when 'clear' then "\e[2J"
|
38
|
+
when 'colour_reset' then "\e[38;2;39m\e[48;2;49m"
|
38
39
|
when 'hide_cursor' then "\e[?25l"
|
39
40
|
when 'negative' then "\e[7m"
|
40
41
|
when 'positive' then "\e[27m"
|
@@ -3,18 +3,18 @@ require_relative 'terminal'
|
|
3
3
|
|
4
4
|
module Vedeu
|
5
5
|
class Geometry
|
6
|
-
def
|
7
|
-
|
6
|
+
def initialize(interface)
|
7
|
+
@interface = interface
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
@interface, @index = interface, index
|
12
|
-
end
|
13
|
-
|
14
|
-
def origin
|
10
|
+
def origin(index = 0)
|
15
11
|
Esc.set_position(virtual_y(index), virtual_x)
|
16
12
|
end
|
17
13
|
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :interface
|
17
|
+
|
18
18
|
def virtual_x(index = 0)
|
19
19
|
((x..max_x).to_a)[index]
|
20
20
|
end
|
@@ -24,8 +24,8 @@ module Vedeu
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def max_y
|
27
|
-
if (
|
28
|
-
|
27
|
+
if (y + height) > Terminal.height
|
28
|
+
Terminal.height
|
29
29
|
|
30
30
|
else
|
31
31
|
(y + height)
|
@@ -34,8 +34,8 @@ module Vedeu
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def max_x
|
37
|
-
if (
|
38
|
-
|
37
|
+
if (x + width) > Terminal.width
|
38
|
+
Terminal.width
|
39
39
|
|
40
40
|
else
|
41
41
|
(x + width)
|
@@ -43,10 +43,6 @@ module Vedeu
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
private
|
47
|
-
|
48
|
-
attr_reader :interface, :index
|
49
|
-
|
50
46
|
def height
|
51
47
|
interface.height
|
52
48
|
end
|
@@ -62,13 +58,5 @@ module Vedeu
|
|
62
58
|
def y
|
63
59
|
interface.y
|
64
60
|
end
|
65
|
-
|
66
|
-
def screen_height
|
67
|
-
@height ||= Terminal.height
|
68
|
-
end
|
69
|
-
|
70
|
-
def screen_width
|
71
|
-
@width ||= Terminal.width
|
72
|
-
end
|
73
61
|
end
|
74
62
|
end
|
data/lib/vedeu/support/parser.rb
CHANGED
data/lib/vedeu/support/queue.rb
CHANGED
data/lib/vedeu.rb
CHANGED
@@ -3,9 +3,9 @@ require 'logger'
|
|
3
3
|
|
4
4
|
require_relative 'vedeu/repository/command_repository'
|
5
5
|
require_relative 'vedeu/repository/interface_repository'
|
6
|
+
require_relative 'vedeu/repository/event_repository'
|
6
7
|
require_relative 'vedeu/support/exit'
|
7
8
|
require_relative 'vedeu/launcher'
|
8
|
-
require_relative 'vedeu/version'
|
9
9
|
|
10
10
|
module Vedeu
|
11
11
|
# :nocov:
|
@@ -20,6 +20,14 @@ module Vedeu
|
|
20
20
|
.merge!(options))
|
21
21
|
end
|
22
22
|
|
23
|
+
def event(name, &block)
|
24
|
+
EventRepository.register(name, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(name, *args)
|
28
|
+
EventRepository.trigger(name, *args)
|
29
|
+
end
|
30
|
+
|
23
31
|
private
|
24
32
|
|
25
33
|
def stringify_symbols(value)
|
@@ -35,7 +43,15 @@ module Vedeu
|
|
35
43
|
end
|
36
44
|
end
|
37
45
|
|
46
|
+
def self.error(exception)
|
47
|
+
logger.debug "\e[38;5;196mError:\e[38;2;39m\e[48;2;49m " +
|
48
|
+
"#{exception.message}\n\n" +
|
49
|
+
exception.backtrace.join("\n")
|
50
|
+
end
|
51
|
+
|
38
52
|
def self.debug(filename = 'profile.html', &block)
|
53
|
+
require 'ruby-prof'
|
54
|
+
|
39
55
|
RubyProf.start
|
40
56
|
|
41
57
|
yield
|
@@ -45,6 +61,7 @@ module Vedeu
|
|
45
61
|
|
46
62
|
File.open(Vedeu.root_path + '/tmp/' + filename, 'w') do |file|
|
47
63
|
RubyProf::CallStackPrinter.new(result).print(file)
|
64
|
+
# RubyProf::GraphPrinter.new(result).print(file)
|
48
65
|
end
|
49
66
|
end
|
50
67
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'vedeu'
|
4
|
+
|
5
|
+
module Example
|
6
|
+
extend self
|
7
|
+
|
8
|
+
class ExampleCommand
|
9
|
+
def self.dispatch
|
10
|
+
%Q|{
|
11
|
+
"interfaces": {
|
12
|
+
"name": "example",
|
13
|
+
"lines": {
|
14
|
+
"streams": [
|
15
|
+
{
|
16
|
+
"text": "Some text..."
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"text": " "
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"colour": {
|
23
|
+
"foreground": "#00ff00",
|
24
|
+
"background": "#0000ff"
|
25
|
+
},
|
26
|
+
"text": "The time is: #{Time.now}."
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}|
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class App
|
36
|
+
include Vedeu
|
37
|
+
|
38
|
+
interface 'example', {
|
39
|
+
y: 1, x: 1, width: 80, height: 5,
|
40
|
+
colour: { background: '#ff0000', foreground: '#000000' },
|
41
|
+
cursor: false
|
42
|
+
}
|
43
|
+
interface 'command', {
|
44
|
+
y: 6, x: 1, width: 80, height: 1,
|
45
|
+
colour: { background: '#4040cc', foreground: '#aadd00' },
|
46
|
+
cursor: true
|
47
|
+
}
|
48
|
+
command 'time', {
|
49
|
+
entity: ExampleCommand,
|
50
|
+
keyword: 'time',
|
51
|
+
keypress: 't'
|
52
|
+
}
|
53
|
+
command 'exit', {
|
54
|
+
entity: Vedeu::Exit,
|
55
|
+
keyword: 'exit',
|
56
|
+
keypress: 'q'
|
57
|
+
}
|
58
|
+
|
59
|
+
def self.start
|
60
|
+
Vedeu::Launcher.new([]).execute!
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -3,45 +3,15 @@ require_relative '../../../lib/vedeu/application'
|
|
3
3
|
|
4
4
|
module Vedeu
|
5
5
|
describe Application do
|
6
|
-
let(:described_class) { Application }
|
7
|
-
let(:described_instance) { described_class.new(options) }
|
8
|
-
let(:options) { {} }
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
let(:subject) { described_class.new(options) }
|
12
|
-
|
13
|
-
it 'returns an Application instance' do
|
14
|
-
subject.must_be_instance_of(Application)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
6
|
describe '.start' do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Terminal.stubs(:open).yields(self)
|
23
|
-
Output.stubs(:render)
|
24
|
-
Input.stubs(:capture)
|
25
|
-
Process.stubs(:evaluate)
|
26
|
-
Terminal.stubs(:close)
|
7
|
+
it 'returns a NilClass when the application should run interactively' do
|
8
|
+
skip
|
9
|
+
# Application.start({ interactive: true }).must_be_instance_of(NilClass)
|
27
10
|
end
|
28
11
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
before { Process.stubs(:evaluate).raises(StopIteration) }
|
33
|
-
|
34
|
-
it 'returns a NilClass' do
|
35
|
-
subject.must_be_instance_of(NilClass)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'when the application should run once' do
|
40
|
-
let(:options) { { interactive: false } }
|
41
|
-
|
42
|
-
it 'returns a NilClass' do
|
43
|
-
subject.must_be_instance_of(NilClass)
|
44
|
-
end
|
12
|
+
it 'returns a NilClass when the application should run once' do
|
13
|
+
skip
|
14
|
+
# Application.start({ interactive: false }).must_be_instance_of(NilClass)
|
45
15
|
end
|
46
16
|
end
|
47
17
|
end
|
@@ -3,40 +3,14 @@ require_relative '../../../lib/vedeu/configuration'
|
|
3
3
|
|
4
4
|
module Vedeu
|
5
5
|
describe Configuration do
|
6
|
-
let(:described_class) { Configuration }
|
7
|
-
let(:described_instance) { described_class.new(args) }
|
8
|
-
let(:args) { [] }
|
9
|
-
let(:subject) { described_instance }
|
10
|
-
|
11
|
-
describe '#initialize' do
|
12
|
-
let(:subject) { described_instance }
|
13
|
-
|
14
|
-
it 'returns a Configuration instance' do
|
15
|
-
subject.must_be_instance_of(Configuration)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'sets an instance variable' do
|
19
|
-
subject.instance_variable_get('@args').must_equal([])
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'sets an instance variable' do
|
23
|
-
subject.instance_variable_get('@options').must_equal({})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
6
|
describe '#configure' do
|
28
|
-
|
29
|
-
|
30
|
-
it 'returns a Hash' do
|
31
|
-
subject.must_be_instance_of(Hash)
|
7
|
+
it 'returns an empty collection when no options are set' do
|
8
|
+
Configuration.configure([]).must_equal({})
|
32
9
|
end
|
33
10
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
it 'returns the options which instructs Vedeu to run once' do
|
38
|
-
subject.must_equal({ interactive: false })
|
39
|
-
end
|
11
|
+
it 'returns the options which instructs Vedeu to run once' do
|
12
|
+
Configuration.configure(['--run-once'])
|
13
|
+
.must_equal({ interactive: false })
|
40
14
|
end
|
41
15
|
end
|
42
16
|
end
|
@@ -3,23 +3,11 @@ require_relative '../../../../lib/vedeu/input/input'
|
|
3
3
|
|
4
4
|
module Vedeu
|
5
5
|
describe Input do
|
6
|
-
let(:described_module) { Input }
|
7
|
-
let(:input) { 'input' }
|
8
|
-
|
9
|
-
before do
|
10
|
-
Terminal.stubs(:input).returns(input)
|
11
|
-
Queue.stubs(:enqueue).returns([input])
|
12
|
-
end
|
13
|
-
|
14
6
|
describe '.capture' do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'returns the enqueued input' do
|
22
|
-
subject.must_equal([input])
|
7
|
+
it 'enqueues the captured input from the terminal' do
|
8
|
+
Terminal.stub :input, 'input' do
|
9
|
+
Input.capture.must_equal(Vedeu::Queue)
|
10
|
+
end
|
23
11
|
end
|
24
12
|
end
|
25
13
|
end
|
@@ -3,22 +3,13 @@ require_relative '../../../lib/vedeu/launcher'
|
|
3
3
|
|
4
4
|
module Vedeu
|
5
5
|
describe Launcher do
|
6
|
-
let(:described_class) { Launcher }
|
7
|
-
let(:described_instance) { described_class.new(argv) }
|
8
|
-
let(:argv) { [] }
|
9
|
-
|
10
|
-
before { Application.stubs(:start) }
|
11
|
-
|
12
|
-
describe '#initialize' do
|
13
|
-
let(:subject) { described_class.new(argv) }
|
14
|
-
|
15
|
-
it 'returns a Launcher instance' do
|
16
|
-
subject.must_be_instance_of(Launcher)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
6
|
describe '#execute!' do
|
21
|
-
|
7
|
+
it 'needs a spec, please write one.' do
|
8
|
+
skip
|
9
|
+
Application.stub :start, nil do
|
10
|
+
Launcher.new([]).execute!
|
11
|
+
end
|
12
|
+
end
|
22
13
|
end
|
23
14
|
end
|
24
15
|
end
|