Sha256: 101ea78f16f1a693120af1cb0f8db985506778c012a83a5cbea2de2eaf48618c
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true require_relative "runner" require_relative "bundle" require_relative "null_filter" require_relative "skip_filter" require_relative "updater" require_relative "version_control" module KeepUp # Error thrown when we can't go any further. class BailOut < RuntimeError end # Main application class Application def initialize(local:, test_command:, skip:, runner: Runner) @test_command = test_command @local = local @skip = skip @runner = runner end def run check_version_control_clean check_bundle_lockfile update_all_dependencies report_done end private attr_reader :skip, :local, :runner def check_version_control_clean return if version_control.clean? raise BailOut, "Commit or stash your work before running 'keep_up'" end def check_bundle_lockfile return if bundle.check? && version_control.clean? version_control.revert_changes raise BailOut, "Make sure your Gemfile.lock is up-to-date before running 'keep_up'" end def update_all_dependencies Updater.new( bundle: bundle, version_control: version_control, filter: filter ).run end def version_control @version_control ||= VersionControl.new(runner: runner) end def bundle @bundle ||= Bundle.new(runner: runner, local: local) end def report_done puts "All done!" end def filter @filter ||= if skip.any? SkipFilter.new(skip) else NullFilter.new end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
keep_up-0.11.0 | lib/keep_up/application.rb |
keep_up-0.10.2 | lib/keep_up/application.rb |
keep_up-0.10.1 | lib/keep_up/application.rb |
keep_up-0.10.0 | lib/keep_up/application.rb |