Sha256: 37c40d3e9287e7bcb1dac3243d75d589ff0dacf384e014aac1eac0f69cda0116

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

class BootupGenerator < Rails::Generators::Base
  require_relative 'authentication'
  require_relative 'methods'

  include HelperMethods

  source_root File.expand_path('../templates', __FILE__)
  argument :app_name, type: :string, default: Rails.application.class.parent

  def generate_bootup
    log :bootup, "Booting #{app_name}......"

    #Get database from User
    @db = fetch_database

    #Setup & bundle the Gemfile
    setup_gems

    log :bootup_log, "Removing public/index.."
    inside Rails.root do
      run "rm public/index.html"
    end

    #For postgres databases, a username password needs to be part of database.yml. This data needs to come from the user. For mongoid, the mongoid:config generator is run
    @db == 'postgres' ? create_postgres : create_mongoid

    #Run generators for all view related gems
    setup_view_stuff

    tests = ask("\n\n Would you like to get rid of the default testing framework & install Rspec with Guard?", :blue)
    if %w(y yes).include? tests
      #Setup Rspec & Guard
      setup_testing
    else
      log :bootup_log, "Skipping removal of tests"
    end

    #Git init, git add & git commit
    first_commit

    auth = ask("\n\n Would you like Bootup to create an application with basic authentication to start off with?", :blue)

    if %w(Y y Yes YES yes).include? auth
      #This sets a complete web application with authentication
      setup_authentication
    end

    say "\n Installation complete! Hope bootup helped you save some time. \n\n\n", :green
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootup-0.0.4.1 lib/generators/bootup/bootup_generator.rb
bootup-0.0.4 lib/generators/bootup/bootup_generator.rb