lib/bolt/task.rb
# Returns a hash of implementation name, path to executable, input method (if defined),
# and any additional files (name and path)
Returns a hash of implementation name, path to executable, input method (if defined),
and any additional files (name and path)
Returns a hash of implementation name path to executable input method ( if defined ) and any additional files ( name and path )
def select_implementation(target, provided_features = [])
      impl = if (impls = implementations)
               available_features = target.feature_set + provided_features
               impl = impls.find do |imp|
                 remote_impl = imp['remote']
                 remote_impl = metadata['remote'] if remote_impl.nil?
                 Set.new(imp['requirements']).subset?(available_features) && !!remote_impl == @remote
               end
               raise NoImplementationError.new(target, self) unless impl
               impl = impl.dup
               impl['path'] = file_path(impl['name'])
               impl.delete('requirements')
               impl
             else
               raise NoImplementationError.new(target, self) unless !!metadata['remote'] == @remote
               name = files.first['name']
               { 'name' => name, 'path' => file_path(name) }
             end
      inmethod = impl['input_method'] || metadata['input_method']
      impl['input_method'] = inmethod unless inmethod.nil?
      mfiles = impl.fetch('files', []) + metadata.fetch('files', [])
      dirnames, filenames = mfiles.partition { |file| file.end_with?('/') }
      impl['files'] = filenames.map do |file|
        path = file_path(file)
        raise "No file found for reference #{file}" if path.nil?
        { 'name' => file, 'path' => path }
      end
      unless dirnames.empty?
        files.each do |file|
          name = file['name']
          if dirnames.any? { |dirname| name.start_with?(dirname) }
            impl['files'] << { 'name' => name, 'path' => file_path(name) }
          end
        end
      end
      impl
    end
def select_implementation ( target , provided_features = [ ] ) impl = if ( impls = implementations ) available_features = target . feature_set + provided_features impl = impls . find do | imp | remote_impl = imp [ 'remote' ] remote_impl = metadata [ 'remote' ] if remote_impl . nil? Set . new ( imp [ 'requirements' ] ) . subset? ( available_features ) && ! ! remote_impl == @remote end raise NoImplementationError . new ( target , self ) unless impl impl = impl . dup impl [ 'path' ] = file_path ( impl [ 'name' ] ) impl . delete ( 'requirements' ) impl else raise NoImplementationError . new ( target , self ) unless ! ! metadata [ 'remote' ] == @remote name = files . first [ 'name' ] { 'name' => name , 'path' => file_path ( name ) } end inmethod = impl [ 'input_method' ] || metadata [ 'input_method' ] impl [ 'input_method' ] = inmethod unless inmethod . nil? mfiles = impl . fetch ( 'files' , [ ] ) + metadata . fetch ( 'files' , [ ] ) dirnames , filenames = mfiles . partition { | file | file . end_with? ( '/' ) } impl [ 'files' ] = filenames . map do | file | path = file_path ( file ) raise "No file found for reference #{file}" if path . nil? { 'name' => file , 'path' => path } end unless dirnames . empty? files . each do | file | name = file [ 'name' ] if dirnames . any? { | dirname | name . start_with? ( dirname ) } impl [ 'files' ] << { 'name' => name , 'path' => file_path ( name ) } end end end impl end
Returns a hash of implementation name, path to executable, input method (if defined),
and any additional files (name and path)
Returns a hash of implementation name path to executable input method ( if defined ) and any additional files ( name and path )
target
<not_specific>
provided_features
<not_specific>