Class: FalkorLib::CLI::App

Inherits:
Thor
  • Object
show all
Includes:
FalkorLib::Common, Thor::Actions
Defined in:
lib/falkorlib/cli.rb

Overview

Main Application

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FalkorLib::Common

ask, bold, command?, cyan, error, exec_or_exit, execute, execute_in_dir, green, info, init_from_template, init_rvm, list_items, load_config, nice_execute, normalized_path, not_implemented, really_continue?, red, run, select_from, select_multiple_from, show_diff_and_write, store_config, warning, write_from_erb_template, write_from_template

Class Method Details

.start(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/falkorlib/cli.rb', line 27

def self.start(*args)
  if (Thor::HELP_MAPPINGS & ARGV).any? and subcommands.grep(/^#{ARGV[0]}/).empty?
    Thor::HELP_MAPPINGS.each do |cmd|
      if match = ARGV.delete(cmd)
        ARGV.unshift match
      end
    end
  end
  super
end

Instance Method Details

#commandsObject



59
60
61
# File 'lib/falkorlib/cli.rb', line 59

def commands
  puts App.all_commands.keys.sort - [ "zsh-completions"]
end

#config(_key = '') ⇒ Object



74
75
76
77
78
79
# File 'lib/falkorlib/cli.rb', line 74

def config(_key = '')
  info "Thor options:"
  puts options.to_yaml
  info "FalkorLib internal configuration:"
  puts FalkorLib.config.to_yaml
end

#gitcrypt(path = '.') ⇒ Object



92
93
94
# File 'lib/falkorlib/cli.rb', line 92

def gitcrypt(path = '.')
  FalkorLib::Bootstrap.gitcrypt(path, options)
end

#gitignore(path = '.') ⇒ Object



105
106
107
# File 'lib/falkorlib/cli.rb', line 105

def gitignore(path = '.')
  FalkorLib::Bootstrap.gitignore(path, options)
end

#init(name = '.') ⇒ Object

method_option :latex, :aliases => ‘-l’, :type => :boolean, :desc => “Initiate a LaTeX project” #method_option :gem, :type => :boolean, :desc => “Initiate a Ruby gem project” method_option :rvm, :type => :boolean, :desc => “Initiate a RVM-based Ruby project” method_option :ruby, :default => ‘1.9.3’, :desc => “Ruby version to configure for RVM” method_option :pyenv, :type => :boolean, :desc => “Initiate a pyenv-based Python project” method_option :octopress, :aliases => [‘-o’, ‘–www’], :type => :boolean, :desc => “Initiate an Octopress web site” _



144
145
146
147
148
# File 'lib/falkorlib/cli.rb', line 144

def init(name = '.')
  #options[:rvm] = true if options[:rake] or options[:gem]
  # _newrepo(name, options)
  FalkorLib::Bootstrap.repo(name, options)
end

#mkdocs(path = '.') ⇒ Object



159
160
161
# File 'lib/falkorlib/cli.rb', line 159

def mkdocs(path = '.')
  FalkorLib::Bootstrap.mkdocs(path, options)
end

#motd(path = '.') ⇒ Object



182
183
184
# File 'lib/falkorlib/cli.rb', line 182

def motd(path = '.')
  FalkorLib::Bootstrap.motd(path, options)
end

#vagrant(path = '.') ⇒ Object



197
198
199
# File 'lib/falkorlib/cli.rb', line 197

def vagrant(path = '.')
  FalkorLib::Bootstrap.vagrant(path, options)
end

#versionObject



203
204
205
# File 'lib/falkorlib/cli.rb', line 203

def version
  say "Falkor[Lib] version " + FalkorLib::VERSION, :yellow # + "on ruby " + `ruby --version`
end