Sha256: 52f1385cdcdccc8ee647f17f7c8aea0e0114fc6001abb985c8b3e3be3442efb6
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
require_relative 'library/single_version' require_relative 'library/multi_version' require 'arduino/library/model' require 'arli/errors' module Arli module Library ADDITIONAL_KEYS = %i(depends headers_only folder) def library_model(lib) return lib if lib.is_a?(::Arduino::Library::Model) ::Arduino::Library::Model.from(lib).tap do |model| if model.nil? lib_output = (lib && lib['name']) ? lib['name'] : lib.to_s raise Arli::Errors::LibraryNotFound, 'Error: '.bold.red + "Library #{lib_output.yellow} ".red + "was not found.\n\n".red + %Q[ HINT: run #{"arli search 'name: /#{lib_output}/'".green}\n] + %Q[ to find the exact name of the library you are trying\n] + %Q[ to install. Alternatively, provide a url: field.\n] end end end def make_lib(lib) additional_keys = {} ADDITIONAL_KEYS.each do |k| if lib.is_a?(Hash) && lib[k] additional_keys[k] = lib[k] lib.delete(k) end end ::Arli::Library::SingleVersion.new(library_model(lib)).tap do |svlib| additional_keys.each_pair do |key, value| svlib.send("#{key}=", value) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arli-1.4.0 | lib/arli/library.rb |
arli-1.3.0 | lib/arli/library.rb |