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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0aff3320c0e6cc3531421b5e7cb7c53029a265b8
4
- data.tar.gz: 820acc52deb23830f05ec37fd93b44a89fc682a9
3
+ metadata.gz: 121912571a39917cef2985ae874175d5b9bd6717
4
+ data.tar.gz: daa584fd47c2f664d80b22cff56291d22799f223
5
5
  SHA512:
6
- metadata.gz: 5112b3158f73b5a83e1d6939f5d4f2b4802216a2c0ba23c24374915d9ab302924318ca0135dffab74f736adaf9e360ad01eff25ee6fb42516f8ecc50e5291f32
7
- data.tar.gz: a11b0d861b3e007f777231f1636e8ede919a75b17d42014fa3d5066f9d47188083ecf0c5c7930bc215aece02e742ee4ad4fb58cb148b9e129452dcb87ce05228
6
+ metadata.gz: 859d2b37b3062ef636774ce337f7fdb6b3ba18522832f03735bb949a9c566ec2f11a6578205bd25d82907bb2bcb734faab1887646881e5d3e148360fc03692c5
7
+ data.tar.gz: 0e1362c1165db2c5854d25df47c7314d74e2da80f2fc70dbceb94c1718a101e1af776ac281d99073b35b4dcb32034236e02978f4403dac2a0fd8a66ffee63ac4
@@ -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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/deplist`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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/[USERNAME]/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.
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 = { query: { gems: gems, os: OsDetector.current_os } }
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 = self.class.get('/dependencies', @options)
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
@@ -1,4 +1,5 @@
1
1
  require 'rbconfig'
2
+
2
3
  class OsDetector
3
4
  class << self
4
5
  def current_os
@@ -1,3 +1,3 @@
1
1
  module Deplist
2
- VERSION = '0.5.20'.freeze
2
+ VERSION = '0.5.21'.freeze
3
3
  end
@@ -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 = Bundler.load.specs.map(&:name)
9
- packages = GemListServer.new(gems).dependencies
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'\
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.20
4
+ version: 0.5.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90