mmyoji / bu_pr

Simple bundle update and pull-request CLI tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove compare_linker

mmyoji opened this issue · comments

  • Write code by myself for less dependencies.
  • Use cleaner similar gem.

compare_linker does

  • Fetch base branch's Gemfile.lock and head branch's one from remote
  • Compare their diffs
  • Find https://github.com/:username/:repo/compare links
  • Create comment

On the other hand, this bu_pr gem itself does executing bundle update and it is not necessary to fetch Gemfile.locks from remote repository. Only compare the file(s) before and after bundle update in local machine.

require "bundler"

file = File.read("./Gemfile.lock")
before_parser = Bundler::LockfileParser.new(file)

# execute `bundle update`

file = File.read("./Gemfile.lock")
after_parser = Bundler::LockfileParser.new(file)

# and compare gems

very simple approach 😎

Problems

  • how to get the Gemfile.lock path?
    • Dir.pwd + "/Gemfile.lock" ?? just try
    • => Bundler.root #=> #<Pathname:/home/mmyoji/projects/bu_pr>

no motivation