deplist 0.5.22 → 0.5.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +8 -3
- data/README.md +7 -2
- data/lib/deplist.rb +2 -1
- data/lib/deplist/dep_logger.rb +26 -0
- data/lib/deplist/gemlist_server.rb +4 -6
- data/lib/deplist/installer.rb +5 -3
- data/lib/deplist/railtie.rb +2 -1
- data/lib/deplist/version.rb +1 -1
- data/lib/tasks/show_dep.rake +15 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7f0d364f2762c4402a752ad09f36f7da3e2b3b
|
4
|
+
data.tar.gz: c292908171bf9f0f647a6f8b829e1a5d55af8045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898e14fdb99d4c5583ac7729dfe4a2f6a74219e46b9e24eaed5fd443c1184ca4b7959278716703da55f4e6bdc3729c5a28b673827e725967916fa92131e88626
|
7
|
+
data.tar.gz: 0085eb92d5b96476390ddf36e71255fa61b813df88ebab8b152cbb7d4289339daaddbebb98bdad47c88e2d132c93ecb4f7e8c0d8276046009c5af5c7dff0d85e
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2016-11-
|
3
|
+
# on 2016-11-20 01:19:07 +0200 using RuboCop version 0.45.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 7
|
10
10
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
|
11
11
|
# URISchemes: http, https
|
12
12
|
Metrics/LineLength:
|
@@ -15,4 +15,9 @@ Metrics/LineLength:
|
|
15
15
|
# Offense count: 2
|
16
16
|
# Configuration parameters: CountComments.
|
17
17
|
Metrics/MethodLength:
|
18
|
-
Max:
|
18
|
+
Max: 13
|
19
|
+
|
20
|
+
# Offense count: 1
|
21
|
+
Style/ClassVars:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/deplist/dep_logger.rb'
|
data/README.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Collects the project dependencies and operating system information, sends them to the web service, and displays the required system libraries to install and ask to install them.
|
4
4
|
|
5
|
+
## How DepList works:
|
6
|
+
|
7
|
+
DepList detects missing system dependencies of gems you are using in your Rails project. It sends them to an external API which responds with a list of dependencies that your system needs to be able to run your project. DepList also asks you to add a list of dependencies for gems that it could not identify, and sends them back to the external API to populate its knowledge base.
|
8
|
+
|
9
|
+
NOTE: DepList will not ask you to install system packages you already have. In case DepList fails to install any packages, it will let you know the name of the packages so you can configure them manually. DepList keeps a log of all its operations in `log/deplist.log`.
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
@@ -22,7 +28,7 @@ Or install it yourself as:
|
|
22
28
|
|
23
29
|
Show all system library needed to be able to run your rails application and ask you to install missing dependencies.
|
24
30
|
|
25
|
-
$ rake
|
31
|
+
$ rake deplist:show
|
26
32
|
|
27
33
|
## Contributing
|
28
34
|
|
@@ -32,4 +38,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/adham9
|
|
32
38
|
## License
|
33
39
|
|
34
40
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
35
|
-
|
data/lib/deplist.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
class DepLogger
|
4
|
+
LOG_DIR = 'log'.freeze
|
5
|
+
LOG_FILE = "#{LOG_DIR}/deplist.log".freeze
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def error(msg)
|
9
|
+
logger.error(msg)
|
10
|
+
end
|
11
|
+
|
12
|
+
def info(msg)
|
13
|
+
logger.info(msg)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def logger
|
19
|
+
FileUtils.mkdir_p(LOG_DIR)
|
20
|
+
|
21
|
+
@@logger ||= begin
|
22
|
+
Logger.new(LOG_FILE)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
class GemListServer
|
5
5
|
include HTTParty
|
6
|
+
|
6
7
|
base_uri 'https://gemdep.herokuapp.com'
|
7
8
|
# base_uri 'http://localhost:3000'
|
8
9
|
|
@@ -11,17 +12,14 @@ class GemListServer
|
|
11
12
|
@packages = load_packages(@options)
|
12
13
|
end
|
13
14
|
|
14
|
-
def create(unknown_gem, dependencies)
|
15
|
+
def self.create(unknown_gem, dependencies)
|
15
16
|
options = { body: { gem: unknown_gem, dependencies: dependencies, os: OsDetector.current_os } }
|
16
17
|
|
17
18
|
self.class.post('/system_lib', options)
|
18
19
|
end
|
19
20
|
|
20
21
|
def dependencies
|
21
|
-
|
22
|
-
system('clear')
|
23
|
-
|
24
|
-
system_dependencies
|
22
|
+
@packages['dependencies'].reject { |pkg| pkg_exists?(pkg) }
|
25
23
|
end
|
26
24
|
|
27
25
|
def unknown_gems
|
@@ -36,6 +34,6 @@ class GemListServer
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def pkg_exists?(pkg)
|
39
|
-
system("which #{pkg}")
|
37
|
+
system("which #{pkg} >/dev/null 2>&1")
|
40
38
|
end
|
41
39
|
end
|
data/lib/deplist/installer.rb
CHANGED
@@ -14,9 +14,12 @@ class Installer
|
|
14
14
|
|
15
15
|
packages.each do |pkg|
|
16
16
|
status = send("#{os}_install", pkg)
|
17
|
-
|
17
|
+
|
18
|
+
if status
|
19
|
+
DepLogger.info("Succeeded to install: #{pkg}")
|
18
20
|
success_list << pkg
|
19
21
|
else
|
22
|
+
DepLogger.error("Failed to install: #{pkg}")
|
20
23
|
fail_list << pkg
|
21
24
|
end
|
22
25
|
end
|
@@ -30,8 +33,7 @@ class Installer
|
|
30
33
|
end
|
31
34
|
|
32
35
|
def macosx_install(pkg)
|
33
|
-
|
34
|
-
system("sudo bower install #{pkg} --no-interactive")
|
36
|
+
system("bower install #{pkg} --no-interactive")
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
data/lib/deplist/railtie.rb
CHANGED
data/lib/deplist/version.rb
CHANGED
data/lib/tasks/show_dep.rake
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'colorize'
|
3
3
|
|
4
|
-
namespace :
|
5
|
-
desc '
|
4
|
+
namespace :deplist do
|
5
|
+
desc 'List system dependencies'
|
6
6
|
task show: :environment do
|
7
7
|
# get a list of project gems
|
8
8
|
gems = Bundler.load.specs.map(&:name)
|
@@ -10,24 +10,24 @@ namespace :system_dependencies do
|
|
10
10
|
packages = server.dependencies
|
11
11
|
unknown_gems = server.unknown_gems
|
12
12
|
|
13
|
-
|
13
|
+
if unknown_gems.any?
|
14
14
|
# TODO: change this message
|
15
15
|
puts "I don't know this gems can you tell"\
|
16
|
-
'me what dependencies they need if you know(y/n)
|
16
|
+
'me what dependencies they need if you know? (y/n)'.yellow
|
17
17
|
puts unknown_gems.join(', ').red
|
18
18
|
|
19
19
|
if user_input
|
20
20
|
puts 'To abort type exit.'.yellow
|
21
|
-
puts 'To add multiple dependencies use
|
21
|
+
puts 'To add multiple dependencies use e.g. pkg1,pkg2,...,pkgn.'.yellow
|
22
22
|
unknown_gems.each do |unknown_gem|
|
23
|
-
# TODO: Change this message
|
24
23
|
print "What about (#{unknown_gem}): ".yellow
|
25
24
|
STDOUT.flush
|
26
25
|
dependencies = STDIN.gets.chomp.split(/[\s,]+/)
|
26
|
+
|
27
27
|
break if dependencies == ['exit']
|
28
28
|
next if dependencies.empty?
|
29
29
|
|
30
|
-
|
30
|
+
GemListServer.create(unknown_gem, dependencies)
|
31
31
|
packages = packages.concat(dependencies)
|
32
32
|
end
|
33
33
|
end
|
@@ -35,24 +35,23 @@ namespace :system_dependencies do
|
|
35
35
|
|
36
36
|
abort 'Life is good ;D'.green if packages.empty?
|
37
37
|
|
38
|
-
puts 'Your system
|
39
|
-
' to be able to run your
|
38
|
+
puts 'Your system needs to have these packages'\
|
39
|
+
' to be able to run your Rails project:'.yellow
|
40
40
|
puts packages.join(', ').red
|
41
|
-
puts 'Do you want to install missing dependencies(y/n)
|
41
|
+
puts 'Do you want to install missing dependencies? (y/n)'.blue
|
42
42
|
|
43
43
|
begin
|
44
44
|
if user_input
|
45
45
|
status = Installer.install(packages)
|
46
|
-
system('clear')
|
47
46
|
|
48
|
-
|
49
|
-
puts 'I have installed
|
47
|
+
if status[:success].present?
|
48
|
+
puts 'I have installed these packages for you :)'.yellow
|
50
49
|
puts status[:success].join(', ').green
|
51
50
|
puts
|
52
51
|
end
|
53
52
|
|
54
|
-
|
55
|
-
puts "I'm sorry
|
53
|
+
if status[:fail].present?
|
54
|
+
puts "I'm sorry, I can't install these packages :(".yellow
|
56
55
|
abort status[:fail].join(', ').red
|
57
56
|
end
|
58
57
|
|
@@ -71,7 +70,7 @@ namespace :system_dependencies do
|
|
71
70
|
when 'Y', 'y', "\r"
|
72
71
|
return true
|
73
72
|
else
|
74
|
-
puts '
|
73
|
+
puts 'Goodbye my friend'
|
75
74
|
return false
|
76
75
|
end
|
77
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deplist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adham90
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- bin/setup
|
119
119
|
- deplist.gemspec
|
120
120
|
- lib/deplist.rb
|
121
|
+
- lib/deplist/dep_logger.rb
|
121
122
|
- lib/deplist/gemlist_server.rb
|
122
123
|
- lib/deplist/installer.rb
|
123
124
|
- lib/deplist/os_detector.rb
|