nicht 0.1.4 → 0.1.6

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: 92aad0c35da8434196ea77a43592d23d3c8b8b35
4
- data.tar.gz: '028a6875e15e5cc230846b16efa863f82e31a720'
3
+ metadata.gz: 9a39149cb5290867577863bf37c2ad54d1a5bdd7
4
+ data.tar.gz: f8971c4f29263f7507cb590dc3d949dcc03e518f
5
5
  SHA512:
6
- metadata.gz: eb261127dfeeaf039cf67090cc1ee08f105fbf03e8a4e278cb6aeb2f40c76f8e95fbd0754008c9e1639115d373ecd05e912f308cf081120787c13cf27aa2d935
7
- data.tar.gz: '018f4c433564b78ccdeef2e9486abd4ca0a37d425ffe7d5472e4eaa607806c2885d24b38974d3328b6d9d449836881a3a53faa17463501cb2b25b905111c7c17'
6
+ metadata.gz: 949af638d8eb0e1dcc7cee994215785840ed6c38ab7ad606ce0d5ff416fa2229ce13770f71225336502de7fcffb003822d533da48c0cc1da0d5a279d9d4103c2
7
+ data.tar.gz: dad72faace350d80a0cde7de47e07493fea3c2f7a2f0a5512eea173f39ec2c052de1aece1d82f23aa2c03731a94a65a7720f57fce5717cd627919fd612c5774c
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ rvm:
5
5
  - 2.2.7
6
6
  - 2.3.4
7
7
  - 2.4.1
8
- before_install: gem install bundler -v 1.15.1
8
+ before_install: gem install bundler -v 1.15.3
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Nicht [![Gem](https://img.shields.io/gem/v/nicht.svg)](https://rubygems.org/gems/nicht) [![Build Status](https://img.shields.io/travis/vavgustov/nicht/master.svg)](https://travis-ci.org/vavgustov/nicht) [![Code Climate](https://img.shields.io/codeclimate/github/vavgustov/nicht.svg)](https://codeclimate.com/github/vavgustov/nicht)
2
2
 
3
- Summary coming soon...
3
+ This library allow you to see gems usage per your or 3rd-party projects.
4
+
5
+ ![image](https://user-images.githubusercontent.com/312873/28325799-7810e96a-6be7-11e7-8d82-2814a9233cfb.png)
4
6
 
5
7
  ## Installation
6
8
 
@@ -8,6 +10,12 @@ Summary coming soon...
8
10
  gem install nicht
9
11
  ```
10
12
 
13
+ Then create `.nichtrc` file in your home directory with path to the projects.
14
+
11
15
  ## Usage
12
16
 
13
- Desription coming soon...
17
+ Pass gem name as argument to see the list of the projects which use this gem:
18
+
19
+ ```bash
20
+ nicht webpacker
21
+ ```
data/lib/nicht.rb CHANGED
@@ -8,7 +8,7 @@ module Nicht
8
8
  def run(path, search = nil)
9
9
  settings = Nicht::Settings.new path
10
10
  begin
11
- projects_path = settings.valid?
11
+ projects_path = settings.get_path
12
12
  rescue Nicht::SettingsNotFound
13
13
  puts 'Settings not found. You should create .nichtrc with settings in your home directory.'
14
14
  rescue Nicht::SettingsNotValid
@@ -1,5 +1,3 @@
1
- # require 'nicht/exceptions'
2
-
3
1
  module Nicht
4
2
  class Settings
5
3
  FILENAME = '~/.nichtrc'.freeze
@@ -8,7 +6,7 @@ module Nicht
8
6
  @path = File.expand_path path
9
7
  end
10
8
 
11
- def valid?
9
+ def get_path
12
10
  raise Nicht::SettingsNotFound unless File.exist? @path
13
11
  projects_path = File.expand_path(File.read(@path))
14
12
  raise Nicht::SettingsNotValid unless File.exist? projects_path
data/lib/nicht/stats.rb CHANGED
@@ -45,16 +45,24 @@ module Nicht
45
45
  end
46
46
 
47
47
  def output
48
- if @search.nil?
49
- ap @stats[:per_project]
48
+ @search.nil? ? dump_per_project : dump_per_gem
49
+ end
50
+
51
+ def dump_per_project
52
+ @stats[:per_project].each_key do |key|
53
+ @stats[:per_project][key].sort!
54
+ end
55
+ ap @stats[:per_project]
56
+ end
57
+
58
+ def dump_per_gem
59
+ @stats[:per_gem] = @stats[:per_gem].sort.to_h
60
+ dump_gems = @stats[:per_gem][@search] ? @stats[:per_gem][@search] : @stats[:per_gem].select { |k, v| k.include? @search }
61
+ if dump_gems.empty?
62
+ puts "No matches found for '#{@search}'"
50
63
  else
51
- dump_gems = @stats[:per_gem][@search] ? @stats[:per_gem][@search] : @stats[:per_gem].select { |k, v| k.include? @search }
52
- if dump_gems.empty?
53
- puts "No matches found for '#{@search}'"
54
- else
55
- ap dump_gems
56
- end
64
+ ap dump_gems
57
65
  end
58
66
  end
59
67
  end
60
- end
68
+ end
data/lib/nicht/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nicht
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicht
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Avgustov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.6.11
113
+ rubygems_version: 2.6.12
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: This library allow you to see gems usage per your projects.