Skip to content

Instantly share code, notes, and snippets.

@yvesvanbroekhoven
Created April 28, 2011 09:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yvesvanbroekhoven/946066 to your computer and use it in GitHub Desktop.
Save yvesvanbroekhoven/946066 to your computer and use it in GitHub Desktop.
check for dir path in Rails config files
case Etc.getpwuid(Process.uid).name
when 'your name'
# my config
when 'my name'
# my config
else
# everybody else
end
@fd
Copy link

fd commented Apr 28, 2011

You can also do

case ENV['USER']
when 'your name'
  # my config
when 'my name'
  # my config
else
  # everybody else
end

@yvesvanbroekhoven
Copy link
Author

will try :)

@yvesvanbroekhoven
Copy link
Author

Ok, after some tests, this is a working case:

case Etc.getpwuid(Process.uid).name
...

@fd
Copy link

fd commented May 3, 2011

development:
  <% case Etc.getpwuid(Process.uid).name
     when 'your name' %>
  # your config
  <% else %>
  # my config
  <% end %>

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