Sha256: d48085728bbad8ddf5797eabb5bb423a82f7b672e1ee32c9b4c9f71104303025

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 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_and_logs " - Failed to build '#{entity_full_name}' because #{entity_report.join}", logs_as: :error, check_verbose: false
          end
        end

      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
power_stencil-0.6.1 lib/power_stencil/command_processors/build.rb