Reputation: 16898
Inside of my Rails app's config files (config/environments/*.rb) I need to provide paths to some files needed to configure HTTPS. I don't want to package these files themselves within my application itself because they're things like private key files.
What I'd like to do is check the local OS (whether it is Windows or Linux) and provide alternate paths based on that. What can I call to get this information?
Upvotes: 1
Views: 41
Reputation: 3035
Here's a command-line example which outputs 'linux' on a Linux machine:
ruby -e "require 'rbconfig'; puts Config::CONFIG['target_os']"
Upvotes: 0
Reputation: 6942
may be this is helpful
case RUBY_PLATFORM
when /linux.*x86_64|x86_64.*linux/
OS_PLATFORM = 'linux64'
when /linux/
OS_PLATFORM = 'linux32'
when /darwin/
OS_PLATFORM = 'darwin'
else
OS_PLATFORM = 'win32'
end
Upvotes: 2