Sha256: 8b27adb1bac98c40c3ff702827da3848157cc474a15e340cd7147d9475192236
Contents?: true
Size: 1.84 KB
Versions: 4
Compression:
Stored size: 1.84 KB
Contents
require 'logger' require 'thor' require_relative 'app' require_relative 'metadata' module KitchenHooks class Main < Thor desc 'version', 'Show application version' def version puts VERSION end desc 'art', 'Show application art' def art w = ART.lines.map(&:length).sort.last w += 1 if w % 2 != 0 puts puts 'kitchen_hooks'.center(w) puts VERSION.center(w) puts puts SUMMARY.center(w) puts "\n\n\n" puts ART puts "\n\n\n" end desc 'server', 'Start application web server' option :port, \ type: :numeric, aliases: %w[ -p ], desc: 'Set Sinatra port', default: 4567 option :environment, \ type: :string, aliases: %w[ -e ], desc: 'Set Sinatra environment', default: 'development' option :bind, \ type: :string, aliases: %w[ -b ], desc: 'Set Sinatra interface', default: '0.0.0.0' option :config, \ type: :string, aliases: %w[ -c ], desc: 'Configuration file to use', default: '/etc/kitchen_hooks/config.json' option :database, \ type: :string, aliases: %w[ -d ], desc: 'Location of application database', default: '/etc/kitchen_hooks/app.db' option :tmpdir, \ type: :string, aliases: %w[ -t ], desc: 'Location of temporary directory', default: '/tmp' def server App.db! options.database App.tmp! options.tmpdir App.config! JSON::parse(File.read(options.config)) App.set :environment, options.environment App.set :port, options.port App.set :bind, options.bind App.set :raise_errors, true App.set :dump_errors, true App.set :show_exceptions, true App.set :logging, ::Logger::DEBUG App.run! at_exit do App.close! end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kitchen_hooks-1.5.8 | lib/kitchen_hooks/main.rb |
kitchen_hooks-1.5.7 | lib/kitchen_hooks/main.rb |
kitchen_hooks-1.5.6 | lib/kitchen_hooks/main.rb |
kitchen_hooks-1.5.5 | lib/kitchen_hooks/main.rb |