class GitLogTime::Cli
Public Class Methods
new(*args)
click to toggle source
# File lib/git-log-time/cli.rb, line 10 def initialize(*args) @args = args end
Public Instance Methods
config()
click to toggle source
# File lib/git-log-time/cli.rb, line 48 def config @config ||= GitLogTime::Configuration.new(GitLogTime.pluginator) end
execute()
click to toggle source
# File lib/git-log-time/cli.rb, line 14 def execute() action_name = @args.shift or 'help' action = :"execute_#{action_name}" if respond_to?(action) then send(action, *@args) else execute_help(action_name, *@args) end end
execute_help(*args)
click to toggle source
# File lib/git-log-time/cli.rb, line 23 def execute_help(*args) warn "Usage: git-log-time install" warn "Usage: git-log-time uninstall" args.empty? # return status, it's ok if user requested help end
execute_install(key = nil, *args)
click to toggle source
# File lib/git-log-time/cli.rb, line 29 def execute_install(key = nil, *args) ['post-commit', 'pre-push' ].each do |key| GitLogTime::Installer.new(key).install end end
execute_new(*args)
click to toggle source
# File lib/git-log-time/cli.rb, line 41 def execute_new(*args) GitLogTime::Template.new(*args).save rescue ArgumentError => e warn e warn "Usage: git-log-time new plugin-name 'Author Name' author@email 'description of the plugin'" end
execute_uninstall(key = nil, *args)
click to toggle source
# File lib/git-log-time/cli.rb, line 35 def execute_uninstall(key = nil, *args) ['post-commit', 'pre-push' ].each do |key| GitLogTime::Installer.new(key).uninstall end end
list_evaluator()
click to toggle source
# File lib/git-log-time/cli.rb, line 52 def list_evaluator @list_evaluator ||= GitLogTime::ListEvaluator.new(config) end