Sha256: aeeb8ed42ce641252a6838a23c81ab458dcd18581a88530b4671224d5f0cfc6e

Contents?: true

Size: 1.58 KB

Versions: 9

Compression:

Stored size: 1.58 KB

Contents

module PowerStencil
  module CommandProcessors

    class Build

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



      def execute

        if config[:'supported-builds']
          project.engine.available_entities_hash.select do |_, klass|
            klass.respond_to?(:buildable?) and klass.buildable?
          end .each do |entity_type, _|
            puts " - '#{entity_type}'"
          end
          return
        end

        if config.command_line_layer.extra_parameters.empty?
          raise PowerStencil::Error, 'Please specify something to build'
        end

        if config[:'build-tag']
          raise PowerStencil::Error, "Invalid tag name '#{config[:'build-tag']}'" if config[:'build-tag'].include? '/'
          raise PowerStencil::Error, "Cannot tag a build under Windows" if PowerStencil::Utils::Os.windows?
        end

        targets = targets_from_criteria analyse_extra_params, project.engine.root_universe
        raise PowerStencil::Error, 'No valid entity specified' if targets.empty?
        project.engine.build targets, fail_on_error: config[:'fail-on-error'], parallelized: config[:parallelized]
        project.engine.last_build_report.each do |entity_full_name, entity_report|
          if entity_report == ['Ok']
            puts " - '#{entity_full_name}' has been correctly built"
          else
            puts " - Failed to build '#{entity_full_name}' because ", entity_report
          end
        end

      end

    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
power_stencil-0.6.0 lib/power_stencil/command_processors/build.rb
power_stencil-0.5.1 lib/power_stencil/command_processors/build.rb
power_stencil-0.5.0 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.22 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.21 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.20 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.19 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.18 lib/power_stencil/command_processors/build.rb
power_stencil-0.4.17 lib/power_stencil/command_processors/build.rb