module Unwrappr

Define our namespace

Welcome to unwrappr…

Constants

VERSION

Public Class Methods

any_lockfile_present?(lock_files) click to toggle source
# File lib/unwrappr/cli.rb, line 101
def self.any_lockfile_present?(lock_files)
  lock_files.any? { |lock_file| GitCommandRunner.file_exist?(lock_file) }
end
bundle_update!(lock_files:, recursive:) click to toggle source
# File lib/unwrappr/cli.rb, line 105
def self.bundle_update!(lock_files:, recursive:)
  directories(lock_files: lock_files, recursive: recursive).each do |dir|
    Dir.chdir(dir) do
      puts "Doing the unwrappr thing in #{Dir.pwd}"
      BundlerCommandRunner.bundle_update!
    end
  end
end
directories(lock_files:, recursive:) click to toggle source
# File lib/unwrappr/cli.rb, line 114
def self.directories(lock_files:, recursive:)
  if recursive
    lock_files
      .flat_map { |f| Dir.glob("**/#{f}") }
      .map { |f| File.dirname(f) }
      .uniq
  else
    %w[.]
  end
end
run_unwrappr_in_pwd(base_branch:, lock_files:, recursive:) click to toggle source
# File lib/unwrappr/cli.rb, line 92
def self.run_unwrappr_in_pwd(base_branch:, lock_files:, recursive:)
  return unless any_lockfile_present?(lock_files)

  GitCommandRunner.create_branch!(base_branch: base_branch)
  bundle_update!(lock_files: lock_files, recursive: recursive)
  GitCommandRunner.commit_and_push_changes!
  GitHub::Client.make_pull_request!(lock_files)
end