Class: Tachikoma::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/tachikoma/cli.rb

Overview

Command for Tachikoma

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help(shell) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/tachikoma/cli.rb', line 47

def self.help(shell, *)
  list = printable_tasks

  shell.say 'Commands:'
  shell.print_table(list, indent: 2, truncate: true)
  shell.say
  class_options_help(shell)
  shell.say <<-USAGE
Tasks:
  rake tachikoma:run_bundler   # run tachikoma with bundler
  rake tachikoma:run_carton    # run tachikoma with carton
  rake tachikoma:run_none      # run tachikoma with none
  rake tachikoma:run_david     # run tachikoma with david
  rake tachikoma:run_composer  # run tachikoma with composer
  rake tachikoma:run_cocoapods # run tachikoma with cocoapods
USAGE
end

.source_rootObject



65
66
67
# File 'lib/tachikoma/cli.rb', line 65

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#initObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tachikoma/cli.rb', line 11

def init
  require 'fileutils'

  copy_or_append_file_lists = %w(
    .gitignore
    Rakefile
    data/__user_config__.yaml
  )
  copy_file_lists = %w(
    repos/.gitkeep
    data/bot-motoko-tachikoma.yaml
  )

  copy_or_append_file_lists.each do |target|
    if File.exist?(target)
      append_to_file target do
        File.read(File.join(self.class.source_root, target))
      end
    else
      copy_file target
    end
  end

  copy_file_lists.each do |target|
    copy_file target
  end

  puts 'tachikoma init completed!'
  puts 'You might want to see README!'
end

#versionObject



43
44
45
# File 'lib/tachikoma/cli.rb', line 43

def version
  puts Tachikoma::VERSION
end