Sha256: b0859b535f821de6c27043025ddb99c96e73de69955854a174b165ba34193dce

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

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

  def generate_bootup
    log :generate, "Booting #{app_name}"

    log :generate, "Copying Gemfile"
    copy_file "Gemfile", "Gemfile"

    log :generate, "Running Bundler"
    inside Rails.root do
      run "bundle install"
    end

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

    log :generate, "Initializing database.yml"
    template 'database.yml.erb', 'config/database.yml'

    log :generate, "Creating database"
    rake("db:create")

    log :generate, "Installing Twitter Bootstrap"
    generate "bootstrap:install"

    log :generate, "Copy application.js & initialize datatables to #datatables - Remember to change sorting"
    copy_file "application.js", "app/assets/javascripts/application.js"

    log :generate, "Copying stylesheets"
    copy_file "application.css", "app/assets/stylesheets/application.css"

    log :generate, "Installing Simple Form"
    generate "simple_form:install --bootstrap"

    tests = ask("Would you like to get rid of the default testing framework & install Rspec with Guard?")
    if tests == 'y' or tests == 'yes'
      log :generate, "Removing Tests.."
      inside Rails.root do
        run "rm -rf test/"
      end

      log :generate, "Setting up Rspec.."
      generate "rspec:install"

      log :generate, "Setting up Guard with a custom guardfile.."
      copy_file "Guardfile", "Guardfile"

      log :generate, "Setting up spork"
      copy_file "spec_helper.rb", "spec/spec_helper.rb"
    else
      log :generate, "Skipping removal of tests"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootup-0.0.1alpha lib/generators/bootup/bootup_generator.rb