powder-rb / powder

Makes Pow even easier. I mean really, really, ridiculously easy
http://git.io/powder
MIT License
1.29k stars 69 forks source link

Launch a rails console in pow environment #123

Open nielsbuus opened 9 years ago

nielsbuus commented 9 years ago

I would like to be able to run powder console to launch a rails console with the same environment that my application is running with.

Would you be in favor of a pull request adding that sort of functionality?

philnash commented 9 years ago

Why would you not use rails console?

nielsbuus commented 8 years ago

bundle exec rails console does not include .powrc and .powenv.

The easiest way is get around that is to source them both before launching the rails console, but this leaves your current shell dirty which can have side effects ranging from confusing to dangerous.

For instance, if you are working in one project and you set ENABLE_INVOICING=1 and then you switch to another project, it could exhibit undesired behavior because you've forgot that ENABLE_INVOICING is still set. I do realize the likelihood is small, because the pow webserver itself is running independently of your shell.

In addition to side effects, it is also tedious that you have to source before launching a console and if you are changing your .pow* files, then you have to re-source every time you want those changes reflected in a console.

For now, I have written my own bash script and dropped it in my path:

#!/usr/bin/env bash

source .powrc
source .powenv
bundle exec spring stop
bundle exec rails c

I think this functionality is quite useful, so I think it should be part of powder.

nielsbuus commented 8 years ago

Come to think of it, it would be nice to have a command to run anything in a pow environment. E.g. powder exec rake some:task

nielsbuus commented 8 years ago

@philnash any update on this?

philnash commented 8 years ago

This does seem like a pretty good idea, given your explanation. Do you have time to have a go at implementing?