Sha256: acd8595eaece3a7a7e8f2b443a4c082768e9ce5c7cf832cfc73e925be830a837

Contents?: true

Size: 861 Bytes

Versions: 15

Compression:

Stored size: 861 Bytes

Contents

require File.expand_path("../all", File.dirname(__FILE__))

module Jax
  module Generators
    class ModelGenerator < Jax::Generators::RailsBase
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
      rails_equivalent { (orm = ::Rails::Generators.options[:rails][:orm]) && "#{orm}:model" }
      
      def create_model_file
        coffee_template_with_fallback "model.js",
          File.join('app/assets/jax/models', "#{file_name}.js")
      end
      
      def create_spec_file
        coffee_template_with_fallback "model_spec.js",
          File.join('spec/javascripts/jax/models', "#{file_name}_spec.js")
      end
      
      def create_resource_file
        template 'model_defaults.resource.erb', File.join("app/assets/jax/resources", file_name.pluralize, "default.resource")
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jax-3.0.0.rc2 lib/generators/jax/model/model_generator.rb
jax-2.0.12 lib/generators/jax/model/model_generator.rb
jax-3.0.0.rc1 lib/generators/jax/model/model_generator.rb
jax-2.0.11 lib/generators/jax/model/model_generator.rb
jax-2.0.10 lib/generators/jax/model/model_generator.rb
jax-2.0.9 lib/generators/jax/model/model_generator.rb
jax-2.0.8 lib/generators/jax/model/model_generator.rb
jax-2.0.7 lib/generators/jax/model/model_generator.rb
jax-2.0.6 lib/generators/jax/model/model_generator.rb
jax-2.0.5 lib/generators/jax/model/model_generator.rb
jax-2.0.4 lib/generators/jax/model/model_generator.rb
jax-2.0.3 lib/generators/jax/model/model_generator.rb
jax-2.0.2 lib/generators/jax/model/model_generator.rb
jax-2.0.1 lib/generators/jax/model/model_generator.rb
jax-2.0.0 lib/generators/jax/model/model_generator.rb