Permalink
Browse files

Include git gems' branch and sha in output from show

  • Loading branch information...
indirect committed Mar 30, 2010
1 parent 6b5efc7 commit 8011efc01f7f4994f1bce9a92b3133bcf9b8474f
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/bundler/cli.rb
  2. +8 −0 lib/bundler/rubygems_ext.rb
View
@@ -128,7 +128,7 @@ def show(gem_name = nil)
environment = Bundler.load
Bundler.ui.info "Gems included by the bundle:"
environment.specs.sort_by { |s| s.name }.each do |s|
- Bundler.ui.info " * #{s.name} (#{s.version})"
+ Bundler.ui.info " * #{s.name} (#{s.version}#{s.git_version})"
end
end
end
@@ -17,6 +17,14 @@ def groups
@groups ||= []
end
+ def git_version
+ Dir.chdir(full_gem_path) do
+ rev = `git rev-parse HEAD`.strip[0...6]
+ branch = `git show-branch --no-color 2>/dev/null`.strip[/\[(.*?)\]/, 1]
+ branch.empty? ? " #{rev}" : " #{branch}-#{rev}"
+ end if File.exist?(File.join(full_gem_path, ".git"))
+ end
+
def to_gemfile(path = nil)
gemfile = "source :gemcutter\n"
gemfile << dependencies_to_gemfile(dependencies)

0 comments on commit 8011efc

Please sign in to comment.