Sha256: 98c1fc0e363d09fc987b10381d7e4635cec31ef4817756b4c5c4d54b458e7292

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module HowAreWeDoing
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      include ::Rails::Generators::Migration
      
      source_root File.expand_path('../templates', __FILE__)
  
      def self.next_migration_number(dirname)
        if ActiveRecord::Base.timestamped_migrations
          Time.now.utc.strftime("%Y%m%d%H%M%S%L")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end
      
      def generate_controllers
        #template "app/controllers/authentications_controller.rb", "app/controllers/authentications_controller.rb"
      end
      
      def generate_migrations
        migration_template "db/migrate/create_views.rb", "db/migrate/create_views.rb"
        migration_template "db/migrate/create_shares.rb", "db/migrate/create_shares.rb"
        migration_template "db/migrate/create_prints.rb", "db/migrate/create_prints.rb"
      end
      
      def generate_routes
        route("match ':viewable_type/:viewable_id/views' => 'views#create', :via => :post")
        route("match ':printable_type/:printable_id/prints' => 'prints#create', :via => :post")
        route("match ':shareable_type/:shareable_id/shares' => 'shares#create', :via => :post")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
how_are_we_doing-0.0.3 lib/generators/how_are_we_doing/install/install_generator.rb
how_are_we_doing-0.0.2 lib/generators/how_are_we_doing/install/install_generator.rb