Sha256: 95c059592bb8111580a25d2d1e592885928ac5fc5eab413c7241611ac3f0dd91

Contents?: true

Size: 1.41 KB

Versions: 27

Compression:

Stored size: 1.41 KB

Contents

require 'autoproj/cli/inspection_tool'
require 'tty/prompt'

module Autoproj
    module CLI
        class Clean < InspectionTool
            def validate_options(packages, options)
                packages, options = super
                if packages.empty? && !options[:all]
                    prompt = TTY::Prompt.new
                    if !prompt.yes?("this is going to clean all packages. Is that really what you want ?")
                        raise Interrupt
                    end
                end
                return packages, options
            end

            def run(selection, options = Hash.new)
                initialize_and_load
                packages, _ = normalize_command_line_package_selection(selection)

                deps = if options.has_key?(:deps)
                           options[:deps]
                       else
                           selection.empty?
                       end

                source_packages, * = resolve_selection(
                    packages,
                    recursive: deps)
                if source_packages.empty?
                    raise CLIInvalidArguments, "no packages or OS packages match #{selection.join(" ")}"
                end

                source_packages.each do |pkg_name|
                    ws.manifest.find_autobuild_package(pkg_name).
                        prepare_for_rebuild
                end
            end
        end
    end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
autoproj-2.14.0 lib/autoproj/cli/clean.rb
autoproj-2.13.0 lib/autoproj/cli/clean.rb
autoproj-2.12.1 lib/autoproj/cli/clean.rb
autoproj-2.12.0 lib/autoproj/cli/clean.rb
autoproj-2.11.0 lib/autoproj/cli/clean.rb
autoproj-2.10.2 lib/autoproj/cli/clean.rb
autoproj-2.10.1 lib/autoproj/cli/clean.rb
autoproj-2.10.0 lib/autoproj/cli/clean.rb
autoproj-2.9.0 lib/autoproj/cli/clean.rb
autoproj-2.8.8 lib/autoproj/cli/clean.rb
autoproj-2.8.7 lib/autoproj/cli/clean.rb
autoproj-2.8.6 lib/autoproj/cli/clean.rb
autoproj-2.8.5 lib/autoproj/cli/clean.rb
autoproj-2.8.5.b1 lib/autoproj/cli/clean.rb
autoproj-2.8.4 lib/autoproj/cli/clean.rb
autoproj-2.8.3 lib/autoproj/cli/clean.rb
autoproj-2.8.2 lib/autoproj/cli/clean.rb
autoproj-2.8.1 lib/autoproj/cli/clean.rb
autoproj-2.8.0 lib/autoproj/cli/clean.rb
autoproj-2.7.1 lib/autoproj/cli/clean.rb