Sha256: ef787af604c6034c321aa110e6e153406347461a3a9d788d700bbb3aec87916c

Contents?: true

Size: 477 Bytes

Versions: 12

Compression:

Stored size: 477 Bytes

Contents

# encoding: utf-8

module Doggy
  class CLI::Delete
    def run(ids)
      Doggy::Model.all_local_resources.each do |resource|
        next unless ids.include?(resource.id.to_s)
        Doggy.ui.say("Deleting #{resource.path}, with id #{resource.id}")
        resp = resource.destroy
        if resp['errors']
          Doggy.ui.error("Could not delete. Error: #{resp['errors']}. Skipping")
        else
          resource.destroy_local
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
doggy-2.0.42 lib/doggy/cli/delete.rb
doggy-2.0.41 lib/doggy/cli/delete.rb
doggy-2.0.40 lib/doggy/cli/delete.rb
doggy-2.0.39 lib/doggy/cli/delete.rb
doggy-2.0.38 lib/doggy/cli/delete.rb
doggy-2.0.37 lib/doggy/cli/delete.rb
doggy-2.0.36 lib/doggy/cli/delete.rb
doggy-2.0.35 lib/doggy/cli/delete.rb
doggy-2.0.34 lib/doggy/cli/delete.rb
doggy-2.0.33 lib/doggy/cli/delete.rb
doggy-2.0.32 lib/doggy/cli/delete.rb
doggy-2.0.31 lib/doggy/cli/delete.rb