dependenci 1.0.1 → 1.1.0

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: 5a4847b4ba9d5a2894697c05aabc4c8ecbd6ee04
4
- data.tar.gz: 3b500a144bf2ceb2fe396e195ce9437288e60078
3
+ metadata.gz: 1dd8b04c2537b17d558707a84cbd66a2ff162dd5
4
+ data.tar.gz: fa8b147a7062e001ece709f2372873681ec4ef0a
5
5
  SHA512:
6
- metadata.gz: 8f236d81179176bff337ca571b1fc438027952fce6ab0317701d180ed24ae1fa5c55eecf59d4a09a55e4e003eea76fc0ede680734f5524dd42b25186d8459d13
7
- data.tar.gz: 5ac0c27f92004b5e455f6cb86fb2b88136ae1339d12ed18b8e52a00330137c9c99d644aff25e868b8780fff841e47824f2274a64832b2e1fa39e1987c6badeb8
6
+ metadata.gz: fb85b7b71ca859fd94d9b15c4f94eb86f90edf123a102a6e7d42c19fd232418b535575c81b103ce57a2960dec73219bd9f2a8c46950540050d7eff109849b017
7
+ data.tar.gz: f096e58860722c9432578cb2c3dcee5810b576aaf1eec452b00f2280d1039d87452a0655a7ff8ac497fd3512f807b27122bad510ab43ed66947f6ad365b8514b
data/bin/dependenci CHANGED
@@ -9,6 +9,7 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
9
9
  require 'faraday'
10
10
  require 'json'
11
11
  require 'terminal_helpers'
12
+ require 'optparse'
12
13
  require 'dependenci'
13
14
 
14
15
  include TerminalHelpers
@@ -57,16 +58,36 @@ def run_rubygems(dir)
57
58
  end
58
59
 
59
60
  def run_npm(dir)
60
- package_json = File.read(File.join(dir, 'package.json'))
61
- data = Dependenci.npm(package_json)
61
+ package_json = File.read(File.join(dir, 'package.json')) rescue ''
62
62
 
63
- print_result(data)
63
+ if package_json.empty?
64
+ STDERR.puts "Nothing to check"
65
+ else
66
+ data = Dependenci.npm(package_json)
67
+ print_result(data)
68
+ end
69
+ end
70
+
71
+ options = {}
72
+ optsparse = OptionParser.new do |o|
73
+ o.banner = 'Usage: dependenci PATH [options]'
74
+ o.on('--rubygems') { |b| options[:rubygems] = b }
75
+ o.on('--npm') { |b| options[:npm] = b }
76
+ o.on('-h', '--help') { puts o; exit }
77
+ o.parse!
78
+ end
79
+
80
+ unless path = ARGV.shift
81
+ puts optsparse
82
+ exit
64
83
  end
65
84
 
66
- dir = File.expand_path(ARGV.shift)
85
+ dir = File.expand_path(path)
67
86
 
68
- if File.exists?("#{dir}/package.json")
69
- run_npm(dir)
87
+ unless options[:rubygems] || options[:npm]
88
+ File.exists?("#{dir}/package.json") ? run_npm(dir) : run_rubygems(dir)
70
89
  else
71
- run_rubygems(dir)
72
- end
90
+ run_npm(dir) if options[:npm]
91
+ run_rubygems(dir) if options[:rubygems]
92
+ end
93
+
@@ -1,3 +1,3 @@
1
1
  module Dependenci
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependenci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Sosedoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.0.5
122
+ rubygems_version: 2.1.11
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: API wrapper for dependenci.com