bin/guinness in guinness-0.0.2 vs bin/guinness in guinness-0.1.0
- old
+ new
@@ -1,26 +1,30 @@
#!/usr/bin/env ruby
require File.expand_path('../../lib/guinness', __FILE__)
-cmd = ARGV[0] || 'drink'
+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
-when 'build', 'drink'
+ ["/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
+ @app.send(cmd)
else
puts "'#{cmd}' is not a valid guinness command"
- puts 'Usage: guinness (build,drink,new) <directory>'
-
+ puts 'Usage: guinness (serve,new) <directory>'
end