bundleup 0.9.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,60 +0,0 @@
1
- module Bundleup
2
- class Upgrade
3
- def initialize(update_args=[], commands=BundleCommands.new)
4
- @update_args = update_args
5
- @commands = commands
6
- @gem_statuses = {}
7
- @original_lockfile_contents = IO.read(lockfile)
8
- run
9
- end
10
-
11
- def upgrades
12
- @gem_statuses.values.select(&:upgraded?).sort_by(&:name)
13
- end
14
-
15
- def pins
16
- @gem_statuses.values.select(&:pinned?).sort_by(&:name)
17
- end
18
-
19
- def lockfile_changed?
20
- IO.read(lockfile) != original_lockfile_contents
21
- end
22
-
23
- def undo
24
- IO.write(lockfile, original_lockfile_contents)
25
- end
26
-
27
- private
28
-
29
- attr_reader :update_args, :commands, :original_lockfile_contents
30
-
31
- def run
32
- find_versions(:old)
33
- commands.update(update_args)
34
- find_versions(:new)
35
- find_pinned_versions
36
- end
37
-
38
- def lockfile
39
- "Gemfile.lock"
40
- end
41
-
42
- def find_pinned_versions
43
- expr = /\* (\S+) \(newest (\S+),.* requested (.*)\)/
44
- commands.outdated.scan(expr) do |name, newest, pin|
45
- gem_status(name).newest_version = newest
46
- gem_status(name).pin = pin
47
- end
48
- end
49
-
50
- def find_versions(type)
51
- commands.list.scan(/\* (\S+) \((\S+)(?: (\S+))?\)/) do |name, ver, sha|
52
- gem_status(name).public_send("#{type}_version=", sha || ver)
53
- end
54
- end
55
-
56
- def gem_status(name)
57
- @gem_statuses[name] ||= GemStatus.new(name)
58
- end
59
- end
60
- end
data/sample.png DELETED
Binary file