Class: Arli::Library::SingleVersion
- Inherits:
-
Object
- Object
- Arli::Library::SingleVersion
show all
- Defined in:
- lib/arli/library/single_version.rb
Overview
Represents a wrapper around Arduino::Library::Model instance and decorates with a few additional helpers.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(lib, config: Arli.config) ⇒ SingleVersion
Returns a new instance of SingleVersion.
21
22
23
24
25
26
27
|
# File 'lib/arli/library/single_version.rb', line 21
def initialize(lib, config: Arli.config)
self.lib = lib
self.config = config
self.lib_dir = lib.name.gsub(/ /, '_')
self. = false
self.depends = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/arli/library/single_version.rb', line 67
def method_missing(method, *args, &block)
if lib && lib.respond_to?(method)
lib.send(method, *args, &block)
else
super(method, *args, &block)
end
end
|
Instance Attribute Details
#canonical_dir ⇒ Object
Returns the value of attribute canonical_dir.
12
13
14
|
# File 'lib/arli/library/single_version.rb', line 12
def canonical_dir
@canonical_dir
end
|
#config ⇒ Object
Returns the value of attribute config.
12
13
14
|
# File 'lib/arli/library/single_version.rb', line 12
def config
@config
end
|
#depends ⇒ Object
Additional attributes that can be set via Arlifile
18
19
20
|
# File 'lib/arli/library/single_version.rb', line 18
def depends
@depends
end
|
Additional attributes that can be set via Arlifile
18
19
20
|
# File 'lib/arli/library/single_version.rb', line 18
def
@headers_only
end
|
#lib ⇒ Object
Returns the value of attribute lib.
12
13
14
|
# File 'lib/arli/library/single_version.rb', line 12
def lib
@lib
end
|
#lib_dir ⇒ Object
Returns the value of attribute lib_dir.
12
13
14
|
# File 'lib/arli/library/single_version.rb', line 12
def lib_dir
@lib_dir
end
|
Instance Method Details
#dir ⇒ Object
45
46
47
|
# File 'lib/arli/library/single_version.rb', line 45
def dir
canonical_dir || lib_dir
end
|
#exists? ⇒ Boolean
57
58
59
|
# File 'lib/arli/library/single_version.rb', line 57
def exists?
Dir.exist?(path)
end
|
#inspect ⇒ Object
61
62
63
64
65
|
# File 'lib/arli/library/single_version.rb', line 61
def inspect
<<-EOF
Library: #{lib.name} (#{lib.url}), only headers? #{ ? 'YES' : 'NO'}
EOF
end
|
#install ⇒ Object
29
30
31
|
# File 'lib/arli/library/single_version.rb', line 29
def install
installer.install
end
|
#installer ⇒ Object
33
34
35
|
# File 'lib/arli/library/single_version.rb', line 33
def installer
@installer ||= Installer.new(self)
end
|
#libraries_home ⇒ Object
37
38
39
|
# File 'lib/arli/library/single_version.rb', line 37
def libraries_home
config.libraries.path
end
|
#path ⇒ Object
49
50
51
|
# File 'lib/arli/library/single_version.rb', line 49
def path
libraries_home + '/' + dir
end
|
#temp_dir ⇒ Object
41
42
43
|
# File 'lib/arli/library/single_version.rb', line 41
def temp_dir
config.libraries.temp_dir
end
|
#temp_path ⇒ Object
53
54
55
|
# File 'lib/arli/library/single_version.rb', line 53
def temp_path
temp_dir + '/' + dir
end
|