deplist 0.5.20 → 0.5.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +16 -2
- data/README.md +4 -10
- data/lib/deplist/gemlist_server.rb +18 -4
- data/lib/deplist/os_detector.rb +1 -0
- data/lib/deplist/version.rb +1 -1
- data/lib/tasks/show_dep.rake +28 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 121912571a39917cef2985ae874175d5b9bd6717
|
4
|
+
data.tar.gz: daa584fd47c2f664d80b22cff56291d22799f223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 859d2b37b3062ef636774ce337f7fdb6b3ba18522832f03735bb949a9c566ec2f11a6578205bd25d82907bb2bcb734faab1887646881e5d3e148360fc03692c5
|
7
|
+
data.tar.gz: 0e1362c1165db2c5854d25df47c7314d74e2da80f2fc70dbceb94c1718a101e1af776ac281d99073b35b4dcb32034236e02978f4403dac2a0fd8a66ffee63ac4
|
data/.rubocop_todo.yml
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-11-19 17:02:27 +0200 using RuboCop version 0.45.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 6
|
10
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
|
11
|
+
# URISchemes: http, https
|
12
|
+
Metrics/LineLength:
|
13
|
+
Max: 118
|
14
|
+
|
15
|
+
# Offense count: 2
|
16
|
+
# Configuration parameters: CountComments.
|
1
17
|
Metrics/MethodLength:
|
2
18
|
Max: 11
|
3
|
-
Metrics/LineLength:
|
4
|
-
Max: 103
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Deplist
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
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.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,13 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
23
|
+
Show all system library needed to be able to run your rails application and ask you to install missing dependencies.
|
30
24
|
|
31
|
-
|
25
|
+
$ rake system_dependencies:show
|
32
26
|
|
33
27
|
## Contributing
|
34
28
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/adham90/deplist. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
30
|
|
37
31
|
|
38
32
|
## License
|
@@ -7,20 +7,34 @@ class GemListServer
|
|
7
7
|
# base_uri 'http://localhost:3000'
|
8
8
|
|
9
9
|
def initialize(gems)
|
10
|
-
@options
|
10
|
+
@options = { query: { gems: gems, os: OsDetector.current_os } }
|
11
|
+
@packages = load_packages(@options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(unknown_gem, dependencies)
|
15
|
+
options = { body: { gem: unknown_gem, dependencies: dependencies } }
|
16
|
+
|
17
|
+
self.class.post('/system_lib', options)
|
11
18
|
end
|
12
19
|
|
13
20
|
def dependencies
|
14
|
-
system_dependencies =
|
15
|
-
system_dependencies = JSON.parse(system_dependencies.to_json)
|
16
|
-
system_dependencies.select! { |pkg| !pkg_exists?(pkg) }
|
21
|
+
system_dependencies = @packages['dependencies'].select { |pkg| !pkg_exists?(pkg) }
|
17
22
|
system('clear')
|
18
23
|
|
19
24
|
system_dependencies
|
20
25
|
end
|
21
26
|
|
27
|
+
def unknown_gems
|
28
|
+
@packages['unknown']
|
29
|
+
end
|
30
|
+
|
22
31
|
private
|
23
32
|
|
33
|
+
def load_packages(options)
|
34
|
+
packages = self.class.get('/dependencies', options)
|
35
|
+
JSON.parse(packages.to_json)
|
36
|
+
end
|
37
|
+
|
24
38
|
def pkg_exists?(pkg)
|
25
39
|
system("which #{pkg}")
|
26
40
|
end
|
data/lib/deplist/os_detector.rb
CHANGED
data/lib/deplist/version.rb
CHANGED
data/lib/tasks/show_dep.rake
CHANGED
@@ -5,8 +5,34 @@ namespace :system_dependencies do
|
|
5
5
|
desc 'TODO'
|
6
6
|
task show: :environment do
|
7
7
|
# get a list of project gems
|
8
|
-
gems
|
9
|
-
|
8
|
+
gems = Bundler.load.specs.map(&:name)
|
9
|
+
server = GemListServer.new(gems)
|
10
|
+
packages = server.dependencies
|
11
|
+
unknown_gems = server.unknown_gems
|
12
|
+
|
13
|
+
unless unknown_gems.empty?
|
14
|
+
# TODO: change this message
|
15
|
+
puts "I don't know this gems can you tell"\
|
16
|
+
'me what dependencies they need if you know(y/n)?'.yellow
|
17
|
+
puts unknown_gems.join(', ').red
|
18
|
+
|
19
|
+
if user_input
|
20
|
+
puts 'To abort type exit.'.yellow
|
21
|
+
puts 'To add multiple dependencies use ex(pkg1,pkg2).'.yellow
|
22
|
+
unknown_gems.each do |unknown_gem|
|
23
|
+
# TODO: Change this message
|
24
|
+
print "What about (#{unknown_gem}): ".yellow
|
25
|
+
STDOUT.flush
|
26
|
+
dependencies = STDIN.gets.chomp.split(/[\s,]+/)
|
27
|
+
break if dependencies == ['exit']
|
28
|
+
next if dependencies.empty?
|
29
|
+
|
30
|
+
server.create(unknown_gem, dependencies)
|
31
|
+
packages = packages.concat(dependencies)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
10
36
|
abort 'Life is good ;D'.green if packages.empty?
|
11
37
|
|
12
38
|
puts 'Your system need to have this packages'\
|