Sha256: 1202ef0974c6c6fcf06525bd5d5d393d528974a4cc25e9709ae0363d73c9e7d5

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 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_assets
        directory "public/", "public/"
      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" rescue true
        migration_template "db/migrate/create_shares.rb", "db/migrate/create_shares.rb" rescue true
        migration_template "db/migrate/create_prints.rb", "db/migrate/create_prints.rb" rescue true
        migration_template "db/migrate/create_totals.rb", "db/migrate/create_totals.rb" rescue true
      end
      
      def generate_routes
        route("match '/reports' => 'reports#index'")
        route("match ':parent_type/:parent_id/reports' => 'reports#index'")
        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

5 entries across 5 versions & 1 rubygems

Version Path
how_are_we_doing-0.0.9 lib/generators/how_are_we_doing/install/install_generator.rb
how_are_we_doing-0.0.8 lib/generators/how_are_we_doing/install/install_generator.rb
how_are_we_doing-0.0.7 lib/generators/how_are_we_doing/install/install_generator.rb
how_are_we_doing-0.0.6 lib/generators/how_are_we_doing/install/install_generator.rb
how_are_we_doing-0.0.5 lib/generators/how_are_we_doing/install/install_generator.rb