incr 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4896689095379204d0697a39423ce3c15b87f4920164314bc86c2121f22154b
4
- data.tar.gz: 9f008d7fbf98ff81278ba1cb4851fee1cdea1327890428e234a85c3487c983c3
3
+ metadata.gz: 9afe3ededb1966abd48644e8c02606dadf1a0a29af74b0287deab7079f034cd8
4
+ data.tar.gz: eb60c16aae7d930ef2ceec4e957bf91f61d722b12f7fc5ea6aa76ed93fca514c
5
5
  SHA512:
6
- metadata.gz: 426b80a1277e931264e19c8305d92e6a04a2615ff5f20152a0ffac3ffe1ea67dbff34adabc05ff556bf07d73492e7ee6f1280e87dc09ca860be071989a0b8744
7
- data.tar.gz: 397eef5e1e50727872a09a223d9487252f98e808eca019d8ba999006068b5323de33684cafbd713e1fc167ca5d4dd343876b83e6e51f5cb90a84730f0b3cc5b3
6
+ metadata.gz: 309db6be2b962833f4302e09ac0c2aca0d38e44937f035044d131a89d0ebfa8599ded9e00b2360acd509ba40b92d01fb123fc27fe375940b70db051cd09769c6
7
+ data.tar.gz: 0be89efa75da4fc94e76d1ab6a6accff6eff3b5d3e39e11b86b10b9b7969f0595458c48c9702a3b8d4761a2fc848a90e9ebc75c2ea605e3f1f04982bbf698ca1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- incr (0.4.0)
4
+ incr (0.5.0)
5
5
  git (= 1.3.0)
6
6
  gli (= 2.17.1)
7
7
  sem_version (= 2.0.1)
@@ -20,4 +20,4 @@ DEPENDENCIES
20
20
  incr!
21
21
 
22
22
  BUNDLED WITH
23
- 1.16.1
23
+ 1.16.6
data/README.md CHANGED
@@ -6,8 +6,7 @@
6
6
  Incr is a tool to help you easily increment the version number of your NPM or Mix packages.
7
7
  <br /><br />
8
8
  <a href="https://rubygems.org/gems/incr"><img src="http://img.shields.io/gem/v/incr.svg" /></a>
9
- <a href="https://codeclimate.com/github/jcouture/incr"><img src="http://img.shields.io/codeclimate/github/jcouture/incr.svg" /></a>
10
- <a href="https://gemnasium.com/jcouture/incr"><img src="http://img.shields.io/gemnasium/jcouture/incr.svg" /></a>
9
+
11
10
  <a href="https://travis-ci.org/jcouture/incr"><img src="http://img.shields.io/travis/jcouture/incr.svg" /></a>
12
11
  </p>
13
12
 
@@ -1,6 +1,12 @@
1
1
  module Incr
2
2
  module Command
3
3
  class Mix
4
+ VERSION_REGEX = /@?version:?\W*\"(\d*.\d*.\d*)"/
5
+ VERSION_REPLACEMENT_PATTERNS = [
6
+ "version: \"%s\"",
7
+ "@version \"%s\""
8
+ ]
9
+
4
10
  def initialize(args, global_options)
5
11
  @segment = args[0]
6
12
  @mix_file_filename = File.join('.', global_options[:versionFileDirectory], 'mix.exs')
@@ -15,10 +21,10 @@ module Incr
15
21
  return
16
22
  end
17
23
 
18
- file_version = file_content.match(/version:\W*\"(\d*.\d*.\d*)",/)[1]
24
+ file_version = file_content.match(VERSION_REGEX)[1]
19
25
  old_version = SemVersion.new(file_version)
20
26
  new_version = Incr::Service::Version.increment_segment(old_version, @segment)
21
- Incr::Service::FileHelper.replace_once(@mix_file_filename, version_pattern(old_version.to_s), version_pattern(new_version.to_s))
27
+ replace_file_version(old_version, new_version)
22
28
 
23
29
  new_tag = @tag_pattern % new_version.to_s
24
30
 
@@ -41,8 +47,13 @@ module Incr
41
47
  IO.read(filename)
42
48
  end
43
49
 
44
- def version_pattern(version)
45
- "version: \"#{version}\""
50
+ def replace_file_version(old_version, new_version)
51
+ VERSION_REPLACEMENT_PATTERNS.each do |pattern|
52
+ old_version_pattern = format(pattern, old_version.to_s)
53
+ new_version_pattern = format(pattern, new_version.to_s)
54
+
55
+ Incr::Service::FileHelper.replace_once(@mix_file_filename, old_version_pattern, new_version_pattern)
56
+ end
46
57
  end
47
58
  end
48
59
  end
@@ -1,3 +1,3 @@
1
1
  module Incr
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  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: 0.5.0
4
+ version: 0.6.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: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2019-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -95,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.7.6
98
+ rubygems_version: 3.0.3
100
99
  signing_key:
101
100
  specification_version: 4
102
101
  summary: Tasteful utility to increment the version number and create a corresponding