Skip to content

Instantly share code, notes, and snippets.

@crisptrutski
Forked from brendon9x/list_rack_versions.rb
Last active December 15, 2015 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crisptrutski/5194679 to your computer and use it in GitHub Desktop.
Save crisptrutski/5194679 to your computer and use it in GitHub Desktop.
#!/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_gems = `cd #{dir}; rvm exec bundle list|grep ' rails'`
if rails_gems == ""
puts "#{f}: unknown (gem not found)"
next
else
rails_version = rails_gems.match(/\(([^)]+)\)/)[1]
puts "#{f}: #{rails_version}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment