Sha256: 0e3d4c9fe4e693ec1830ebb05ba71fc513fe7bf3909989339d0a4ace860e0433

Contents?: true

Size: 1.25 KB

Versions: 30

Compression:

Stored size: 1.25 KB

Contents

module PowerStencil
  module SystemEntityDefinitions

    class SimpleExec < PowerStencil::SystemEntityDefinitions::ProjectEntity

      include PowerStencil::SystemEntityDefinitions::EntityTemplates

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

      entity_type :simple_exec

      buildable

      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'
            }, user: is_user_entity?
          end
        end
        super(raise_error: raise_error)
      end

      def save(uri = source_uri, raise_error: true, force_save: false, force_files_generation: false )
        valid? raise_error: raise_error
        self.post_process.save
        super
      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

30 entries across 30 versions & 1 rubygems

Version Path
power_stencil-0.10.0 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.8 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.7 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.6 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.5 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.4 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.3 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.2 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.1 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.9.0 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.14 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.13 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.12 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.11 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.10 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.9 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.8 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.7 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.6 lib/power_stencil/system_entity_definitions/simple_exec.rb
power_stencil-0.8.5 lib/power_stencil/system_entity_definitions/simple_exec.rb