Sha256: c63e03d66ce4258898ef5113c1a3a5ceaf2f9476d71fe1d328254af566866f61

Contents?: true

Size: 1.29 KB

Versions: 36

Compression:

Stored size: 1.29 KB

Contents

module PowerStencil
  module CommandProcessors

    class Delete

      include Climatic::Script::UnimplementedProcessor
      include Climatic::Proxy
      include PowerStencil::Project::Proxy
      include PowerStencil::CommandProcessors::EntityHelper

      def execute
        analyse_extra_params.each do |search_criterion|
          begin
            unless project.engine.entity *search_criterion.to_a, project.engine.root_universe
              puts "Skipping '#{search_criterion.as_path}'. Entity not found."
              next
            end
            puts_and_logs "Deleting entity '#{search_criterion.as_path}'"
            if project.engine.delete_entity project.engine.root_universe,
                                            *search_criterion.to_a,
                                            delete_files: config[:'delete-files']
              msg = "Deleted '#{search_criterion.as_path}'"
              msg << ' and associated files.' if config[:'delete-files']
              puts msg
            else
              puts 'Cancelled by user input.'
            end
          rescue => e
            puts "Failed to delete '#{search_criterion.as_path}' with message '#{e.message}'."
            logger.debug PowerStencil::Error.report_error(e)
          end
        end
      end

    end

  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
power_stencil-0.4.5 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.4 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.3 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.2 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.1 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.0 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.9 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.8 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.7 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.6 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.5 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.4 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.3 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.2 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.1 lib/power_stencil/command_processors/delete.rb
power_stencil-0.3.0 lib/power_stencil/command_processors/delete.rb