Skip to content

Instantly share code, notes, and snippets.

@brendon9x
Last active December 10, 2015 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brendon9x/4510688 to your computer and use it in GitHub Desktop.
Save brendon9x/4510688 to your computer and use it in GitHub Desktop.
For listing Rails versions in Apache
#!/usr/bin/ruby
files = Dir["reports*"]
files.each do |f|
dir = File.join(`cat #{f}|grep DocumentRoot`.lines.first.split(/\s+/).last.split(/\//)[0..-2])
rails_version = `cd #{dir}; rvm exec bundle list|grep ' rack'`.match(/\(([^)]+)\)/)[1]
deployed_version = `cd #{dir}; cat version`
deployed_branch = `cd #{dir}; cat config/environments/capistrano/#{f.to_s.gsub(/reports_/, '')}.rb|grep :branch`
puts "#{f}: #{rails_version}@#{deployed_version} - #{deployed_branch}"
end
#!/usr/bin/ruby
files = Dir["reports*"]
files.each do |f|
dir = File.join(`cat #{f}|grep DocumentRoot`.lines.first.split(/\s+/).last.split(/\//)[0..-2])
rails_version = `cd #{dir}; rvm exec bundle list|grep ' rails'`.match(/\(([^)]+)\)/)[1]
puts "#{f}: #{rails_version}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment