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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 328c063e3081afbff01115411e74caa3211e8a29
4
- data.tar.gz: adca5bb74103d747276fdf1b0a4125992b92b83f
3
+ metadata.gz: 4de5012f76a9beb59465ad858c91f2524b288205
4
+ data.tar.gz: 0438035f46d094646ee1985d6f1212aeb6e2aa2d
5
5
  SHA512:
6
- metadata.gz: b0de9cc4828b61f5a1e80a49e9e43679018effb35a5d792dd4b6a59f505ad368008549a5a5225c091c0d98ce9244526eb79be8a8e3bc263132294e1e4f3e99a8
7
- data.tar.gz: 03d183d243225dc0534ab62eb125776f411a1af423fc4c493520fe294fe64daedf789daa3e67cedf06fe492a1cbfe6663c32f8ad96d0ec8696699ba109629a61
6
+ metadata.gz: 0e3d2cb21736d93693e575831dbff354b869f237e75c1dac870144f478d8934fbde92ea12c7ddc5fa8dd8dbb343384a9ca76e5f1936ab1b76c78a22ef599c78b
7
+ data.tar.gz: bcce9fc82f7222964dd106bb920b38451893b3e632b262e36806f0ddefc279b2db399dc50ff186260e4ed29473f030347d026d3dfcd7d7addf0a6a37e64283d3
@@ -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
- def create_lockfile(gem_dependencies:, source_specs: [], ensure_sources: true)
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
- defn = Bundler::Definition.new(lockfile_filename, Array(gem_dependencies), @sources, {})
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
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Fixture
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  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.1.0
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-13 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler