Class: Sbire::Command

Inherits:
Thor
  • Object
show all
Defined in:
lib/sbire/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



5
6
7
# File 'lib/sbire/command.rb', line 5

def command
  @command
end

Instance Method Details

#installObject



45
46
47
48
49
50
51
52
# File 'lib/sbire/command.rb', line 45

def install
  home = Dir.home
  config_file = "config_#{OS.familly}.yml"
  FileUtils.mkdir_p("#{home}/.sbire/out")
  dirname = File.dirname(__FILE__)
  path = "#{dirname}/../../files/#{config_file}"
  FileUtils.copy(path, "#{home}/.sbire/config.yml")
end

#pipeObject



35
36
37
38
39
40
41
42
# File 'lib/sbire/command.rb', line 35

def pipe
  stop
  show("Sbire is listening your voice")
  audio_recorder.start
  audio_converter.start do |results, index|
    pipe_manager.pipe(results, index) if results
  end
end

#saveObject



24
25
26
27
28
29
30
31
32
# File 'lib/sbire/command.rb', line 24

def save
  stop
  show("Sbire is listening your voice")
  audio_recorder.start
  recreate_text_file
  audio_converter.start do |results, index|
    save_manager.save(results, index) if results
  end
end

#startObject



8
9
10
11
12
13
14
15
# File 'lib/sbire/command.rb', line 8

def start
  stop
  show("Sbire is listening your voice")
  audio_recorder.start
  audio_converter.start do |results, index|
    command_manager.execute(results, index)
  end
end

#stopObject



18
19
20
21
# File 'lib/sbire/command.rb', line 18

def stop
  audio_recorder.stop
  audio_converter.stop
end