Sha256: c8356f4a5aa5ec219b09998738f199cead3941944da88ddb35684ed8b841623b

Contents?: true

Size: 624 Bytes

Versions: 6

Compression:

Stored size: 624 Bytes

Contents

class TerraspaceBundler::CLI
  class PurgeCache < Base
    include TB::Mod::Concerns::PathConcern
    include TB::Util::Logging
    include TB::Util::Sure

    def run
      paths = [tmp_root]
      are_you_sure?(paths)
      paths.each do |path|
        FileUtils.rm_rf(path)
        logger.info "Removed #{path}"
      end

    end

    def are_you_sure?(paths)
      pretty_paths = paths.map { |p| "    #{p}" }.join("\n")
      message = <<~EOL.chomp
        Will remove these folders and all their files:

        #{pretty_paths}

        Are you sure?
      EOL
      sure?(message) # from Util::Sure
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
terraspace-bundler-0.5.0 lib/terraspace_bundler/cli/purge_cache.rb
terraspace-bundler-0.4.4 lib/terraspace_bundler/cli/purge_cache.rb
terraspace-bundler-0.4.3 lib/terraspace_bundler/cli/purge_cache.rb
terraspace-bundler-0.4.2 lib/terraspace_bundler/cli/purge_cache.rb
terraspace-bundler-0.4.1 lib/terraspace_bundler/cli/purge_cache.rb
terraspace-bundler-0.4.0 lib/terraspace_bundler/cli/purge_cache.rb