class FitCommit::Cli
Constants
- EXIT_CODE_FAILURE
- EXIT_CODE_SUCCESS
Attributes
args[RW]
Public Class Methods
new(*args)
click to toggle source
# File lib/fit_commit/cli.rb, line 10 def initialize(*args) self.args = args end
Public Instance Methods
execute()
click to toggle source
# File lib/fit_commit/cli.rb, line 14 def execute action_name = in_git_repo? ? args.shift : :fail_git_repo action_name = :help unless action_name && respond_to?(action_name, :include_private) send(action_name) end
Private Instance Methods
fail_git_repo()
click to toggle source
# File lib/fit_commit/cli.rb, line 43 def fail_git_repo $stderr.puts "fit-commit: .git directory not found. Please run from your Git repository root." EXIT_CODE_FAILURE end
help()
click to toggle source
# File lib/fit_commit/cli.rb, line 22 def help $stderr.puts "fit-commit v#{FitCommit::VERSION}" $stderr.puts "Usage: fit-commit install" $stderr.puts "Usage: fit-commit uninstall" EXIT_CODE_SUCCESS end
in_git_repo?()
click to toggle source
# File lib/fit_commit/cli.rb, line 39 def in_git_repo? File.exist?(".git") end
install()
click to toggle source
# File lib/fit_commit/cli.rb, line 29 def install FitCommit::Installer.new.install EXIT_CODE_SUCCESS end
uninstall()
click to toggle source
# File lib/fit_commit/cli.rb, line 34 def uninstall FitCommit::Installer.new.uninstall EXIT_CODE_SUCCESS end