incr 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +1 -1
- data/.tool-versions +1 -1
- data/Gemfile.lock +42 -36
- data/bin/incr +9 -0
- data/incr.gemspec +6 -6
- data/lib/incr/command/laravel.rb +58 -0
- data/lib/incr/version.rb +1 -1
- data/lib/incr.rb +1 -0
- data/spec/fixtures/laravel/app.php +6 -0
- data/spec/incr/command/laravel_spec.rb +76 -0
- metadata +18 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f794ed99e6baff884b2fdd079ae1334033be211256cd9503454be27370d9833
|
4
|
+
data.tar.gz: f1e68068b5466c44aad7203846cb25c009101282565debe53129e684a8c2dd22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb104c81ddd8ec4894a510bc848972cd96bb6e58ab4e533a61adec1de7dfa2c8dd86dc3d6a3ba89601c36a9ef994391223612040b72e7825691fd2b2c0269dd
|
7
|
+
data.tar.gz: ca773d11bc8758a98ead0cb9f43278f2c6923992c7ba9c33920aa68aa9bdbef1b473bc8e153a5592bb0d149215875747c6da8c3c9f0be8827179798e0e3713a1
|
data/.github/workflows/ci.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 3.2.2
|
data/Gemfile.lock
CHANGED
@@ -2,61 +2,67 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
incr (1.0.0)
|
5
|
-
git (= 1.
|
6
|
-
gli (= 2.21.
|
5
|
+
git (= 1.19.1)
|
6
|
+
gli (= 2.21.1)
|
7
7
|
sem_version (= 2.0.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.8.
|
12
|
+
addressable (2.8.6)
|
13
13
|
public_suffix (>= 2.0.2, < 6.0)
|
14
14
|
ast (2.4.2)
|
15
|
-
diff-lcs (1.5.
|
16
|
-
git (1.
|
15
|
+
diff-lcs (1.5.1)
|
16
|
+
git (1.19.1)
|
17
17
|
addressable (~> 2.8)
|
18
18
|
rchardet (~> 1.8)
|
19
|
-
gli (2.21.
|
20
|
-
json (2.
|
19
|
+
gli (2.21.1)
|
20
|
+
json (2.7.2)
|
21
|
+
language_server-protocol (3.17.0.3)
|
21
22
|
meowcop (3.2.0)
|
22
23
|
rubocop (>= 1.13.0, < 2.0.0)
|
23
|
-
parallel (1.
|
24
|
-
parser (3.1.
|
24
|
+
parallel (1.24.0)
|
25
|
+
parser (3.3.1.0)
|
25
26
|
ast (~> 2.4.1)
|
26
|
-
|
27
|
+
racc
|
28
|
+
public_suffix (5.0.5)
|
29
|
+
racc (1.8.0)
|
27
30
|
rainbow (3.1.1)
|
28
|
-
rake (13.
|
31
|
+
rake (13.2.1)
|
29
32
|
rchardet (1.8.0)
|
30
|
-
regexp_parser (2.
|
31
|
-
rexml (3.2.
|
32
|
-
|
33
|
-
|
34
|
-
rspec-
|
35
|
-
rspec-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
regexp_parser (2.9.2)
|
34
|
+
rexml (3.2.8)
|
35
|
+
strscan (>= 3.0.9)
|
36
|
+
rspec (3.13.0)
|
37
|
+
rspec-core (~> 3.13.0)
|
38
|
+
rspec-expectations (~> 3.13.0)
|
39
|
+
rspec-mocks (~> 3.13.0)
|
40
|
+
rspec-core (3.13.0)
|
41
|
+
rspec-support (~> 3.13.0)
|
42
|
+
rspec-expectations (3.13.0)
|
39
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
44
|
+
rspec-support (~> 3.13.0)
|
45
|
+
rspec-mocks (3.13.1)
|
42
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
rubocop (1.
|
47
|
+
rspec-support (~> 3.13.0)
|
48
|
+
rspec-support (3.13.1)
|
49
|
+
rubocop (1.63.5)
|
46
50
|
json (~> 2.3)
|
51
|
+
language_server-protocol (>= 3.17.0)
|
47
52
|
parallel (~> 1.10)
|
48
|
-
parser (>= 3.
|
53
|
+
parser (>= 3.3.0.2)
|
49
54
|
rainbow (>= 2.2.2, < 4.0)
|
50
55
|
regexp_parser (>= 1.8, < 3.0)
|
51
56
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
57
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
53
58
|
ruby-progressbar (~> 1.7)
|
54
|
-
unicode-display_width (>=
|
55
|
-
rubocop-ast (1.
|
56
|
-
parser (>= 3.
|
57
|
-
ruby-progressbar (1.
|
59
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
60
|
+
rubocop-ast (1.31.3)
|
61
|
+
parser (>= 3.3.1.0)
|
62
|
+
ruby-progressbar (1.13.0)
|
58
63
|
sem_version (2.0.1)
|
59
|
-
|
64
|
+
strscan (3.1.0)
|
65
|
+
unicode-display_width (2.5.0)
|
60
66
|
|
61
67
|
PLATFORMS
|
62
68
|
ruby
|
@@ -64,9 +70,9 @@ PLATFORMS
|
|
64
70
|
DEPENDENCIES
|
65
71
|
incr!
|
66
72
|
meowcop (= 3.2.0)
|
67
|
-
rake (= 13.
|
68
|
-
rspec (= 3.
|
69
|
-
rubocop (= 1.
|
73
|
+
rake (= 13.2.1)
|
74
|
+
rspec (= 3.13.0)
|
75
|
+
rubocop (= 1.63.5)
|
70
76
|
|
71
77
|
BUNDLED WITH
|
72
|
-
2.
|
78
|
+
2.4.21
|
data/bin/incr
CHANGED
@@ -42,4 +42,13 @@ command :mix do |cmd|
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
# Laravel Support
|
46
|
+
desc('Increment the version of your config/app.php.')
|
47
|
+
command :laravel do |cmd|
|
48
|
+
cmd.action do |global_options, options, args|
|
49
|
+
mix = Incr::Command::Laravel.new(args, global_options)
|
50
|
+
mix.execute
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
45
54
|
exit(run(ARGV))
|
data/incr.gemspec
CHANGED
@@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables << 'incr'
|
19
19
|
spec.require_paths << 'lib'
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>= 2
|
21
|
+
spec.required_ruby_version = '>= 3.2'
|
22
22
|
|
23
|
-
spec.add_runtime_dependency('gli', '2.21.
|
23
|
+
spec.add_runtime_dependency('gli', '2.21.1')
|
24
24
|
spec.add_runtime_dependency('sem_version', '2.0.1')
|
25
|
-
spec.add_runtime_dependency('git', '1.
|
25
|
+
spec.add_runtime_dependency('git', '1.19.1')
|
26
26
|
|
27
|
-
spec.add_development_dependency('rake', '13.
|
28
|
-
spec.add_development_dependency('rspec', '3.
|
29
|
-
spec.add_development_dependency('rubocop', '1.
|
27
|
+
spec.add_development_dependency('rake', '13.2.1')
|
28
|
+
spec.add_development_dependency('rspec', '3.13.0')
|
29
|
+
spec.add_development_dependency('rubocop', '1.63.5')
|
30
30
|
spec.add_development_dependency('meowcop', '3.2.0')
|
31
31
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Incr
|
2
|
+
module Command
|
3
|
+
class Laravel
|
4
|
+
VERSION_REGEX = /'version' => '(\d*.\d*.\d*)'/
|
5
|
+
VERSION_REPLACEMENT_PATTERNS = [
|
6
|
+
"'version' => '%s",
|
7
|
+
]
|
8
|
+
|
9
|
+
def initialize(args, global_options)
|
10
|
+
@segment = args[0]
|
11
|
+
@config_file_filename = File.join('.', global_options[:version_file_dir], 'config', 'app.php')
|
12
|
+
@tag_pattern = global_options[:tag_name_pattern]
|
13
|
+
@commit = global_options[:commit]
|
14
|
+
@tag = global_options[:tag]
|
15
|
+
@noop = global_options[:noop]
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
if !File.exist?(@config_file_filename)
|
20
|
+
warn("'#{@config_file_filename}': file not found.")
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
file_content = IO.read(@config_file_filename)
|
25
|
+
if file_content == nil
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
29
|
+
file_version = file_content.match(VERSION_REGEX)[1]
|
30
|
+
old_version = SemVersion.new(file_version)
|
31
|
+
new_version = Incr::Service::Version.increment_segment(old_version, @segment)
|
32
|
+
replace_file_version(old_version, new_version)
|
33
|
+
|
34
|
+
new_tag = @tag_pattern % new_version.to_s
|
35
|
+
|
36
|
+
puts new_tag
|
37
|
+
|
38
|
+
if not @noop
|
39
|
+
repository = Incr::Service::Repository.new('.')
|
40
|
+
repository.add(@config_file_filename)
|
41
|
+
repository.commit(new_tag) if @commit
|
42
|
+
repository.tag(new_tag) if @tag
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def replace_file_version(old_version, new_version)
|
49
|
+
VERSION_REPLACEMENT_PATTERNS.each do |pattern|
|
50
|
+
old_version_pattern = format(pattern, old_version.to_s)
|
51
|
+
new_version_pattern = format(pattern, new_version.to_s)
|
52
|
+
|
53
|
+
Incr::Service::FileHelper.replace(@config_file_filename, old_version_pattern, new_version_pattern)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/incr/version.rb
CHANGED
data/lib/incr.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Incr::Command::Laravel do
|
4
|
+
let(:args) do
|
5
|
+
['major']
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#execute' do
|
9
|
+
context 'with version specified in config/app.php' do
|
10
|
+
before(:each) do
|
11
|
+
@tmpdir = Dir.mktmpdir('incr', '.')
|
12
|
+
Dir.mkdir(File.join(@tmpdir, "config"))
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:global_options) do
|
16
|
+
{
|
17
|
+
commit: false,
|
18
|
+
tag: false,
|
19
|
+
noop: true,
|
20
|
+
version_file_dir: @tmpdir,
|
21
|
+
tag_name_pattern: 'v%s'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:app_config_filename) { "#{File.dirname(__FILE__)}/../../fixtures/laravel/app.php" }
|
26
|
+
|
27
|
+
it 'should increase the version number' do
|
28
|
+
copy_files(File.join(@tmpdir, "config"), app_config_filename)
|
29
|
+
|
30
|
+
expected = %(<?php
|
31
|
+
|
32
|
+
return [
|
33
|
+
'name' => env('APP_NAME', 'Laravel'),
|
34
|
+
'version' => '2.0.0',
|
35
|
+
]
|
36
|
+
)
|
37
|
+
|
38
|
+
command = Incr::Command::Laravel.new(args, global_options)
|
39
|
+
expect{ command.execute() }.to output("v2.0.0\n").to_stdout
|
40
|
+
|
41
|
+
result = read_file(File.join(@tmpdir, 'config', 'app.php'))
|
42
|
+
expect(result).to eql(expected)
|
43
|
+
end
|
44
|
+
|
45
|
+
after(:each) do
|
46
|
+
FileUtils.remove_entry_secure(@tmpdir)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'without expected files' do
|
51
|
+
before(:each) do
|
52
|
+
@tmpdir = Dir.mktmpdir('incr', '.')
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:global_options) do
|
56
|
+
{
|
57
|
+
commit: false,
|
58
|
+
tag: false,
|
59
|
+
noop: true,
|
60
|
+
version_file_dir: @tmpdir,
|
61
|
+
tag_name_pattern: 'v%s'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should return an error' do
|
66
|
+
command = Incr::Command::Laravel.new(args, global_options)
|
67
|
+
expected = "'#{File.join('.', @tmpdir, 'config', 'app.php')}': file not found.\n"
|
68
|
+
expect { command.execute() }.to output(expected).to_stderr
|
69
|
+
end
|
70
|
+
|
71
|
+
after(:each) do
|
72
|
+
FileUtils.remove_entry_secure(@tmpdir)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: incr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Philippe Couture
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.21.
|
19
|
+
version: 2.21.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.21.
|
26
|
+
version: 2.21.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sem_version
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,56 +44,56 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.19.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.19.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 13.
|
61
|
+
version: 13.2.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 13.
|
68
|
+
version: 13.2.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.
|
75
|
+
version: 3.13.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.
|
82
|
+
version: 3.13.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.63.5
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.63.5
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: meowcop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,7 @@ executables:
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- ".github/dependabot.yml"
|
119
120
|
- ".github/workflows/ci.yml"
|
120
121
|
- ".github/workflows/gem-push.yml"
|
121
122
|
- ".gitignore"
|
@@ -131,17 +132,20 @@ files:
|
|
131
132
|
- bin/incr
|
132
133
|
- incr.gemspec
|
133
134
|
- lib/incr.rb
|
135
|
+
- lib/incr/command/laravel.rb
|
134
136
|
- lib/incr/command/mix.rb
|
135
137
|
- lib/incr/command/npm.rb
|
136
138
|
- lib/incr/service/file_helper.rb
|
137
139
|
- lib/incr/service/repository.rb
|
138
140
|
- lib/incr/service/version.rb
|
139
141
|
- lib/incr/version.rb
|
142
|
+
- spec/fixtures/laravel/app.php
|
140
143
|
- spec/fixtures/mix/mix.exs
|
141
144
|
- spec/fixtures/npmv6/package-lock.json
|
142
145
|
- spec/fixtures/npmv6/package.json
|
143
146
|
- spec/fixtures/npmv7/package-lock.json
|
144
147
|
- spec/fixtures/npmv7/package.json
|
148
|
+
- spec/incr/command/laravel_spec.rb
|
145
149
|
- spec/incr/command/mix_spec.rb
|
146
150
|
- spec/incr/command/npm_spec.rb
|
147
151
|
- spec/incr/service/file_helper_spec.rb
|
@@ -160,14 +164,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
164
|
requirements:
|
161
165
|
- - ">="
|
162
166
|
- !ruby/object:Gem::Version
|
163
|
-
version: '2
|
167
|
+
version: '3.2'
|
164
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
169
|
requirements:
|
166
170
|
- - ">="
|
167
171
|
- !ruby/object:Gem::Version
|
168
172
|
version: '0'
|
169
173
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
174
|
+
rubygems_version: 3.4.10
|
171
175
|
signing_key:
|
172
176
|
specification_version: 4
|
173
177
|
summary: Tasteful utility to increment the version number and create a corresponding
|