lib/stack.rb in stack-0.0.2 vs lib/stack.rb in stack-0.0.3

- old
+ new

@@ -1,25 +1,35 @@ # rubygems require 'rubygems' require 'optparse' +require 'liquid' require 'core_ext/hash' require 'stack/configuration' require 'stack/generator' require 'stack/runner' +require 'stack/template' +require 'stack/parsable' + +require 'stack/templates/page' +require 'stack/templates/layout' + module Stack # Default options used by stack, overridden from the command line or YML configration file. DEFAULTS = { :source => '.', :target => File.join('.', '_stack') }.freeze # Array of valid commands stack can use COMMANDS = %w(create generate server) + # Array of valid extensions + EXTENSIONS = %w(.html .markdown .mdown) + class << self attr_accessor :runner end # Parses the options configuration from the command line @@ -27,10 +37,15 @@ config = { } parser = OptionParser.new do |opts| opts.banner = "Usage: stack [options] #{Stack::COMMANDS.join('|')}" - opts.on("-s", "--source [DIR]", "Directory to use as the source for generating a stack") do |l| config[:source] = l unless l.nil? end + opts.on("-s", "--source [DIR]", "Directory to use as the source for generating a stack") do |l| + if !l.nil? + config[:source] = l + config[:target] = "#{config[:source]}_stack" + end + end opts.on("-t", "--target [DIR]", "Directory to use as the target directory") do |l| config[:target] = l unless l.nil? end opts.on_tail("-h", "--help", "Show this message") { puts opts; exit } opts.on_tail("-v", "--version" "Show version") do puts "stack #{Stack::version}"; exit; end end \ No newline at end of file