Sha256: 6b7e6865ed2f6d8935bf1b73371945040b419a998d839943e52c17391e2146d9

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

require 'logical-construct/target/sinatra-resolver'
module LogicalConstruct
  module Default
    class ResolveConfiguration < Mattock::Tasklib
      default_namespace 'configuration'

      setting :bind, '0.0.0.0'
      setting :port, 51076
      setting :valise

      def initialize(*args, &block)
        @pending_satisfiables = []
        @resolver = nil
        @manifest = nil
        super
      end

      def default_configuration(provision)
        super
        self.valise = provision.valise
      end

      def add_file(file_satisfiable)
        if @resolver.nil?
          @pending_satifiables << file_satisfiable
        else
          @resolver.add_satisfiable(file_satisfiable)
          @manifest.add_satisfiable(file_satisfiable)
        end
      end

      def define
        in_namespace do
          @manifest = LogicalConstruct::Manifest.new(*@pending_satisfiables)

          @resolver = LogicalConstruct::SinatraResolver.new(*([@manifest] + @pending_satisfiables)) do |task|
            copy_settings_to(task)
          end
          @pending_satisfiables.clear
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logical-construct-0.0.5 lib/logical-construct/target/platforms/default/resolve-configuration.rb
logical-construct-0.0.4 lib/logical-construct/target/platforms/default/resolve-configuration.rb
logical-construct-0.0.3 lib/logical-construct/target/platforms/default/resolve-configuration.rb
logical-construct-0.0.2 lib/logical-construct/target/platforms/default/resolve-configuration.rb
logical-construct-0.0.1 lib/logical-construct/target/platforms/default/resolve-configuration.rb