dependenci 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWJkZDNlZjE4MjBlNjFlMjc0ZjZmZmEwMjllY2FjNzQ5ZmNmMTM4Nw==
5
+ data.tar.gz: !binary |-
6
+ NTllMmI4NzYxNzkzMmMyNGFmNjBiMjkwMGI5YzNmMzkzMmI1YjkzMw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MTZkMjgyZTRkOWIxOTViNGQ2ZDAyOTZhMDM4YTViZTJlNDRlNzgwN2U1Y2Y2
10
+ NTdhM2RkMTUxYzE0OWViYmUyYjI5NjljODY5OWQ3NTIyY2Y4NDU0MmZhNjNm
11
+ NWUyNDBiNmY0ZjFlNGJlZWZkMDE0ZjlhMzMwMWUzNzRhNWE1NWE=
12
+ data.tar.gz: !binary |-
13
+ YTU0NTllYWFhNjljN2E1OGVjMWFmMzg2MGEyM2VlZTc3Nzk4NWY1OGFkMjFi
14
+ MDVhNjNiZGU0N2NhMzg2NmI2NmIxMjkwYmZjNzRhMWY2ZWUyM2Q4M2NiOTQy
15
+ OTllMmZkMjc0MjgxMGJjNmQyYmQ4MmRjNzY1YTMyMjRlOTY4MDY=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dan Sosedoff
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # Dependenci
2
+
3
+ API wrapper for [Dependenci Service](http://dependenci.com)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dependenci'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dependenci
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ require 'dependenci'
23
+
24
+ status = Dependenci.rubygems(gemfile, gemfile_lock, gemspec)
25
+ status = Dependenci.npm(package_json)
26
+ ```
27
+
28
+ Example output:
29
+
30
+ ```
31
+ {"runtime"=>
32
+ [{"name"=>"coffee-script",
33
+ "required"=>"1.6.2",
34
+ "locked"=>nil,
35
+ "status"=>"ok",
36
+ "latest"=>"1.6.2"},
37
+ {"name"=>"optparse",
38
+ "required"=>"1.0.4",
39
+ "locked"=>nil,
40
+ "status"=>"ok",
41
+ "latest"=>"1.0.4"},
42
+ {"name"=>"scoped-http-client",
43
+ "required"=>"0.9.8",
44
+ "locked"=>nil,
45
+ "status"=>"ok",
46
+ "latest"=>"0.9.8"},
47
+ {"name"=>"log",
48
+ "required"=>"1.3.1",
49
+ "locked"=>nil,
50
+ "status"=>"ok",
51
+ "latest"=>"1.3.1"},
52
+ {"name"=>"express",
53
+ "required"=>"3.1.1",
54
+ "locked"=>nil,
55
+ "status"=>"update",
56
+ "latest"=>"3.2.0"}]}
57
+ ```
58
+
59
+ General dependency structure:
60
+
61
+ - `name` - Package name
62
+ - `status` - Dependency status
63
+ - `required` - Required versions
64
+ - `locked` - Locked version
65
+ - `url` - Package URL (rubygems or npm)
66
+
67
+ Or use command line tool:
68
+
69
+ ```
70
+ dependeci ~/myproject
71
+ ```
72
+
73
+ It'll analyze what's being used and print output like this:
74
+
75
+ ![Screen](screenshot.png)
76
+
77
+
78
+ ## Contributing
79
+
80
+ 1. Fork it
81
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
82
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
83
+ 4. Push to the branch (`git push origin my-new-feature`)
84
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/dependenci ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'terminal_helpers'
4
+ #!/usr/bin/env ruby
5
+
6
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
7
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
8
+
9
+ require 'faraday'
10
+ require 'json'
11
+ require 'terminal_helpers'
12
+ require 'dependenci'
13
+
14
+ include TerminalHelpers
15
+
16
+ def print_result(result)
17
+ if result['status']
18
+ status = result.delete('status')
19
+ color = status == 'ok' ? :green : :yellow
20
+
21
+ puts "\nDependency status: #{status.upcase.send(color)}\n\n"
22
+ end
23
+
24
+ result.each_pair do |group, deps|
25
+ puts "#{group.upcase}\n"
26
+
27
+ deps.each do |d|
28
+ status = d['status']
29
+ color = status == 'ok' ? :green : :yellow
30
+
31
+ msg = " * [#{status.upcase.send(color)}] #{d['name']} #{d['required']}"
32
+
33
+ unless status == 'ok'
34
+ msg << " ("
35
+ msg << " locked #{d['locked']} " if d['locked']
36
+ msg << " latest #{d['latest']} )"
37
+ end
38
+
39
+ puts msg
40
+ end
41
+
42
+ puts
43
+ end
44
+ end
45
+
46
+ def run_rubygems(dir)
47
+ gemfile = File.read(File.join(dir, 'Gemfile')) rescue ''
48
+ gemfile_lock = File.read(File.join(dir, 'Gemfile.lock')) rescue ''
49
+ gemspec = File.read(File.join(dir, "#{File.basename(dir)}.gemspec")) rescue ''
50
+
51
+ if gemfile.empty? && gemfile_lock.empty? && gemspec.empty?
52
+ STDERR.puts "Nothing to check"
53
+ else
54
+ data = Dependenci.rubygems(gemfile, gemfile_lock, gemspec)
55
+ print_result(data)
56
+ end
57
+ end
58
+
59
+ def run_npm(dir)
60
+ package_json = File.read(File.join(dir, 'package.json'))
61
+ data = Dependenci.npm(package_json)
62
+
63
+ print_result(data)
64
+ end
65
+
66
+ dir = File.expand_path(ARGV.shift)
67
+
68
+ if File.exists?("#{dir}/package.json")
69
+ run_npm(dir)
70
+ else
71
+ run_rubygems(dir)
72
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/dependenci/version', __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "dependenci"
6
+ spec.version = Dependenci::VERSION
7
+ spec.authors = ["Dan Sosedoff"]
8
+ spec.email = ["dan.sosedoff@gmail.com"]
9
+ spec.description = %q{API wrapper for dependenci.com}
10
+ spec.summary = %q{API wrapper for dependenci.com}
11
+ spec.homepage = "http://dependenci.com"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency "faraday", "~> 0.8"
20
+ spec.add_runtime_dependency "json", "~> 1.8"
21
+ spec.add_runtime_dependency "terminal_helpers", "~> 0.1"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ module Dependenci
5
+ class Client
6
+ API_BASE = 'http://dependenci.com'
7
+
8
+ def rubygems(opts={})
9
+ send_request('/api/rubygems', opts)
10
+ end
11
+
12
+ def npm(opts={})
13
+ send_request('/api/npm', opts)
14
+ end
15
+
16
+ private
17
+
18
+ def send_request(path, params={})
19
+ url = "#{API_BASE}#{path}"
20
+ resp = Faraday.post(url, params)
21
+
22
+ JSON.parse(resp.body)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Dependenci
2
+ VERSION = "1.0.0"
3
+ end
data/lib/dependenci.rb ADDED
@@ -0,0 +1,34 @@
1
+ require "dependenci/version"
2
+ require "dependenci/client"
3
+
4
+ module Dependenci
5
+ # Get dependencies status for ruby project
6
+ #
7
+ # gemfile - Contents of Gemfile
8
+ # gemfile_lock - Contents of Gemfile.lock (optional)
9
+ # gemspec - Contents of *.gemspec file (optional)
10
+ #
11
+ # Returns a hash with status result
12
+ def self.rubygems(gemfile=nil, gemfile_lock=nil, gemspec=nil)
13
+ opts = {
14
+ gemfile: gemfile,
15
+ gemfile_lock: gemfile_lock,
16
+ gemspec: gemspec
17
+ }
18
+
19
+ client.rubygems(opts.reject { |k,v| v.nil? })
20
+ end
21
+
22
+ # Get dependencies status for node.js project
23
+ #
24
+ # package_json - Contents of package.json file
25
+ #
26
+ # Returns a hash with status result
27
+ def self.npm(package_json)
28
+ client.npm(package: package_json)
29
+ end
30
+
31
+ def self.client
32
+ Dependenci::Client.new
33
+ end
34
+ end
data/screenshot.png ADDED
Binary file
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dependenci
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Sosedoff
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: terminal_helpers
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: API wrapper for dependenci.com
84
+ email:
85
+ - dan.sosedoff@gmail.com
86
+ executables:
87
+ - dependenci
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/dependenci
97
+ - dependenci.gemspec
98
+ - lib/dependenci.rb
99
+ - lib/dependenci/client.rb
100
+ - lib/dependenci/version.rb
101
+ - screenshot.png
102
+ homepage: http://dependenci.com
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.0.3
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: API wrapper for dependenci.com
126
+ test_files: []
127
+ has_rdoc: