generators/class/class_generator.rb in coherent-0.6.10 vs generators/class/class_generator.rb in coherent-0.6.11

- old
+ new

@@ -1,6 +1,7 @@ require "#{File.dirname(__FILE__)}/../../lib/coherent" +require "yaml" class ClassGenerator < CoherentBaseGenerator default_options :author => nil @@ -10,20 +11,32 @@ super usage if args.empty? full_name= args.shift parts= full_name.split(".") - @namespace= parts[0..-2].join(".") + @name= parts[-1] @full_name= full_name + @namespace= parts[0..-2].join(".") + if @namespace.empty? + @target_folder = "src/js" + project = YAML::load_file(PROJECT_FILE) + if project["export"].is_a?(String) + @namespace = project["export"] + @full_name= [@namespace, @name].join(".") + end + else + @target_folder = "src/js/#{namespace.gsub(".", "/")}" + end + extract_options end def manifest record do |m| - copy_template_folder m, "src/js/#{@namespace.gsub(".", "/")}" + copy_template_folder m, @target_folder end end protected \ No newline at end of file