module HelperMethods def fetch_database db = ask("\n\nWhat database would you like to start off with? P-Postgres / M-Mongoid / Default-SQLite", :blue) case db when "P","p" 'postgres' when "M","m" 'mongoid' else 'sqlite' end end def create_postgres @username = ask("\n\nPlease enter you postgres username", :blue) @password = ask("\n\nPlease enter you postgres password. Leave blank if not applicable", :blue) log :bootup_log, "Initializing database.yml" template 'database.yml.erb', 'config/database.yml' log :bootup_log, "Creating database" rake("db:create") end def create_mongoid unless @db == "sqlite" log :bootup_log, "Generating Mongoid config" generate "mongoid:config" end end def setup_view_stuff log :bootup_log, "Installing Twitter Bootstrap" generate "bootstrap:install" log :bootup_log, "Copy application.js & initialize datatables to #datatables - Remember to change sorting" copy_file "application.js", "app/assets/javascripts/application.js" log :bootup_log, "Copying stylesheets" copy_file "application.css", "app/assets/stylesheets/application.css" log :bootup_log, "Installing Simple Form" generate "simple_form:install --bootstrap" end def setup_testing log :bootup_log, "Removing Tests.." inside Rails.root do run "rm -rf test/" end log :bootup_log, "Setting up Rspec.." generate "rspec:install" log :bootup_log, "Setting up Guard with a custom guardfile.." copy_file "Guardfile", "Guardfile" log :bootup_log, "Setting up spork" copy_file "spec_helper.rb", "spec/spec_helper.rb" end def setup_gems log :bootup_log, "Copying Gemfile" template "Gemfile.erb", "Gemfile" log :bootup_log, "Running Bundler" Bundler.with_clean_env do run "bundle install" end end def first_commit log :bootup_log, "Initializing git repo" inside Rails.root do run "git init" end copy_file ".gitignore", ".gitignore" inside Rails.root do run "git add ." run "git commit -m 'Initial Commit'" end end end