Sha256: 29f83b044cb77aa7db690294730359798e012dcbff9629689446ab113ce69ca1
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'thor' require 'random_password' require 'site_hook/config_sections' module SiteHook module Commands class ConfigClass < Thor # def __version # puts SiteHook::VERSION # end # map ['-v', '--version'] => __version desc 'gen [-o]', 'generate a sample config, -o will output to STDOUT instead of to the default config location' method_option(:output, type: :boolean, default: false, aliases: '-o') def gen unless SiteHook::Paths.default_config.exist? if options[:output] == true say SiteHook::ConfigSections.all_samples else File.open(SiteHook::Paths.config, 'w+') do |file| file.puts SiteHook::ConfigSections.all_samples end end else if options[:output] == true say SiteHook::ConfigSections.all_samples end if !SiteHook::Paths.default_config.exist? File.open(SiteHook::Paths.config, 'w+') do |file| file.puts SiteHook::ConfigSections.all_samples end end end end desc 'mkpass [options]', 'create a hook password' method_option(:length, type: :numeric, banner: 'LENGTH', aliases: ['-l'], default: 20) def mkpass puts RandomPassword.new(length: options[:length]).generate end desc 'inspect [options]', 'output the configuration' def inspect puts SiteHook::Config.new.inspect end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
site_hook-0.9.16 | lib/site_hook/commands/config_class.rb |
site_hook-0.9.15 | lib/site_hook/commands/config_class.rb |