bundler-fixture 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bundler/fixture.rb +19 -3
- data/lib/bundler/fixture/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4de5012f76a9beb59465ad858c91f2524b288205
|
4
|
+
data.tar.gz: 0438035f46d094646ee1985d6f1212aeb6e2aa2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e3d2cb21736d93693e575831dbff354b869f237e75c1dac870144f478d8934fbde92ea12c7ddc5fa8dd8dbb343384a9ca76e5f1936ab1b76c78a22ef599c78b
|
7
|
+
data.tar.gz: bcce9fc82f7222964dd106bb920b38451893b3e632b262e36806f0ddefc279b2db399dc50ff186260e4ed29473f030347d026d3dfcd7d7addf0a6a37e64283d3
|
data/lib/bundler/fixture.rb
CHANGED
@@ -19,17 +19,25 @@ class BundlerFixture
|
|
19
19
|
# @param [Gem::Specification] source_specs This simulates gems in the source index.
|
20
20
|
# @param [boolean] ensure_sources Default is true, makes sure a source exists for each gem_dependency.
|
21
21
|
# Set this to false to require sending in sources in @param source_specs.
|
22
|
-
|
22
|
+
# @param [Array boolean] update_gems An array of gem names to update to latest, or `true` to update all.
|
23
|
+
# Default is empty Array.
|
24
|
+
def create_lockfile(gem_dependencies:,
|
25
|
+
source_specs: [],
|
26
|
+
ensure_sources: true,
|
27
|
+
update_gems: [])
|
23
28
|
index = Bundler::Index.new
|
24
29
|
Array(source_specs).each { |s| index << s }
|
25
|
-
source.instance_variable_set('@specs', index)
|
26
30
|
|
27
31
|
Array(gem_dependencies).each do |dep|
|
28
32
|
index << create_spec(dep.name, dep.requirement.requirements.first.last)
|
29
33
|
end if ensure_sources
|
30
34
|
|
31
|
-
|
35
|
+
update_hash = update_gems === true ? true : {gems: Array(update_gems)}
|
36
|
+
defn = Bundler::Definition.new(lockfile_filename, Array(gem_dependencies), @sources, update_hash)
|
32
37
|
defn.instance_variable_set('@index', index)
|
38
|
+
# reading an existing lockfile in will overwrite the hacked up sources with detected
|
39
|
+
# ones from lockfile, so this needs to go here after the constructor is called.
|
40
|
+
source.instance_variable_set('@specs', index)
|
33
41
|
defn.lock(lockfile_filename)
|
34
42
|
end
|
35
43
|
|
@@ -41,6 +49,14 @@ class BundlerFixture
|
|
41
49
|
File.read(lockfile_filename)
|
42
50
|
end
|
43
51
|
|
52
|
+
def parsed_lockfile
|
53
|
+
Bundler::LockfileParser.new(lockfile_contents)
|
54
|
+
end
|
55
|
+
|
56
|
+
def parsed_lockfile_spec(gem_name)
|
57
|
+
parsed_lockfile.specs.detect { |s| s.name == gem_name }
|
58
|
+
end
|
59
|
+
|
44
60
|
def create_dependency(name, *requirements)
|
45
61
|
Bundler::Dependency.new(name, requirements, {'source' => source})
|
46
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-fixture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrismo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|