ruaur 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruaur.rb +3 -3
- data/lib/ruaur/aur.rb +11 -11
- data/lib/ruaur/error.rb +8 -8
- data/lib/ruaur/error/{aur_error.rb → aur.rb} +1 -1
- data/lib/ruaur/error/{failed_to_compile_error.rb → failed_to_compile.rb} +1 -1
- data/lib/ruaur/error/{failed_to_download_error.rb → failed_to_download.rb} +1 -1
- data/lib/ruaur/error/{failed_to_extract_error.rb → failed_to_extract.rb} +1 -1
- data/lib/ruaur/error/{missing_dependency_error.rb → missing_dependency.rb} +1 -1
- data/lib/ruaur/error/{package_not_found_error.rb → package_not_found.rb} +1 -1
- data/lib/ruaur/error/{package_not_installed_error.rb → package_not_installed.rb} +1 -1
- data/lib/ruaur/error/{ruaur_already_running_error.rb → ruaur_already_running.rb} +1 -1
- data/lib/ruaur/pacman.rb +5 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f309e539238f5b09c165e1f33ec6ab925bd60318122c5d2d2acb1e58eadf6a1
|
4
|
+
data.tar.gz: 7cf6e42fe094284f512b0b026a011407fc6cde2e88ea36ec2f321ecc31f6ceef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c79f9a130e1f6dc6d2eb3ff72f5471217ff11cd0d487054e2b2b129942a620757f78af2a1aed78545afa593d83bbc02f971f7600b726ff0988a2dd03f9d542
|
7
|
+
data.tar.gz: 0e30cc94bd5c1a73f4a3fd9a64da08a35f94a86ac1c28f7359330e909aed5a3edc7033b17ac9e93542598cdd0c7b32fe2698d089ac43773f77ccf52ea449930d
|
data/lib/ruaur.rb
CHANGED
@@ -4,7 +4,7 @@ require "scoobydoo"
|
|
4
4
|
class RuAUR
|
5
5
|
def check_and_lock
|
6
6
|
if (@lock.exist?)
|
7
|
-
raise RuAUR::Error::
|
7
|
+
raise RuAUR::Error::RuAURAlreadyRunning.new
|
8
8
|
end
|
9
9
|
|
10
10
|
FileUtils.touch(@lock)
|
@@ -46,7 +46,7 @@ class RuAUR
|
|
46
46
|
"sudo"
|
47
47
|
].each do |dep|
|
48
48
|
if (ScoobyDoo.where_are_you(dep).nil?)
|
49
|
-
raise RuAUR::Error::
|
49
|
+
raise RuAUR::Error::MissingDependency.new(dep)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -58,7 +58,7 @@ class RuAUR
|
|
58
58
|
|
59
59
|
def install(pkg_names, noconfirm = false)
|
60
60
|
if (pkg_names.nil? || pkg_names.empty?)
|
61
|
-
raise RuAUR::Error::
|
61
|
+
raise RuAUR::Error::PackageNotFound.new
|
62
62
|
end
|
63
63
|
|
64
64
|
check_and_lock
|
data/lib/ruaur/aur.rb
CHANGED
@@ -28,7 +28,7 @@ class RuAUR::AUR
|
|
28
28
|
compiled = Dir["#{package.name}*.pkg.tar.xz"]
|
29
29
|
|
30
30
|
if (compiled.empty?)
|
31
|
-
raise RuAUR::Error::
|
31
|
+
raise RuAUR::Error::FailedToCompile.new(
|
32
32
|
package.name
|
33
33
|
)
|
34
34
|
end
|
@@ -48,7 +48,7 @@ class RuAUR::AUR
|
|
48
48
|
|
49
49
|
tgz = Pathname.new("#{package.name}.tar.gz").expand_path
|
50
50
|
if (!tgz.exist?)
|
51
|
-
raise RuAUR::Error::
|
51
|
+
raise RuAUR::Error::FailedToDownload.new(
|
52
52
|
package.name
|
53
53
|
)
|
54
54
|
end
|
@@ -105,7 +105,7 @@ class RuAUR::AUR
|
|
105
105
|
|
106
106
|
dir = Pathname.new(package.name).expand_path
|
107
107
|
if (!dir.exist? || !dir.directory?)
|
108
|
-
raise RuAUR::Error::
|
108
|
+
raise RuAUR::Error::FailedToExtract.new(package.name)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
private :extract
|
@@ -178,7 +178,7 @@ class RuAUR::AUR
|
|
178
178
|
response = Typhoeus.get("#{@rpc_url}?#{query}", timeout: 5)
|
179
179
|
|
180
180
|
if (response.timed_out?)
|
181
|
-
raise RuAUR::Error::
|
181
|
+
raise RuAUR::Error::AUR.new(
|
182
182
|
"Check your internet connection!"
|
183
183
|
)
|
184
184
|
end
|
@@ -187,7 +187,7 @@ class RuAUR::AUR
|
|
187
187
|
body = JSON.parse(response.body)
|
188
188
|
|
189
189
|
if (body["type"] == "error")
|
190
|
-
raise RuAUR::Error::
|
190
|
+
raise RuAUR::Error::AUR.new(body["results"])
|
191
191
|
end
|
192
192
|
|
193
193
|
return nil if (body["results"].empty?)
|
@@ -206,7 +206,7 @@ class RuAUR::AUR
|
|
206
206
|
def install(pkg_name, noconfirm = false)
|
207
207
|
package = info(pkg_name)
|
208
208
|
if (package.nil?)
|
209
|
-
raise RuAUR::Error::
|
209
|
+
raise RuAUR::Error::PackageNotFound.new(pkg_name)
|
210
210
|
end
|
211
211
|
|
212
212
|
if (
|
@@ -256,7 +256,7 @@ class RuAUR::AUR
|
|
256
256
|
response = Typhoeus.get("#{@rpc_url}?#{query}", timeout: 5)
|
257
257
|
|
258
258
|
if (response.timed_out?)
|
259
|
-
raise RuAUR::Error::
|
259
|
+
raise RuAUR::Error::AUR.new(
|
260
260
|
"Check your internet connection!"
|
261
261
|
)
|
262
262
|
end
|
@@ -265,7 +265,7 @@ class RuAUR::AUR
|
|
265
265
|
body = JSON.parse(response.body)
|
266
266
|
|
267
267
|
if (body["type"] == "error")
|
268
|
-
raise RuAUR::Error::
|
268
|
+
raise RuAUR::Error::AUR.new(body["results"])
|
269
269
|
end
|
270
270
|
|
271
271
|
body["results"].each do |result|
|
@@ -325,7 +325,7 @@ class RuAUR::AUR
|
|
325
325
|
response = Typhoeus.get("#{@rpc_url}?#{query}", timeout: 5)
|
326
326
|
|
327
327
|
if (response.timed_out?)
|
328
|
-
raise RuAUR::Error::
|
328
|
+
raise RuAUR::Error::AUR.new(
|
329
329
|
"Check your internet connection!"
|
330
330
|
)
|
331
331
|
end
|
@@ -334,7 +334,7 @@ class RuAUR::AUR
|
|
334
334
|
body = JSON.parse(response.body)
|
335
335
|
|
336
336
|
if (body["type"] == "error")
|
337
|
-
raise RuAUR::Error::
|
337
|
+
raise RuAUR::Error::AUR.new(body["results"])
|
338
338
|
end
|
339
339
|
|
340
340
|
body["results"].each do |result|
|
@@ -359,7 +359,7 @@ class RuAUR::AUR
|
|
359
359
|
|
360
360
|
request.on_headers do |response|
|
361
361
|
if (response.code != 200)
|
362
|
-
raise RuAUR::Error::
|
362
|
+
raise RuAUR::Error::FailedToDownload.new(name)
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
data/lib/ruaur/error.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
class RuAUR::Error < RuntimeError
|
2
2
|
end
|
3
3
|
|
4
|
-
require "ruaur/error/
|
5
|
-
require "ruaur/error/
|
6
|
-
require "ruaur/error/
|
7
|
-
require "ruaur/error/
|
8
|
-
require "ruaur/error/
|
9
|
-
require "ruaur/error/
|
10
|
-
require "ruaur/error/
|
11
|
-
require "ruaur/error/
|
4
|
+
require "ruaur/error/aur"
|
5
|
+
require "ruaur/error/failed_to_compile"
|
6
|
+
require "ruaur/error/failed_to_download"
|
7
|
+
require "ruaur/error/failed_to_extract"
|
8
|
+
require "ruaur/error/missing_dependency"
|
9
|
+
require "ruaur/error/package_not_found"
|
10
|
+
require "ruaur/error/package_not_installed"
|
11
|
+
require "ruaur/error/ruaur_already_running"
|
data/lib/ruaur/pacman.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "hilighter"
|
2
2
|
require "pathname"
|
3
|
+
require "shellwords"
|
3
4
|
|
4
5
|
class RuAUR::Pacman
|
5
6
|
def clean(noconfirm = false)
|
@@ -18,7 +19,9 @@ class RuAUR::Pacman
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def exist?(pkg_name)
|
21
|
-
return !%x(
|
22
|
+
return !%x(
|
23
|
+
#{@pac_nocolor} -Ss "^#{pkg_name.shellescape}$"
|
24
|
+
).empty?
|
22
25
|
end
|
23
26
|
|
24
27
|
def hilight_installed(installed)
|
@@ -35,7 +38,7 @@ class RuAUR::Pacman
|
|
35
38
|
|
36
39
|
def initialize
|
37
40
|
if (ScoobyDoo.where_are_you("pacman").nil?)
|
38
|
-
raise RuAUR::Error::
|
41
|
+
raise RuAUR::Error::MissingDependency.new("pacman")
|
39
42
|
end
|
40
43
|
|
41
44
|
@pac_nocolor = "pacman --color=never"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruaur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -122,14 +122,14 @@ files:
|
|
122
122
|
- lib/ruaur.rb
|
123
123
|
- lib/ruaur/aur.rb
|
124
124
|
- lib/ruaur/error.rb
|
125
|
-
- lib/ruaur/error/
|
126
|
-
- lib/ruaur/error/
|
127
|
-
- lib/ruaur/error/
|
128
|
-
- lib/ruaur/error/
|
129
|
-
- lib/ruaur/error/
|
130
|
-
- lib/ruaur/error/
|
131
|
-
- lib/ruaur/error/
|
132
|
-
- lib/ruaur/error/
|
125
|
+
- lib/ruaur/error/aur.rb
|
126
|
+
- lib/ruaur/error/failed_to_compile.rb
|
127
|
+
- lib/ruaur/error/failed_to_download.rb
|
128
|
+
- lib/ruaur/error/failed_to_extract.rb
|
129
|
+
- lib/ruaur/error/missing_dependency.rb
|
130
|
+
- lib/ruaur/error/package_not_found.rb
|
131
|
+
- lib/ruaur/error/package_not_installed.rb
|
132
|
+
- lib/ruaur/error/ruaur_already_running.rb
|
133
133
|
- lib/ruaur/operation.rb
|
134
134
|
- lib/ruaur/options.rb
|
135
135
|
- lib/ruaur/package.rb
|