Class: Jax::Generators::Model::ModelGenerator

Inherits:
PluggableCommand show all
Defined in:
lib/jax/generators/model/model_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PluggableCommand

#check_plugin_destination

Methods inherited from Command

inherited

Methods included from Usage

extended, included

Class Method Details

.source_rootObject



9
10
11
# File 'lib/jax/generators/model/model_generator.rb', line 9

def self.source_root
  File.expand_path("templates", File.dirname(__FILE__))
end

Instance Method Details

#resourcesObject



21
22
23
# File 'lib/jax/generators/model/model_generator.rb', line 21

def resources
  create_file File.join("app", "resources", plural_name, "default.yml"), "# default attribute values\n# (these will apply to all #{plural_name})"
end

#sourceObject



13
14
15
# File 'lib/jax/generators/model/model_generator.rb', line 13

def source
  template 'model.js.tt', File.join("app/models", "#{file_name}.js")
end

#testObject



17
18
19
# File 'lib/jax/generators/model/model_generator.rb', line 17

def test
  template 'test.js.tt', File.join('spec/javascripts/models', "#{file_name}_spec.js")
end