Class: Auphonic::Exec

Inherits:
Struct
  • Object
show all
Defined in:
lib/auphonic/exec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



2
3
4
# File 'lib/auphonic/exec.rb', line 2

def args
  @args
end

Class Method Details

.run(args) ⇒ Object



4
5
6
# File 'lib/auphonic/exec.rb', line 4

def run(args)
  new(args).run
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/auphonic/exec.rb', line 9

def run
  usage if args[0] != 'process'
  file = args[1] || usage
  puts 'create new production'
  p1 = Preset.all.first.new_production.save
  puts "upload #{file}"
  p1.upload file
  puts 'start production'
  p1.start
  status = nil
  until status == 'Done'
    sleep 5
    status = p1.reload.data['status_string']
    puts "Status: #{status}"
  end
  puts 'download output files'
  puts *p1.download
end

#usageObject



28
29
30
31
32
33
# File 'lib/auphonic/exec.rb', line 28

def usage
  puts
  puts 'Usage: auphonic process <file>'
  puts
  exit
end