arli 1.0.0 → 1.0.1

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
2
  SHA1:
3
- metadata.gz: f95b4f39cee0b07fa49266ec9592091751d120aa
4
- data.tar.gz: 73c36166b9d7944f5f5e19409f6cbcd48ce4cb74
3
+ metadata.gz: e66d1d140d209c8afbc79e983511356099ba62a8
4
+ data.tar.gz: 230a68d260099f99f18a36b5e942fe290e5051ef
5
5
  SHA512:
6
- metadata.gz: 954895dde7df7aa1ba919885a42a2409ce959ab9d46a8707bbd4c577bdbe3675331cfd69900b34669aeaef6162d23102eca5dea692cc2be555e65f659b4119a6
7
- data.tar.gz: b002cfcaff5452763cb76b28d11f741b8c143aea2bc506fac1a61de1670c877a22ccd46d68c7deb4788abdb4966940e24d90e74b27f2a6e42864a2e3ee8739d5
6
+ metadata.gz: b6845831dcc2b447ffff45103fab7b620c616564b1df6a5a0e5b44cf7b0de5320a1e895bfe92b55a6357938b1fe6542e0e18039f730dff2de9607d4319a2d2da
7
+ data.tar.gz: 5b1264568dd1e1c5f3716d66a724a4fc29edc42ed33b079072700a86313ee493e6f764fa029be94ff24f0d8a9b1c83442d615faebfeacf1caf58f17c93187f5e
data/Rakefile CHANGED
@@ -8,10 +8,10 @@ def shell(*args)
8
8
  end
9
9
 
10
10
  task :clean do
11
- shell('rm -rfv pkg/ tmp/ coverage/' )
11
+ shell('rm -rf pkg/ tmp/ coverage/' )
12
12
  end
13
13
 
14
- task :permissions do
14
+ task :permissions => [ :clean ] do
15
15
  shell("chmod -v o+r,g+r * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/*")
16
16
  shell("find . -type d -exec chmod o+x,g+x {} \\;")
17
17
  end
@@ -16,7 +16,6 @@ module Arli
16
16
  attr_accessor :sources, :headers
17
17
 
18
18
  def execute
19
-
20
19
  find_source_files
21
20
 
22
21
  # so "dir" is the 'Adafruit_Unified_Sensor'
@@ -33,13 +32,24 @@ module Arli
33
32
 
34
33
  set_canonical_dir!(candidate)
35
34
  end
35
+
36
+ if if_no(sources) && if_have(headers)
37
+ library.headers_only = true
38
+ end
36
39
  end
37
40
 
38
41
  private
39
42
 
40
43
  def set_canonical_dir!(canonical_dir)
41
44
  if canonical_dir && canonical_dir != dir
42
- mv(dir, canonical_dir)
45
+ # if they are match case insensitively, we may be
46
+ # on a mac where these are considered the same
47
+ if dir =~ /^#{canonical_dir}$/i
48
+ mv(dir, canonical_dir + '.temp')
49
+ mv(canonical_dir + '.temp', canonical_dir)
50
+ else
51
+ mv(dir, canonical_dir)
52
+ end
43
53
  library.canonical_dir = canonical_dir
44
54
  else
45
55
  library.canonical_dir = dir
@@ -57,6 +67,14 @@ module Arli
57
67
  end
58
68
  end
59
69
 
70
+ def if_no(file_names)
71
+ file_names.nil? || file_names.empty?
72
+ end
73
+
74
+ def if_have(file_names)
75
+ file_names && !file_names.empty?
76
+ end
77
+
60
78
  def find_source_files
61
79
  Dir.chdir(dir) do
62
80
  self.sources = files_with_extension('**.{cpp,c}')
@@ -19,11 +19,7 @@ module Arli
19
19
  Arli::CLI::App.new(@argv).start
20
20
  print_debug_info
21
21
  0
22
- rescue StandardError => e
23
- b = e.backtrace
24
- @stderr.puts("#{b.shift.bold}:\n") if Arli.config.debug
25
- @stderr.puts("#{e.message.bold.red} (#{e.class.name.yellow})")
26
- @stderr.puts(b.map { |s| "\tfrom #{s}" }.join("\n").red)
22
+ rescue StandardError
27
23
  1
28
24
  rescue SystemExit => e
29
25
  e.status
@@ -63,6 +63,7 @@ module Arli
63
63
  __pf "\nUse -t (--trace) for detailed exception\n" +
64
64
  "or -D (--debug) to print Arli config\n"
65
65
  end
66
+ raise(e)
66
67
  end
67
68
 
68
69
  def raise_invalid_arli_command!(cmd, e = nil)
@@ -12,12 +12,14 @@ module Arli
12
12
  attr_accessor :lib,
13
13
  :lib_dir,
14
14
  :canonical_dir,
15
- :config
15
+ :config,
16
+ :headers_only
16
17
 
17
18
  def initialize(lib, config: Arli.config)
18
- self.lib = lib
19
- self.config = config
20
- self.lib_dir = lib.name.gsub(/ /, '_')
19
+ self.lib = lib
20
+ self.config = config
21
+ self.lib_dir = lib.name.gsub(/ /, '_')
22
+ self.headers_only = false
21
23
  end
22
24
 
23
25
  def install
@@ -52,6 +54,12 @@ module Arli
52
54
  Dir.exist?(path)
53
55
  end
54
56
 
57
+ def inspect
58
+ <<-EOF
59
+ Library: #{lib.name} (#{lib.url}), only headers? #{headers_only ? 'YES': 'NO'}
60
+ EOF
61
+ end
62
+
55
63
  def method_missing(method, *args, &block)
56
64
  if lib && lib.respond_to?(method)
57
65
  lib.send(method, *args, &block)
@@ -25,6 +25,8 @@ set(ARLI_ARDUINO_LIBS <% arduino_libraries.each do |library| %>
25
25
 
26
26
  <% device_libraries_headers_only.each do |library| %>
27
27
  set(<%= library.name %>_ONLY_HEADER yes)<% end %>
28
+ <% custom_libraries_headers_only.each do |library| %>
29
+ set(<%= library.canonical_dir %>_ONLY_HEADER yes)<% end %>
28
30
 
29
31
  include(Arli)
30
32
 
@@ -54,6 +54,10 @@ module Arli
54
54
  Array(hardware_libraries + arduino_libraries).flatten
55
55
  end
56
56
 
57
+ def custom_libraries_headers_only
58
+ libraries.select { |l| l.headers_only } || []
59
+ end
60
+
57
61
  def device_libraries_headers_only
58
62
  device_libraries.select { |l| l.headers_only } || []
59
63
  end
@@ -8,7 +8,7 @@ module Arli
8
8
 
9
9
  def footer
10
10
  "# vi:syntax=yaml\n" +
11
- YAML.dump(unique_libraries)
11
+ YAML.dump(hash)
12
12
  end
13
13
  end
14
14
  end
data/lib/arli/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arli
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-24 00:00:00.000000000 Z
11
+ date: 2017-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino-library