Sha256: 73632a46c662744502cf50994f4ec98281c92c27159ffd385990b41e0da91930
Contents?: true
Size: 973 Bytes
Versions: 10
Compression:
Stored size: 973 Bytes
Contents
require 'rails/generators/joosy/joosy_base' module Joosy module Generators class PageGenerator < ::Rails::Generators::JoosyBase source_root File.join(File.dirname(__FILE__), 'templates') def create_files super template "app/pages/template.js.coffee", "#{app_path}/pages/#{namespace_path}/#{file_name}.js.coffee" create_file "#{app_path}/templates/pages/#{namespace_path}/#{file_name}.jst.#{options[:template_kind]}" end protected def app_path if class_path.size < 2 puts <<HELP Usage: rails generate joosy:page joosy_app_name/page_namespace/page_name Tip: do not add Page suffix to page_name HELP exit 1 end class_path[0] end def namespace_path File.join class_path[1..-1] end def namespace_name class_path[1..-1].map(&:camelize).join '.' end def layout_name class_path[1] end end end end
Version data entries
10 entries across 10 versions & 1 rubygems