Skip to content

Commit

Permalink
Move command to thor class
Browse files Browse the repository at this point in the history
  • Loading branch information
sanemat committed Dec 19, 2013
1 parent 06936da commit 31df182
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 60 deletions.
60 changes: 0 additions & 60 deletions bin/tachikoma
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,3 @@ require 'tachikoma'
require 'tachikoma/cli'

Tachikoma::CLI.start
=begin
case ARGV[0]
when 'init'
require 'fileutils'
File.open('.gitignore', 'a') do |f|
f << <<-EOS
/repos/*
!/repos/.gitkeep
EOS
end
puts 'appended .gitignore'
File.open('Rakefile', 'a') do |f|
f << <<-EOS
require 'bundler/setup'
require 'tachikoma/tasks'
EOS
end
puts 'appended Rakefile'
FileUtils.mkdir_p('data')
puts 'created data/'
File.open(File.join('data', '__user_config__.yaml'), 'w') do |f|
f << <<-EOS
EOS
end
puts 'created data/__user_config__.yaml'
File.open(File.join('data', 'bot-motoko-tachikoma.yaml'), 'w') do |f|
f << <<-EOS
url:
'https://github.com/sanemat/bot-motoko-tachikoma.git'
frequency:
"every 1.day, :at => '6:30 am'"
type:
'fork'
language:
'ruby'
version:
'2.0.0'
EOS
end
puts 'created data/bot-motoko-tachikoma.yaml'
FileUtils.mkdir_p('repos')
puts 'created repos/'
FileUtils.touch(File.join('repos', '.gitkeep'))
puts 'created repos/.gitkeep'
puts 'tachikoma init completed!'
puts 'You might want to see README!'
else
puts <<-EOS
Command Lists
tachikoma init # Initialize files
rake tachikoma:bundle # bundle
rake tachikoma:fetch # fetch
rake tachikoma:fetch_data # fetch another `/data` directory from another location
rake tachikoma:pull_request # pull_request
EOS
end
=end
16 changes: 16 additions & 0 deletions lib/tachikoma/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,21 @@ def init
puts 'tachikoma init completed!'
puts 'You might want to see README!'
end

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:bundle # bundle
rake tachikoma:fetch # fetch
rake tachikoma:fetch_data # fetch another `/data` directory from another location
rake tachikoma:pull_request # pull_request
USAGE
end
end
end

0 comments on commit 31df182

Please sign in to comment.