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.6.0 lib/power_stencil/command_processors/delete.rb
power_stencil-0.5.1 lib/power_stencil/command_processors/delete.rb
power_stencil-0.5.0 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.22 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.21 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.20 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.19 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.18 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.17 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.16 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.15 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.14 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.13 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.12 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.11 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.10 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.9 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.8 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.7 lib/power_stencil/command_processors/delete.rb
power_stencil-0.4.6 lib/power_stencil/command_processors/delete.rb