bunup 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +17 -6
- data/.travis.yml +0 -1
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/bunup.gemspec +8 -7
- data/exe/bunup +2 -1
- data/lib/bunup/bundler.rb +8 -4
- data/lib/bunup/cli.rb +11 -9
- data/lib/bunup/gem.rb +4 -2
- data/lib/bunup/options.rb +7 -1
- data/lib/bunup/services/commiter.rb +6 -4
- data/lib/bunup/services/updater.rb +2 -0
- data/lib/bunup/services/validate_git_version.rb +3 -1
- data/lib/bunup/values/version.rb +2 -0
- data/lib/bunup/version.rb +3 -1
- data/lib/bunup.rb +6 -2
- metadata +20 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63cc322ef7121438476bec3a6fa52b19d5c0b29c0a725ee78245a02c3ab46719
|
4
|
+
data.tar.gz: 4d5c02920b1e0dd16e1737bfd0ef035b4127f2326d90033a6da560d2b79b69e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d14817dc2eee80a359a45befc1d3e87acd7ca916780ce5ea056c586fb167c1f585fc09f44e2fe48076479efd31bc972dbd7c8dbffcff6c8c5404799075db971
|
7
|
+
data.tar.gz: 7d6ed6b5edc46141d631384da30c45b3651743fe8ef09a8b8ae94c130c54a7cbd55bae8f23b1673cac84f6fe21bc003fb76b3f8a947d7d99a3c0f1f5ad02ff71
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
|
1
4
|
Gemspec/RequiredRubyVersion:
|
2
5
|
Enabled: false
|
3
6
|
|
4
|
-
Layout/
|
7
|
+
Layout/ParameterAlignment:
|
5
8
|
EnforcedStyle: with_fixed_indentation
|
6
9
|
|
7
10
|
Layout/CaseIndentation:
|
@@ -23,7 +26,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
23
26
|
Layout/EmptyLinesAroundArguments:
|
24
27
|
Enabled: false
|
25
28
|
|
26
|
-
Layout/
|
29
|
+
Layout/HeredocIndentation:
|
27
30
|
Enabled: false
|
28
31
|
|
29
32
|
Layout/MultilineMethodCallIndentation:
|
@@ -55,10 +58,6 @@ Metrics/ClassLength:
|
|
55
58
|
Metrics/ModuleLength:
|
56
59
|
Enabled: false
|
57
60
|
|
58
|
-
# Status codes or symbols are fine
|
59
|
-
Rails/HttpStatus:
|
60
|
-
Enabled: false
|
61
|
-
|
62
61
|
# Too subtle to lint. Recommend semantic style, but avoid `end.x`.
|
63
62
|
Style/BlockDelimiters:
|
64
63
|
Enabled: false
|
@@ -72,6 +71,18 @@ Style/FormatStringToken:
|
|
72
71
|
Style/GuardClause:
|
73
72
|
Enabled: false
|
74
73
|
|
74
|
+
# New cop opt-in
|
75
|
+
Style/HashEachMethods:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
# New cop opt-in
|
79
|
+
Style/HashTransformKeys:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
# New cop opt-in
|
83
|
+
Style/HashTransformValues:
|
84
|
+
Enabled: true
|
85
|
+
|
75
86
|
# Too subtle to lint. Avoid the "modifier" (postfix) style except on extremely
|
76
87
|
# short and simple lines.
|
77
88
|
Style/IfUnlessModifier:
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/bunup.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'bunup/version'
|
@@ -22,12 +24,11 @@ Gem::Specification.new do |spec|
|
|
22
24
|
spec.bindir = 'exe'
|
23
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
26
|
spec.require_paths = ['lib']
|
25
|
-
spec.required_ruby_version = '>= 2.
|
27
|
+
spec.required_ruby_version = '>= 2.7'
|
26
28
|
|
27
|
-
spec.add_development_dependency 'bundler', '>=
|
28
|
-
spec.add_development_dependency '
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
32
|
-
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
29
|
+
spec.add_development_dependency 'bundler', '>= 2.4.0' # CVE-2019-3881
|
30
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
32
|
+
spec.add_development_dependency 'rubocop', '>= 1.50'
|
33
|
+
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
33
34
|
end
|
data/exe/bunup
CHANGED
data/lib/bunup/bundler.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'open3'
|
2
4
|
|
3
5
|
module Bunup
|
@@ -11,15 +13,17 @@ module Bunup
|
|
11
13
|
(?<name>.*)\s
|
12
14
|
\(newest\s(?<newest>.*),\s
|
13
15
|
installed\s(?<installed>.*?)
|
14
|
-
(
|
16
|
+
(?:,\srequested.*)?
|
15
17
|
\)
|
16
18
|
/x.freeze
|
17
19
|
|
18
20
|
# Expected output format:
|
19
21
|
# "\ngem-name (newest 1.0.0, installed 2.0.0)\n"
|
20
|
-
def self.outdated(gem_names)
|
22
|
+
def self.outdated(gem_names, only_explicit: false)
|
23
|
+
args = %w[--parseable --strict]
|
24
|
+
args << '--only-explicit' if only_explicit
|
21
25
|
stdout, stderr, status = Open3.capture3(
|
22
|
-
"bundler outdated #{gem_names.join(' ')}
|
26
|
+
"bundler outdated #{gem_names.join(' ')} #{args.join(' ')}"
|
23
27
|
)
|
24
28
|
validate_output(stdout, stderr, status)
|
25
29
|
stdout.strip
|
@@ -35,7 +39,7 @@ module Bunup
|
|
35
39
|
unless status.to_i == 256
|
36
40
|
raise ::SystemExit.new(
|
37
41
|
status.to_i,
|
38
|
-
(stderr == '' ? stdout : stderr).chomp
|
42
|
+
"#{(stderr == '' ? stdout : stderr).chomp}\n"
|
39
43
|
)
|
40
44
|
end
|
41
45
|
end
|
data/lib/bunup/cli.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bunup
|
2
4
|
# Parse args, run services, handle output, and handle exits
|
3
5
|
class CLI
|
4
|
-
COMMITING_MSG = 'Commiting Gemfile and Gemfile.lock changes'
|
6
|
+
COMMITING_MSG = 'Commiting Gemfile and Gemfile.lock changes'
|
5
7
|
E_DIRTY_GEMFILE = 'Gemfile and/or Gemfile.lock has changes that would ' \
|
6
8
|
'be overwritten. Please stash or commit your changes before running ' \
|
7
|
-
'bunup.'
|
9
|
+
'bunup.'
|
8
10
|
GIT_REF_UPDATE_WARNING = 'WARNING: %<gem_name>s is installed from a git ' \
|
9
11
|
'repo and is being updated from %<installed_version>s to ' \
|
10
12
|
'%<newest_version>s. This update could include breaking changes. ' \
|
11
|
-
'Continue? [y/N] '
|
13
|
+
'Continue? [y/N] '
|
12
14
|
MAJOR_VERSION_UPDATE_WARNING_FMT = 'WARNING: %<gem_name>s is being ' \
|
13
15
|
'updated from %<installed_version>s to %<newest_version>s. This is ' \
|
14
16
|
'a major version update with possible breaking changes. ' \
|
15
|
-
'Continue? [y/N] '
|
17
|
+
'Continue? [y/N] '
|
16
18
|
UPDATING_MSG_FMT = '(%<remaining>s) Updating %<gem_name>s ' \
|
17
|
-
'%<installed_version>s -> %<newest_version>s'
|
19
|
+
'%<installed_version>s -> %<newest_version>s'
|
18
20
|
|
19
21
|
def initialize(args)
|
20
22
|
@options = ::Bunup::Options.parse!(args)
|
@@ -50,7 +52,7 @@ module Bunup
|
|
50
52
|
|
51
53
|
def bundle_outdated
|
52
54
|
puts 'Checking for updates'
|
53
|
-
Bundler.outdated(bunup_all? ? [] : @args)
|
55
|
+
Bundler.outdated(bunup_all? ? [] : @args, only_explicit: @options[:only_explicit])
|
54
56
|
rescue ::SystemExit => e
|
55
57
|
handle_system_exit(e)
|
56
58
|
''
|
@@ -73,7 +75,7 @@ module Bunup
|
|
73
75
|
msg = []
|
74
76
|
msg << 'ERROR:' unless exception.success?
|
75
77
|
msg << exception.message
|
76
|
-
puts msg.join(' ')
|
78
|
+
puts "#{msg.join(' ')}\n"
|
77
79
|
raise exception unless bunup_many?
|
78
80
|
end
|
79
81
|
|
@@ -96,7 +98,7 @@ module Bunup
|
|
96
98
|
if @options[:assume_yes_for_git_update]
|
97
99
|
print "assuming yes\n"
|
98
100
|
else
|
99
|
-
unless
|
101
|
+
unless $stdin.gets.chomp.casecmp('y').zero?
|
100
102
|
raise ::SystemExit.new(true, 'No update performed')
|
101
103
|
end
|
102
104
|
end
|
@@ -115,7 +117,7 @@ module Bunup
|
|
115
117
|
if @options[:assume_yes_for_major_version_update]
|
116
118
|
print "assuming yes\n"
|
117
119
|
else
|
118
|
-
unless
|
120
|
+
unless $stdin.gets.chomp.casecmp('y').zero?
|
119
121
|
raise ::SystemExit.new(true, 'No update performed')
|
120
122
|
end
|
121
123
|
end
|
data/lib/bunup/gem.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ostruct'
|
2
4
|
|
3
5
|
module Bunup
|
@@ -5,9 +7,9 @@ module Bunup
|
|
5
7
|
class Gem
|
6
8
|
# Gem name patterns taken from
|
7
9
|
# https://github.com/rubygems/rubygems.org/blob/master/lib/patterns.rb
|
8
|
-
SPECIAL_CHARACTERS = '.-_'
|
10
|
+
SPECIAL_CHARACTERS = '.-_'
|
9
11
|
ALLOWED_CHARACTERS = '[A-Za-z0-9' \
|
10
|
-
"#{Regexp.escape(SPECIAL_CHARACTERS)}]+"
|
12
|
+
"#{Regexp.escape(SPECIAL_CHARACTERS)}]+"
|
11
13
|
NAME_PATTERN = /\A#{ALLOWED_CHARACTERS}\Z/.freeze
|
12
14
|
|
13
15
|
attr_accessor :name, :installed_version, :newest_version
|
data/lib/bunup/options.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'optionparser'
|
2
4
|
require 'ostruct'
|
3
5
|
|
@@ -30,13 +32,17 @@ module Bunup
|
|
30
32
|
list.each do |version_type|
|
31
33
|
case version_type.strip
|
32
34
|
when 'major'
|
33
|
-
|
35
|
+
options[:assume_yes_for_major_version_update] = true
|
34
36
|
when 'git' then options[:assume_yes_for_git_update] = true
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
42
|
+
opts.on('--only-explicit') do
|
43
|
+
options[:only_explicit] = true
|
44
|
+
end
|
45
|
+
|
40
46
|
opts.on('-h', '--help', 'Prints this help') do
|
41
47
|
puts opts
|
42
48
|
exit
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bunup
|
2
4
|
module Services
|
3
5
|
# Commit changes to Gemfile and Gemfile.lock to git
|
4
6
|
class Commiter
|
5
7
|
COMMIT_MESSAGE_FMT = '%<gem_name>s %<newest_version>s ' \
|
6
|
-
'(was %<installed_version>s)'
|
8
|
+
'(was %<installed_version>s)'
|
7
9
|
|
8
10
|
def self.clean_gemfile?
|
9
11
|
`git status -s Gemfile Gemfile.lock` == ''
|
@@ -30,9 +32,9 @@ module Bunup
|
|
30
32
|
|
31
33
|
def message
|
32
34
|
format COMMIT_MESSAGE_FMT,
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
gem_name: @gem.name,
|
36
|
+
newest_version: @gem.newest_version,
|
37
|
+
installed_version: @gem.installed_version
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bunup
|
2
4
|
module Services
|
3
5
|
# Validate that version of gem installed from a git source is valid
|
@@ -14,7 +16,7 @@ module Bunup
|
|
14
16
|
return false if sha.nil?
|
15
17
|
|
16
18
|
::Gem::Version.correct?(version) &&
|
17
|
-
sha.match
|
19
|
+
!sha.match(SHA_REGEX).nil?
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
data/lib/bunup/values/version.rb
CHANGED
data/lib/bunup/version.rb
CHANGED
data/lib/bunup.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
Dir.glob("#{File.dirname(__FILE__)}/bunup/**/*.rb").sort.each do |file|
|
4
|
+
require file
|
5
|
+
end
|
6
|
+
|
7
|
+
# Our top-level namespace
|
4
8
|
module Bunup; end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
- Shane Cavanaugh
|
9
9
|
- Leon Miller-Out
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -18,91 +18,71 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
- - "<"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '2.1'
|
21
|
+
version: 2.4.0
|
25
22
|
type: :development
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
requirements:
|
29
26
|
- - ">="
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
32
|
-
- - "<"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '2.1'
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: byebug
|
37
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '9.0'
|
42
|
-
type: :development
|
43
|
-
prerelease: false
|
44
|
-
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '9.0'
|
28
|
+
version: 2.4.0
|
49
29
|
- !ruby/object:Gem::Dependency
|
50
30
|
name: rake
|
51
31
|
requirement: !ruby/object:Gem::Requirement
|
52
32
|
requirements:
|
53
|
-
- - "
|
33
|
+
- - ">="
|
54
34
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
35
|
+
version: 12.3.3
|
56
36
|
type: :development
|
57
37
|
prerelease: false
|
58
38
|
version_requirements: !ruby/object:Gem::Requirement
|
59
39
|
requirements:
|
60
|
-
- - "
|
40
|
+
- - ">="
|
61
41
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
42
|
+
version: 12.3.3
|
63
43
|
- !ruby/object:Gem::Dependency
|
64
44
|
name: rspec
|
65
45
|
requirement: !ruby/object:Gem::Requirement
|
66
46
|
requirements:
|
67
47
|
- - "~>"
|
68
48
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
49
|
+
version: '3.13'
|
70
50
|
type: :development
|
71
51
|
prerelease: false
|
72
52
|
version_requirements: !ruby/object:Gem::Requirement
|
73
53
|
requirements:
|
74
54
|
- - "~>"
|
75
55
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
56
|
+
version: '3.13'
|
77
57
|
- !ruby/object:Gem::Dependency
|
78
58
|
name: rubocop
|
79
59
|
requirement: !ruby/object:Gem::Requirement
|
80
60
|
requirements:
|
81
61
|
- - ">="
|
82
62
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
63
|
+
version: '1.50'
|
84
64
|
type: :development
|
85
65
|
prerelease: false
|
86
66
|
version_requirements: !ruby/object:Gem::Requirement
|
87
67
|
requirements:
|
88
68
|
- - ">="
|
89
69
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
70
|
+
version: '1.50'
|
91
71
|
- !ruby/object:Gem::Dependency
|
92
72
|
name: simplecov
|
93
73
|
requirement: !ruby/object:Gem::Requirement
|
94
74
|
requirements:
|
95
75
|
- - "~>"
|
96
76
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
77
|
+
version: 0.21.2
|
98
78
|
type: :development
|
99
79
|
prerelease: false
|
100
80
|
version_requirements: !ruby/object:Gem::Requirement
|
101
81
|
requirements:
|
102
82
|
- - "~>"
|
103
83
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.
|
105
|
-
description:
|
84
|
+
version: 0.21.2
|
85
|
+
description:
|
106
86
|
email:
|
107
87
|
- jared@jaredbeck.com
|
108
88
|
- shane@shanecav.net
|
@@ -139,7 +119,7 @@ homepage: https://github.com/singlebrook/bunup
|
|
139
119
|
licenses:
|
140
120
|
- MIT
|
141
121
|
metadata: {}
|
142
|
-
post_install_message:
|
122
|
+
post_install_message:
|
143
123
|
rdoc_options: []
|
144
124
|
require_paths:
|
145
125
|
- lib
|
@@ -147,15 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
127
|
requirements:
|
148
128
|
- - ">="
|
149
129
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
130
|
+
version: '2.7'
|
151
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
132
|
requirements:
|
153
133
|
- - ">="
|
154
134
|
- !ruby/object:Gem::Version
|
155
135
|
version: '0'
|
156
136
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
137
|
+
rubygems_version: 3.1.6
|
138
|
+
signing_key:
|
159
139
|
specification_version: 4
|
160
140
|
summary: Bundle update and commit to git with one command
|
161
141
|
test_files: []
|