bumpit 0.1.1 → 0.2.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/lib/bumpit/managers/bundler.rb +39 -9
- data/lib/bumpit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be1c0bb76df08a59b1b9fc2eadb1e46428fd4ab44f854a6102f1ca15bf7de133
|
|
4
|
+
data.tar.gz: 28144e9b887d3530b536bc3cd0cbd858cf0b43e9e5d03faba072c1d76541daf5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f185cfd65f511b3bff01fab6dcec7a84ffdac77fcf384d7baaac9e7728f19ae1272c8904be23a67e7bc6e1e27bef701a9cf73437fea440588a16f7b21b4a142
|
|
7
|
+
data.tar.gz: 8e01b90aabef132c4fb192da53191cf3f08a050619e3a0d877b62c1c8ac6152ccf2090b46a26c7714137b400772665175d8aaea87df854d0ce46f94838822b91
|
|
@@ -6,10 +6,14 @@ require "pathname"
|
|
|
6
6
|
class Bumpit
|
|
7
7
|
module Managers
|
|
8
8
|
class Bundler < Base
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
BUNDLE_VERSION_COMMAND = "bundle info bundler --version"
|
|
10
|
+
BUNDLER_UPDATE_COMMAND = "bundle update --bundler"
|
|
11
|
+
DEPENDENCY_MATCHER = /^\s*gem\s+['"]([^'"]+)['"].*$/
|
|
12
|
+
FILENAMES = %w(Gemfile Gemfile.lock).freeze
|
|
13
|
+
GEM_INFO_COMMAND = "gem info --exact --remote --no-prerelease --no-verbose bundler"
|
|
14
|
+
INFO_MATCHER = /bundler \(([^)]+)\)/
|
|
15
|
+
OUTDATED_COMMAND = "bundle outdated --only-explicit --parseable 2>/dev/null"
|
|
16
|
+
OUTDATED_MATCHER = /\A(.+) \(newest (.+), installed (.+), requested = (.+)\)\z/
|
|
13
17
|
|
|
14
18
|
# Determine if the manager is valid.
|
|
15
19
|
#
|
|
@@ -25,9 +29,11 @@ class Bumpit
|
|
|
25
29
|
#
|
|
26
30
|
# @return [void]
|
|
27
31
|
def bump
|
|
32
|
+
update_bundler
|
|
33
|
+
|
|
28
34
|
if outdated.any?
|
|
29
35
|
write_contents
|
|
30
|
-
|
|
36
|
+
bundle_update
|
|
31
37
|
end
|
|
32
38
|
end
|
|
33
39
|
|
|
@@ -35,8 +41,11 @@ class Bumpit
|
|
|
35
41
|
#
|
|
36
42
|
# @return [String]
|
|
37
43
|
def message
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
dependencies = outdated.keys
|
|
45
|
+
dependencies << "bundler" if update_bundler?
|
|
46
|
+
|
|
47
|
+
if dependencies.any?
|
|
48
|
+
"Updates #{to_sentence(dependencies.sort)} in Ruby."
|
|
40
49
|
end
|
|
41
50
|
end
|
|
42
51
|
|
|
@@ -45,7 +54,7 @@ class Bumpit
|
|
|
45
54
|
# Reset the existing cache and settings and run update for Bundler.
|
|
46
55
|
#
|
|
47
56
|
# @return [void]
|
|
48
|
-
def
|
|
57
|
+
def bundle_update
|
|
49
58
|
silence_output do
|
|
50
59
|
::Bundler.clear_gemspec_cache
|
|
51
60
|
::Bundler.reset!
|
|
@@ -67,7 +76,7 @@ class Bumpit
|
|
|
67
76
|
# @return [Array]
|
|
68
77
|
def modified_contents
|
|
69
78
|
contents.split("\n").map do |line|
|
|
70
|
-
_, name = line.match(
|
|
79
|
+
_, name = line.match(DEPENDENCY_MATCHER).to_a
|
|
71
80
|
dependency = outdated[name]
|
|
72
81
|
|
|
73
82
|
if dependency
|
|
@@ -91,6 +100,27 @@ class Bumpit
|
|
|
91
100
|
end
|
|
92
101
|
end
|
|
93
102
|
|
|
103
|
+
# Update Bundler in the lock file.
|
|
104
|
+
#
|
|
105
|
+
# @return [void]
|
|
106
|
+
def update_bundler
|
|
107
|
+
if update_bundler?
|
|
108
|
+
`#{BUNDLER_UPDATE_COMMAND}`
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Determine if Bundler should be updated in the lock file.
|
|
113
|
+
#
|
|
114
|
+
# @return [Boolean]
|
|
115
|
+
def update_bundler?
|
|
116
|
+
@update_bundler ||= begin
|
|
117
|
+
_, latest = INFO_MATCHER.match(`#{GEM_INFO_COMMAND}`).to_a
|
|
118
|
+
current = `#{BUNDLE_VERSION_COMMAND}`
|
|
119
|
+
|
|
120
|
+
Gem::Version.new(latest.to_s) > Gem::Version.new(current.to_s)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
94
124
|
# Write the file with the bumped dependencies.
|
|
95
125
|
#
|
|
96
126
|
# @return [void]
|
data/lib/bumpit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bumpit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tristan Dunn
|
|
@@ -57,6 +57,7 @@ licenses:
|
|
|
57
57
|
metadata:
|
|
58
58
|
bug_tracker_uri: https://github.com/tristandunn/bumpit/issues
|
|
59
59
|
changelog_uri: https://github.com/tristandunn/bumpit/blob/main/CHANGELOG.md
|
|
60
|
+
github_repo: https://github.com/tristandunn/bumpit
|
|
60
61
|
rubygems_mfa_required: 'true'
|
|
61
62
|
rdoc_options: []
|
|
62
63
|
require_paths:
|
|
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
73
|
- !ruby/object:Gem::Version
|
|
73
74
|
version: '0'
|
|
74
75
|
requirements: []
|
|
75
|
-
rubygems_version: 3.6.
|
|
76
|
+
rubygems_version: 3.6.9
|
|
76
77
|
specification_version: 4
|
|
77
78
|
summary: Automatically bump dependencies in multiple package managers.
|
|
78
79
|
test_files: []
|