require 'rails/generators/joosy/joosy_base' module Joosy module Generators class ResourceGenerator < ::Rails::Generators::JoosyBase source_root File.join(File.dirname(__FILE__), 'templates') def create_files super if namespace_name.empty? template "app/resources/template.js.coffee", "#{app_path}/resources/#{file_name}.js.coffee" else template "app/resources/template_with_namespace.js.coffee", "#{app_path}/resources/#{namespace_path}/#{file_name}.js.coffee" end end protected def app_path if class_path.size < 1 puts <