eac_ruby_gems_utils 0.7.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/eac_ruby_gems_utils.gemspec +1 -1
- data/lib/eac_ruby_gems_utils/gem.rb +2 -1
- data/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
- data/lib/eac_ruby_gems_utils/gem/version_file.rb +6 -5
- data/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
- data/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
- data/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
- data/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/spec/code/rubocop_check_spec.rb +3 -0
- data/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
- data/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
- data/spec/spec_helper.rb +3 -0
- metadata +11 -7
- data/spec/rubocop_check_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c099ecc1a35c258668400a2ae537a1b4d68e8bc015ec5412a13e41c48cd9e068
|
4
|
+
data.tar.gz: 3fc444bbde8b308c16f4e9e7d8f4cac37a249fe7a72e7f1c983a7e6cf110f67d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 719f2c29fc18afe5c9fb00e53c2624cb78aad1d04b0e64f2cbd0b2449da2af67246c3ca8b64a4ec36a497bfe7837de51db00a1c2c033290bd4b11aee3f0dea5a
|
7
|
+
data.tar.gz: f6e66ff586dacf7d43a2daf6a7181cb3b57764f5b92f7425531d838d08640e71b6cb6a01cc92718ca1234917f9381fa5f4f23f62f297adf515ea67c584954a71
|
data/eac_ruby_gems_utils.gemspec
CHANGED
@@ -11,8 +11,9 @@ module EacRubyGemsUtils
|
|
11
11
|
|
12
12
|
GEMSPEC_EXTNAME = '.gemspec'
|
13
13
|
|
14
|
-
common_constructor :root do
|
14
|
+
common_constructor :root, :host_env, default: [nil] do
|
15
15
|
@root = ::Pathname.new(root).expand_path
|
16
|
+
self.host_env ||= ::EacRubyUtils::Envs.local
|
16
17
|
end
|
17
18
|
|
18
19
|
def to_s
|
@@ -11,7 +11,7 @@ module EacRubyGemsUtils
|
|
11
11
|
|
12
12
|
def initialize(gem, command_args, extra_options = {})
|
13
13
|
@gem = gem
|
14
|
-
super(command_args, extra_options)
|
14
|
+
super(command_args, extra_options.merge(host_env: gem.host_env))
|
15
15
|
end
|
16
16
|
|
17
17
|
# Changes current directory to the gem's directory.
|
@@ -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) }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/fs/logs'
|
4
5
|
require 'eac_ruby_utils/fs_cache'
|
5
6
|
require 'eac_ruby_utils/listable'
|
6
7
|
require 'eac_ruby_utils/on_clean_ruby_environment'
|
@@ -27,20 +28,16 @@ module EacRubyGemsUtils
|
|
27
28
|
self.class.name.demodulize.gsub(/Test\z/, '')
|
28
29
|
end
|
29
30
|
|
30
|
-
def stdout_cache
|
31
|
-
root_cache.child('stdout')
|
32
|
-
end
|
33
|
-
|
34
|
-
def stderr_cache
|
35
|
-
root_cache.child('stderr')
|
36
|
-
end
|
37
|
-
|
38
31
|
def to_s
|
39
32
|
"#{gem}[#{name}]"
|
40
33
|
end
|
41
34
|
|
42
35
|
private
|
43
36
|
|
37
|
+
def logs_uncached
|
38
|
+
::EacRubyUtils::Fs::Logs.new.add(:stdout).add(:stderr)
|
39
|
+
end
|
40
|
+
|
44
41
|
def result_uncached
|
45
42
|
return RESULT_NONEXISTENT unless elegible?
|
46
43
|
|
@@ -53,8 +50,8 @@ module EacRubyGemsUtils
|
|
53
50
|
|
54
51
|
def exec_run_with_log
|
55
52
|
r = exec_run
|
56
|
-
|
57
|
-
|
53
|
+
logs[:stdout].write(r[:stdout])
|
54
|
+
logs[:stderr].write(r[:stderr])
|
58
55
|
r[:exit_code].zero?
|
59
56
|
end
|
60
57
|
|
@@ -27,6 +27,12 @@ module EacRubyGemsUtils
|
|
27
27
|
decorated_gems.flat_map(&:tests)
|
28
28
|
end
|
29
29
|
|
30
|
+
def clear_logs
|
31
|
+
all_tests.each do |test|
|
32
|
+
test.logs.remove_all
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
30
36
|
def prepare_all_gems
|
31
37
|
infom 'Preparing all gems...'
|
32
38
|
decorated_gems.each(&:prepare)
|
@@ -47,8 +53,7 @@ module EacRubyGemsUtils
|
|
47
53
|
warn 'Some test did not pass:'
|
48
54
|
failed_tests.each do |test|
|
49
55
|
infov ' * Test', test
|
50
|
-
|
51
|
-
infov ' * STDERR', test.stderr_cache.content_path
|
56
|
+
info test.logs.truncate_all
|
52
57
|
end
|
53
58
|
else
|
54
59
|
success 'All tests passed'
|
@@ -60,6 +65,8 @@ module EacRubyGemsUtils
|
|
60
65
|
prepare_all_gems
|
61
66
|
test_all_gems
|
62
67
|
final_results_banner
|
68
|
+
ensure
|
69
|
+
clear_logs
|
63
70
|
end
|
64
71
|
|
65
72
|
def start_banner
|
@@ -12,14 +12,12 @@ module EacRubyGemsUtils
|
|
12
12
|
log('running "bundle install"...')
|
13
13
|
return if bundle('install').execute.fetch(:exit_code).zero?
|
14
14
|
|
15
|
-
|
16
|
-
log('"bundle install" failed, removing Gemfile.lock and trying again...')
|
17
|
-
gemfile_lock_path.unlink if gemfile_lock_path.exist?
|
18
|
-
bundle('install').execute!
|
19
|
-
else
|
15
|
+
unless can_remove_gemfile_lock?
|
20
16
|
raise '"bundle install" failed and the Gemfile.lock is part of gem' \
|
21
|
-
|
17
|
+
'(Should be changed by developer)'
|
22
18
|
end
|
19
|
+
|
20
|
+
prepare_with_removable_gemfile_lock
|
23
21
|
end
|
24
22
|
|
25
23
|
def tests
|
@@ -33,6 +31,12 @@ module EacRubyGemsUtils
|
|
33
31
|
infov self, message
|
34
32
|
end
|
35
33
|
|
34
|
+
def prepare_with_removable_gemfile_lock
|
35
|
+
log('"bundle install" failed, removing Gemfile.lock and trying again...')
|
36
|
+
gemfile_lock_path.unlink if gemfile_lock_path.exist?
|
37
|
+
bundle('install').execute!
|
38
|
+
end
|
39
|
+
|
36
40
|
def can_remove_gemfile_lock?
|
37
41
|
!files.include?(gemfile_lock_path.relative_path_from(root))
|
38
42
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -97,4 +97,7 @@ RSpec.configure do |config|
|
|
97
97
|
# # test failures related to randomization by passing the same `--seed` value
|
98
98
|
# # as the one that triggered the failure.
|
99
99
|
# Kernel.srand config.seed
|
100
|
+
|
101
|
+
require 'eac_ruby_gem_support/rspec'
|
102
|
+
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
|
100
103
|
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.9.1
|
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:
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.2'
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
executables: []
|
@@ -64,8 +64,10 @@ 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/code/rubocop_check_spec.rb
|
68
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
69
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
67
70
|
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
68
|
-
- spec/rubocop_check_spec.rb
|
69
71
|
- spec/spec_helper.rb
|
70
72
|
- spec/support/mygem/Gemfile
|
71
73
|
- spec/support/mygem/Gemfile.lock
|
@@ -95,13 +97,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
97
|
- !ruby/object:Gem::Version
|
96
98
|
version: '0'
|
97
99
|
requirements: []
|
98
|
-
rubygems_version: 3.0.
|
100
|
+
rubygems_version: 3.0.9
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: Utilities for Ruby gems development.
|
102
104
|
test_files:
|
105
|
+
- spec/code/rubocop_check_spec.rb
|
106
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
107
|
+
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
103
108
|
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
104
|
-
- spec/rubocop_check_spec.rb
|
105
109
|
- spec/spec_helper.rb
|
106
110
|
- spec/support/mygem/Gemfile
|
107
111
|
- spec/support/mygem/Gemfile.lock
|