#!/usr/bin/env ruby require File.expand_path('../../lib/guinness', __FILE__) cmd = ARGV[0] || 'serve' dir = ARGV[1] || '_source' puts "#{Guinness::EMOJI} Guinness : App root is: '#{dir}'" case cmd when 'new' require 'fileutils' File.open(File.join(FileUtils.mkpath(dir), 'index.html'), 'w') do |f| f.puts 'Cheers from Guinness!' end ["/stylesheets", "/javascripts", "/images"].each do |path| FileUtils.mkdir_p(File.join(dir, path)) unless File.exists?(path) end when 'serve' abort "#{Guinness::EMOJI} Guinness : Unable to locate: '#{dir}'" unless Dir.exists?(dir) @app = Guinness::Application.new(root: dir) @app.send(cmd) else puts "'#{cmd}' is not a valid guinness command" puts 'Usage: guinness (serve,new) ' end