Class: Pello::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pello/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



15
16
17
18
# File 'lib/pello/runner.rb', line 15

def initialize
  @prompt = TTY::Prompt.new
  configure_pello
end

Instance Attribute Details

#board_urlObject

Returns the value of attribute board_url.



13
14
15
# File 'lib/pello/runner.rb', line 13

def board_url
  @board_url
end

#list_nameObject

Returns the value of attribute list_name.



13
14
15
# File 'lib/pello/runner.rb', line 13

def list_name
  @list_name
end

#log_file_pathObject

Returns the value of attribute log_file_path.



13
14
15
# File 'lib/pello/runner.rb', line 13

def log_file_path
  @log_file_path
end

#promptObject

Returns the value of attribute prompt.



13
14
15
# File 'lib/pello/runner.rb', line 13

def prompt
  @prompt
end

#usernameObject

Returns the value of attribute username.



13
14
15
# File 'lib/pello/runner.rb', line 13

def username
  @username
end

Instance Method Details

#run!Object



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
# File 'lib/pello/runner.rb', line 20

def run!
  continue = true

  while continue
    case prompt.select('Choose task') do |menu|
      menu.choice name: 'Add pomodori', value: :add_pomodori
      menu.choice name: 'Move card', value: :move_card
      menu.choice name: 'Print board pomodori report', value: :report
      menu.choice name: 'Edit config', value: :edit_config
      menu.choice name: 'quit', value: :quit
    end
    when :add_pomodori
      add_pomodori_to_card
    when :move_card
      move_card
    when :report
      report
    when :edit_config
      editor = ENV['EDITOR'] || 'vim'
      system 'mkdir -p ~/.config/pello'
      system "#{editor} ~/.config/pello/pello.yaml"
    when :quit
      puts 'Ok, bye!'
      exit
    end
  end
end