Sha256: 64ec1c870489544d0e0e0ac6be78aa4c1adbc12ac677a8e36af914afb1b94ac9

Contents?: true

Size: 1.56 KB

Versions: 14

Compression:

Stored size: 1.56 KB

Contents

require 'rails/generators'
require 'rails/generators/migration'
module CloudhdrRails
  module Generators
        
    class ModelUpdateGenerator < Rails::Generators::NamedBase
      
      include Rails::Generators::Migration
        
      #argument :model_names, :type => :array, :default => [], :banner => "action action"
      #check_class_collision :suffix => "CloudhdrRails"
 
      source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
      
      def self.next_migration_number(dirname)
        if ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end
    
      def create_migration_file
        migration_template 'model_update_migration.rb', "db/migrate/make_#{file_name.pluralize}_cloudhdr.rb"
        #migration_template 'model_thumbnail_migration.rb', "db/migrate/create_#{file_name.singularize}_thumbnails.rb"
      end
      
      def create_model_file
        #template 'model.rb', File.join('app/models', class_path, "#{file_name.singularize}.rb")
        template 'model_thumbnail.rb', File.join('app/models', class_path, "#{file_name.singularize}_thumbnail.rb")
      end
      
      
    protected
 
      #def create_views_for(engine)
      #  for state in model_names do
      #    @state  = state
      #    @path   = File.join('app/cells', file_name, "#{state}.html.#{engine}")
      # 
      #    template "view.#{engine}", @path
      #  end
      #end
        
        
        
        
    end
    
  end
end 
  

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cloudhdr_rails-0.0.14 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.13 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.12 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.11 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.10 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.9 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.8 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.7 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.6 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.5 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.4 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.3 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.2 lib/generators/cloudhdr_rails/model_update_generator.rb
cloudhdr_rails-0.0.1 lib/generators/cloudhdr_rails/model_update_generator.rb