Search code examples
rubyrubygems

Which commit was a specific release on rubygems created from?


I am trying to create a release history, how can I identify which commit a specific version of a gem was created from on rubygems.com? When I extract the *.gem archive it does not include any logging of the commit.

EDIT: The releases were pushed to rubygems without updating the github repo with the relevant tags, I want to backfill github with the appropriate release tags.


Solution

  • Simple answer: You cannot!

    Versions of a gem on Rubygems and commits or tags in Git are two totally different concepts and have nothing in common.

    You already discovered that the gem doesn't contain any information about the use of git or a specific commit. And if you think about that, it makes sense that gems do not contain information about the version control system that was used:

    • There is no need to use Rubygems and Git at the same time. Actually, there is no need to use any version control system at all when you build gems.
    • And even if the author used a version control system, there are other version control systems – like SVN or Mercurial for example.
    • Even if the author used Git to keep track of their source code changes, they could still create and upload multiple different versions of the gem without doing a single git commit in the meantime.
    • And even if the author did a commit for every gem version, then – depending on the configuration of the gem and the git repository – both systems can include files which exist on one system but not on the other.

    That said, the assumption that a specific gem version corresponds with a specific git commit is just valid.