Class: DevTrainingBot::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/dev_training_bot/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/dev_training_bot/cli.rb', line 6

def self.exit_on_failure?
  true
end

Instance Method Details

#listObject



48
49
50
51
52
53
54
# File 'lib/dev_training_bot/cli.rb', line 48

def list
  topics_table = topic_service.topics.map do |topic|
    ['', set_color(topic.author, :blue), topic.title]
  end

  print_table topics_table
end

#openObject



18
19
20
# File 'lib/dev_training_bot/cli.rb', line 18

def open
  Launchy.open GoogleDriveService::DOC_URL
end

#publishObject



40
41
42
43
44
45
# File 'lib/dev_training_bot/cli.rb', line 40

def publish
  topics = topic_service.to_poll(exclude: options[:exclude])
  slack_service.create_poll(topics)
  slack_service.link_doc
  say 'Successfully published the poll!', :green
end

#save(file) ⇒ Object



28
29
30
31
32
# File 'lib/dev_training_bot/cli.rb', line 28

def save(file)
  mime = GoogleDriveService.mime(options[:format])
  drive_service.export_file(ENV['FILE_ID'], mime, download_dest: file)
  say 'Successfully saved the document!', :green
end

#versionObject



13
14
15
# File 'lib/dev_training_bot/cli.rb', line 13

def version
  say "v#{VERSION}"
end