Sha256: 9c63722bdc7ed4ab6ed7002231dac241976a5688aa5c1d66884bbcd0cbfb8f21

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

module PowerStencil
  module SystemEntityDefinitions

    class SimpleExec < PowerStencil::SystemEntityDefinitions::ProjectEntity

      include PowerStencil::SystemEntityDefinitions::HasAssociatedFiles

      DOC = 'Describes a simple process to be called after source files have been rendered'.freeze

      entity_type :simple_exec

      buildable_by ''

      has_one :process_descriptor, name: :post_process
      not_null :post_process

      def valid?(raise_error: false)
        unless super(raise_error: false)
          if self.post_process.nil?
            self.post_process = PowerStencil.project.engine.new_entity universe, :process_descriptor, fields: {
                name: "simple_exec_#{name}.process",
                process: './main.sh'
            }
          end
        end
        super(raise_error: raise_error)
      end

      def save(uri = source_uri, force_files_generation: false)
        valid?
        self.post_process.save
        super(uri, force_files_generation: force_files_generation)
      end

      def delete(force_files_deletion: false)
        super
        if self.post_process.name == "simple_exec_#{name}.process"
          self.post_process.delete
        end
        self
      end


    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
power_stencil-0.4.1 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.4.0 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.9 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.8 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.7 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.6 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.5 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.4 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.3 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.2 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.1 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.3.0 lib/power_stencil/system_entity_definitions/simple_exec.rb