dependency_inspector 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1e9723628ed9c3447f1fcd744fec602b8869ffd
4
+ data.tar.gz: 73cff53aa12319a01692aee7ffefcb1ec616942d
5
+ SHA512:
6
+ metadata.gz: 5f356812699a220b5de450be8e72c771f387d438b23455436a3c0a6e652286763d10125853c4e5f41e65b37ac0515fa07a05e908a74558cfd171683e567b09fb
7
+ data.tar.gz: 71ba59f29323afc1a86722929a7070867c721d37fd866b4e9e1e0e606f872654f32016a7c340bc2f9bd38e0e03512968bebfecf7ad108846287605b0778a1694
data/.gitignore ADDED
@@ -0,0 +1,42 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ Gemfile.lock
32
+ .ruby-version
33
+ .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
37
+
38
+ # MacOSX
39
+ .DS_Store
40
+
41
+ # IDE
42
+ .idea
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Metrics/LineLength:
4
+ Max: 100
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,45 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-10-15 13:44:13 +0900 using RuboCop version 0.34.1.
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: 1
10
+ Metrics/AbcSize:
11
+ Max: 21
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 108
17
+
18
+ # Offense count: 2
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 17
22
+
23
+ # Offense count: 1
24
+ Style/CaseEquality:
25
+ Exclude:
26
+ - 'lib/dependency_inspector/ruby_gemfile/dsl.rb'
27
+
28
+ # Offense count: 11
29
+ Style/Documentation:
30
+ Exclude:
31
+ - 'lib/dependency_inspector.rb'
32
+ - 'lib/dependency_inspector/ruby_gemfile/base.rb'
33
+ - 'lib/dependency_inspector/ruby_gemfile/definition.rb'
34
+ - 'lib/dependency_inspector/ruby_gemfile/dependency.rb'
35
+ - 'lib/dependency_inspector/ruby_gemfile/dsl.rb'
36
+ - 'lib/dependency_inspector/ruby_gemfile/requirement.rb'
37
+ - 'lib/dependency_inspector/ruby_gemfile/resolver.rb'
38
+ - 'lib/dependency_inspector/ruby_gemfile/source.rb'
39
+ - 'lib/dependency_inspector/ruby_gemfile/source_list.rb'
40
+ - 'lib/dependency_inspector/version.rb'
41
+
42
+ # Offense count: 1
43
+ Style/OpMethod:
44
+ Exclude:
45
+ - 'lib/dependency_inspector/ruby_gemfile/source.rb'
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Komei Shimamura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Dependency Inspector [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) [![Circle CI](https://circleci.com/gh/travelist/dependency-inspector.svg?style=shield&circle-token=a5c5179f69fddb1a3eeae0a33aad56de84be3701)](https://circleci.com/gh/travelist/dependency-inspector) [![Gem Version](https://badge.fury.io/rb/dependency_inspector.svg)](https://badge.fury.io/rb/dependency_inspector)
2
+
3
+ This gem is for analysing dependencies files such as `Gemfile` and list libraries with their information.
4
+
5
+ *Currently only `Gemfile` is supported. Others will come to be supported*
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'dependency-inspector'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install dependency-inspector
22
+
23
+ ## Usage
24
+
25
+ *NOTE: Since this is primitive project, the following usages is not ensured to be consistent for the future versions*
26
+
27
+ ```ruby
28
+ # include this gem
29
+ require 'dependency-inspector'
30
+ ```
31
+
32
+ ```ruby
33
+ gemfile_filepath = "#{Dir.pwd}/Gemfile"
34
+ di = DependencyInspector::RubyGemfile::Dsl.evaluate(gemfile_filepath)
35
+ ```
36
+ > It can cope with the text as well
37
+ ```ruby
38
+ gemfile_txt = <<EOR
39
+ source 'https://rubygems.org'
40
+ gem 'dependency_inspector'
41
+ EOR
42
+ di = DependencyInspector::RubyGemfile::Dsl.evaluate(gemfile_txt)
43
+
44
+ ```ruby
45
+ dependency_info = di.resolve
46
+ # this takes time according to the amount of the dependency libraries
47
+ ```
48
+
49
+ ```ruby
50
+ # currently library version is not supported (always return latest versoin info)
51
+ dependency_info.each do |i|
52
+ p i["name"] # => "rails"
53
+ p i["downloads"] # => 54525871
54
+ p i["version"] # => "4.2.4"
55
+ p i["version_downloads"] # => 359907
56
+ p i["platform"] # => "ruby"
57
+ p i["authors"] # => "Dav..."
58
+ p i["info"] # => "Ruby"
59
+ p i["licenses"] # => ["MIT"]
60
+ p i["metadata"] # => {}
61
+ p i["sha"] # => "1c33de75..."
62
+ p i["project_uri"] # => "https://rubygems.org/gems/rails"
63
+ p i["gem_uri"] # => "https://rubygems.org/gems/rails-4.2.4.gem"
64
+ p i["homepage_uri"] # => "http://www.rubyonrails.org"
65
+ p i["wiki_uri"] # => "http://wiki.rubyonrails.org"
66
+ p i["documentation_uri"] # => "http://api.rubyonrails.org"
67
+ p i["mailing_list_uri"] # => "http://groups.google.com/group/rubyonrails-talk"
68
+ p i["source_code_uri"] # => "http://github.com/rails/rails"
69
+ p i["bug_tracker_uri"] # => "http://github.com/rails/rails/issues"
70
+ p i["dependencies"] # => {"development"=>[], "runtime"=>[{"name"=>"actionmailer", "requirements"=>"= 4.2.4"}
71
+ end
72
+ ```
73
+
74
+ ## TODO
75
+
76
+ * Write test code
77
+ * support for other languages and dependency managers
78
+
79
+ ## Development
80
+
81
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
82
+
83
+ To install this gem onto your local machine
84
+ ```
85
+ bundle exec rake install
86
+ ```
87
+
88
+ Do not forget to execute `rubocop` before pushing the changes.
89
+
90
+ ```shell
91
+ rubocop
92
+ ```
93
+
94
+ ## Contributing
95
+
96
+ 1 Fork it ( https://github.com/travelist/dependency-inspector/fork )
97
+
98
+ 2 Create your feature branch
99
+ ```shell
100
+ git checkout -b my-new-feature
101
+ ```
102
+
103
+ 3 Commit your changes
104
+ ```shell
105
+ git commit -am 'Add some feature'
106
+ ```
107
+
108
+ 4 Push to the branch
109
+ ```shell
110
+ git push origin my-new-feature
111
+ ```
112
+
113
+ 5 Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'dependency_inspector'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/circle.yml ADDED
@@ -0,0 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version:
4
+ 2.2.0
5
+ test:
6
+ pre:
7
+ - bundle exec rubocop
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dependency_inspector/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'dependency_inspector'
8
+ spec.version = DependencyInspector::VERSION
9
+ spec.authors = ['Komei Shimamura']
10
+ spec.email = ['komei.t.f@gmail.com']
11
+
12
+ spec.summary = 'Inspect dependency files and retrieve the details'
13
+ spec.description = ''
14
+ spec.homepage = 'https://github.com/travelist/dependency_inspector'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'gems'
23
+ spec.add_development_dependency 'bundler', '~> 1.8'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rubocop'
26
+ end
@@ -0,0 +1,6 @@
1
+ module DependencyInspector
2
+ autoload :VERSION, 'dependency_inspector/version'
3
+ autoload :RubyGemfile, 'dependency_inspector/ruby_gemfile/base'
4
+ class << self
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ module DependencyInspector
2
+ require 'gems'
3
+ module RubyGemfile
4
+ autoload :Definition, 'dependency_inspector/ruby_gemfile/definition'
5
+ autoload :Dependency, 'dependency_inspector/ruby_gemfile/dependency'
6
+ autoload :Dsl, 'dependency_inspector/ruby_gemfile/dsl'
7
+ autoload :Requirement, 'dependency_inspector/ruby_gemfile/requirement'
8
+ autoload :Resolver, 'dependency_inspector/ruby_gemfile/resolver'
9
+ autoload :Source, 'dependency_inspector/ruby_gemfile/source'
10
+ autoload :SourceList, 'dependency_inspector/ruby_gemfile/source_list'
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Definition
4
+ attr_reader :dependencies
5
+
6
+ def initialize(dependencies, sources)
7
+ @dependencies = dependencies
8
+ @sources = sources
9
+ @remote = false
10
+ @expanded_dependencies = nil
11
+ end
12
+
13
+ def resolve
14
+ @resolve ||= begin
15
+ Resolver.resolve(index, dependencies, source_requirements)
16
+ end
17
+ end
18
+
19
+ def source_requirements
20
+ source_requirements = {}
21
+ dependencies.each do |dep|
22
+ next unless dep.source
23
+ source_requirements[dep.name] = dep.source
24
+ end
25
+ source_requirements
26
+ end
27
+
28
+ def index
29
+ dependency_names = @dependencies.map(&:name)
30
+ @sources.all_sources.each do |source|
31
+ source.dependency_names = dependency_names.dup
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Dependency
4
+ attr_accessor :name, :version, :source, :groups
5
+ def initialize(name, version, options = {}, &_blk)
6
+ @name = name
7
+ @version = version
8
+ @groups = Array(options['group'] || :default).map(&:to_sym)
9
+ @source = options['source']
10
+ @requirements = RubyGemfile::Requirement.create(version)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,141 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Dsl
4
+ attr_accessor :dependencies
5
+
6
+ def initialize
7
+ @source = nil
8
+ @sources = RubyGemfile::SourceList.new
9
+ @dependencies = []
10
+ @groups = []
11
+ @optional_groups = []
12
+ end
13
+
14
+ def self.evaluate(gemfile)
15
+ builder = new
16
+ builder.eval_gemfile(gemfile)
17
+ builder.to_definition
18
+ end
19
+
20
+ def eval_gemfile(gemfile)
21
+ if gemfile.is_a?(String)
22
+ instance_eval(gemfile)
23
+ else
24
+ txt = File.open(gemfile, 'rb', &:read)
25
+ instance_eval(txt, gemfile.to_s)
26
+ end
27
+ end
28
+
29
+ def normalize_source(src)
30
+ case src
31
+ when String
32
+ src
33
+ else
34
+ fail Exception, "unknown source #{src}"
35
+ end
36
+ end
37
+
38
+ def source(source, &blk)
39
+ source = normalize_source(source)
40
+ if block_given?
41
+ with_source(@sources.add_rubygems_sources('remotes' => source), &blk)
42
+ else
43
+ @sources.add_rubygems_sources(source)
44
+ end
45
+ end
46
+
47
+ def with_source(source)
48
+ old_source = @source
49
+ if block_given?
50
+ @source = source
51
+ yield
52
+ end
53
+ source
54
+ ensure
55
+ @source = old_source
56
+ end
57
+
58
+ def method_missing(name, *_args)
59
+ name
60
+ # p "currently #{name} is not supported"
61
+ end
62
+
63
+ def normalize_group_options(opts, groups)
64
+ normalize_hash(opts)
65
+
66
+ groups = groups.map { |group| ":#{group}" }.join(', ')
67
+ validate_keys("group #{groups}", opts, %w(optional))
68
+
69
+ opts['optional'] ||= false
70
+ end
71
+
72
+ def validate_keys(_command, opts, valid_keys)
73
+ invalid_keys = opts.keys - valid_keys
74
+ p 'error' if invalid_keys.any?
75
+ end
76
+
77
+ def group(*args, &_blk)
78
+ opts = Hash === args.last ? args.pop.dup : {}
79
+ normalize_group_options(opts, args)
80
+
81
+ @groups.concat args
82
+
83
+ if opts['optional']
84
+ optional_groups = args - @optional_groups
85
+ @optional_groups.concat optional_groups
86
+ end
87
+
88
+ yield
89
+ ensure
90
+ args.each { @groups.pop }
91
+ end
92
+
93
+ def normalize_hash(opts)
94
+ opts.keys.each do |k|
95
+ opts[k.to_s] = opts.delete(k) unless k.is_a?(String)
96
+ end
97
+ opts
98
+ end
99
+
100
+ def normalize_options(name, _version, opts)
101
+ if name.is_a?(Symbol)
102
+ fail Exception, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead.)
103
+ end
104
+ if name =~ /\s/
105
+ fail Exception, %('#{name}' is not a valid gem name because it contains whitespace.)
106
+ end
107
+
108
+ normalize_hash(opts)
109
+
110
+ groups = @groups.dup
111
+ opts['group'] = opts.delete('groups') || opts['group']
112
+ groups.concat Array(opts.delete('group'))
113
+ groups = [:default] if groups.empty?
114
+
115
+ if opts.key?('source')
116
+ source = normalize_source(opts['source'])
117
+ opts['source'] = @sources.add_rubygems_source('remotes' => source)
118
+ end
119
+
120
+ opts['source'] ||= @source
121
+ opts['group'] = groups
122
+ end
123
+
124
+ def gem(name, *args)
125
+ options = args.last.is_a?(Hash) ? args.pop.dup : {}
126
+ version = args.empty? ? ['>= 0'] : args
127
+
128
+ normalize_options(name, version, options)
129
+
130
+ dep = RubyGemfile::Dependency.new(name, version, options)
131
+ return if @dependencies.find { |d| d.name == dep.name }
132
+
133
+ @dependencies << dep
134
+ end
135
+
136
+ def to_definition
137
+ RubyGemfile::Definition.new(@dependencies, @sources)
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,67 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Requirement
4
+ attr_reader :requirements
5
+
6
+ OPS = {
7
+ '=': ->(v, r) { v == r },
8
+ '!=': ->(v, r) { v != r },
9
+ '>': ->(v, r) { v > r },
10
+ '<': ->(v, r) { v < r },
11
+ '>=': ->(v, r) { v >= r },
12
+ '<=': ->(v, r) { v <= r },
13
+ '~>': ->(v, r) { v >= r && v.release < r.bump }
14
+ }
15
+
16
+ quoted = OPS.keys.map { |k| Regexp.quote k }.join '|'
17
+ VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'
18
+ PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{VERSION_PATTERN})\\s*"
19
+ PATTERN = /\A#{PATTERN_RAW}\z/
20
+
21
+ DEFAULT_REQUIREMENT = ['>=', 0]
22
+
23
+ def initialize(*requirements)
24
+ requirements = requirements.flatten
25
+ requirements.compact!
26
+ requirements.uniq!
27
+
28
+ if requirements.empty?
29
+ @requirements = [DEFAULT_REQUIREMENT]
30
+ else
31
+ @requirements = requirements.map! { |r| self.class.parse r }
32
+ end
33
+ end
34
+
35
+ def self.create(requirements)
36
+ case requirements
37
+ when RubyGemfile::Requirement then
38
+ requirements
39
+ when Array then
40
+ new requirements
41
+ else
42
+ if input.respond_to? :to_str
43
+ new [input.to_str]
44
+ else
45
+ default
46
+ end
47
+ end
48
+ end
49
+
50
+ def self.default
51
+ new ['>= 0']
52
+ end
53
+
54
+ def self.parse(obj)
55
+ unless PATTERN =~ obj.to_s
56
+ fail Exception, "Wrong requirement [#{obj.inspect}]"
57
+ end
58
+
59
+ if Regexp.last_match(1) == '>=' && Regexp.last_match(2) == '0'
60
+ DEFAULT_REQUIREMENT
61
+ else
62
+ [Regexp.last_match(1) || '=', Regexp.last_match(2)]
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,40 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Resolver
4
+ def self.resolve(index, dependencies, source_requirements)
5
+ reqs = dependencies.map(&:name)
6
+ resolver = new(index, source_requirements)
7
+ resolver.start(reqs)
8
+ end
9
+
10
+ def initialize(index, source_requirements)
11
+ @initial_reqs = []
12
+ @index = index
13
+ @missing_gems = Hash.new(0)
14
+ @source_requirements = source_requirements
15
+ @started_at = Time.now
16
+ end
17
+
18
+ def start(reqs, current_traversal = false)
19
+ activated = {}
20
+ @initial_reqs = reqs.dup unless current_traversal
21
+ resolve(reqs, activated, current_traversal)
22
+ end
23
+
24
+ def resolve(reqs, _activated, _current_traversal)
25
+ results = []
26
+ reqs.each do |r|
27
+ result = search(r)
28
+ next if result.empty?
29
+ # TODO: select correct version instead of 'result.first'
30
+ results.push(result.first)
31
+ end
32
+ results
33
+ end
34
+
35
+ def search(gem_name)
36
+ Gems.search(gem_name)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,33 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class Source
4
+ attr_reader :remotes
5
+ attr_accessor :dependency_names
6
+
7
+ def initialize(options = {})
8
+ @options = options
9
+ @remotes = []
10
+ Array(options['remotes'] || []).reverse_each { |r| add_remote(r) }
11
+ end
12
+
13
+ def eql?(o)
14
+ o.is_a?(Source) && remotes_equal?(o.remotes)
15
+ end
16
+
17
+ alias_method :==, :eql?
18
+
19
+ def add_remote(source)
20
+ uri = normalize_uri(source)
21
+ @remotes.unshift(uri) unless @remotes.include?(uri)
22
+ end
23
+
24
+ def normalize_uri(uri)
25
+ uri = uri.to_s
26
+ uri = "#{uri}/" unless uri =~ %r{/$}
27
+ uri = URI(uri)
28
+ fail Exception, 'The source must be an absolute URI' unless uri.absolute?
29
+ uri
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,26 @@
1
+ module DependencyInspector
2
+ module RubyGemfile
3
+ class SourceList
4
+ def initialize
5
+ @path_sources = []
6
+ @git_sources = []
7
+ @rubygems_sources = []
8
+ end
9
+
10
+ def add_rubygems_sources(options = {})
11
+ add_source_to_list RubyGemfile::Source.new(options), @rubygems_sources
12
+ end
13
+
14
+ def all_sources
15
+ @path_sources + @git_sources + @rubygems_sources
16
+ end
17
+
18
+ private
19
+
20
+ def add_source_to_list(source, list)
21
+ list.unshift(source).uniq!
22
+ source
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module DependencyInspector
2
+ VERSION = '0.1.1'
3
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dependency_inspector
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Komei Shimamura
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gems
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
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: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: ''
70
+ email:
71
+ - komei.t.f@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - ".rubocop_todo.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - circle.yml
86
+ - dependency_inspector.gemspec
87
+ - lib/dependency_inspector.rb
88
+ - lib/dependency_inspector/ruby_gemfile/base.rb
89
+ - lib/dependency_inspector/ruby_gemfile/definition.rb
90
+ - lib/dependency_inspector/ruby_gemfile/dependency.rb
91
+ - lib/dependency_inspector/ruby_gemfile/dsl.rb
92
+ - lib/dependency_inspector/ruby_gemfile/requirement.rb
93
+ - lib/dependency_inspector/ruby_gemfile/resolver.rb
94
+ - lib/dependency_inspector/ruby_gemfile/source.rb
95
+ - lib/dependency_inspector/ruby_gemfile/source_list.rb
96
+ - lib/dependency_inspector/version.rb
97
+ homepage: https://github.com/travelist/dependency_inspector
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.4.5
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: Inspect dependency files and retrieve the details
121
+ test_files: []
122
+ has_rdoc: