Sha256: 08f16aa84c6d47b70933c591a30956648b7787760b6e3425ab4ac9b3994a165e
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'thor' require 'site_hook/config_class' module SiteHook def self.log_levels default = { 'hook' => 'info', 'build' => 'info', 'git' => 'info', 'app' => 'info' } begin log_level = YAML.load_file(Pathname(Dir.home).join('.jph-rc')).fetch('log_levels') if log_level log_level end rescue KeyError default rescue Errno::ENOENT default end end class CLI < Thor map %w[--version -v] => :__print_version desc '--version, -v', 'Print the version' # Prints version string # @return [NilClass] nil def __print_version puts SiteHook::VERSION end method_option(:log_levels, type: :hash, banner: 'LEVELS', default: SiteHook.log_levels) desc 'start', 'Start SiteHook' def start SiteHook.mklogdir unless Pathname(Dir.home).join('.jph', 'logs').exist? SiteHook::Webhook.run! end desc 'config SUBCOMMAND [OPTIONS]', 'Configure site_hook options' subcommand('config', SiteHook::ConfigClass) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
site_hook-0.4.0 | lib/site_hook/cli.rb |
site_hook-0.3.0 | lib/site_hook/cli.rb |