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: 6e22689b28c655a76ab05c049502d3723179ab7478a3ed29ddca72d2d025a428
4
- data.tar.gz: b729e4e446f6f6d8da520625d5d3451287180ebe703930518733310a508d0995
3
+ metadata.gz: a270aafaa6c52ea47438710b51d984db6d41454e5f8f61867ca7bcba9efb1464
4
+ data.tar.gz: b9087111ab04b098dca03bd1a5b15203586770a3dee280573fec7c14ddc044aa
5
5
  SHA512:
6
- metadata.gz: 56718b85ff502646e0b548103d5d6c9d423e15641c033ddc62cab5534ae0b52c0591b600fb79107c99126fb6e5a5e84c59816fa7e188961881bb811ac8d41873
7
- data.tar.gz: 2e8eecf1678a665fa9cd2dd248eced1561130cb85f3dfd8d01e4ac445f68d0f21f7309b1a0ab2cf05bf34f7e5cea7e69cfc3bd00b137af7942e0d9f9c560935e
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 do |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) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.7.1'
4
+ VERSION = '0.7.2'
5
5
  end
@@ -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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Tools
5
+ VERSION = '0.69.1'
6
+ end
7
+ 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.1
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-07 00:00:00.000000000 Z
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