Created
July 13, 2009 19:59
-
-
Save sxross/146407 to your computer and use it in GitHub Desktop.
This file contains 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/env ruby | |
require 'rubygems' | |
require 'fileutils' | |
class Object | |
def empty? | |
return true if self.nil? | |
case | |
when String, Array, Hash | |
return true if self.length == 0 | |
else | |
return false | |
end | |
end | |
end | |
def put_gems_unless_empty(message, gems) | |
puts "\n#{message} gems\n#{'-' * (message.length + 5)}\n#{gems.strip}" unless gems.empty? | |
end | |
gems = `gem list` | |
os = ENV['OS'] | |
os = RUBY_PLATFORM if os.empty? | |
required_gems_shared = `cat config/environment.rb | grep "config.gem"` | |
required_gems_test = `cat config/environments/test.rb | grep "config.gem"` | |
required_gems_development = `cat config/environments/development.rb | grep "config.gem"` | |
required_gems_production = `cat config/environments/production.rb | grep "config.gem"` | |
required_gems_cucumber = `cat config/environments/cucumber.rb | grep "config.gem"` | |
puts "Project: #{FileUtils::pwd}" | |
puts "Date: #{Date.today}" | |
puts | |
puts "OS Info: #{os}" | |
puts "Ruby: #{RUBY_VERSION} p#{RUBY_PATCHLEVEL}" | |
puts | |
puts "Gems required in project (shallow scan)" | |
puts "---------------------------------------" | |
put_gems_unless_empty "Shared", required_gems_shared | |
put_gems_unless_empty "Development", required_gems_development | |
put_gems_unless_empty "Test", required_gems_test | |
put_gems_unless_empty "Production", required_gems_production | |
put_gems_unless_empty "Cucumber", required_gems_cucumber | |
puts | |
put_gems_unless_empty "Installed", gems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment