Class: Fontist::CacheCLI
- Inherits:
-
Thor
- Object
- Thor
- Fontist::CacheCLI
- Includes:
- Fontist::CLI::ClassOptions
- Defined in:
- lib/fontist/cache_cli.rb
Instance Method Summary collapse
Methods included from Fontist::CLI::ClassOptions
#handle_class_options, included, #log_level
Instance Method Details
#clear ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fontist/cache_cli.rb', line 6 def clear () dir = Fontist.downloads_path dir.each_child(&:rmtree) if dir.exist? clear_indexes Fontist.ui.success("Cache has been successfully removed.") CLI::STATUS_SUCCESS end |
#clear_import ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fontist/cache_cli.rb', line 17 def clear_import () cache_path = Fontist.import_cache_path if Dir.exist?(cache_path) size = calculate_size(cache_path) Fontist::Utils::FileOps.safe_rm_rf(cache_path) Fontist.ui.success("Import cache cleared: #{format_size(size)}") else Fontist.ui.say("Import cache is already empty") end CLI::STATUS_SUCCESS end |
#info ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fontist/cache_cli.rb', line 33 def info () download_cache = cache_info(Fontist.downloads_path) import_cache = cache_info(Fontist.import_cache_path) Fontist.ui.say("Font download cache:") Fontist.ui.say(" Location: #{Fontist.downloads_path}") Fontist.ui.say(" Size: #{format_size(download_cache[:size])}") Fontist.ui.say(" Files: #{download_cache[:files]}") Fontist.ui.say("\nImport cache:") Fontist.ui.say(" Location: #{Fontist.import_cache_path}") Fontist.ui.say(" Size: #{format_size(import_cache[:size])}") Fontist.ui.say(" Files: #{import_cache[:files]}") CLI::STATUS_SUCCESS end |