Last active
December 10, 2015 23:38
-
-
Save brendon9x/4510688 to your computer and use it in GitHub Desktop.
For listing Rails versions in Apache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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