Skip to content

Instantly share code, notes, and snippets.

@kbarber
Created July 2, 2012 13:28
Show Gist options
  • Select an option

  • Save kbarber/3033250 to your computer and use it in GitHub Desktop.

Select an option

Save kbarber/3033250 to your computer and use it in GitHub Desktop.
Reverse engineer modules
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'pathname'
current_dir = Pathname.new(Dir.pwd)
current_dir.children.each do |child|
md = child + 'metadata.json'
md_version = JSON.parse(md.read)['version'] if md.exist?
git_version = nil
Dir.chdir(child) do
git_version = `git describe --tags 2>/dev/null`.chomp
end
puts <<-EOS
Directory: #{child}
Metadata Version: #{md_version}
Git Version: #{git_version}
EOS
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment