Repository URL to install this package:
Version:
0.4.2 ▾
|
module NeotericEvents
class InstallGenerator < Rails::Generators::Base
desc "Installs Neoteric Events and generates the necessary migrations"
include Rails::Generators::Migration
def self.source_root
@_neoteric_events_source_root ||= File.expand_path("../templates", __FILE__)
end
def copy_templates
copy_file "show.html.erb", "app/views/events/show.html.erb"
copy_file "index.html.erb", "app/views/events/index.html.erb"
copy_file "_event.html.erb", "app/views/events/_event.html.erb"
copy_file "_sidebar.html.erb", "app/views/events/_sidebar.html.erb"
end
def copy_classes
copy_file "events_controller.rb", "app/controllers/events_controller.rb"
copy_file "event.rb", "app/models/event.rb"
end
def setup_routes
route <<-ROUTES
resources :events, :only => [:index, :show] do
collection do
get ':year/:month', :to => 'events#archive', :as => 'archive'
end
end
ROUTES
end
def generate_upgrade
rake("neoteric_events:upgrade")
end
end
end