arli 0.2.2 → 0.3.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 +4 -4
- data/README.md +57 -34
- data/arli.gemspec +5 -1
- data/lib/arli/arli_file.rb +24 -0
- data/lib/arli/cli.rb +30 -15
- data/lib/arli/commands/base.rb +20 -23
- data/lib/arli/commands/install.rb +8 -9
- data/lib/arli/commands/search.rb +52 -0
- data/lib/arli/commands/update.rb +4 -1
- data/lib/arli/configuration.rb +4 -0
- data/lib/arli/parser.rb +35 -9
- data/lib/arli/version.rb +1 -1
- data/lib/arli.rb +18 -4
- metadata +62 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46f795acacbde34438dcaf8b480b23153f34c802
|
4
|
+
data.tar.gz: f561796a03ce3c9d71d0f4166c67c90692397e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4804d1bfab9e6032f3e2b78bcfc26789f5cc5990c0eaa79d9b13e7b408ca1fe7d497b01a88b8e5a78b36def1cdfa7081a3788b4018589918da47c35d95c4fedd
|
7
|
+
data.tar.gz: adc5d2c4758713eca5fda31bec6e343330529a2bd03d36d19775d4f52aad54171cc5d937634a0468c8d2e4015e1f908cb8991cab162df001225d3f7f76e62a04
|
data/README.md
CHANGED
@@ -3,33 +3,32 @@
|
|
3
3
|
# Arli
|
4
4
|
|
5
5
|
Arli is a simple and easy to use installer of dependencies that can be
|
6
|
-
declared in a
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
},
|
20
|
-
]
|
21
|
-
}
|
6
|
+
declared in a YAML file of the following format:
|
7
|
+
|
8
|
+
```yaml
|
9
|
+
version: 1.0.0
|
10
|
+
dependencies:
|
11
|
+
- name: ESP8266WiFi
|
12
|
+
version: '1.0'
|
13
|
+
url: https://github.com/esp8266/Arduino
|
14
|
+
subfolder: libraries/ESP8266WiFi
|
15
|
+
- name: NTPClient
|
16
|
+
version: '3.1.0'
|
17
|
+
- name: SimpleTimer
|
18
|
+
urL: https://github.com/jfturcot/SimpleTimer
|
22
19
|
```
|
23
20
|
|
24
|
-
Basically a simple pairing of a library/project name
|
25
|
-
directory it's cloned into)
|
21
|
+
Basically a simple pairing of a library/project name
|
22
|
+
(which also happens to be the local directory it's cloned into)
|
23
|
+
and a remote URL.
|
26
24
|
|
27
|
-
The gem was created to fill the need of managing many external
|
28
|
-
in a consistent way. Arli's
|
25
|
+
The gem was created to fill the need of managing many external
|
26
|
+
libraries for an Arduino projects in a consistent way. Arli's
|
27
|
+
API was loosely inspired by Bundler.
|
29
28
|
|
30
29
|
## Installation
|
31
30
|
|
32
|
-
Install the gem globally like this:
|
31
|
+
Install the gem globally like this:
|
33
32
|
|
34
33
|
```bash
|
35
34
|
# if using rbenv, or rvm
|
@@ -45,14 +44,14 @@ Run `arli --help` for more information:
|
|
45
44
|
|
46
45
|
```bash
|
47
46
|
Usage:
|
48
|
-
arli [options] [command [options]]
|
47
|
+
arli [options] [ command [options] ]
|
49
48
|
|
50
|
-
-h, --help
|
49
|
+
-h, --help prints this help
|
51
50
|
|
52
51
|
Available Commands:
|
53
|
-
install : installs libraries defined in
|
54
|
-
update : updates libraries defined in the
|
55
|
-
|
52
|
+
install : installs libraries defined in ArliFile.yml
|
53
|
+
update : updates libraries defined in the ArliFile.yml
|
54
|
+
search : Flexible Search of the Arduino Library Database
|
56
55
|
|
57
56
|
See arli <command> --help for more information on a specific command.
|
58
57
|
```
|
@@ -61,13 +60,13 @@ See arli <command> --help for more information on a specific command.
|
|
61
60
|
|
62
61
|
Use this command to install libraries for the first time.
|
63
62
|
|
64
|
-
NOTE: you
|
65
|
-
|
66
|
-
|
63
|
+
NOTE: unless you pass `-e` flag, install command falls back to `update` if
|
64
|
+
the target folder already exists. With `-e` flag, installer aborts if the
|
65
|
+
target library already exists.
|
67
66
|
|
68
67
|
```bash
|
69
68
|
Description:
|
70
|
-
installs libraries defined in
|
69
|
+
installs libraries defined in ArliFile.yml
|
71
70
|
|
72
71
|
Usage:
|
73
72
|
arli install [options]
|
@@ -75,17 +74,20 @@ Usage:
|
|
75
74
|
Command Options
|
76
75
|
-l, --lib-home HOME Local folder where libraries are installed
|
77
76
|
Default: ~/Documents/Arduino/Libraries
|
78
|
-
-j, --json FILE JSON file with dependencies (defaults to arli.json)
|
79
|
-
-u, --update-existing Update a library that already exists
|
80
|
-
-h, --help prints this help
|
81
77
|
|
78
|
+
-a, --arli-file FILE ArliFile.yml is the file listing the dependencies
|
79
|
+
Default filename is ArliFile.yml
|
80
|
+
|
81
|
+
-e, --abort-on-exiting Abort if a library folder already exists
|
82
|
+
instead of updating it.
|
83
|
+
-h, --help prints this help
|
82
84
|
```
|
83
85
|
|
84
86
|
#### Update Command
|
85
87
|
|
86
88
|
To upate previously checked out libraries, use the `update` command:
|
87
89
|
|
88
|
-
```
|
90
|
+
```bash
|
89
91
|
Description:
|
90
92
|
updates libraries defined in the JSON file
|
91
93
|
|
@@ -99,6 +101,27 @@ Command Options
|
|
99
101
|
-h, --help prints this help
|
100
102
|
```
|
101
103
|
|
104
|
+
#### Search Command
|
105
|
+
|
106
|
+
To search Arduino library database, you can use the search command:
|
107
|
+
|
108
|
+
```bash
|
109
|
+
Description:
|
110
|
+
Flexible Search of the Arduino Library Database
|
111
|
+
|
112
|
+
Usage:
|
113
|
+
arli search [options]
|
114
|
+
|
115
|
+
Command Options
|
116
|
+
-s, --search TERMS ruby-style hash arguments to search for
|
117
|
+
eg: -s "name: 'AudioZero', version: /^1.0/"
|
118
|
+
-d, --database SOURCE a JSON file name, or a URL that contains the index
|
119
|
+
By default, the Arduino-maintained list is searched
|
120
|
+
-m, --max LIMIT if provided, limits the result set to this number
|
121
|
+
Default value is 100
|
122
|
+
-h, --help prints this help
|
123
|
+
```
|
124
|
+
|
102
125
|
## Development
|
103
126
|
|
104
127
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/arli.gemspec
CHANGED
@@ -28,8 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
-
spec.add_dependency '
|
31
|
+
spec.add_dependency 'arduino-library'
|
32
32
|
spec.add_dependency 'colored2'
|
33
|
+
spec.add_dependency 'hashie'
|
34
|
+
spec.add_dependency 'dry-types'
|
35
|
+
spec.add_dependency 'dry-struct'
|
36
|
+
spec.add_dependency 'awesome_print'
|
33
37
|
|
34
38
|
|
35
39
|
spec.add_development_dependency 'simplecov'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'arli'
|
2
|
+
require 'arduino/library'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Arli
|
6
|
+
class ArliFile
|
7
|
+
require 'arduino/library/include'
|
8
|
+
|
9
|
+
extend Forwardable
|
10
|
+
def_delegators :@dependencies, *(Array.new.methods - Object.methods)
|
11
|
+
|
12
|
+
DEFAULT_FILE_NAME = 'ArliFile.yml'.freeze
|
13
|
+
|
14
|
+
attr_accessor :dependencies, :arli_hash, :file
|
15
|
+
|
16
|
+
def initialize(file = DEFAULT_FILE_NAME)
|
17
|
+
self.file = file
|
18
|
+
self.arli_hash = ::YAML.load(File.read(file))
|
19
|
+
self.dependencies = arli_hash['dependencies'].map do |lib_hash|
|
20
|
+
library_from(lib_hash)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/arli/cli.rb
CHANGED
@@ -6,6 +6,7 @@ require 'arli'
|
|
6
6
|
require 'arli/parser'
|
7
7
|
require 'arli/commands/update'
|
8
8
|
require 'arli/commands/install'
|
9
|
+
require 'arli/commands/search'
|
9
10
|
|
10
11
|
module Arli
|
11
12
|
class CLI
|
@@ -60,15 +61,15 @@ module Arli
|
|
60
61
|
if command
|
61
62
|
command_class = ::Arli::Commands.const_get(command.to_s.capitalize)
|
62
63
|
|
63
|
-
options[:
|
64
|
-
options[:lib_home] ||= ::
|
64
|
+
options[:arli_file] ||= ::Arli::DEFAULT_ARLI_FILE
|
65
|
+
options[:lib_home] ||= ::Arduino::Library::DEFAULT_ARDUINO_LIBRARY_PATH
|
65
66
|
|
66
67
|
output "run_command #{command.to_s.bold.green}, options: #{options.inspect.bold.blue}" if Arli::DEBUG
|
67
|
-
command_class.new(options)
|
68
|
+
@command_instance = command_class.new(options)
|
69
|
+
@command_instance.header.run
|
68
70
|
end
|
69
71
|
rescue NameError => e
|
70
72
|
output e.inspect
|
71
|
-
output "Unfortunately command #{command.to_s.red} is not yet implemented.\n\n"
|
72
73
|
end
|
73
74
|
|
74
75
|
def parse_command_options!
|
@@ -87,7 +88,6 @@ module Arli
|
|
87
88
|
end
|
88
89
|
|
89
90
|
class << self
|
90
|
-
|
91
91
|
def global
|
92
92
|
@global ||= PARSER.new do |parser|
|
93
93
|
parser.banner = usage_line
|
@@ -101,29 +101,34 @@ module Arli
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def global_usage(command)
|
104
|
-
"Usage:\n ".bold + COMMAND.bold.blue +
|
104
|
+
"Usage:\n ".bold + COMMAND.bold.blue +
|
105
|
+
' [options] '.yellow + '[' + (command || 'command').green +
|
106
|
+
' [options]'.yellow + ']' + "\n"
|
105
107
|
end
|
106
108
|
|
107
109
|
def command_usage(command)
|
108
|
-
"Usage:\n ".bold + COMMAND.bold.blue + ' ' +
|
110
|
+
"Usage:\n ".bold + COMMAND.bold.blue + ' ' +
|
111
|
+
command.bold.green +
|
112
|
+
' [options]'.yellow + "\n\n" +
|
113
|
+
'Command Options'.bold
|
109
114
|
end
|
110
115
|
|
111
116
|
def commands
|
112
117
|
@commands ||= {
|
113
118
|
install: {
|
114
|
-
description: 'installs libraries defined in
|
119
|
+
description: 'installs libraries defined in ArliFile.yml',
|
115
120
|
parser: -> (command) {
|
116
121
|
PARSER.new do |parser|
|
117
122
|
parser.banner = usage_line 'install'
|
118
123
|
parser.option_lib_home
|
119
124
|
parser.option_dependency_file
|
120
|
-
parser.
|
125
|
+
parser.option_abort_if_exists
|
121
126
|
parser.option_help(command: command)
|
122
127
|
end
|
123
128
|
} },
|
124
129
|
|
125
130
|
update: {
|
126
|
-
description: 'updates libraries defined in the
|
131
|
+
description: 'updates libraries defined in the ArliFile.yml',
|
127
132
|
parser: -> (command) {
|
128
133
|
PARSER.new do |parser|
|
129
134
|
parser.banner = usage_line 'update'
|
@@ -133,16 +138,26 @@ module Arli
|
|
133
138
|
end
|
134
139
|
} },
|
135
140
|
|
136
|
-
|
137
|
-
description: '
|
141
|
+
search: {
|
142
|
+
description: 'Flexible Search of the Arduino Library Database',
|
138
143
|
parser: -> (command) {
|
139
144
|
PARSER.new do |parser|
|
140
|
-
parser.banner = usage_line '
|
141
|
-
parser.
|
142
|
-
parser.option_library
|
145
|
+
parser.banner = usage_line 'search'
|
146
|
+
parser.option_search
|
143
147
|
parser.option_help(command: command)
|
144
148
|
end
|
145
149
|
} }
|
150
|
+
|
151
|
+
# library: {
|
152
|
+
# description: 'Install, update, or remove a single library',
|
153
|
+
# parser: -> (command) {
|
154
|
+
# PARSER.new do |parser|
|
155
|
+
# parser.banner = usage_line 'library'
|
156
|
+
# parser.option_lib_home
|
157
|
+
# parser.option_library
|
158
|
+
# parser.option_help(command: command)
|
159
|
+
# end
|
160
|
+
# } }
|
146
161
|
}
|
147
162
|
end
|
148
163
|
|
data/lib/arli/commands/base.rb
CHANGED
@@ -7,28 +7,32 @@ require 'arli/version'
|
|
7
7
|
module Arli
|
8
8
|
module Commands
|
9
9
|
class Base
|
10
|
-
attr_accessor :lib_path, :
|
10
|
+
attr_accessor :lib_path, :arli_file, :abort_if_exists, :command
|
11
11
|
|
12
12
|
def initialize(options)
|
13
|
-
self.lib_path
|
14
|
-
self.
|
15
|
-
self.
|
16
|
-
self.command = self.class.name.gsub(/.*::/, '').downcase.to_sym
|
13
|
+
self.lib_path = options[:lib_home]
|
14
|
+
self.abort_if_exists = options[:abort_if_exists]
|
15
|
+
self.command = self.class.name.gsub(/.*::/, '').downcase.to_sym
|
17
16
|
setup
|
18
17
|
end
|
19
18
|
|
19
|
+
def header
|
20
|
+
out = "——————————————————————————————————————————————————————————\n"
|
21
|
+
out << "Arli : Version #{::Arli::VERSION.bold.yellow}\n"
|
22
|
+
out << "Command : #{command.to_s.bold.blue}\n" if command
|
23
|
+
out << "Library Path : #{lib_path.bold.green}\n" if lib_path
|
24
|
+
out << "ArliFile : #{arli_file.file.bold.magenta}\n" if
|
25
|
+
arli_file && arli_file.file
|
26
|
+
out << '——————————————————————————————————————————————————————————'
|
20
27
|
|
21
|
-
|
22
|
-
protected
|
28
|
+
info out
|
23
29
|
|
24
|
-
|
25
|
-
info "Arli : Version #{::Arli::VERSION.bold.yellow}\n" +
|
26
|
-
"Running command : #{command.to_s.bold.blue}\n" +
|
27
|
-
"Library Path : #{lib_path.bold.green}\n" +
|
28
|
-
"JSON File : #{json_file.bold.magenta}\n" +
|
29
|
-
'———————————————————————————————————————————————————————'
|
30
|
+
self
|
30
31
|
end
|
31
32
|
|
33
|
+
# Commands implement #run method that uses helpers below:
|
34
|
+
protected
|
35
|
+
|
32
36
|
def all_dependencies(cmd, *args)
|
33
37
|
for_each_dependency do |dep|
|
34
38
|
begin
|
@@ -71,22 +75,15 @@ module Arli
|
|
71
75
|
end
|
72
76
|
|
73
77
|
def for_each_dependency(&_block)
|
74
|
-
|
78
|
+
raise 'Library Path is nil!' unless lib_path
|
79
|
+
FileUtils.mkpath(lib_path) unless Dir.exist?(lib_path)
|
80
|
+
arli_file.each do |dependency|
|
75
81
|
Dir.chdir(lib_path) do
|
76
82
|
yield(dependency)
|
77
83
|
end
|
78
84
|
end
|
79
85
|
end
|
80
86
|
|
81
|
-
def dependencies
|
82
|
-
@deps ||= begin
|
83
|
-
JSON.load(File.read(json_file))
|
84
|
-
rescue Errno::ENOENT => e
|
85
|
-
error("File #{json_file.bold.yellow} could not be found!", e)
|
86
|
-
{ 'dependencies' => [] }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
87
|
def error(msg, exception = nil)
|
91
88
|
printf 'Runtime Error: '.bold.red + "\n#{msg}\n" if msg
|
92
89
|
if exception
|
@@ -9,22 +9,21 @@ module Arli
|
|
9
9
|
class Install < Update
|
10
10
|
|
11
11
|
def run
|
12
|
-
|
13
|
-
all_dependencies(command, 'name', 'git')
|
12
|
+
all_dependencies(command, 'name', 'url')
|
14
13
|
end
|
15
14
|
|
16
15
|
def install_dependency(name, url)
|
17
16
|
cmd = if Dir.exist?(name)
|
18
|
-
if
|
19
|
-
update_dependency(name)
|
20
|
-
else
|
17
|
+
if abort_if_exists
|
21
18
|
raise <<-EOF
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
Existing folder found for library #{name.red}.
|
20
|
+
Please use -u switch with 'install' command,
|
21
|
+
or invoke the 'update' command directly."
|
22
|
+
EOF
|
26
23
|
.gsub(/^\s+/, '')
|
27
24
|
|
25
|
+
else
|
26
|
+
update_dependency(name)
|
28
27
|
end
|
29
28
|
else
|
30
29
|
"git clone -v #{url} #{name} 2>&1"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'open3'
|
4
|
+
require 'arli'
|
5
|
+
require 'arli/commands/base'
|
6
|
+
require 'arduino/library'
|
7
|
+
require 'awesome_print'
|
8
|
+
module Arli
|
9
|
+
module Commands
|
10
|
+
class Search < Base
|
11
|
+
require 'arduino/library/include'
|
12
|
+
|
13
|
+
attr_accessor :search_string,
|
14
|
+
:search_opts,
|
15
|
+
:limit,
|
16
|
+
:database
|
17
|
+
|
18
|
+
class InvalidOptionError < ArgumentError; end
|
19
|
+
|
20
|
+
def initialize(options)
|
21
|
+
super(options)
|
22
|
+
self.search_string = options[:search]
|
23
|
+
self.limit = options[:limit] || 100
|
24
|
+
|
25
|
+
raise InvalidOptionError, 'Please provide search string with --search' \
|
26
|
+
unless search_string
|
27
|
+
|
28
|
+
begin
|
29
|
+
self.search_opts = eval("{ #{search_string} }")
|
30
|
+
rescue => e
|
31
|
+
raise InvalidOptionError "Search string '#{search_string}' is invalid.\n" +
|
32
|
+
e.message.red
|
33
|
+
end
|
34
|
+
|
35
|
+
unless search_opts.is_a?(::Hash) && search_opts.size > 0
|
36
|
+
raise InvalidOptionError, "Search string '#{search_string}' did not eval to Hash.\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
self.database = options[:database] ? db_from(option[:database]) : db_default
|
40
|
+
|
41
|
+
search_opts.merge!(limit: limit) if limit
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
ap search(database, **search_opts).map(&:to_hash)
|
46
|
+
rescue Exception => e
|
47
|
+
error e
|
48
|
+
puts e.backtrace.join("\n") if ENV['DEBUG']
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/arli/commands/update.rb
CHANGED
@@ -7,9 +7,12 @@ require_relative 'base'
|
|
7
7
|
module Arli
|
8
8
|
module Commands
|
9
9
|
class Update < Base
|
10
|
+
def initialize(options)
|
11
|
+
super(options)
|
12
|
+
self.arli_file = options[:arli_file] ? ArliFile.new(options[:arli_file]) : ArliFile.new
|
13
|
+
end
|
10
14
|
|
11
15
|
def run
|
12
|
-
header
|
13
16
|
all_dependencies(command, 'name')
|
14
17
|
end
|
15
18
|
|
data/lib/arli/parser.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'arduino/library'
|
1
2
|
module Arli
|
2
3
|
class CLI
|
3
4
|
class Parser < OptionParser
|
@@ -7,7 +8,7 @@ module Arli
|
|
7
8
|
super(nil, 22)
|
8
9
|
self.output_lines = Array.new
|
9
10
|
self.command = command
|
10
|
-
self.options
|
11
|
+
self.options = Hashie::Mash.new
|
11
12
|
end
|
12
13
|
|
13
14
|
def sep(text = nil)
|
@@ -15,23 +16,43 @@ module Arli
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def option_dependency_file
|
18
|
-
on('-
|
19
|
-
|
20
|
-
|
19
|
+
on('-a', '--arli-file FILE',
|
20
|
+
'ArliFile.yml'.bold.green + ' is the file listing the dependencies',
|
21
|
+
"Default filename is #{DEFAULT_ARLI_FILE.bold.magenta})\n\n") do |v|
|
22
|
+
options[:arli_file] = v
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def option_lib_home
|
25
27
|
on('-l', '--lib-home HOME', 'Local folder where libraries are installed',
|
26
|
-
|
28
|
+
"Default: #{default_library_path}\n\n") do |v|
|
27
29
|
options[:lib_home] = v
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
|
34
|
+
def option_search
|
35
|
+
on('-s', '--search TERMS', 'ruby-style hash arguments to search for',
|
36
|
+
%Q(eg: -s "name: 'AudioZero', version: /^1.0/")) do |v|
|
37
|
+
options[:search] = v
|
38
|
+
end
|
39
|
+
on('-d', '--database SOURCE',
|
40
|
+
'a JSON file name, or a URL that contains the index',
|
41
|
+
'By default, the Arduino-maintained list is searched') do |v|
|
42
|
+
options[:database] = v
|
43
|
+
end
|
44
|
+
on('-m', '--max LIMIT',
|
45
|
+
'if provided, limits the result set to this number',
|
46
|
+
'Default value is 100') do |v|
|
47
|
+
options[:limit] = v
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def option_abort_if_exists
|
52
|
+
on('-e', '--abort-on-exiting',
|
53
|
+
'Abort if a library folder already exists',
|
54
|
+
'instead of updating it.') do |v|
|
55
|
+
options[:abort_if_exists] = true
|
35
56
|
end
|
36
57
|
end
|
37
58
|
|
@@ -89,6 +110,11 @@ See #{COMMAND.bold.blue + ' <command> '.bold.green + '--help'.bold.yellow} for m
|
|
89
110
|
def print
|
90
111
|
puts output.join("\n") unless output.empty?
|
91
112
|
end
|
113
|
+
|
114
|
+
def default_library_path
|
115
|
+
Arduino::Library::DEFAULT_ARDUINO_LIBRARY_PATH.gsub(%r(#{ENV['HOME']}), '~').blue
|
116
|
+
end
|
117
|
+
|
92
118
|
end
|
93
119
|
end
|
94
120
|
end
|
data/lib/arli/version.rb
CHANGED
data/lib/arli.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'arli/version'
|
2
|
+
require 'arli/arli_file'
|
3
|
+
require 'arli/configuration'
|
2
4
|
require 'arli/cli'
|
3
5
|
require 'logger'
|
4
6
|
|
5
7
|
module Arli
|
6
|
-
|
7
|
-
DEFAULT_JSON_FILE = ENV[DEFAULT_JSON_FILE_ENV] || 'arli.json'.freeze
|
8
|
+
LIBRARY_INDEX_JSON_GZ = 'http://downloads.arduino.cc/libraries/library_index.json.gz'.freeze
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
DEFAULT_ARLI_FILE_ENV = 'ARDUINO_ARLI_LIBRARY_FILE'.freeze
|
11
|
+
DEFAULT_ARLI_FILE = ENV[DEFAULT_ARLI_FILE_ENV] || ArliFile::DEFAULT_FILE_NAME
|
11
12
|
|
12
13
|
DEBUG = ENV['DEBUG'] ? true : false
|
13
14
|
|
@@ -16,6 +17,7 @@ module Arli
|
|
16
17
|
|
17
18
|
class << self
|
18
19
|
attr_accessor :logger
|
20
|
+
attr_writer :configuration
|
19
21
|
|
20
22
|
%i(debug info error warn fatal).each do |level|
|
21
23
|
define_method level do |*args|
|
@@ -23,5 +25,17 @@ module Arli
|
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
28
|
+
|
29
|
+
def self.configuration
|
30
|
+
@configuration ||= Configuration.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.reset
|
34
|
+
@configuration = Configuration.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.configure
|
38
|
+
yield(configuration)
|
39
|
+
end
|
26
40
|
end
|
27
41
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-10-
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: arduino-library
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -38,6 +38,62 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dry-types
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dry-struct
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: awesome_print
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
41
97
|
- !ruby/object:Gem::Dependency
|
42
98
|
name: simplecov
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,10 +186,13 @@ files:
|
|
130
186
|
- bin/setup
|
131
187
|
- exe/arli
|
132
188
|
- lib/arli.rb
|
189
|
+
- lib/arli/arli_file.rb
|
133
190
|
- lib/arli/cli.rb
|
134
191
|
- lib/arli/commands/base.rb
|
135
192
|
- lib/arli/commands/install.rb
|
193
|
+
- lib/arli/commands/search.rb
|
136
194
|
- lib/arli/commands/update.rb
|
195
|
+
- lib/arli/configuration.rb
|
137
196
|
- lib/arli/parser.rb
|
138
197
|
- lib/arli/version.rb
|
139
198
|
homepage: https://github.com/kigster/arli
|