Sha256: e6e02348db5b9f7d7b7ab14b45e7d7943fb7a5ddc48e215674842991234cf9ef

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

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 [options]', 'generate a sample config'

      def gen
        if SiteHook::Paths.default_config.exist?
          puts SiteHook::ConfigSections.all_samples
        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.4 lib/site_hook/commands/config_class.rb
site_hook-0.9.3 lib/site_hook/commands/config_class.rb