class Tacape::Cli

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/tacape/cli.rb, line 18
def self.exit_on_failure?
  true
end
new(*args) click to toggle source
Calls superclass method
# File lib/tacape/cli.rb, line 10
def initialize(*args)
  super
  @current_os=Tacape::Belt.current_os
  create_folder_structure
  
  puts I18n.t('greeting')
end

Public Instance Methods

check() click to toggle source
# File lib/tacape/cli.rb, line 30
def check
  if `which ffmpeg`.include? 'ffmpeg'
    ffmpeg=''
  end
  say "FFMPEG #{ffmpeg}"
end
update() click to toggle source
# File lib/tacape/cli.rb, line 39
def update
  update_tools
end
version() click to toggle source
# File lib/tacape/cli.rb, line 24
def version
  say "Tacape version #{Version::STRING}"
end

Private Instance Methods

color(text, color) click to toggle source
# File lib/tacape/cli.rb, line 56
def color(text, color)
  color? ? shell.set_color(text, color) : text
end
color?() click to toggle source
# File lib/tacape/cli.rb, line 60
def color?
  shell.instance_of?(Thor::Shell::Color)
end
config() click to toggle source
# File lib/tacape/cli.rb, line 44
def config
  YAML.load_file(config_path).with_indifferent_access
end
config_path() click to toggle source
# File lib/tacape/cli.rb, line 48
def config_path
  root_dir.join("config/tacape.yml")
end
create_folder_structure() click to toggle source
# File lib/tacape/cli.rb, line 73
def create_folder_structure
  unless File.exists? @current_os.config_folder
    FileUtils.mkdir_p(@current_os.config_folder)
  end
  unless File.exists? @current_os.tool_folder
    puts 'Cloning Tools repository...'
    `git clone git@github.com:lucasmartins/tacape-tools.git #{@current_os.tool_folder}`
    puts 'Installing Tools dependencies...'
    `cd #{@current_os.tool_folder} && bundle install`
  end
end
root_dir() click to toggle source
# File lib/tacape/cli.rb, line 52
def root_dir
  @root ||= Pathname.new(Dir.pwd)
end
update_tools() click to toggle source
# File lib/tacape/cli.rb, line 64
def update_tools
  #Thread.new {
  puts 'Updating Tools repository...'
  `cd #{@current_os.tool_folder} && git pull`
  puts 'Installing Tools dependencies...'
  `cd #{@current_os.tool_folder} && bundle install`
  #}
end