Class: FluidCLI::Commands::Theme::Pull
- Inherits:
-
FluidCLI::Command
- Object
- CLI::Kit::BaseCommand
- FluidCLI::Command
- FluidCLI::Commands::Theme::Pull
- Includes:
- Common::RootHelper
- Defined in:
- lib/fluid_cli/commands/theme/pull.rb
Constant Summary
Constants included from Common::RootHelper
Common::RootHelper::REQUIRED_FOLDERS
Instance Attribute Summary
Attributes inherited from FluidCLI::Command
Instance Method Summary collapse
Methods included from Common::RootHelper
#exist_and_not_empty?, #root_value, #valid_theme_directory?
Methods inherited from FluidCLI::Command
call, call_help, #initialize, options, subcommand, subcommand_registry
Constructor Details
This class inherits a constructor from FluidCLI::Command
Instance Method Details
#call(_args, name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fluid_cli/commands/theme/pull.rb', line 17 def call(_args, name) root = root_value(, name) return if exist_and_not_empty?(root) && !valid_theme_directory?(root) delete = !.flags[:nodelete] theme = find_theme(root, **.flags) return if theme.nil? syncer = FluidCLI::Theme::Syncer.new(@ctx, theme: theme) begin syncer.start_threads CLI::UI::Frame.open("pulling theme #{theme.name} (##{theme.id})") do FluidCLI::Theme::UI::SyncProgressBar.new(syncer).progress(:download_theme!, delete: delete) end if syncer.has_any_error? @ctx.warn("Some files could not be downloaded. Please check the log file for more details: #{FluidCLI::LOG_FILE}") else @ctx.done("Theme #{theme.name} (##{theme.id}) pulled successfully.") end rescue FluidCLI::API::APIRequestNotFoundError @ctx.abort("No theme found with ID: ##{theme.id}") ensure syncer.shutdown end end |