Class: Cli::LibrariesCommand
- Inherits:
-
Thor
- Object
- Thor
- Cli::LibrariesCommand
- Defined in:
- app/lib/cli/libraries_command.rb
Constant Summary collapse
- DESCRIPTION =
"manage libraries"
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/lib/cli/libraries_command.rb', line 20 def create l = Library.create(name: [:name], path: [:path], storage_service: "filesystem") if l.valid? puts "\nNew library created OK" else puts "\nError when creating library:\n" puts l.errors..inspect end end |
#scan ⇒ Object
10 11 12 13 14 15 |
# File 'app/lib/cli/libraries_command.rb', line 10 def scan scope = Library.all # rubocop:disable Pundit/UsePolicyScope scope = scope.where(name: [:name]) if [:name].presence puts "\nQueueing #{scope.count} #{"library".pluralize(scope.count)} for filesystem scan" scope.find_each(&:detect_filesystem_changes_later) end |