eac_ruby_gems_utils 0.7.2 → 0.9.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: a270aafaa6c52ea47438710b51d984db6d41454e5f8f61867ca7bcba9efb1464
4
- data.tar.gz: b9087111ab04b098dca03bd1a5b15203586770a3dee280573fec7c14ddc044aa
3
+ metadata.gz: 5e2119711a775b103e79e53d283c534053f106fd1957b1102df2090f8a00bee7
4
+ data.tar.gz: 95ed095e201df5d0c695f61c65a93199d74a68e423ff9e68383f401628431797
5
5
  SHA512:
6
- metadata.gz: 3b93b7e14f08dcda516149f86dce135f752cff4a5ec8b1d076642e63cc75b0565f28d306bf4fff6668fbaf982011e1c281d432f3c4949e7cc07572f391284c3d
7
- data.tar.gz: 6678b85a95bffdfc0ecb8bfe6dfd5516e804b94c56e60b8873ee5a6b80a6612433f5a3d638ad41c11d3d6dc8ccf44efa56a0d3d13a7df6ebc2ebea94ff816cb0
6
+ metadata.gz: ddb71e98d08f6b1cb3f938d80f1bec4d89bde9b17ce681d7addf672f5f40ac9fc0ada2c841bff051e01f4d064ec86b3707ea28a3756276ccdaef905fb97c81c3
7
+ data.tar.gz: bb80228776292e23e0646072f91b926bac32d516b038c2ed57ad5159d0c719cf479bda47925e9cbc05d022afe6a84a20d3a562f0b8435cc8932a935ec976d9c9
@@ -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.
@@ -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
- stdout_cache.write(r[:stdout])
57
- stderr_cache.write(r[:stderr])
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
- infov ' * STDOUT', test.stdout_cache.content_path
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
- if can_remove_gemfile_lock?
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
- '(Should be changed by developer)'
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.7.2'
4
+ VERSION = '0.9.2'
5
5
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
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,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_gems_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.9.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-27 00:00:00.000000000 Z
11
+ date: 2021-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.2.17
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.2.17
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: eac_ruby_utils
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -30,14 +50,14 @@ dependencies:
30
50
  requirements:
31
51
  - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '0.1'
53
+ version: '0.2'
34
54
  type: :development
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '0.1'
60
+ version: '0.2'
41
61
  description:
42
62
  email:
43
63
  executables: []
@@ -45,13 +65,9 @@ extensions: []
45
65
  extra_rdoc_files:
46
66
  - README.rdoc
47
67
  files:
48
- - ".gitignore"
49
68
  - ".rspec"
50
- - ".rubocop.yml"
51
69
  - Gemfile
52
- - LICENCE
53
70
  - README.rdoc
54
- - eac_ruby_gems_utils.gemspec
55
71
  - lib/eac_ruby_gems_utils.rb
56
72
  - lib/eac_ruby_gems_utils/gem.rb
57
73
  - lib/eac_ruby_gems_utils/gem/command.rb
@@ -64,10 +80,10 @@ files:
64
80
  - lib/eac_ruby_gems_utils/tests/multiple/result.rb
65
81
  - lib/eac_ruby_gems_utils/tests/rspec.rb
66
82
  - lib/eac_ruby_gems_utils/version.rb
83
+ - spec/code/rubocop_check_spec.rb
67
84
  - spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
68
85
  - spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
69
86
  - spec/lib/eac_ruby_gems_utils/gem_spec.rb
70
- - spec/rubocop_check_spec.rb
71
87
  - spec/spec_helper.rb
72
88
  - spec/support/mygem/Gemfile
73
89
  - spec/support/mygem/Gemfile.lock
@@ -97,20 +113,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
113
  - !ruby/object:Gem::Version
98
114
  version: '0'
99
115
  requirements: []
100
- rubygems_version: 3.0.8
116
+ rubygems_version: 3.0.9
101
117
  signing_key:
102
118
  specification_version: 4
103
119
  summary: Utilities for Ruby gems development.
104
120
  test_files:
105
- - spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
106
121
  - spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
122
+ - spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
107
123
  - spec/lib/eac_ruby_gems_utils/gem_spec.rb
108
- - spec/rubocop_check_spec.rb
109
124
  - spec/spec_helper.rb
110
- - spec/support/mygem/Gemfile
111
- - spec/support/mygem/Gemfile.lock
125
+ - spec/code/rubocop_check_spec.rb
112
126
  - spec/support/mygem/Rakefile
113
- - spec/support/mygem/exe/myrunner
114
- - spec/support/mygem/lib/mygem.rb
127
+ - spec/support/mygem/Gemfile
115
128
  - spec/support/mygem/lib/mygem/version.rb
129
+ - spec/support/mygem/lib/mygem.rb
130
+ - spec/support/mygem/exe/myrunner
116
131
  - spec/support/mygem/mygem.gemspec
132
+ - spec/support/mygem/Gemfile.lock
133
+ - ".rspec"
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /Gemfile.lock
2
- doc/**/*
3
- .yardoc/**/*
data/.rubocop.yml DELETED
@@ -1,25 +0,0 @@
1
- require:
2
- - rubocop-rails
3
- - rubocop-rspec
4
-
5
- AllCops:
6
- TargetRubyVersion: 2.4
7
-
8
- Layout/LineLength:
9
- Max: 100
10
-
11
- Rails/RakeEnvironment:
12
- Exclude:
13
- - spec/support/mygem/Rakefile
14
-
15
- Style/Documentation:
16
- Enabled: false
17
-
18
- Style/HashEachMethods:
19
- Enabled: true
20
-
21
- Style/HashTransformKeys:
22
- Enabled: true
23
-
24
- Style/HashTransformValues:
25
- Enabled: true
data/LICENCE DELETED
@@ -1,16 +0,0 @@
1
- Copyright (c) 2020 Eduardo Henrique Bogoni
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
- associated documentation files (the "Software"), to deal in the Software without restriction,
5
- including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
- furnished to do so, subject to the following conditions:
8
-
9
- The above copyright notice and this permission notice (including the next paragraph) shall be
10
- included in all copies or substantial portions of the Software.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
- NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
16
- OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
-
5
- # Maintain your gem's version:
6
- require 'eac_ruby_gems_utils/version'
7
-
8
- # Describe your gem and declare its dependencies:
9
- Gem::Specification.new do |s|
10
- s.name = 'eac_ruby_gems_utils'
11
- s.version = ::EacRubyGemsUtils::VERSION
12
- s.authors = ['Esquilo Azul Company']
13
- s.summary = 'Utilities for Ruby gems development.'
14
- s.license = 'MIT'
15
- s.homepage = 'https://github.com/esquilo-azul/eac_ruby_gems_utils'
16
- s.metadata = { 'source_code_uri' => s.homepage }
17
-
18
- s.extra_rdoc_files = ['README.rdoc']
19
- s.rdoc_options = ['--charset=UTF-8']
20
-
21
- s.require_paths = ['lib']
22
- s.files = `git ls-files`.split("\n")
23
- s.test_files = `git ls-files spec examples`.split("\n")
24
-
25
- s.add_dependency 'eac_ruby_utils', '~> 0.29'
26
-
27
- # Tests
28
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1'
29
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop do
6
- include_examples 'rubocop_check', ::File.expand_path('../..', __dir__)
7
- end