arli 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0abe9044357d7bff2eab6f8cd87b80b729aebc9a
4
- data.tar.gz: ce3df76a7613eccd2d7ada2426400fd4084b7724
2
+ SHA256:
3
+ metadata.gz: 5cbff710fa5c642b1c785d3e5f57acd716383c27a5638ce1164ac4539c655706
4
+ data.tar.gz: 36918da039ee3f764296e3d6073af80a89d39690199ef6e80b4a15d8ed310929
5
5
  SHA512:
6
- metadata.gz: b7f6aaed86211c89a35b9da9c0083c4daf9d01d4b3a1d3d6ff39cdcc577a9f1d091c25dd7ddb62ce681568879fe72b6755641fb1c7d3a067ecbfb2e8d4daec6a
7
- data.tar.gz: 26ebf7fdfc17fcf40ac043e0b7e7c95960c8c84d1f7a3239e6b575a354c181b7b9cd688f3dda56b827cdb74c37d13d7da91fcc08f6bc75487e3bf089fae94f74
6
+ metadata.gz: 9b73273990d8bd70ad20f1925068060bb486b74535a75f69c42ab01789502cefb555255745d6c12a805faf7778ab6851e6c68686517e2ed7b8db15738cf41af9
7
+ data.tar.gz: 89f52802678e11a45f2f2a6424f0aa08d4e2fde5bdcdfaf7edc8230e65fd1d0c6c75d93bc702ddc748cc956fcae710f8e0170f29d74a8ea150c48d153513c8fb
@@ -13,9 +13,12 @@ module Arli
13
13
  extend Forwardable
14
14
  def_delegators :@library,
15
15
  :exists?,
16
- :path, :temp_path,
17
- :dir, :temp_dir,
18
- :libraries_home
16
+ :path,
17
+ :temp_path,
18
+ :dir,
19
+ :temp_dir,
20
+ :libraries_home,
21
+ :folder
19
22
 
20
23
  class << self
21
24
  def inherited(base)
@@ -15,7 +15,12 @@ module Arli
15
15
  if Dir.exist?(temp_path) && !Dir.exist?(path)
16
16
  FileUtils.mkdir_p(File.dirname(path))
17
17
  ___ "current: #{Dir.pwd.yellow}\ntemp_path: #{temp_path.yellow}\nlibrary_path: #{path.yellow}\n" if debug?
18
- mv(temp_path, path)
18
+ if folder && Dir.exist?("#{temp_path}/#{folder}")
19
+ mv("#{temp_path}/#{folder}", path)
20
+ FileUtils.rm_rf(temp_path)
21
+ else
22
+ mv(temp_path, path)
23
+ end
19
24
  elsif Dir.exist?(path)
20
25
  raise ::Arli::Errors::InstallerError,
21
26
  "Directory #{path} was not expected to still be there!"
@@ -12,6 +12,7 @@ module Arli
12
12
  module Commands
13
13
  class Install < Base
14
14
  require 'arduino/library/include'
15
+ include Arduino::Library::InstanceMethods
15
16
 
16
17
  attr_accessor :library,
17
18
  :arlifile,
@@ -47,22 +48,24 @@ module Arli
47
48
  def identify_library(arg)
48
49
  results = if arg =~ %r[https?://]i
49
50
  self.install_method = :url
50
- r = search(url: /^#{arg}$/i)
51
- if r.empty?
51
+ result = search url: /^#{arg}$/i
52
+
53
+ if result.empty?
52
54
  self.install_method = :website
53
- r = search(website: /^#{arg}$/i)
55
+ result = search(website: /^#{arg}$/i)
54
56
  end
55
- if r.empty?
57
+
58
+ if result.empty?
56
59
  self.install_method = :custom
57
- r = [Arduino::Library::Model.from_hash(url: arg, name: File.basename(arg))]
60
+ result = [Arduino::Library::Model.from_hash(url: arg, name: File.basename(arg))]
58
61
  end
59
- r
62
+ result
60
63
  elsif File.exist?(arg) || arg =~ /\.zip$/
61
64
  self.install_method = :archiveFileName
62
- search(archiveFileName: "#{File.basename(arg)}")
65
+ search archiveFileName: "#{File.basename(arg)}"
63
66
  else
64
67
  self.install_method = :name
65
- search(name: /^#{arg}$/)
68
+ search name: /^#{arg}$/
66
69
  end
67
70
 
68
71
  validate_search(arg, results)
@@ -77,6 +80,11 @@ module Arli
77
80
  #
78
81
  end
79
82
 
83
+ def search(**opts)
84
+ # noinspection RubyArgCount
85
+ super(opts)
86
+ end
87
+
80
88
  private
81
89
 
82
90
  def validate_search(arg, results)
@@ -36,6 +36,7 @@ module Arli
36
36
  end
37
37
 
38
38
  def self.included(base)
39
+ # This works for both classes and modules
39
40
  base.instance_eval do
40
41
  class << self
41
42
  include(::Arli::Helpers::Inherited::ClassMethods)
@@ -5,7 +5,7 @@ require 'arli/errors'
5
5
 
6
6
  module Arli
7
7
  module Library
8
- ADDITIONAL_KEYS = %i(depends headers_only)
8
+ ADDITIONAL_KEYS = %i(depends headers_only folder)
9
9
 
10
10
  def library_model(lib)
11
11
  return lib if lib.is_a?(::Arduino::Library::Model)
@@ -16,7 +16,8 @@ module Arli
16
16
 
17
17
  # Additional attributes that can be set via Arlifile
18
18
  attr_accessor :headers_only,
19
- :depends
19
+ :depends,
20
+ :folder # indicates a sub-folder of the library
20
21
 
21
22
  def initialize(lib, config: Arli.config)
22
23
  self.lib = lib
@@ -24,6 +25,7 @@ module Arli
24
25
  self.lib_dir = lib.name.gsub(/ /, '_')
25
26
  self.headers_only = false
26
27
  self.depends = nil
28
+ self.folder = nil
27
29
  end
28
30
 
29
31
  def install
@@ -1,3 +1,3 @@
1
1
  module Arli
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino-library
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  version: '0'
330
330
  requirements: []
331
331
  rubyforge_project:
332
- rubygems_version: 2.6.14
332
+ rubygems_version: 2.7.6
333
333
  signing_key:
334
334
  specification_version: 4
335
335
  summary: This is an Arduino helper toolkit that builds on top of the arduino-cmake