eac_ruby_gems_utils 0.7.1 → 0.7.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a270aafaa6c52ea47438710b51d984db6d41454e5f8f61867ca7bcba9efb1464
|
4
|
+
data.tar.gz: b9087111ab04b098dca03bd1a5b15203586770a3dee280573fec7c14ddc044aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b93b7e14f08dcda516149f86dce135f752cff4a5ec8b1d076642e63cc75b0565f28d306bf4fff6668fbaf982011e1c281d432f3c4949e7cc07572f391284c3d
|
7
|
+
data.tar.gz: 6678b85a95bffdfc0ecb8bfe6dfd5516e804b94c56e60b8873ee5a6b80a6612433f5a3d638ad41c11d3d6dc8ccf44efa56a0d3d13a7df6ebc2ebea94ff816cb0
|
@@ -10,11 +10,7 @@ module EacRubyGemsUtils
|
|
10
10
|
VERSION_LINE_PATTERN = /\A(\s*)VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"](\s*)\z/.freeze
|
11
11
|
|
12
12
|
def value
|
13
|
-
path.read.each_line
|
14
|
-
VERSION_LINE_PATTERN.if_match(line.rstrip, false) do |m|
|
15
|
-
::Gem::Version.new(m[2])
|
16
|
-
end
|
17
|
-
end
|
13
|
+
path.read.each_line.lazy.map { |line| line_value(line) }.find { |v| v }
|
18
14
|
end
|
19
15
|
|
20
16
|
def value=(new_value)
|
@@ -23,6 +19,11 @@ module EacRubyGemsUtils
|
|
23
19
|
|
24
20
|
private
|
25
21
|
|
22
|
+
# @return Version found in line, nil otherwise.
|
23
|
+
def line_value(line)
|
24
|
+
VERSION_LINE_PATTERN.if_match(line.rstrip, false) { |m| ::Gem::Version.new(m[2]) }
|
25
|
+
end
|
26
|
+
|
26
27
|
def new_value_content(new_value)
|
27
28
|
path.read.each_line
|
28
29
|
.map { |line| new_value_line(line, new_value) }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_gems_utils/gem'
|
4
|
+
|
5
|
+
::RSpec.describe ::EacRubyGemsUtils::Gem::VersionFile do
|
6
|
+
let(:stubs_dir) { ::Pathname.new(__dir__).join('version_file_spec_files') }
|
7
|
+
let(:stub_file) { stubs_dir.join('a_version_file.rb') }
|
8
|
+
let(:instance) { described_class.new(stub_file) }
|
9
|
+
let(:target_version) { ::Gem::Version.new('0.69.1') }
|
10
|
+
|
11
|
+
describe '#value' do
|
12
|
+
it { expect(instance.value).to eq(target_version) }
|
13
|
+
end
|
14
|
+
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.7.
|
4
|
+
version: 0.7.2
|
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-09-
|
11
|
+
date: 2020-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -64,6 +64,8 @@ files:
|
|
64
64
|
- lib/eac_ruby_gems_utils/tests/multiple/result.rb
|
65
65
|
- lib/eac_ruby_gems_utils/tests/rspec.rb
|
66
66
|
- lib/eac_ruby_gems_utils/version.rb
|
67
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
68
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
67
69
|
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
68
70
|
- spec/rubocop_check_spec.rb
|
69
71
|
- spec/spec_helper.rb
|
@@ -100,6 +102,8 @@ signing_key:
|
|
100
102
|
specification_version: 4
|
101
103
|
summary: Utilities for Ruby gems development.
|
102
104
|
test_files:
|
105
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
106
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
103
107
|
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
104
108
|
- spec/rubocop_check_spec.rb
|
105
109
|
- spec/spec_helper.rb
|