Sha256: e1f3f96719ade615f0ee48daac06272eac98aad0eb410696f333121dbbd58e7d
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'rails/generators' class CoffeescriptGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) desc "This generator creates a coffee script file at app/assets/javascripts/partials" argument :functions, type: :array, default: [], banner: "functionOne functionTwo" attr_reader :namespace def copy_template_file @namespace = class_name.split("::") @namespace.pop @namespace = @namespace.join("::") template "coffeescript.coffee.erb", file_path end private def function_name file_name.camelize(:lower) end def partial_file_name "_#{file_name}" end def file_path Rails.root.join("app/assets/javascripts/partials", partial_file_name + ".coffee") end def template_file_path(temp_name) Rails.root.join('app', 'views', namespace_path + file_name, temp_name + ".html.slim") end def namespace_path if namespace.blank? return "" else namespace.split("::").map(&:underscore).join("/") + "/" end end def singular_name super.singularize end # def authenticate_actor? # options['authenticate'].present? # end # def authenticate_actor # options['authenticate'] # end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
orthodox-0.1.0 | lib/generators/coffeescript/coffeescript_generator.rb |