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.7.0 lib/autoproj/cli/clean.rb
autoproj-2.6.1 lib/autoproj/cli/clean.rb
autoproj-2.6.0 lib/autoproj/cli/clean.rb
autoproj-2.5.1 lib/autoproj/cli/clean.rb
autoproj-2.5.0 lib/autoproj/cli/clean.rb
autoproj-2.5.0.pre1 lib/autoproj/cli/clean.rb
autoproj-2.4.0 lib/autoproj/cli/clean.rb