class DepUpgrade::Command

Attributes

bundler_audit_output[RW]
bundler_outdated_output[RW]
yarn_outdated_output[RW]

Public Instance Methods

bundle_audit() click to toggle source
# File lib/dep_upgrade/command.rb, line 77
def bundle_audit
  return unless has_gemfile?

  puts "\n== Audit all gems =="
  self.bundler_audit_output = `bundle exec bundle audit`.strip
  puts "Done."
end
bundle_audit_update() click to toggle source
# File lib/dep_upgrade/command.rb, line 70
def bundle_audit_update
  return unless has_gemfile?

  puts "\n== Update gems advisory database =="
  system!("bundle exec bundle audit update")
end
bundle_outdated() click to toggle source
# File lib/dep_upgrade/command.rb, line 46
def bundle_outdated
  return unless has_gemfile?

  puts "\n== Analyze outdated gems =="
  self.bundler_outdated_output = `bundle outdated --strict --parseable`
  puts "Done."
end
bundle_update() click to toggle source
# File lib/dep_upgrade/command.rb, line 63
def bundle_update
  return unless has_gemfile?

  puts "\n== Update all gems =="
  system!("bundle update")
end
call() click to toggle source
# File lib/dep_upgrade/command.rb, line 11
def call
  detect_dependency_files

  bundle_outdated
  yarn_outdated

  bundle_update
  bundle_audit_update
  bundle_audit
  yarn_upgrade

  print_summary
end
detect_dependency_files() click to toggle source
# File lib/dep_upgrade/command.rb, line 25
def detect_dependency_files
  puts "\n== Detect dependency config files =="
  @_has_gemfile = File.exist?("Gemfile")
  @_has_package_json = File.exist?("package.json")

  puts "Gemfile#{ " not" unless has_gemfile? } found."
  puts "package.json#{ " not" unless has_package_json? } found."
end
has_gemfile?() click to toggle source
# File lib/dep_upgrade/command.rb, line 34
def has_gemfile?
  @_has_gemfile
end
has_package_json?() click to toggle source
# File lib/dep_upgrade/command.rb, line 38
def has_package_json?
  @_has_package_json
end
print_bundle_audit_summary() click to toggle source
print_bundle_update_summary() click to toggle source
print_summary() click to toggle source
print_yarn_upgrade_summary() click to toggle source
system!(*args) click to toggle source
# File lib/dep_upgrade/command.rb, line 42
def system!(*args)
  system(*args) || abort("\n== Command #{args} failed ==")
end
yarn_outdated() click to toggle source
# File lib/dep_upgrade/command.rb, line 54
def yarn_outdated
  return unless has_package_json?

  puts "\n== Analyze outdated yarn packages =="
  self.yarn_outdated_output = JSON
    .parse(`yarn outdated --json`.split("\n").last)
  puts "Done."
end
yarn_upgrade() click to toggle source
# File lib/dep_upgrade/command.rb, line 85
def yarn_upgrade
  return unless has_package_json?

  puts "\n== Update all yarn packages =="
  system!("yarn upgrade")
end