arli 0.7.0 → 0.8.3
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/.gitignore +2 -0
- data/Gemfile +0 -2
- data/README.md +149 -48
- data/arli.gemspec +1 -3
- data/docs/arli-in-action.png +0 -0
- data/docs/arlifile.png +0 -0
- data/exe/arli +5 -1
- data/lib/arli.rb +2 -2
- data/lib/arli/actions.rb +6 -1
- data/lib/arli/actions/action.rb +57 -37
- data/lib/arli/actions/dir_name.rb +18 -16
- data/lib/arli/actions/git_repo.rb +8 -8
- data/lib/arli/actions/move_to_library_path.rb +54 -0
- data/lib/arli/actions/{zip_file.rb → unzip_file.rb} +14 -10
- data/lib/arli/arli_file.rb +52 -32
- data/lib/arli/cli/app.rb +11 -4
- data/lib/arli/cli/command_finder.rb +14 -11
- data/lib/arli/cli/parser.rb +70 -29
- data/lib/arli/cli/parser_factory.rb +105 -50
- data/lib/arli/cli/runner.rb +8 -4
- data/lib/arli/commands.rb +1 -0
- data/lib/arli/commands/base.rb +11 -6
- data/lib/arli/commands/bundle.rb +43 -0
- data/lib/arli/commands/install.rb +56 -13
- data/lib/arli/commands/search.rb +82 -27
- data/lib/arli/configuration.rb +37 -18
- data/lib/arli/errors.rb +6 -0
- data/lib/arli/library.rb +4 -46
- data/lib/arli/library/installer.rb +71 -0
- data/lib/arli/library/proxy.rb +79 -0
- data/lib/arli/lock/file.rb +65 -0
- data/lib/arli/lock/formats.rb +4 -0
- data/lib/arli/lock/formats/base.rb +26 -0
- data/lib/arli/lock/formats/cmake.rb +24 -0
- data/lib/arli/lock/formats/json.rb +25 -0
- data/lib/arli/lock/formats/text.rb +13 -0
- data/lib/arli/lock/formats/yaml.rb +14 -0
- data/lib/arli/output.rb +94 -11
- data/lib/arli/version.rb +1 -1
- metadata +17 -35
- data/docs/arli-full.png +0 -0
- data/lib/arli/installer.rb +0 -52
data/lib/arli/output.rb
CHANGED
@@ -3,15 +3,20 @@ require 'tty-cursor'
|
|
3
3
|
|
4
4
|
module Arli
|
5
5
|
module Output
|
6
|
+
CHAR_FAILURE = '✖'.red
|
7
|
+
CHAR_SUCCESS = '✔'.green
|
6
8
|
|
7
9
|
class << self
|
8
10
|
attr_accessor :enabled, :cursor
|
11
|
+
|
9
12
|
def enable!
|
10
13
|
self.enabled = true
|
11
14
|
end
|
15
|
+
|
12
16
|
def enabled?
|
13
17
|
self.enabled
|
14
18
|
end
|
19
|
+
|
15
20
|
def disable!
|
16
21
|
self.enabled = false
|
17
22
|
end
|
@@ -40,13 +45,19 @@ module Arli
|
|
40
45
|
end
|
41
46
|
|
42
47
|
def report_exception(e, header = nil)
|
43
|
-
|
48
|
+
if header
|
49
|
+
__pf header.bold.yellow + ': '
|
50
|
+
else
|
51
|
+
__pf 'Error: '.bold.red
|
52
|
+
end
|
44
53
|
error e.message if (e && e.respond_to?(:message))
|
45
54
|
if e && Arli.config.trace
|
46
|
-
__pf
|
55
|
+
__pf "\n"
|
56
|
+
__pf 'Top 10 stack trace'.bold.yellow + "\n"
|
57
|
+
__pf e.backtrace.reverse[-10..-1].join("\n").red + "\n"
|
47
58
|
elsif e
|
48
59
|
__pf "\nUse -t (--trace) for detailed exception\n" +
|
49
|
-
|
60
|
+
"or -D (--debug) to print Arli config\n"
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
@@ -73,24 +84,67 @@ module Arli
|
|
73
84
|
printf(*args) if Arli::Output.enabled?
|
74
85
|
end
|
75
86
|
|
76
|
-
|
77
|
-
|
87
|
+
|
88
|
+
def print_target_dir(d, verb = 'installed')
|
89
|
+
print_action_success(d.green, "#{verb} #{d.green} ")
|
90
|
+
end
|
91
|
+
|
92
|
+
def print_action_starting(action_name)
|
93
|
+
if verbose?
|
94
|
+
indent_cursor
|
95
|
+
___ "⇨ #{action_name.yellow} ... "
|
96
|
+
end
|
97
|
+
if block_given?
|
98
|
+
yield
|
99
|
+
ok if verbose?
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def print_action_success(short, verbose = nil)
|
104
|
+
if verbose? && !quiet?
|
105
|
+
indent_cursor
|
106
|
+
___ "⇨ #{verbose || short} #{CHAR_SUCCESS}"
|
107
|
+
elsif !quiet?
|
108
|
+
___ "#{short} #{CHAR_SUCCESS} "
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def print_action_failure(short, verbose = nil)
|
113
|
+
if verbose? && !quiet?
|
114
|
+
indent_cursor
|
115
|
+
___ "⇨ #{verbose || short} #{CHAR_FAILURE}\n"
|
116
|
+
elsif !quiet?
|
117
|
+
___ "#{short} #{CHAR_FAILURE} "
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def action_fail(action, exception)
|
122
|
+
print_action_failure(action.class.action_name,
|
123
|
+
"#{action.class.action_name} failed with #{exception.message.red}\n" +
|
124
|
+
"Action Description: #{action.class.description}")
|
125
|
+
raise(exception)
|
78
126
|
end
|
79
127
|
|
80
|
-
def
|
81
|
-
|
128
|
+
def action_ok(action)
|
129
|
+
print_action_success(action.action_name)
|
130
|
+
end
|
131
|
+
|
132
|
+
def ok
|
133
|
+
___ " #{CHAR_SUCCESS} "
|
82
134
|
end
|
83
135
|
|
84
136
|
def fuck
|
85
|
-
___
|
137
|
+
___ " #{CHAR_FAILURE} "
|
86
138
|
end
|
87
139
|
|
88
140
|
def header(command: nil)
|
89
141
|
out = "\n#{hr}\n"
|
90
142
|
out << "Arli (#{::Arli::VERSION.yellow})"
|
91
|
-
out << "
|
92
|
-
|
93
|
-
|
143
|
+
out << ", Command: #{command.name.to_s.magenta.bold}" if command
|
144
|
+
if command && command.params && Arli.config.verbose
|
145
|
+
out << "\n#{command.params.to_s.blue}\n"
|
146
|
+
end
|
147
|
+
out << "\nLibrary Path: #{Arli.default_library_path.green}\n"
|
94
148
|
out << "#{hr}\n"
|
95
149
|
info out
|
96
150
|
end
|
@@ -99,5 +153,34 @@ module Arli
|
|
99
153
|
('-' * (ENV['COLUMNS'] || 80)).red.dark
|
100
154
|
end
|
101
155
|
|
156
|
+
# Some shortcuts
|
157
|
+
def verbose?
|
158
|
+
config.verbose && !quiet?
|
159
|
+
end
|
160
|
+
|
161
|
+
def quiet?
|
162
|
+
config.quiet
|
163
|
+
end
|
164
|
+
|
165
|
+
def overwrite?
|
166
|
+
config.if_exists.overwrite
|
167
|
+
end
|
168
|
+
|
169
|
+
def backup?
|
170
|
+
config.if_exists.backup
|
171
|
+
end
|
172
|
+
|
173
|
+
def abort?
|
174
|
+
config.if_exists.abort
|
175
|
+
end
|
176
|
+
|
177
|
+
def debug?
|
178
|
+
config.debug
|
179
|
+
end
|
180
|
+
|
181
|
+
private
|
182
|
+
def indent_cursor
|
183
|
+
___ cursor.column(40)
|
184
|
+
end
|
102
185
|
end
|
103
186
|
end
|
data/lib/arli/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.8.3
|
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-
|
11
|
+
date: 2017-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arduino-library
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.5.
|
19
|
+
version: 0.5.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.5.
|
26
|
+
version: 0.5.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colored2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,34 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: awesome_print
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: archive-zip
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: tty-cursor
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,15 +227,16 @@ files:
|
|
255
227
|
- arli.gemspec
|
256
228
|
- bin/console
|
257
229
|
- bin/setup
|
258
|
-
- docs/arli-full.png
|
259
230
|
- docs/arli-in-action.png
|
231
|
+
- docs/arlifile.png
|
260
232
|
- exe/arli
|
261
233
|
- lib/arli.rb
|
262
234
|
- lib/arli/actions.rb
|
263
235
|
- lib/arli/actions/action.rb
|
264
236
|
- lib/arli/actions/dir_name.rb
|
265
237
|
- lib/arli/actions/git_repo.rb
|
266
|
-
- lib/arli/actions/
|
238
|
+
- lib/arli/actions/move_to_library_path.rb
|
239
|
+
- lib/arli/actions/unzip_file.rb
|
267
240
|
- lib/arli/arli_file.rb
|
268
241
|
- lib/arli/cli.rb
|
269
242
|
- lib/arli/cli/app.rb
|
@@ -273,13 +246,22 @@ files:
|
|
273
246
|
- lib/arli/cli/runner.rb
|
274
247
|
- lib/arli/commands.rb
|
275
248
|
- lib/arli/commands/base.rb
|
249
|
+
- lib/arli/commands/bundle.rb
|
276
250
|
- lib/arli/commands/install.rb
|
277
251
|
- lib/arli/commands/search.rb
|
278
252
|
- lib/arli/configuration.rb
|
279
253
|
- lib/arli/errors.rb
|
280
254
|
- lib/arli/extensions.rb
|
281
|
-
- lib/arli/installer.rb
|
282
255
|
- lib/arli/library.rb
|
256
|
+
- lib/arli/library/installer.rb
|
257
|
+
- lib/arli/library/proxy.rb
|
258
|
+
- lib/arli/lock/file.rb
|
259
|
+
- lib/arli/lock/formats.rb
|
260
|
+
- lib/arli/lock/formats/base.rb
|
261
|
+
- lib/arli/lock/formats/cmake.rb
|
262
|
+
- lib/arli/lock/formats/json.rb
|
263
|
+
- lib/arli/lock/formats/text.rb
|
264
|
+
- lib/arli/lock/formats/yaml.rb
|
283
265
|
- lib/arli/output.rb
|
284
266
|
- lib/arli/version.rb
|
285
267
|
homepage: https://github.com/kigster/arli
|
data/docs/arli-full.png
DELETED
Binary file
|
data/lib/arli/installer.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
require 'arli'
|
3
|
-
require_relative 'actions'
|
4
|
-
|
5
|
-
module Arli
|
6
|
-
class Installer
|
7
|
-
include ::Arli::Output
|
8
|
-
|
9
|
-
extend Forwardable
|
10
|
-
def_delegators :@library, :exists?
|
11
|
-
|
12
|
-
attr_accessor :library, :config
|
13
|
-
|
14
|
-
def initialize(library, config: Arli.config)
|
15
|
-
self.config = config
|
16
|
-
self.library = library
|
17
|
-
end
|
18
|
-
|
19
|
-
def install
|
20
|
-
___ "#{library.name.blue} "
|
21
|
-
|
22
|
-
if library.nil? && library.library.nil?
|
23
|
-
___ ' (no library) '
|
24
|
-
fuck
|
25
|
-
elsif library.url.nil?
|
26
|
-
___ ' (no url) '
|
27
|
-
fuck
|
28
|
-
else
|
29
|
-
___ "(#{library.version.green}) " if library.version
|
30
|
-
___ cursor.column(45) unless config.quiet
|
31
|
-
actions(library).each do |action|
|
32
|
-
run_action(action)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
___ "\n"
|
36
|
-
end
|
37
|
-
|
38
|
-
def run_action(action)
|
39
|
-
klass = Arli::Actions.action(action)
|
40
|
-
klass.new(library, config: config).act if klass
|
41
|
-
end
|
42
|
-
|
43
|
-
def actions(library)
|
44
|
-
actions = []
|
45
|
-
# First, how do we get the library?
|
46
|
-
actions << ((library.url =~ /\.zip$/i) ? :zip_file : :git_repo)
|
47
|
-
actions << :dir_name
|
48
|
-
actions
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|