module Breezer

This is our main class. Call Breezer.freeze! to update the Gemfile

Constants

VERSION

Public Class Methods

check_gemfile!(gemfile, deps, options) click to toggle source
# File lib/breezer.rb, line 24
def self.check_gemfile!(gemfile, deps, options)
  puts "Checking Gemfile #{gemfile}..."
  checks = Freezer.check_gemfile!(gemfile, deps, options)
  print_check_results(checks)
  checks.values.map { |e| e[:valid] }.all?
end
freeze!(gemfile_path, lockfile_path, **options) click to toggle source
# File lib/breezer.rb, line 8
def self.freeze!(gemfile_path, lockfile_path, **options)
  puts "Updating Gemfile #{gemfile_path}..."
  absolute_lockfile_path = File.join(lockfile_path)
  absolute_gemfile_path = File.join(gemfile_path)
  ENV['BUNDLE_GEMFILE'] = absolute_gemfile_path

  deps = Parser.deps(absolute_lockfile_path, options)

  gemfile = Bundler.read_file(absolute_gemfile_path)
  if options[:check]
    check_gemfile!(gemfile, deps, options)
  else
    update_gemfile!(gemfile, deps, options, options[:output] || absolute_gemfile_path)
  end
end
print_check_results(checks) click to toggle source
update_gemfile!(gemfile, deps, options, output) click to toggle source
# File lib/breezer.rb, line 31
def self.update_gemfile!(gemfile, deps, options, output)
  updated_gemfile = Freezer.update_gemfile!(gemfile, deps, options)
  write_or_print_output(updated_gemfile, output, options)
end
write_or_print_output(updated_gemfile, output_path, **options) click to toggle source
# File lib/breezer.rb, line 36
def self.write_or_print_output(updated_gemfile, output_path, **options)
  if options[:dry]
    puts updated_gemfile
  else
    File.open(output_path, 'w') do |file|
      file.write(updated_gemfile)
    end
    puts 'Gemfile updated !'
  end
  updated_gemfile
end