deplist 0.5.18 → 0.5.19

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
  SHA1:
3
- metadata.gz: 06aa9dc39c0cbd809d2bebf768d1705a32cf3122
4
- data.tar.gz: f88d45ccd6188bead60873e90d0c0046afceb01d
3
+ metadata.gz: c96c79b418bc051375e86c8ebf52262ff06ac437
4
+ data.tar.gz: 141c54ef2e93280f43e82dc90d0076945b1025ba
5
5
  SHA512:
6
- metadata.gz: cd57636ed811e6e4633e1aa25062445fc7994ed518c8b31a900969f51870b3207e66a06c9b20efccd27d0a675b7e39a8c2427d173a8d097ddcc7601a4ba718ae
7
- data.tar.gz: 37d709c55001c31dcfee686110c3a982a1d754d7678dd035e47b33aeaaadb2e8408d45d3dd3ee30f68a04ef1f614a4e3658554c0c0feccee4cdc4dc4b733a578
6
+ metadata.gz: 328bd41746deff35d2a534592bdeff1bc62b50ce499d3fb880ddd225351eba805cbe185126a550710c9d6ee5a06d84cee8f6f81f0f13a6dc88c89a7acb732974
7
+ data.tar.gz: bba33426326e74164f4251587700d0f0386a37a2134b9eddf8b84752cbfafe99c8e18302fb505eb407a1903eb93d745e7da547c1b4d42c85a93002ee08d19153
@@ -4,9 +4,10 @@ require 'json'
4
4
  class GemListServer
5
5
  include HTTParty
6
6
  base_uri 'https://gemdep.herokuapp.com'
7
+ # base_uri 'http://localhost:3000'
7
8
 
8
9
  def initialize(gems)
9
- @options = { query: {gems: gems, os: OsDetector.current_os} }
10
+ @options = { query: { gems: gems, os: OsDetector.current_os } }
10
11
  end
11
12
 
12
13
  def get_dependencies
@@ -1,11 +1,38 @@
1
1
  class Installer
2
- def self.install(pkg)
3
- if OsDetector.linux?
4
- system("sudo pacman -S #{pkg.join(' ')}")
5
- elsif OsDetector.macosx?
6
- system("sudo bower install #{pkg.join(' ')}")
7
- else
8
- fail UnknownOS
2
+ class << self
3
+ def install(packages)
4
+ fail UnknownOS if OsDetector.unknown?
5
+
6
+ setup(packages, OsDetector.current_os)
7
+ end
8
+
9
+ private
10
+
11
+ def setup(packages, os)
12
+ success_list = []
13
+ fail_list = []
14
+
15
+ packages.each do |pkg|
16
+ status = send("#{os}_install", pkg)
17
+
18
+ if status == true
19
+ success_list << pkg
20
+ else
21
+ fail_list << pkg
22
+ end
23
+ end
24
+
25
+ { success: success_list, fail: fail_list }
26
+ end
27
+
28
+ def linux_install(pkg)
29
+ # TODO: change pacman to 'apt-get -y install'
30
+ system("sudo pacman -S #{pkg} --noconfirm")
31
+ end
32
+
33
+ def macosx_install(pkg)
34
+ # TODO: esc confirmation
35
+ system("sudo bower install #{pkg} --no-interactive")
9
36
  end
10
37
  end
11
38
  end
@@ -14,7 +14,7 @@ class OsDetector
14
14
  end
15
15
 
16
16
  def unknown?
17
- (linux? || macosx?) == false
17
+ os_name == 'unknown'
18
18
  end
19
19
 
20
20
  private
@@ -28,7 +28,7 @@ class OsDetector
28
28
  when /linux/
29
29
  'linux'
30
30
  else
31
- raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
31
+ 'unknown'
32
32
  end
33
33
  )
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module Deplist
2
- VERSION = "0.5.18"
2
+ VERSION = "0.5.19"
3
3
  end
@@ -15,9 +15,21 @@ namespace :system_dependencies do
15
15
 
16
16
  begin
17
17
  if get_input
18
- Installer.install(packages)
18
+ status = Installer.install(packages)
19
+ system('clear')
19
20
 
20
- puts 'Life is better now, Goodbye my friend ;D'.green
21
+ unless status[:success].empty?
22
+ puts 'I have installed this packages for you :)'.yellow unless status[:fail].empty?
23
+ puts status[:success].join(', ').green
24
+ puts
25
+ end
26
+
27
+ unless status[:fail].empty?
28
+ puts "I'm sorry i can't install this packages :(".yellow
29
+ abort status[:fail].join(', ').red
30
+ end
31
+
32
+ abort 'Life is better now, Goodbye my friend ;D'.green
21
33
  end
22
34
 
23
35
  rescue UnknownOS
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deplist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.18
4
+ version: 0.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90