eac_ruby_gems_utils 0.6.2 → 0.7.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba6901f2b81816e02333d51f9c1e4eb8d5a705a500f8d5485b20897925d1e0a2
|
4
|
+
data.tar.gz: b84a7c9aa771b08b204860e6c1961c259d847c044ab26d00b1db16e7fe2fbfc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc046a756ad593ab46288d1882488ecd1e2c10116698036923f24d694b4c60daf025f798a7184b0b26705154588529a6ade87ea5261d64e81b7b3e2a79222d6
|
7
|
+
data.tar.gz: e70343b18f054bc8c402336b0150aed0c33a9638e815c40e9c75a13ff49835ea46498b1d686f91065edd401f834de1302e1d5ff3bd51ca80c2d25192e4441f28
|
@@ -54,7 +54,7 @@ module EacRubyGemsUtils
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def version
|
57
|
-
|
57
|
+
version_file.value
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
@@ -76,6 +76,10 @@ module EacRubyGemsUtils
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def version_file_uncached
|
79
|
+
::EacRubyGemsUtils::Gem::VersionFile.new(version_file_path)
|
80
|
+
end
|
81
|
+
|
82
|
+
def version_file_path_uncached
|
79
83
|
root.join('lib', *namespace_parts, 'version.rb')
|
80
84
|
end
|
81
85
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRubyGemsUtils
|
6
|
+
class Gem
|
7
|
+
class VersionFile
|
8
|
+
common_constructor :path
|
9
|
+
|
10
|
+
VERSION_LINE_PATTERN = /\A(\s*)VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"](\s*)\z/.freeze
|
11
|
+
|
12
|
+
def value
|
13
|
+
path.read.each_line do |line|
|
14
|
+
VERSION_LINE_PATTERN.if_match(line.rstrip, false) do |m|
|
15
|
+
::Gem::Version.new(m[2])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def value=(new_value)
|
21
|
+
path.write(new_value_content(new_value))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def new_value_content(new_value)
|
27
|
+
path.read.each_line
|
28
|
+
.map { |line| new_value_line(line, new_value) }
|
29
|
+
.join
|
30
|
+
end
|
31
|
+
|
32
|
+
def new_value_line(line, new_value)
|
33
|
+
m = VERSION_LINE_PATTERN.match(line)
|
34
|
+
return line unless m
|
35
|
+
|
36
|
+
"#{m[1]}VERSION = '#{new_value}'#{m[3]}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_gems_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/eac_ruby_gems_utils.rb
|
56
56
|
- lib/eac_ruby_gems_utils/gem.rb
|
57
57
|
- lib/eac_ruby_gems_utils/gem/command.rb
|
58
|
+
- lib/eac_ruby_gems_utils/gem/version_file.rb
|
58
59
|
- lib/eac_ruby_gems_utils/tests.rb
|
59
60
|
- lib/eac_ruby_gems_utils/tests/base.rb
|
60
61
|
- lib/eac_ruby_gems_utils/tests/minitest.rb
|