lib/generators/blocky/install_generator.rb in blocky-0.0.11 vs lib/generators/blocky/install_generator.rb in blocky-1.0.0

- old
+ new

@@ -1,41 +1,17 @@ module Blocky class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../../../..", __FILE__) - def ask_questions - @blocky_route = ask("What route should be used to manage content blocks? [/admin/content]") - if @blocky_route.blank? - @blocky_route = "/admin/content" - end - - @user_class = ask("What class is used for user authentication? [User]") - if @user_class.blank? - @user_class = "User" - end - end - - def create_initializer_file - create_file "config/initializers/blocky.rb", <<-INITIALIZER -Blocky.user_class = "#{@user_class}" -Blocky.s3_access_key_id = ENV["BLOCKY_S3_KEY"] -Blocky.s3_secret_access_key = ENV["BLOCKY_S3_SECRET"] -Blocky.s3_bucket = ENV["BLOCKY_S3_BUCKET"] -INITIALIZER - end - + # Install the database migrations required for Blocky's content blocks def install_migrations rake "blocky:install:migrations" end - def mount_engine - insert_into_file(File.join("config", "routes.rb"), :after => "Application.routes.draw do\n") do <<-MOUNTENGINE - # This line mounts Blocky's routes to the path '#{@blocky_route}'. - # This means, any requests to '#{@blocky_route}', will go to Blocky::ContentBlocksController. - # If you would like to change where this engine is mounted, simply change the :at option to something different. - mount Blocky::Engine, at: "#{@blocky_route}" - MOUNTENGINE + # Install the content block helper into the main app's ApplicationHelper. + def install_blocky_content_helper + insert_into_file(File.join("app", "helpers", "application_helper.rb"), after: "module ApplicationHelper\n") do + " include BlockyHelper\n" end end - end end