module AsProject ####################################### # ProjectArguments class ProjectArguments < Hash attr_accessor :path_finder, :selected_templates, :execution_dir, :default_templates, :default_home_templates, :project_templates, :copy_to_home, :copy_to_project, :project_name, :verbose, :should_create def initialize self[:project_name] = '' self[:copy_to_project] = false self[:copy_to_home] = false self[:default_templates] = false self[:default_home_templates] = false self[:force] = false self[:should_create] = true self[:verbose] = true self[:selected_templates] = [] end def parse!(args) if(@path_finder.nil?) raise ProjectError.new('ProjectArguments needs a path_finder in order to work properly') end opts = OptionParser.new do |opts| opts.banner = < 1) self[:selected_templates] << args.shift end self[:project_name] = clean_name(args.shift.to_s) else while(args.size > 0) self[:selected_templates] << args.shift end end if(self[:selected_templates].size == 0) self[:selected_templates] = @default_templates end verify_templates(self[:selected_templates]) end def process_templates(str) str = str.split(', ').join(',') if(!str.index(' ').nil? && str.index(',').nil?) templates = str.split(' ') else templates = str.split(',') end end def verify_templates(templates) templates.each do |template| if(!@project_templates.index template) msg = <