ruaur 1.0.6 → 1.0.7

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
  SHA256:
3
- metadata.gz: 8f30ee3547cf8f289a463fb44b65c0301b61fa9cc1e03cebd305842c7c8fbdf8
4
- data.tar.gz: cb7cd6303985596af02d528f82b4174286671b922d3bf650224c069c8340835c
3
+ metadata.gz: 3f309e539238f5b09c165e1f33ec6ab925bd60318122c5d2d2acb1e58eadf6a1
4
+ data.tar.gz: 7cf6e42fe094284f512b0b026a011407fc6cde2e88ea36ec2f321ecc31f6ceef
5
5
  SHA512:
6
- metadata.gz: 479c0e1c0fed696eef6dd3e52351fd365f26e561f0cf890b2f908cc856625c26b352e09a7d61e0da3ce5968d70ba6aa5ba512c4a17a3fce69c29621032c8d851
7
- data.tar.gz: d8dcb6eab55ec4a9598af8e241532514825416f68b41e44dad729359d93a5d6d5ac313a52cf094a72d85f03fcec670ce206ff2d53e7cf138ae72c1f523804dd4
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::RuAURAlreadyRunningError.new
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::MissingDependencyError.new(dep)
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::PackageNotFoundError.new
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::FailedToCompileError.new(
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::FailedToDownloadError.new(
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::FailedToExtractError.new(package.name)
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::AURError.new(
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::AURError.new(body["results"])
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::PackageNotFoundError.new(pkg_name)
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::AURError.new(
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::AURError.new(body["results"])
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::AURError.new(
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::AURError.new(body["results"])
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::FailedToDownloadError.new(name)
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/aur_error"
5
- require "ruaur/error/failed_to_compile_error"
6
- require "ruaur/error/failed_to_download_error"
7
- require "ruaur/error/failed_to_extract_error"
8
- require "ruaur/error/missing_dependency_error"
9
- require "ruaur/error/package_not_found_error"
10
- require "ruaur/error/package_not_installed_error"
11
- require "ruaur/error/ruaur_already_running_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"
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::AURError < RuAUR::Error
1
+ class RuAUR::Error::AUR < RuAUR::Error
2
2
  def initialize(msg)
3
3
  super(msg)
4
4
  end
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::FailedToCompileError < RuAUR::Error
1
+ class RuAUR::Error::FailedToCompile < RuAUR::Error
2
2
  def initialize(package = nil)
3
3
  super("Failed to compile: #{package}") if (package)
4
4
  super("Failed to compile") if (package.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::FailedToDownloadError < RuAUR::Error
1
+ class RuAUR::Error::FailedToDownload < RuAUR::Error
2
2
  def initialize(package = nil)
3
3
  super("Failed to download: #{package}") if (package)
4
4
  super("Failed to download") if (package.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::FailedToExtractError < RuAUR::Error
1
+ class RuAUR::Error::FailedToExtract < RuAUR::Error
2
2
  def initialize(package = nil)
3
3
  super("Failed to extract: #{package}") if (package)
4
4
  super("Failed to extract") if (package.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::MissingDependencyError < RuAUR::Error
1
+ class RuAUR::Error::MissingDependency < RuAUR::Error
2
2
  def initialize(dep = nil)
3
3
  super("Dependency not found: #{dep}") if (dep)
4
4
  super("Dependency not found") if (dep.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::PackageNotFoundError < RuAUR::Error
1
+ class RuAUR::Error::PackageNotFound < RuAUR::Error
2
2
  def initialize(package = nil)
3
3
  super("Package not found: #{package}") if (package)
4
4
  super("No package was specified") if (package.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::PackageNotInstalledError < RuAUR::Error
1
+ class RuAUR::Error::PackageNotInstalled < RuAUR::Error
2
2
  def initialize(package = nil)
3
3
  super("Package not installed: #{package}") if (package)
4
4
  super("Package not installed") if (package.nil?)
@@ -1,4 +1,4 @@
1
- class RuAUR::Error::RuAURAlreadyRunningError < RuAUR::Error
1
+ class RuAUR::Error::RuAURAlreadyRunning < RuAUR::Error
2
2
  def initialize
3
3
  super("RuAUR is already running")
4
4
  end
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(#{@pac_nocolor} -Ss "^#{pkg_name}$").empty?
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::MissingDependencyError.new("pacman")
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.6
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-02-28 00:00:00.000000000 Z
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/aur_error.rb
126
- - lib/ruaur/error/failed_to_compile_error.rb
127
- - lib/ruaur/error/failed_to_download_error.rb
128
- - lib/ruaur/error/failed_to_extract_error.rb
129
- - lib/ruaur/error/missing_dependency_error.rb
130
- - lib/ruaur/error/package_not_found_error.rb
131
- - lib/ruaur/error/package_not_installed_error.rb
132
- - lib/ruaur/error/ruaur_already_running_error.rb
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