gemfile_interpreter 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gemfile_interpreter +34 -12
- data/lib/gemfile_interpreter.rb +5 -4
- data/lib/gemfile_interpreter/{own_bundler.rb → readonly_bundler.rb} +6 -8
- data/lib/gemfile_interpreter/version.rb +1 -1
- data/spec/assets/Gemfile +4 -0
- data/spec/assets/Gemfile.lock +99 -0
- data/spec/assets/GemfileWithoutLock +4 -0
- data/spec/assets/ValidGemfile +4 -0
- data/spec/assets/ValidGemfile.own_lock +99 -0
- data/spec/spec_helper.rb +109 -0
- data/spec/unit/gemfile_interpreter_spec.rb +120 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335bd10b8fd86e148878446ab59b416e04a439e4
|
4
|
+
data.tar.gz: e99a0736bcf7ab369b03a402923df8b3624509c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4efe62ace0b8e9e8972eb93af9a5a408a7b142b2868acce73e0fef788d08650f799188271b480d0e9362c09d07b33f3d262ddfe045df337d0550cc24ba5f136
|
7
|
+
data.tar.gz: 7f7d55b5e8c9060ebeeddf9add41cd02f8c321b564d394484c31a15d64bb6ccc949961b357e6fb38e55d4b3afefe1b755306e077c0641475a6b97b8c8c9d240d
|
data/bin/gemfile_interpreter
CHANGED
@@ -1,23 +1,45 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'optparse'
|
3
4
|
require 'gemfile_interpreter'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
options = {}
|
7
|
+
parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: #{__FILE__} PATH_TO_PROJECT [options]"
|
9
|
+
opts.on '--yaml', 'Change the output from json to yaml' do
|
10
|
+
options[:yaml] = true
|
11
|
+
end
|
12
|
+
opts.on '--gemfile=GEMFILE', 'The name of the Gemfile (default: Gemfile)' do |gemfile|
|
13
|
+
options[:gemfile] = gemfile
|
14
|
+
end
|
15
|
+
opts.on '--lockfile=GEMFILE', 'The name of the Gemfile.lock (default: %GEMFILE%.lock where %GEMFILE% is replaced with the Gemfile setting)' do |lockfile|
|
16
|
+
options[:lockfile] = lockfile
|
17
|
+
end
|
18
|
+
opts.on '-h', '--help', 'Prints this message' do
|
19
|
+
puts opts
|
20
|
+
exit
|
21
|
+
end
|
8
22
|
end
|
23
|
+
parser.parse!
|
24
|
+
options[:gemfile] ||= 'Gemfile'
|
25
|
+
options[:lockfile] ||= '%GEMFILE%.lock'
|
26
|
+
options[:lockfile].gsub! '%GEMFILE%', options[:gemfile]
|
9
27
|
|
10
|
-
|
11
|
-
|
12
|
-
|
28
|
+
dir = ARGV.pop
|
29
|
+
|
30
|
+
#def print_help
|
31
|
+
# puts "Usage: #{__FILE__} GEMFILE [--json|--yaml]"
|
32
|
+
# exit 1
|
33
|
+
#end
|
34
|
+
|
35
|
+
if dir.nil? || dir =~ /\A\s*\Z/
|
36
|
+
puts parser
|
37
|
+
#print_help
|
13
38
|
else
|
14
|
-
|
15
|
-
|
16
|
-
if type == '--yaml'
|
39
|
+
interpreter = GemfileInterpreter.new dir, gemfile: options[:gemfile], lockfile: options[:lockfile]
|
40
|
+
if options[:yaml]
|
17
41
|
puts interpreter.to_yaml
|
18
|
-
elsif type.nil? || type == '--json'
|
19
|
-
puts interpreter.to_json
|
20
42
|
else
|
21
|
-
|
43
|
+
puts interpreter.to_json
|
22
44
|
end
|
23
45
|
end
|
data/lib/gemfile_interpreter.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'gemfile_interpreter/version'
|
2
2
|
require 'gemfile_interpreter/parser'
|
3
|
-
require 'gemfile_interpreter/
|
3
|
+
require 'gemfile_interpreter/readonly_bundler'
|
4
4
|
require 'json'
|
5
5
|
require 'yaml'
|
6
6
|
|
7
7
|
class GemfileInterpreter
|
8
|
-
def initialize gemfile
|
9
|
-
|
8
|
+
def initialize dir, gemfile: 'Gemfile', lockfile: nil
|
9
|
+
gemfile_path = File.join dir, gemfile
|
10
|
+
lockfile_path = File.join dir, (lockfile || "#{gemfile}.lock")
|
10
11
|
@parsed = nil
|
11
|
-
@bundler_runtime =
|
12
|
+
@bundler_runtime = ReadonlyBundler.load_gemfile gemfile_path, lockfile_path
|
12
13
|
true
|
13
14
|
end
|
14
15
|
|
@@ -1,31 +1,29 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
|
3
3
|
class GemfileInterpreter
|
4
|
-
|
4
|
+
ReadonlyBundler = Bundler.dup
|
5
5
|
|
6
6
|
class GemfileMissingError < IOError; end
|
7
7
|
class GemfileLockMissingError < IOError; end
|
8
8
|
|
9
|
-
module
|
9
|
+
module ReadonlyBundler
|
10
10
|
class << self
|
11
|
-
def load_gemfile gemfile
|
11
|
+
def load_gemfile gemfile, lockfile
|
12
12
|
raise ArgumentError, 'The parameter gemfile may not be empty' if gemfile.nil? || gemfile.empty?
|
13
13
|
reset!
|
14
14
|
@default_gemfile = Pathname.new gemfile
|
15
|
+
@default_lockfile = Pathname.new lockfile
|
15
16
|
ensure_file_exists! default_gemfile, GemfileMissingError
|
16
17
|
ensure_file_exists! default_lockfile, GemfileLockMissingError
|
17
18
|
load
|
18
19
|
end
|
19
20
|
|
20
21
|
def default_gemfile
|
21
|
-
@default_gemfile || raise("First call #
|
22
|
+
@default_gemfile || raise("First call #load_gemfile")
|
22
23
|
end
|
23
24
|
|
24
25
|
def default_lockfile
|
25
|
-
|
26
|
-
when "gems.rb" then Pathname.new(default_gemfile.sub(/.rb$/, ".locked"))
|
27
|
-
else Pathname.new("#{default_gemfile}.lock")
|
28
|
-
end.untaint
|
26
|
+
@default_lockfile || raise("First call #load_gemfile")
|
29
27
|
end
|
30
28
|
|
31
29
|
def default_bundle_dir
|
data/spec/assets/Gemfile
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/ThunderKey/omniauth-keltec.git
|
3
|
+
revision: d954a55459b48cb56be4dbbcaa1fd2afc113db5b
|
4
|
+
specs:
|
5
|
+
omniauth-keltec (0.0.1)
|
6
|
+
omniauth-oauth2 (~> 1.3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (5.0.1)
|
12
|
+
actionview (= 5.0.1)
|
13
|
+
activesupport (= 5.0.1)
|
14
|
+
rack (~> 2.0)
|
15
|
+
rack-test (~> 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
+
actionview (5.0.1)
|
19
|
+
activesupport (= 5.0.1)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubis (~> 2.7.0)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
activesupport (5.0.1)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
i18n (~> 0.7)
|
27
|
+
minitest (~> 5.1)
|
28
|
+
tzinfo (~> 1.1)
|
29
|
+
bcrypt (3.1.11)
|
30
|
+
builder (3.2.3)
|
31
|
+
concurrent-ruby (1.0.4)
|
32
|
+
devise (4.2.0)
|
33
|
+
bcrypt (~> 3.0)
|
34
|
+
orm_adapter (~> 0.1)
|
35
|
+
railties (>= 4.1.0, < 5.1)
|
36
|
+
responders
|
37
|
+
warden (~> 1.2.3)
|
38
|
+
erubis (2.7.0)
|
39
|
+
faraday (0.10.1)
|
40
|
+
multipart-post (>= 1.2, < 3)
|
41
|
+
hashie (3.5.3)
|
42
|
+
i18n (0.8.0)
|
43
|
+
jwt (1.5.6)
|
44
|
+
loofah (2.0.3)
|
45
|
+
nokogiri (>= 1.5.9)
|
46
|
+
method_source (0.8.2)
|
47
|
+
mini_portile2 (2.1.0)
|
48
|
+
minitest (5.10.1)
|
49
|
+
multi_json (1.12.1)
|
50
|
+
multi_xml (0.6.0)
|
51
|
+
multipart-post (2.0.0)
|
52
|
+
nokogiri (1.7.0.1)
|
53
|
+
mini_portile2 (~> 2.1.0)
|
54
|
+
oauth2 (1.3.0)
|
55
|
+
faraday (>= 0.8, < 0.11)
|
56
|
+
jwt (~> 1.0)
|
57
|
+
multi_json (~> 1.3)
|
58
|
+
multi_xml (~> 0.5)
|
59
|
+
rack (>= 1.2, < 3)
|
60
|
+
omniauth (1.6.1)
|
61
|
+
hashie (>= 3.4.6, < 3.6.0)
|
62
|
+
rack (>= 1.6.2, < 3)
|
63
|
+
omniauth-oauth2 (1.3.1)
|
64
|
+
oauth2 (~> 1.0)
|
65
|
+
omniauth (~> 1.2)
|
66
|
+
orm_adapter (0.5.0)
|
67
|
+
rack (2.0.1)
|
68
|
+
rack-test (0.6.3)
|
69
|
+
rack (>= 1.0)
|
70
|
+
rails-dom-testing (2.0.2)
|
71
|
+
activesupport (>= 4.2.0, < 6.0)
|
72
|
+
nokogiri (~> 1.6)
|
73
|
+
rails-html-sanitizer (1.0.3)
|
74
|
+
loofah (~> 2.0)
|
75
|
+
railties (5.0.1)
|
76
|
+
actionpack (= 5.0.1)
|
77
|
+
activesupport (= 5.0.1)
|
78
|
+
method_source
|
79
|
+
rake (>= 0.8.7)
|
80
|
+
thor (>= 0.18.1, < 2.0)
|
81
|
+
rake (12.0.0)
|
82
|
+
responders (2.3.0)
|
83
|
+
railties (>= 4.2.0, < 5.1)
|
84
|
+
thor (0.19.4)
|
85
|
+
thread_safe (0.3.5)
|
86
|
+
tzinfo (1.2.2)
|
87
|
+
thread_safe (~> 0.1)
|
88
|
+
warden (1.2.7)
|
89
|
+
rack (>= 1.0)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
devise
|
96
|
+
omniauth-keltec!
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
1.14.3
|
@@ -0,0 +1,99 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/ThunderKey/omniauth-keltec.git
|
3
|
+
revision: d954a55459b48cb56be4dbbcaa1fd2afc113db5b
|
4
|
+
specs:
|
5
|
+
omniauth-keltec (0.0.1)
|
6
|
+
omniauth-oauth2 (~> 1.3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (5.0.1)
|
12
|
+
actionview (= 5.0.1)
|
13
|
+
activesupport (= 5.0.1)
|
14
|
+
rack (~> 2.0)
|
15
|
+
rack-test (~> 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
+
actionview (5.0.1)
|
19
|
+
activesupport (= 5.0.1)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubis (~> 2.7.0)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
activesupport (5.0.1)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
i18n (~> 0.7)
|
27
|
+
minitest (~> 5.1)
|
28
|
+
tzinfo (~> 1.1)
|
29
|
+
bcrypt (3.1.11)
|
30
|
+
builder (3.2.3)
|
31
|
+
concurrent-ruby (1.0.4)
|
32
|
+
devise (4.2.0)
|
33
|
+
bcrypt (~> 3.0)
|
34
|
+
orm_adapter (~> 0.1)
|
35
|
+
railties (>= 4.1.0, < 5.1)
|
36
|
+
responders
|
37
|
+
warden (~> 1.2.3)
|
38
|
+
erubis (2.7.0)
|
39
|
+
faraday (0.10.1)
|
40
|
+
multipart-post (>= 1.2, < 3)
|
41
|
+
hashie (3.5.3)
|
42
|
+
i18n (0.8.0)
|
43
|
+
jwt (1.5.6)
|
44
|
+
loofah (2.0.3)
|
45
|
+
nokogiri (>= 1.5.9)
|
46
|
+
method_source (0.8.2)
|
47
|
+
mini_portile2 (2.1.0)
|
48
|
+
minitest (5.10.1)
|
49
|
+
multi_json (1.12.1)
|
50
|
+
multi_xml (0.6.0)
|
51
|
+
multipart-post (2.0.0)
|
52
|
+
nokogiri (1.7.0.1)
|
53
|
+
mini_portile2 (~> 2.1.0)
|
54
|
+
oauth2 (1.3.0)
|
55
|
+
faraday (>= 0.8, < 0.11)
|
56
|
+
jwt (~> 1.0)
|
57
|
+
multi_json (~> 1.3)
|
58
|
+
multi_xml (~> 0.5)
|
59
|
+
rack (>= 1.2, < 3)
|
60
|
+
omniauth (1.6.1)
|
61
|
+
hashie (>= 3.4.6, < 3.6.0)
|
62
|
+
rack (>= 1.6.2, < 3)
|
63
|
+
omniauth-oauth2 (1.3.1)
|
64
|
+
oauth2 (~> 1.0)
|
65
|
+
omniauth (~> 1.2)
|
66
|
+
orm_adapter (0.5.0)
|
67
|
+
rack (2.0.1)
|
68
|
+
rack-test (0.6.3)
|
69
|
+
rack (>= 1.0)
|
70
|
+
rails-dom-testing (2.0.2)
|
71
|
+
activesupport (>= 4.2.0, < 6.0)
|
72
|
+
nokogiri (~> 1.6)
|
73
|
+
rails-html-sanitizer (1.0.3)
|
74
|
+
loofah (~> 2.0)
|
75
|
+
railties (5.0.1)
|
76
|
+
actionpack (= 5.0.1)
|
77
|
+
activesupport (= 5.0.1)
|
78
|
+
method_source
|
79
|
+
rake (>= 0.8.7)
|
80
|
+
thor (>= 0.18.1, < 2.0)
|
81
|
+
rake (12.0.0)
|
82
|
+
responders (2.3.0)
|
83
|
+
railties (>= 4.2.0, < 5.1)
|
84
|
+
thor (0.19.4)
|
85
|
+
thread_safe (0.3.5)
|
86
|
+
tzinfo (1.2.2)
|
87
|
+
thread_safe (~> 0.1)
|
88
|
+
warden (1.2.7)
|
89
|
+
rack (>= 1.0)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
devise
|
96
|
+
omniauth-keltec!
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
1.14.3
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# Tag all groups and examples in the spec/unit directory with
|
35
|
+
# :type => :unit
|
36
|
+
config.define_derived_metadata(:file_path => %r{/spec/unit/}) do |metadata|
|
37
|
+
metadata[:type] = :unit
|
38
|
+
end
|
39
|
+
|
40
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
41
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
42
|
+
config.mock_with :rspec do |mocks|
|
43
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
44
|
+
# a real object. This is generally recommended, and will default to
|
45
|
+
# `true` in RSpec 4.
|
46
|
+
mocks.verify_partial_doubles = true
|
47
|
+
end
|
48
|
+
|
49
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
50
|
+
# have no way to turn it off -- the option exists only for backwards
|
51
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
52
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
53
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
54
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
55
|
+
|
56
|
+
# The settings below are suggested to provide a good initial experience
|
57
|
+
# with RSpec, but feel free to customize to your heart's content.
|
58
|
+
=begin
|
59
|
+
# This allows you to limit a spec run to individual examples or groups
|
60
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
61
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
62
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
63
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
64
|
+
config.filter_run_when_matching :focus
|
65
|
+
|
66
|
+
# Allows RSpec to persist some state between runs in order to support
|
67
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
68
|
+
# you configure your source control system to ignore this file.
|
69
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
70
|
+
|
71
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
72
|
+
# recommended. For more details, see:
|
73
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
74
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
75
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
76
|
+
config.disable_monkey_patching!
|
77
|
+
|
78
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
79
|
+
# be too noisy due to issues in dependencies.
|
80
|
+
config.warnings = true
|
81
|
+
|
82
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
83
|
+
# file, and it's useful to allow more verbose output when running an
|
84
|
+
# individual spec file.
|
85
|
+
if config.files_to_run.one?
|
86
|
+
# Use the documentation formatter for detailed output,
|
87
|
+
# unless a formatter has already been configured
|
88
|
+
# (e.g. via a command-line flag).
|
89
|
+
config.default_formatter = 'doc'
|
90
|
+
end
|
91
|
+
|
92
|
+
# Print the 10 slowest examples and example groups at the
|
93
|
+
# end of the spec run, to help surface which specs are running
|
94
|
+
# particularly slow.
|
95
|
+
config.profile_examples = 10
|
96
|
+
|
97
|
+
# Run specs in random order to surface order dependencies. If you find an
|
98
|
+
# order dependency and want to debug it, you can fix the order by providing
|
99
|
+
# the seed, which is printed after each run.
|
100
|
+
# --seed 1234
|
101
|
+
config.order = :random
|
102
|
+
|
103
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
104
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
105
|
+
# test failures related to randomization by passing the same `--seed` value
|
106
|
+
# as the one that triggered the failure.
|
107
|
+
Kernel.srand config.seed
|
108
|
+
=end
|
109
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gemfile_interpreter'
|
3
|
+
|
4
|
+
RSpec.describe GemfileInterpreter do
|
5
|
+
root_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
|
6
|
+
assets_dir = File.join root_dir, 'spec', 'assets'
|
7
|
+
|
8
|
+
it 'generates a correct hash from a valid Gemfile' do
|
9
|
+
i = GemfileInterpreter.new assets_dir
|
10
|
+
expect(i.parsed.to_a).to eq [
|
11
|
+
rubygems_gem('rake', '12.0.0'),
|
12
|
+
rubygems_gem('concurrent-ruby', '1.0.4'),
|
13
|
+
rubygems_gem('i18n', '0.8.0'),
|
14
|
+
rubygems_gem('minitest', '5.10.1'),
|
15
|
+
rubygems_gem('thread_safe', '0.3.5'),
|
16
|
+
rubygems_gem('tzinfo', '1.2.2'),
|
17
|
+
rubygems_gem('activesupport', '5.0.1'),
|
18
|
+
rubygems_gem('builder', '3.2.3'),
|
19
|
+
rubygems_gem('erubis', '2.7.0'),
|
20
|
+
rubygems_gem('mini_portile2', '2.1.0'),
|
21
|
+
rubygems_gem('nokogiri', '1.7.0.1'),
|
22
|
+
rubygems_gem('rails-dom-testing', '2.0.2'),
|
23
|
+
rubygems_gem('loofah', '2.0.3'),
|
24
|
+
rubygems_gem('rails-html-sanitizer', '1.0.3'),
|
25
|
+
rubygems_gem('actionview', '5.0.1'),
|
26
|
+
rubygems_gem('rack', '2.0.1'),
|
27
|
+
rubygems_gem('rack-test', '0.6.3'),
|
28
|
+
rubygems_gem('actionpack', '5.0.1'),
|
29
|
+
rubygems_gem('bcrypt', '3.1.11'),
|
30
|
+
rubygems_gem('orm_adapter', '0.5.0'),
|
31
|
+
rubygems_gem('method_source', '0.8.2'),
|
32
|
+
rubygems_gem('thor', '0.19.4'),
|
33
|
+
rubygems_gem('railties', '5.0.1'),
|
34
|
+
rubygems_gem('responders', '2.3.0'),
|
35
|
+
rubygems_gem('warden', '1.2.7'),
|
36
|
+
rubygems_gem('devise', '4.2.0'),
|
37
|
+
rubygems_gem('multipart-post', '2.0.0'),
|
38
|
+
rubygems_gem('faraday', '0.10.1'),
|
39
|
+
rubygems_gem('hashie', '3.5.3'),
|
40
|
+
rubygems_gem('jwt', '1.5.6'),
|
41
|
+
rubygems_gem('multi_json', '1.12.1'),
|
42
|
+
rubygems_gem('multi_xml', '0.6.0'),
|
43
|
+
rubygems_gem('oauth2', '1.3.0'),
|
44
|
+
rubygems_gem('omniauth', '1.6.1'),
|
45
|
+
rubygems_gem('omniauth-oauth2', '1.3.1'),
|
46
|
+
git_gem('omniauth-keltec', '0.0.1', 'https://github.com/ThunderKey/omniauth-keltec.git', 'd954a55459b48cb56be4dbbcaa1fd2afc113db5b'),
|
47
|
+
rubygems_gem('bundler', '1.14.3'),
|
48
|
+
]
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'generates a correct hash from a valid Gemfile with own names' do
|
52
|
+
i = GemfileInterpreter.new assets_dir, gemfile: 'ValidGemfile', lockfile: 'ValidGemfile.own_lock'
|
53
|
+
expect(i.parsed.to_a).to eq [
|
54
|
+
rubygems_gem('rake', '12.0.0'),
|
55
|
+
rubygems_gem('concurrent-ruby', '1.0.4'),
|
56
|
+
rubygems_gem('i18n', '0.8.0'),
|
57
|
+
rubygems_gem('minitest', '5.10.1'),
|
58
|
+
rubygems_gem('thread_safe', '0.3.5'),
|
59
|
+
rubygems_gem('tzinfo', '1.2.2'),
|
60
|
+
rubygems_gem('activesupport', '5.0.1'),
|
61
|
+
rubygems_gem('builder', '3.2.3'),
|
62
|
+
rubygems_gem('erubis', '2.7.0'),
|
63
|
+
rubygems_gem('mini_portile2', '2.1.0'),
|
64
|
+
rubygems_gem('nokogiri', '1.7.0.1'),
|
65
|
+
rubygems_gem('rails-dom-testing', '2.0.2'),
|
66
|
+
rubygems_gem('loofah', '2.0.3'),
|
67
|
+
rubygems_gem('rails-html-sanitizer', '1.0.3'),
|
68
|
+
rubygems_gem('actionview', '5.0.1'),
|
69
|
+
rubygems_gem('rack', '2.0.1'),
|
70
|
+
rubygems_gem('rack-test', '0.6.3'),
|
71
|
+
rubygems_gem('actionpack', '5.0.1'),
|
72
|
+
rubygems_gem('bcrypt', '3.1.11'),
|
73
|
+
rubygems_gem('orm_adapter', '0.5.0'),
|
74
|
+
rubygems_gem('method_source', '0.8.2'),
|
75
|
+
rubygems_gem('thor', '0.19.4'),
|
76
|
+
rubygems_gem('railties', '5.0.1'),
|
77
|
+
rubygems_gem('responders', '2.3.0'),
|
78
|
+
rubygems_gem('warden', '1.2.7'),
|
79
|
+
rubygems_gem('devise', '4.2.0'),
|
80
|
+
rubygems_gem('multipart-post', '2.0.0'),
|
81
|
+
rubygems_gem('faraday', '0.10.1'),
|
82
|
+
rubygems_gem('hashie', '3.5.3'),
|
83
|
+
rubygems_gem('jwt', '1.5.6'),
|
84
|
+
rubygems_gem('multi_json', '1.12.1'),
|
85
|
+
rubygems_gem('multi_xml', '0.6.0'),
|
86
|
+
rubygems_gem('oauth2', '1.3.0'),
|
87
|
+
rubygems_gem('omniauth', '1.6.1'),
|
88
|
+
rubygems_gem('omniauth-oauth2', '1.3.1'),
|
89
|
+
git_gem('omniauth-keltec', '0.0.1', 'https://github.com/ThunderKey/omniauth-keltec.git', 'd954a55459b48cb56be4dbbcaa1fd2afc113db5b'),
|
90
|
+
rubygems_gem('bundler', '1.14.3'),
|
91
|
+
]
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'raises an error if the Gemfile has a reference to a local directory' do
|
95
|
+
i = GemfileInterpreter.new root_dir
|
96
|
+
expect { i.parsed }.to raise_error NotImplementedError
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'raises an error if the lock file is missing' do
|
100
|
+
expect { GemfileInterpreter.new assets_dir, gemfile: 'GemfileWithoutLock' }.to raise_error GemfileInterpreter::GemfileLockMissingError
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'raises an error if the Gemfile is missing' do
|
104
|
+
expect { GemfileInterpreter.new assets_dir, gemfile: 'MissingGemfile' }.to raise_error GemfileInterpreter::GemfileMissingError
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def rubygems_gem name, version
|
110
|
+
gem name, version, {'type' => 'rubygems', 'remotes' => ['https://rubygems.org/']}
|
111
|
+
end
|
112
|
+
|
113
|
+
def git_gem name, version, uri, revision
|
114
|
+
gem name, version, {'type' => 'git', 'revision' => revision, 'uri' => uri}
|
115
|
+
end
|
116
|
+
|
117
|
+
def gem name, version, source
|
118
|
+
[name, {'version' => version, 'full_name' => "#{name}-#{version}", 'platform' => 'ruby', 'remote' => '', 'source' => source}]
|
119
|
+
end
|
120
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemfile_interpreter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Ganz
|
@@ -47,9 +47,16 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- bin/gemfile_interpreter
|
49
49
|
- lib/gemfile_interpreter.rb
|
50
|
-
- lib/gemfile_interpreter/own_bundler.rb
|
51
50
|
- lib/gemfile_interpreter/parser.rb
|
51
|
+
- lib/gemfile_interpreter/readonly_bundler.rb
|
52
52
|
- lib/gemfile_interpreter/version.rb
|
53
|
+
- spec/assets/Gemfile
|
54
|
+
- spec/assets/Gemfile.lock
|
55
|
+
- spec/assets/GemfileWithoutLock
|
56
|
+
- spec/assets/ValidGemfile
|
57
|
+
- spec/assets/ValidGemfile.own_lock
|
58
|
+
- spec/spec_helper.rb
|
59
|
+
- spec/unit/gemfile_interpreter_spec.rb
|
53
60
|
homepage: https://github.com/ThunderKey/gemfile_interpreter
|
54
61
|
licenses:
|
55
62
|
- MIT
|
@@ -74,4 +81,11 @@ rubygems_version: 2.6.8
|
|
74
81
|
signing_key:
|
75
82
|
specification_version: 4
|
76
83
|
summary: Gemfile Interpreter
|
77
|
-
test_files:
|
84
|
+
test_files:
|
85
|
+
- spec/assets/Gemfile
|
86
|
+
- spec/assets/Gemfile.lock
|
87
|
+
- spec/assets/GemfileWithoutLock
|
88
|
+
- spec/assets/ValidGemfile
|
89
|
+
- spec/assets/ValidGemfile.own_lock
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/unit/gemfile_interpreter_spec.rb
|