bmp 1.1.0 → 1.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/.bmp.yml +2 -1
- data/.travis.yml +7 -0
- data/Gemfile.lock +4 -1
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +50 -12
- data/TODO.md +2 -0
- data/lib/bump/application.rb +20 -7
- data/lib/bump/domain/bump_info.rb +24 -5
- data/lib/bump/domain/bump_info_repository.rb +10 -5
- data/lib/bump/domain/file_update_rule.rb +7 -1
- data/lib/bump/logger.rb +0 -18
- data/lib/bump/version.rb +1 -1
- data/spec/bump/application_spec.rb +65 -0
- data/spec/bump/command_spec.rb +23 -0
- data/spec/bump/domain/bump_info_repository_spec.rb +31 -0
- data/spec/bump/domain/bump_info_spec.rb +43 -0
- data/spec/bump/domain/file_update_rule_factory_spec.rb +30 -0
- data/spec/bump/domain/file_update_rule_spec.rb +11 -8
- data/spec/fixture/bmp.yml +5 -0
- data/spec/fixture/dummy.txt +1 -0
- metadata +9 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2c8239d42b3a23ccafc9aa63bb1d68c0b93771c
|
|
4
|
+
data.tar.gz: 5428fb76d0951706ff3c538d12059d8931594ba9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce2e10ce24b53b7f515106ed3b3eb83f5b4332a97718e363f127d91eb20226f0ba1046724267c8f01e3c2f3c00574e146008172e174fcd33e2ddd7a8c77156f5
|
|
7
|
+
data.tar.gz: dd40f2c484593c87a248a8ecb77531f438debb64eec606cff7c5041592859f5d5ae5826949bf45290568300304ab7dd33a8a864171c450d4f2d9c77bc80f2caf
|
data/.bmp.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Bmp v1.
|
|
1
|
+
# Bmp v1.2.0
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/bmp)
|
|
4
4
|
[](https://travis-ci.org/kt3k/bmp)
|
|
@@ -19,37 +19,55 @@ This install `bmp` command
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
### `.bmp.yml`
|
|
22
|
+
### `.bmp.yml` file
|
|
23
23
|
|
|
24
|
-
put `.bmp.yml` file on the top of your repository like following:
|
|
24
|
+
First you need to put `.bmp.yml` file on the top of your repository like the following:
|
|
25
25
|
|
|
26
|
-
```
|
|
26
|
+
```yml
|
|
27
27
|
---
|
|
28
28
|
version: 0.1.6
|
|
29
|
+
commit: Bump to version v%.%.%
|
|
29
30
|
files:
|
|
30
31
|
gradle.properties: version=%.%.%
|
|
31
32
|
README.md:
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
- coveralls-gradle-plugin v%.%.%
|
|
34
|
+
- org.kt3k.gradle.plugin:coveralls-gradle-plugin:%.%.%
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
`version`
|
|
37
|
+
`version` property is the current version number of the repository.
|
|
37
38
|
|
|
38
|
-
`
|
|
39
|
+
`commit` property is the commit comment of bump commits. This field is optional. The default is `Bump to version v%.%.%`.
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
`files` are the patterns of the files which contain version numbers in them. The key is the filename and value is the pattern containing the version number. `%.%.%` in the pettern string expresses the current vesion number.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
```yml
|
|
41
45
|
gradle.properties: version=%.%.%
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
The expression above means the file `./gradle.properties` contains the
|
|
48
|
+
The expression above means the file `./gradle.properties` contains the pattern `version=0.1.6` (for now) and `%.%.%` part means the current version number (`0.1.6`) and it will be replaced in each version bumping.
|
|
49
|
+
|
|
50
|
+
You can set arrays of string to the value for a pattern. In that case, every string is considered as a separate pattern and all will be replaced with the next version in each bump
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
```yml
|
|
54
|
+
README.md:
|
|
55
|
+
- coveralls-gradle-plugin v%.%.%
|
|
56
|
+
- org.kt3k.gradle.plugin:coveralls-gradle-plugin:%.%.%
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## The commands
|
|
45
60
|
|
|
46
|
-
###
|
|
61
|
+
### Info
|
|
47
62
|
|
|
48
63
|
Show current version info:
|
|
49
64
|
```
|
|
50
65
|
bmp [-i|--info]
|
|
51
66
|
```
|
|
52
67
|
|
|
68
|
+
This shows errors if exist. You can check the contents of `.bmp.yml` with this command.
|
|
69
|
+
|
|
70
|
+
### Bump
|
|
53
71
|
|
|
54
72
|
bump patch (0.0.1) level:
|
|
55
73
|
```
|
|
@@ -71,10 +89,30 @@ bmp -j|--major
|
|
|
71
89
|
```
|
|
72
90
|
|
|
73
91
|
|
|
74
|
-
|
|
92
|
+
Add `preid`:
|
|
93
|
+
```
|
|
94
|
+
bmp --preid beta.1 # This performs 1.2.3 => 1.2.3-beta.1
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Remove `preid` (which means you `release` it):
|
|
98
|
+
```
|
|
99
|
+
bmp --release
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Commit (and tag)
|
|
103
|
+
|
|
104
|
+
Commit bump results (and tag it):
|
|
75
105
|
```
|
|
76
106
|
bmp -c|--commit
|
|
77
107
|
```
|
|
78
108
|
|
|
79
109
|
`bmp -c` commits all the changes now the repository has. Be careful.
|
|
80
110
|
And this command also tag it as `vX.Y.Z`.
|
|
111
|
+
|
|
112
|
+
# History
|
|
113
|
+
|
|
114
|
+
- 2016-05-15 v1.2.0 Add commit property in `.bmp.yml`.
|
|
115
|
+
|
|
116
|
+
# License
|
|
117
|
+
|
|
118
|
+
MIT
|
data/TODO.md
CHANGED
data/lib/bump/application.rb
CHANGED
|
@@ -98,15 +98,28 @@ module Bump
|
|
|
98
98
|
log "Version patterns:"
|
|
99
99
|
|
|
100
100
|
bumpInfo.updateRules.each do |rule|
|
|
101
|
+
|
|
102
|
+
if not rule.fileExists
|
|
103
|
+
|
|
104
|
+
log_red " #{rule.file}:", false
|
|
105
|
+
log_red " '#{rule.beforePattern}' (file not found)"
|
|
106
|
+
|
|
107
|
+
next
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
101
111
|
log " #{rule.file}:", false
|
|
102
112
|
|
|
103
|
-
if rule.patternExists
|
|
104
|
-
|
|
105
|
-
else
|
|
113
|
+
if not rule.patternExists
|
|
114
|
+
|
|
106
115
|
log_red " '#{rule.beforePattern}' (pattern not found)"
|
|
116
|
+
|
|
117
|
+
next
|
|
118
|
+
|
|
107
119
|
end
|
|
108
|
-
end
|
|
109
120
|
|
|
121
|
+
log_green " '#{rule.beforePattern}'"
|
|
122
|
+
end
|
|
110
123
|
end
|
|
111
124
|
|
|
112
125
|
# handler of `bmp [--info]`
|
|
@@ -204,7 +217,7 @@ module Bump
|
|
|
204
217
|
|
|
205
218
|
if @options[:commit]
|
|
206
219
|
comm.exec "git add ."
|
|
207
|
-
comm.exec "git commit -m '
|
|
220
|
+
comm.exec "git commit -m '#{bumpInfo.getCommitMessage}'"
|
|
208
221
|
comm.exec "git tag v#{bumpInfo.afterVersion}"
|
|
209
222
|
end
|
|
210
223
|
end
|
|
@@ -247,7 +260,7 @@ module Bump
|
|
|
247
260
|
# @return [void]
|
|
248
261
|
def log_red message, newline = true
|
|
249
262
|
|
|
250
|
-
@logger.
|
|
263
|
+
log @logger.red(message), newline
|
|
251
264
|
|
|
252
265
|
end
|
|
253
266
|
|
|
@@ -258,7 +271,7 @@ module Bump
|
|
|
258
271
|
# @return [void]
|
|
259
272
|
def log_green message, newline = true
|
|
260
273
|
|
|
261
|
-
@logger.
|
|
274
|
+
log @logger.green(message), newline
|
|
262
275
|
|
|
263
276
|
end
|
|
264
277
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
require 'yaml'
|
|
3
2
|
|
|
4
3
|
module Bump
|
|
@@ -6,11 +5,17 @@ module Bump
|
|
|
6
5
|
# The bump information model
|
|
7
6
|
class BumpInfo
|
|
8
7
|
|
|
9
|
-
# @param [Bump::VersionNumber] version
|
|
10
|
-
# @param [Array] files
|
|
11
|
-
|
|
8
|
+
# @param [Bump::VersionNumber] version The version
|
|
9
|
+
# @param [Array] files The replace patterns
|
|
10
|
+
# @param [String] commit The commit message
|
|
11
|
+
def initialize version, files, commit
|
|
12
12
|
@version = version
|
|
13
13
|
@files = files
|
|
14
|
+
@commit = commit
|
|
15
|
+
|
|
16
|
+
if not @commit
|
|
17
|
+
@commit = 'Bump to version v%.%.%'
|
|
18
|
+
end
|
|
14
19
|
|
|
15
20
|
@before_version = @version.to_s
|
|
16
21
|
@after_version = @version.to_s
|
|
@@ -31,6 +36,20 @@ module Bump
|
|
|
31
36
|
@files
|
|
32
37
|
end
|
|
33
38
|
|
|
39
|
+
# Returns the commit message
|
|
40
|
+
#
|
|
41
|
+
# @return [String]
|
|
42
|
+
def commit
|
|
43
|
+
@commit
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Gets the commit message with the current version number
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
def getCommitMessage
|
|
50
|
+
@commit.sub '%.%.%', @after_version
|
|
51
|
+
end
|
|
52
|
+
|
|
34
53
|
# Performs bumping version
|
|
35
54
|
#
|
|
36
55
|
# @param [Symbol] level
|
|
@@ -85,7 +104,7 @@ module Bump
|
|
|
85
104
|
|
|
86
105
|
createUpdateRules.each do |rule|
|
|
87
106
|
|
|
88
|
-
if not rule.patternExists
|
|
107
|
+
if not rule.fileExists or not rule.patternExists
|
|
89
108
|
return false
|
|
90
109
|
end
|
|
91
110
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
require 'yaml'
|
|
4
2
|
|
|
5
3
|
module Bump
|
|
@@ -21,9 +19,8 @@ module Bump
|
|
|
21
19
|
|
|
22
20
|
config = YAML.load_file @file
|
|
23
21
|
version = VersionNumberFactory.fromString config['version']
|
|
24
|
-
files = config['files']
|
|
25
22
|
|
|
26
|
-
BumpInfo.new version, files
|
|
23
|
+
BumpInfo.new version, config['files'], config['commit']
|
|
27
24
|
|
|
28
25
|
end
|
|
29
26
|
|
|
@@ -40,7 +37,15 @@ module Bump
|
|
|
40
37
|
# @return [Hash]
|
|
41
38
|
def toYaml bumpInfo
|
|
42
39
|
|
|
43
|
-
{"version" => bumpInfo.version.to_s
|
|
40
|
+
hash = { "version" => bumpInfo.version.to_s }
|
|
41
|
+
|
|
42
|
+
if bumpInfo.commit
|
|
43
|
+
hash["commit"] = bumpInfo.commit
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
hash["files"] = bumpInfo.files
|
|
47
|
+
|
|
48
|
+
hash.to_yaml
|
|
44
49
|
|
|
45
50
|
end
|
|
46
51
|
|
|
@@ -51,11 +51,17 @@ module Bump
|
|
|
51
51
|
File.read @file, :encoding => Encoding::UTF_8
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
# Returns true if the file exists
|
|
55
|
+
# @return [Boolean]
|
|
56
|
+
def fileExists
|
|
57
|
+
File.exist? @file
|
|
58
|
+
end
|
|
59
|
+
|
|
54
60
|
# Checks if the pattern found in the file
|
|
55
61
|
#
|
|
56
62
|
# @return [Boolean]
|
|
57
63
|
def patternExists
|
|
58
|
-
fileGetContents.index
|
|
64
|
+
fileGetContents.index(@before_pattern) != nil
|
|
59
65
|
end
|
|
60
66
|
|
|
61
67
|
# Performs file update
|
data/lib/bump/logger.rb
CHANGED
|
@@ -20,24 +20,6 @@ module Bump
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
# Logs the message in green.
|
|
24
|
-
#
|
|
25
|
-
# @param [String] message
|
|
26
|
-
# @param [Boolean] breakline
|
|
27
|
-
# @return [void]
|
|
28
|
-
def log_green message = '', breakline = true
|
|
29
|
-
log green(message), breakline
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Logs the message in red.
|
|
33
|
-
#
|
|
34
|
-
# @param [String] message
|
|
35
|
-
# @param [Boolean] breakline
|
|
36
|
-
# @return [void]
|
|
37
|
-
def log_red message = '', breakline = true
|
|
38
|
-
log red(message), breakline
|
|
39
|
-
end
|
|
40
|
-
|
|
41
23
|
# Colorize the text by the color code.
|
|
42
24
|
#
|
|
43
25
|
# @param [String] text
|
data/lib/bump/version.rb
CHANGED
|
@@ -4,4 +4,69 @@ require 'bump'
|
|
|
4
4
|
|
|
5
5
|
describe Bump::Application do
|
|
6
6
|
|
|
7
|
+
before :each do
|
|
8
|
+
@help_message = 'help_message'
|
|
9
|
+
@version_exp = "Bmp #{Bump::VERSION}"
|
|
10
|
+
@bmp_file = 'spec/fixture/bmp.yml'
|
|
11
|
+
@logger = Bump::Logger.new
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe 'selectAction' do
|
|
16
|
+
|
|
17
|
+
it 'returns :help if the options contain :help' do
|
|
18
|
+
|
|
19
|
+
app = Bump::Application.new({ :help => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
20
|
+
|
|
21
|
+
expect(app.selectAction).to eq :help
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'returns :version if the :version option preset' do
|
|
26
|
+
|
|
27
|
+
app = Bump::Application.new({ :version => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
28
|
+
|
|
29
|
+
expect(app.selectAction).to eq :version
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'returns :info if the :info option present' do
|
|
34
|
+
|
|
35
|
+
app = Bump::Application.new({ :info => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
36
|
+
|
|
37
|
+
expect(app.selectAction).to eq :info
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'returns :bump if one of :major, :minor, :patch, :commit, :preid, :release options present' do
|
|
42
|
+
|
|
43
|
+
app = Bump::Application.new({ :major => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
44
|
+
expect(app.selectAction).to eq :bump
|
|
45
|
+
|
|
46
|
+
app = Bump::Application.new({ :minor => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
47
|
+
expect(app.selectAction).to eq :bump
|
|
48
|
+
|
|
49
|
+
app = Bump::Application.new({ :patch => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
50
|
+
expect(app.selectAction).to eq :bump
|
|
51
|
+
|
|
52
|
+
app = Bump::Application.new({ :commit => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
53
|
+
expect(app.selectAction).to eq :bump
|
|
54
|
+
|
|
55
|
+
app = Bump::Application.new({ :preid => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
56
|
+
expect(app.selectAction).to eq :bump
|
|
57
|
+
|
|
58
|
+
app = Bump::Application.new({ :release => true }, @help_message, @version_exp, @bmp_file, @logger)
|
|
59
|
+
expect(app.selectAction).to eq :bump
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'returns :info if none of the above options are present' do
|
|
64
|
+
|
|
65
|
+
app = Bump::Application.new({}, @help_message, @version_exp, @bmp_file, @logger)
|
|
66
|
+
expect(app.selectAction).to eq :info
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
|
71
|
+
|
|
7
72
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
describe Bump::Command do
|
|
5
|
+
|
|
6
|
+
describe '#exec' do
|
|
7
|
+
|
|
8
|
+
it 'prints and executes the command' do
|
|
9
|
+
|
|
10
|
+
logger = double()
|
|
11
|
+
|
|
12
|
+
comm = Bump::Command.new logger
|
|
13
|
+
|
|
14
|
+
expect(logger).to receive(:log).with "===> echo 1"
|
|
15
|
+
expect(logger).to receive(:log).with "1\n"
|
|
16
|
+
|
|
17
|
+
comm.exec "echo 1"
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -4,4 +4,35 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe Bump::BumpInfoRepository do
|
|
6
6
|
|
|
7
|
+
describe '#fromFile' do
|
|
8
|
+
|
|
9
|
+
it 'gets the bump info from the file' do
|
|
10
|
+
|
|
11
|
+
repo = Bump::BumpInfoRepository.new 'spec/fixture/bmp.yml'
|
|
12
|
+
|
|
13
|
+
bumpInfo = repo.fromFile
|
|
14
|
+
|
|
15
|
+
expect(bumpInfo.class).to eq Bump::BumpInfo
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe '#save' do
|
|
22
|
+
|
|
23
|
+
it 'saves the current info to the file' do
|
|
24
|
+
|
|
25
|
+
repo = Bump::BumpInfoRepository.new 'spec/fixture/bmp.yml'
|
|
26
|
+
|
|
27
|
+
bumpInfo = repo.fromFile
|
|
28
|
+
bumpInfo = Bump::BumpInfo.new Bump::VersionNumber.new(1, 2, 4), bumpInfo.files, bumpInfo.commit
|
|
29
|
+
|
|
30
|
+
repo.save bumpInfo
|
|
31
|
+
|
|
32
|
+
bumpInfo = repo.fromFile
|
|
33
|
+
expect(bumpInfo.version.to_s).to eq '1.2.4'
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
7
38
|
end
|
|
@@ -4,4 +4,47 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe Bump::BumpInfo do
|
|
6
6
|
|
|
7
|
+
before :each do
|
|
8
|
+
|
|
9
|
+
@info = Bump::BumpInfo.new Bump::VersionNumber.new(1, 2, 3), { "README.md" => "v%.%.%", "package.json" => "v%.%.%" }, nil
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#version' do
|
|
14
|
+
|
|
15
|
+
it 'returns the version object' do
|
|
16
|
+
|
|
17
|
+
expect(@info.version.class).to eq Bump::VersionNumber
|
|
18
|
+
expect(@info.version.to_s).to eq '1.2.3'
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe '#files' do
|
|
25
|
+
|
|
26
|
+
it 'returns the hash of the files' do
|
|
27
|
+
|
|
28
|
+
expect(@info.files).to eq({ "README.md" => "v%.%.%", "package.json" => "v%.%.%" })
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe '#bump' do
|
|
35
|
+
|
|
36
|
+
it 'bumps the version with the give level' do
|
|
37
|
+
|
|
38
|
+
@info.bump :patch
|
|
39
|
+
expect(@info.version.to_s).to eq '1.2.4'
|
|
40
|
+
|
|
41
|
+
@info.bump :minor
|
|
42
|
+
expect(@info.version.to_s).to eq '1.3.0'
|
|
43
|
+
|
|
44
|
+
@info.bump :major
|
|
45
|
+
expect(@info.version.to_s).to eq '2.0.0'
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
7
50
|
end
|
|
@@ -4,4 +4,34 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe Bump::FileUpdateRuleFactory do
|
|
6
6
|
|
|
7
|
+
describe 'self.create' do
|
|
8
|
+
|
|
9
|
+
it 'creates a FileUpdateRule if the give param is string' do
|
|
10
|
+
|
|
11
|
+
rule = Bump::FileUpdateRuleFactory.create 'README.md', 'v%.%.%', '1.2.3', '2.0.0'
|
|
12
|
+
|
|
13
|
+
expect(rule.class).to eq Bump::FileUpdateRule
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'craetes a list of FileUpdateRules if the give param is an array of string' do
|
|
18
|
+
|
|
19
|
+
rules = Bump::FileUpdateRuleFactory.create 'READEME.md', ['v%.%.%', 'w%.%.%'], '1.2.3', '2.0.0'
|
|
20
|
+
|
|
21
|
+
expect(rules.class).to eq Array
|
|
22
|
+
expect(rules[0].class).to eq Bump::FileUpdateRule
|
|
23
|
+
expect(rules[1].class).to eq Bump::FileUpdateRule
|
|
24
|
+
expect(rules.size).to eq 2
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'creates a FileUpdateRule if the given param is not a string nor an array' do
|
|
28
|
+
|
|
29
|
+
rule = Bump::FileUpdateRuleFactory.create 'READEME.md', nil, '1.2.3', '2.0.0'
|
|
30
|
+
|
|
31
|
+
expect(rule.class).to eq Bump::FileUpdateRule
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
7
37
|
end
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
1
|
require 'bump'
|
|
3
2
|
require 'spec_helper'
|
|
4
3
|
|
|
5
4
|
describe Bump::FileUpdateRule do
|
|
6
5
|
|
|
6
|
+
before :each do
|
|
7
|
+
@rule = Bump::FileUpdateRule.new 'spec/fixture/dummy.txt', 'v%.%.%', '1.2.3', '2.0.0'
|
|
8
|
+
end
|
|
9
|
+
|
|
7
10
|
describe '#file' do
|
|
8
11
|
|
|
9
12
|
it 'returns file property' do
|
|
10
|
-
rule = Bump::FileUpdateRule.new 'abc', '%.%.%', '0.0.1', '1.0.0'
|
|
11
13
|
|
|
12
|
-
expect(rule.file).to eq '
|
|
14
|
+
expect(@rule.file).to eq 'spec/fixture/dummy.txt'
|
|
15
|
+
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
end
|
|
@@ -17,9 +20,9 @@ describe Bump::FileUpdateRule do
|
|
|
17
20
|
describe '#beforePattern' do
|
|
18
21
|
|
|
19
22
|
it 'returns before_pattern property' do
|
|
20
|
-
rule = Bump::FileUpdateRule.new 'abc', 'v%.%.%', '0.0.1', '1.0.0'
|
|
21
23
|
|
|
22
|
-
expect(rule.beforePattern).to eq '
|
|
24
|
+
expect(@rule.beforePattern).to eq 'v1.2.3'
|
|
25
|
+
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
end
|
|
@@ -27,9 +30,9 @@ describe Bump::FileUpdateRule do
|
|
|
27
30
|
describe '#afterPattern' do
|
|
28
31
|
|
|
29
32
|
it 'returns before_pattern property' do
|
|
30
|
-
rule = Bump::FileUpdateRule.new 'abc', 'v%.%.%', '0.0.1', '1.0.0'
|
|
31
33
|
|
|
32
|
-
expect(rule.afterPattern).to eq '
|
|
34
|
+
expect(@rule.afterPattern).to eq 'v2.0.0'
|
|
35
|
+
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
end
|
|
@@ -38,7 +41,7 @@ describe Bump::FileUpdateRule do
|
|
|
38
41
|
|
|
39
42
|
it 'checks if the given pattern found in the file' do
|
|
40
43
|
|
|
41
|
-
rule
|
|
44
|
+
expect(@rule.patternExists).to be true
|
|
42
45
|
|
|
43
46
|
end
|
|
44
47
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dummy v1.2.3-rc1
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bmp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yoshiya Hinosawa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-05-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: slop
|
|
@@ -66,7 +66,7 @@ files:
|
|
|
66
66
|
- ".travis.yml"
|
|
67
67
|
- Gemfile
|
|
68
68
|
- Gemfile.lock
|
|
69
|
-
- LICENSE
|
|
69
|
+
- LICENSE
|
|
70
70
|
- README.md
|
|
71
71
|
- Rakefile
|
|
72
72
|
- TODO.md
|
|
@@ -87,6 +87,7 @@ files:
|
|
|
87
87
|
- lib/bump/version.rb
|
|
88
88
|
- spec/bump/application_spec.rb
|
|
89
89
|
- spec/bump/cli_spec.rb
|
|
90
|
+
- spec/bump/command_spec.rb
|
|
90
91
|
- spec/bump/domain/bump_info_repository_spec.rb
|
|
91
92
|
- spec/bump/domain/bump_info_spec.rb
|
|
92
93
|
- spec/bump/domain/file_update_rule_factory_spec.rb
|
|
@@ -94,6 +95,8 @@ files:
|
|
|
94
95
|
- spec/bump/domain/version_number_factory_spec.rb
|
|
95
96
|
- spec/bump/domain/version_number_spec.rb
|
|
96
97
|
- spec/bump/logger_spec.rb
|
|
98
|
+
- spec/fixture/bmp.yml
|
|
99
|
+
- spec/fixture/dummy.txt
|
|
97
100
|
- spec/spec_helper.rb
|
|
98
101
|
homepage: https://github.com/kt3k/bump
|
|
99
102
|
licenses:
|
|
@@ -122,6 +125,7 @@ summary: No hassle on bumping
|
|
|
122
125
|
test_files:
|
|
123
126
|
- spec/bump/application_spec.rb
|
|
124
127
|
- spec/bump/cli_spec.rb
|
|
128
|
+
- spec/bump/command_spec.rb
|
|
125
129
|
- spec/bump/domain/bump_info_repository_spec.rb
|
|
126
130
|
- spec/bump/domain/bump_info_spec.rb
|
|
127
131
|
- spec/bump/domain/file_update_rule_factory_spec.rb
|
|
@@ -129,4 +133,6 @@ test_files:
|
|
|
129
133
|
- spec/bump/domain/version_number_factory_spec.rb
|
|
130
134
|
- spec/bump/domain/version_number_spec.rb
|
|
131
135
|
- spec/bump/logger_spec.rb
|
|
136
|
+
- spec/fixture/bmp.yml
|
|
137
|
+
- spec/fixture/dummy.txt
|
|
132
138
|
- spec/spec_helper.rb
|