Closed ddnexus closed 9 years ago
Thanks for the idea! I was thinking about it at the beginning of development, but never needed this, so it was forgotten. Do you switch often between environments or you just use one with custom name?
Good observation: we have to switch trough environments, so a per-app setting would be optimal, but if it is complex to implement, a manual switch could be enough.
I mean, the same app does not switch a lot, but different apps have different envs (including development for some)
I got it, thanks) It's not a problem to add separate setting for each application, I just was thinking about the place for this option. If you switch environments rarely, then I'll put it in the plugin config dialog, if you do this often, then plugin toolbar will be more suitable place for it.
Whatever is better for you :). Thanks!
@ddnexus, unfortunately, implementation may take some time. Current RubyMine API doesn't allow to set environment variables for running rake tasks (details here: https://devnet.jetbrains.com/thread/459419?tstart=0), so I need time to find a workaround for this. Sorry.
I see :(
I have a few possible work arounds:
On Thu, Dec 18, 2014 at 9:46 PM, Basil Gren notifications@github.com wrote:
@ddnexus https://github.com/ddnexus, unfortunately, implementation may take some time. Current RubyMine API doesn't allow to set environment variables for running rake tasks (details here: https://devnet.jetbrains.com/thread/459419?tstart=0), so I need time to find a workaround for this. Sorry.
— Reply to this email directly or view it on GitHub https://github.com/basgren/railways/issues/12#issuecomment-67495007.
sorry, I missed that the rake task setting IS a per-app setting! That solves the problem for now. We need just to add a simple task in the app. Something like the following:
task :custom_routes do
Rails.env = 'custom_environment'
Rake::Task['routes'].invoke
end
Thank you!
Thank you, @ddnexus, for your suggestions! I was thinking about overriding routes task, but decided that it would be unoptimal hack just to make IDE plugin work. But happily I remembered, that rake accepts environment variables as parameters, so both alternatives are the same:
$ RAILS_ENV=test rake routes
$ rake routes RAILS_ENV=test
While the first one cannot be done using RubyMine API, the second invocation is easily implemented, and also it's cross-platform (in Windows systems env. vars cannot be set using the first syntax). So yesterday I tested my suggestion and it worked! I need to polish several things yet, but you will see this new option in the next release and then you won't need extra rake task to make the plugin work. Thank you for your help!
@ddnexus , new version of Railways plugin is released. Please update it to 0.8.1 version and let me know if everything is OK with Rails environment settings.
I tried it and it's perfect. Thank you for the fast response!
Railways relies on the development environment, and if you don't have one it cannot work. We have several apps that just don't have any development configured since each developer uses his own. Adding a simple setting would allow its usage also in that case.