bundleup 1.0.0 → 2.1.0
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 +4 -4
- data/README.md +36 -6
- data/exe/bundleup +7 -1
- data/lib/bundleup.rb +20 -5
- data/lib/bundleup/backup.rb +29 -0
- data/lib/bundleup/cli.rb +123 -61
- data/lib/bundleup/colors.rb +56 -0
- data/lib/bundleup/commands.rb +40 -0
- data/lib/bundleup/gemfile.rb +48 -2
- data/lib/bundleup/logger.rb +64 -0
- data/lib/bundleup/pin_report.rb +37 -0
- data/lib/bundleup/report.rb +38 -0
- data/lib/bundleup/shell.rb +35 -0
- data/lib/bundleup/update_report.rb +63 -0
- data/lib/bundleup/version.rb +1 -1
- data/lib/bundleup/version_spec.rb +54 -0
- metadata +22 -125
- data/.github/release-drafter.yml +0 -17
- data/.github/workflows/push.yml +0 -12
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -57
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -1
- data/CODE_OF_CONDUCT.md +0 -49
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -4
- data/Rakefile +0 -93
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bundleup.gemspec +0 -40
- data/lib/bundleup/bundle_commands.rb +0 -31
- data/lib/bundleup/console.rb +0 -99
- data/lib/bundleup/gem_status.rb +0 -59
- data/lib/bundleup/upgrade.rb +0 -60
- data/sample.png +0 -0
data/lib/bundleup/gem_status.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# rubocop:disable Metrics/BlockLength
|
2
|
-
module Bundleup
|
3
|
-
GemStatus = Struct.new(:name,
|
4
|
-
:old_version,
|
5
|
-
:new_version,
|
6
|
-
:newest_version,
|
7
|
-
:pin) do
|
8
|
-
def pinned?
|
9
|
-
!pin.nil?
|
10
|
-
end
|
11
|
-
|
12
|
-
def upgraded?
|
13
|
-
new_version != old_version
|
14
|
-
end
|
15
|
-
|
16
|
-
def added?
|
17
|
-
old_version.nil?
|
18
|
-
end
|
19
|
-
|
20
|
-
def removed?
|
21
|
-
new_version.nil?
|
22
|
-
end
|
23
|
-
|
24
|
-
def color
|
25
|
-
if major_upgrade? || removed?
|
26
|
-
:red
|
27
|
-
elsif minor_upgrade?
|
28
|
-
:yellow
|
29
|
-
elsif added?
|
30
|
-
:blue
|
31
|
-
else
|
32
|
-
:plain
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def major_upgrade?
|
37
|
-
return false if new_version.nil? || old_version.nil?
|
38
|
-
|
39
|
-
major(new_version) != major(old_version)
|
40
|
-
end
|
41
|
-
|
42
|
-
def minor_upgrade?
|
43
|
-
return false if new_version.nil? || old_version.nil?
|
44
|
-
|
45
|
-
!major_upgrade? && minor(new_version) != minor(old_version)
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def major(version)
|
51
|
-
version.split(".", 2)[0]
|
52
|
-
end
|
53
|
-
|
54
|
-
def minor(version)
|
55
|
-
version.split(".", 3)[1]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
# rubocop:enable Metrics/BlockLength
|
data/lib/bundleup/upgrade.rb
DELETED
@@ -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
|