Sha256: e80ea37d916eedbe8bc8ea27dfe2f43c3c362f8f66aa44001cd21f5a5c217e1f
Contents?: true
Size: 1.63 KB
Versions: 3
Compression:
Stored size: 1.63 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
keep_up-0.8.0 | lib/keep_up/application.rb |
keep_up-0.7.1 | lib/keep_up/application.rb |
keep_up-0.7.0 | lib/keep_up/application.rb |