test/rails_app/bin/setup in chr-0.5.1 vs test/rails_app/bin/setup in chr-0.5.3
- old
+ new
@@ -1,29 +1,35 @@
-#!/usr/bin/env ruby
-require 'pathname'
+#!/usr/bin/env sh
-# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+# Set up Rails app. Run this script immediately after cloning the codebase.
+# https://github.com/thoughtbot/guides/tree/master/protocol
-Dir.chdir APP_ROOT do
- # This script is a starting point to setup your application.
- # Add necessary setup steps to this file:
+# Exit if any subcommand fails
+set -e
- puts "== Installing dependencies =="
- system "gem install bundler --conservative"
- system "bundle check || bundle install"
+# Set up Ruby dependencies via Bundler
+gem install bundler --conservative
+bundle check || bundle install
- # puts "\n== Copying sample files =="
- # unless File.exist?("config/database.yml")
- # system "cp config/database.yml.sample config/database.yml"
- # end
+# Set up configurable environment variables
+if [ ! -f .env ]; then
+ cp .sample.env .env
+fi
- puts "\n== Preparing database =="
- system "bin/rake db:setup"
+# Set up database and add any development seed data
+bin/rake dev:prime
- puts "\n== Removing old logs and tempfiles =="
- system "rm -f log/*"
- system "rm -rf tmp/cache"
+# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
+mkdir -p .git/safe
- puts "\n== Restarting application server =="
- system "touch tmp/restart.txt"
-end
+# Pick a port for Foreman
+if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
+ printf 'port: 3000\n' >> .foreman
+fi
+
+if ! command -v foreman > /dev/null; then
+ gem install foreman
+fi
+
+# Only if this isn't CI
+# if [ -z "$CI" ]; then
+# fi