lib/hse/cli.rb in hse-0.1.14 vs lib/hse/cli.rb in hse-0.1.15

- old
+ new

@@ -2,18 +2,22 @@ require 'thor' require 'thor/actions' require 'uuidtools' require 'typhoeus' require 'pp' -require 'redcarpet' +# require 'redcarpet' module Hse class CLI < ::Thor include Thor::Actions attr_accessor :appdir, :config_file, :debug + method_option "appname", + :type => :string, + :banner => "set the name of the application for templating. defaults to the basename of the appdir" + class_option "appdir", :type => :string, :banner => "set the application directory to work with. assumes the current directory" # class_option "config", @@ -140,11 +144,26 @@ post_body = JSON.generate doc puts "pushing document id #{doc[:_id]}" remote(env).put(doc[:_id], post_body) end + desc 'generate [APPDIR]', 'generates .couchapprc' + def generate(to = nil) + self.appdir = to if to + self.destination_root = appdir + directory('modules') + directory('posts') + directory('panels') + directory('events') + template('couchapprc.erb', '.couchapprc') + end + private + + def appname + @appname = options[:name] || File.basename(appdir) + end def remote(env) Hse::Remote.new appdir, env #, config_file rescue => e say e.message, :red