Move script/setup to bin/setup #131

Merged
merged 1 commit into from Jan 11, 2013

Conversation

Projects
None yet
3 participants
Owner

croaky commented Jan 2, 2013

  • bin/setup is more in line with Rails 4.0 conventions.
  • Include -e $RACK_ENV in Procfile per Heroku docs.
  • Make bin/setup idempotent by only copying .sample.env to .env
    .env if file does not exist yet.
  • Change sample.env to a .sample.env so it shows less often.
Owner

drapergeek commented Jan 2, 2013

I think keeping the sample env gives a good place to start putting the other ENV variables in.

I don't think keeping env in source control is recommended so having the sample there for new developers on the project or even just as a reference for server config is nice.

@jferris jferris and 1 other commented on an outdated diff Jan 3, 2013

templates/script_setup
@@ -5,4 +5,8 @@
bundle install --binstubs=bin/stubs
bundle exec rake db:setup
-cp sample.env .env
+touch .env
+
+if [ `grep -c "RACK_ENV=development" .env` -eq 0 ]; then
@jferris

jferris Jan 3, 2013

Owner

I find this code harder to read than the sample/template file.

@croaky

croaky Jan 4, 2013

Owner

@jferris Fair enough. What do you think of this change? d62c934

@jferris jferris and 1 other commented on an outdated diff Jan 4, 2013

templates/bin_setup
@@ -5,4 +5,8 @@
bundle install --binstubs=bin/stubs
bundle exec rake db:setup
-cp sample.env .env
+touch .env
+
+if [ ! -f .env ]; then
+ echo "RACK_ENV=development" >> .env
@jferris

jferris Jan 4, 2013

Owner

I think the check is good, but I still think just copying the sample file over if .env doesn't exist would be better. Are you strongly opposed to having sample.env in the repo? What if we renamed it to .sample.env so that it didn't show up most of the time?

@croaky

croaky Jan 6, 2013

Owner

Nope, not strongly opposed. The .sample.env dotfile idea is a nice middle ground. Made that change in 69455a4,.

Also changed the PR title and description to match what I intend the squashed commit message to be. Seems the most important part of this commit now is moving the script to bin/setup to match Rails 4.0 conventions.

@croaky croaky Rename script/setup to bin/setup
This will be the Rails 4 recommendation:

rails/rails@009873a

* Include `-e $RACK_ENV` in `Procfile` per Heroku docs.
* Make bin/setup idempotent by only copying `.sample.env` to `.env` if
  `.env` file does not exist yet. Prevent users from accidentally
  overwriting the file, which is not kept in version control.
* Change `sample.env` to a `.sample.env` so it shows less often.
1ebc5a7
Owner

jferris commented Jan 11, 2013

Cool - looks good to me.

@croaky croaky merged commit 1ebc5a7 into master Jan 11, 2013

1 check passed

default The Travis build passed
Details
Owner

croaky commented Jan 11, 2013

Thanks, merged.

jferris referenced this pull request Jan 16, 2013

Closed

Remove sample.env #137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment