eac_ruby_gems_utils 0.9.8 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_gems_utils/version.rb +1 -1
- metadata +8 -52
- data/lib/eac_ruby_gems_utils/gem/command.rb +0 -33
- data/lib/eac_ruby_gems_utils/gem/version_file.rb +0 -41
- data/lib/eac_ruby_gems_utils/gem.rb +0 -97
- data/lib/eac_ruby_gems_utils/tests/base.rb +0 -57
- data/lib/eac_ruby_gems_utils/tests/minitest.rb +0 -25
- data/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +0 -48
- data/lib/eac_ruby_gems_utils/tests/multiple/result.rb +0 -25
- data/lib/eac_ruby_gems_utils/tests/multiple.rb +0 -84
- data/lib/eac_ruby_gems_utils/tests/rspec.rb +0 -21
- data/lib/eac_ruby_gems_utils/tests.rb +0 -9
- data/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +0 -14
- data/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +0 -7
- data/spec/lib/eac_ruby_gems_utils/gem_spec.rb +0 -20
- data/spec/support/mygem/Gemfile +0 -5
- data/spec/support/mygem/Gemfile.lock +0 -19
- data/spec/support/mygem/Rakefile +0 -14
- data/spec/support/mygem/exe/myrunner +0 -5
- data/spec/support/mygem/lib/mygem/version.rb +0 -5
- data/spec/support/mygem/lib/mygem.rb +0 -5
- data/spec/support/mygem/mygem.gemspec +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97186383fb111da8af2e3c38989b41db1ef8c75c1d90872d9793308bfe8ba514
|
4
|
+
data.tar.gz: e8ca7537e7a2407f43eb7a7a574c1be74d9aa6cdbc34bc0decee9b16b2cca8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bfac8001f74cd7798b24e4d640daa12281cc8be06a8a95fde3557f3fdb45dc5970cd2e2b5fde7bd6bcf0cc7f69a8cec181df78a525adf2bba2e3d4571d60708
|
7
|
+
data.tar.gz: 329cbee10a5d8370c74c862eaf9a7fffa186e9aa56cd7bb8fab098646a3f0969f3f4a4011cbc16d6cb78ef76e3fae54f471270d68f3db4be3137d82bed24c982
|
metadata
CHANGED
@@ -1,58 +1,44 @@
|
|
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.10.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:
|
11
|
+
date: 2022-07-04 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: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: eac_ruby_utils
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
19
|
+
version: '0.81'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
26
|
+
version: '0.81'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: eac_ruby_gem_support
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
33
|
+
version: 0.5.1
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
40
|
+
version: 0.5.1
|
41
|
+
description: 'Deprecated: use gem "avm-eac_ruby_base1" instead.'
|
56
42
|
email:
|
57
43
|
executables: []
|
58
44
|
extensions: []
|
@@ -63,29 +49,9 @@ files:
|
|
63
49
|
- Gemfile
|
64
50
|
- README.rdoc
|
65
51
|
- lib/eac_ruby_gems_utils.rb
|
66
|
-
- lib/eac_ruby_gems_utils/gem.rb
|
67
|
-
- lib/eac_ruby_gems_utils/gem/command.rb
|
68
|
-
- lib/eac_ruby_gems_utils/gem/version_file.rb
|
69
|
-
- lib/eac_ruby_gems_utils/tests.rb
|
70
|
-
- lib/eac_ruby_gems_utils/tests/base.rb
|
71
|
-
- lib/eac_ruby_gems_utils/tests/minitest.rb
|
72
|
-
- lib/eac_ruby_gems_utils/tests/multiple.rb
|
73
|
-
- lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
|
74
|
-
- lib/eac_ruby_gems_utils/tests/multiple/result.rb
|
75
|
-
- lib/eac_ruby_gems_utils/tests/rspec.rb
|
76
52
|
- lib/eac_ruby_gems_utils/version.rb
|
77
53
|
- spec/code/rubocop_check_spec.rb
|
78
|
-
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
79
|
-
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
80
|
-
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
81
54
|
- spec/spec_helper.rb
|
82
|
-
- spec/support/mygem/Gemfile
|
83
|
-
- spec/support/mygem/Gemfile.lock
|
84
|
-
- spec/support/mygem/Rakefile
|
85
|
-
- spec/support/mygem/exe/myrunner
|
86
|
-
- spec/support/mygem/lib/mygem.rb
|
87
|
-
- spec/support/mygem/lib/mygem/version.rb
|
88
|
-
- spec/support/mygem/mygem.gemspec
|
89
55
|
homepage: https://github.com/esquilo-azul/eac_ruby_gems_utils
|
90
56
|
licenses:
|
91
57
|
- MIT
|
@@ -110,18 +76,8 @@ requirements: []
|
|
110
76
|
rubygems_version: 3.1.6
|
111
77
|
signing_key:
|
112
78
|
specification_version: 4
|
113
|
-
summary: Utilities for Ruby gems development.
|
79
|
+
summary: Utilities for Ruby gems development (Deprecated).
|
114
80
|
test_files:
|
115
|
-
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
116
|
-
- spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
117
|
-
- spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
118
81
|
- spec/spec_helper.rb
|
119
82
|
- spec/code/rubocop_check_spec.rb
|
120
|
-
- spec/support/mygem/Rakefile
|
121
|
-
- spec/support/mygem/Gemfile
|
122
|
-
- spec/support/mygem/lib/mygem/version.rb
|
123
|
-
- spec/support/mygem/lib/mygem.rb
|
124
|
-
- spec/support/mygem/exe/myrunner
|
125
|
-
- spec/support/mygem/mygem.gemspec
|
126
|
-
- spec/support/mygem/Gemfile.lock
|
127
83
|
- ".rspec"
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/ruby/command'
|
5
|
-
require 'delegate'
|
6
|
-
|
7
|
-
module EacRubyGemsUtils
|
8
|
-
class Gem
|
9
|
-
class Command < ::EacRubyUtils::Ruby::Command
|
10
|
-
attr_reader :gem
|
11
|
-
|
12
|
-
def initialize(gem, command_args, extra_options = {})
|
13
|
-
@gem = gem
|
14
|
-
super(command_args, extra_options.merge(host_env: gem.host_env))
|
15
|
-
end
|
16
|
-
|
17
|
-
# Changes current directory to the gem's directory.
|
18
|
-
def chdir_root
|
19
|
-
chdir(gem.root.to_path)
|
20
|
-
end
|
21
|
-
|
22
|
-
def envvar_gemfile
|
23
|
-
envvar('BUNDLE_GEMFILE', gem.gemfile_path.to_path)
|
24
|
-
end
|
25
|
-
|
26
|
-
protected
|
27
|
-
|
28
|
-
def duplicate(command, extra_options)
|
29
|
-
self.class.new(gem, command, extra_options)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,41 +0,0 @@
|
|
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.lazy.map { |line| line_value(line) }.find { |v| v }
|
14
|
-
end
|
15
|
-
|
16
|
-
def value=(new_value)
|
17
|
-
path.write(new_value_content(new_value))
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
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
|
-
|
27
|
-
def new_value_content(new_value)
|
28
|
-
path.read.each_line
|
29
|
-
.map { |line| new_value_line(line, new_value) }
|
30
|
-
.join
|
31
|
-
end
|
32
|
-
|
33
|
-
def new_value_line(line, new_value)
|
34
|
-
m = VERSION_LINE_PATTERN.match(line)
|
35
|
-
return line unless m
|
36
|
-
|
37
|
-
"#{m[1]}VERSION = '#{new_value}'#{m[3]}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/envs'
|
5
|
-
require 'rubygems'
|
6
|
-
|
7
|
-
module EacRubyGemsUtils
|
8
|
-
class Gem
|
9
|
-
require_sub __FILE__
|
10
|
-
enable_simple_cache
|
11
|
-
|
12
|
-
GEMSPEC_EXTNAME = '.gemspec'
|
13
|
-
|
14
|
-
common_constructor :root, :host_env, default: [nil] do
|
15
|
-
@root = ::Pathname.new(root).expand_path
|
16
|
-
self.host_env ||= ::EacRubyUtils::Envs.local
|
17
|
-
end
|
18
|
-
|
19
|
-
def to_s
|
20
|
-
name
|
21
|
-
end
|
22
|
-
|
23
|
-
def bundle(*args)
|
24
|
-
::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile
|
25
|
-
end
|
26
|
-
|
27
|
-
# @return A [Pathname] array with relative paths from root listed in gemspec's .file directive.
|
28
|
-
def files
|
29
|
-
gemspec.files.map(&:to_pathname)
|
30
|
-
end
|
31
|
-
|
32
|
-
def gemfile_lock_gem_version(gem_name)
|
33
|
-
gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version)
|
34
|
-
end
|
35
|
-
|
36
|
-
def gemfile_lock_content
|
37
|
-
::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path))
|
38
|
-
end
|
39
|
-
|
40
|
-
def name
|
41
|
-
name_by_gemspec || name_by_path
|
42
|
-
end
|
43
|
-
|
44
|
-
def name_by_gemspec
|
45
|
-
gemspec_path.if_present { |v| v.basename(GEMSPEC_EXTNAME).to_path }
|
46
|
-
end
|
47
|
-
|
48
|
-
def name_by_path
|
49
|
-
fullname = root.basename.to_s
|
50
|
-
/\A(.+)(?:-\d+(?:\.\d+)*)\z/.if_match(fullname, false) { |m| m[1] }.if_present(fullname)
|
51
|
-
end
|
52
|
-
|
53
|
-
def namespace_parts
|
54
|
-
name.split('-')
|
55
|
-
end
|
56
|
-
|
57
|
-
def rake(*args)
|
58
|
-
raise "File \"#{rakefile_path}\" does not exist" unless rakefile_path.exist?
|
59
|
-
|
60
|
-
bundle('exec', 'rake', '--rakefile', rakefile_path, *args)
|
61
|
-
end
|
62
|
-
|
63
|
-
def version
|
64
|
-
version_file.value
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def gemfile_path_uncached
|
70
|
-
root.join('Gemfile')
|
71
|
-
end
|
72
|
-
|
73
|
-
def gemfile_lock_path_uncached
|
74
|
-
gemfile_path.basename_sub { |b| "#{b}.lock" }
|
75
|
-
end
|
76
|
-
|
77
|
-
def gemspec_uncached
|
78
|
-
::Gem::Specification.load(gemspec_path.to_path)
|
79
|
-
end
|
80
|
-
|
81
|
-
def gemspec_path_uncached
|
82
|
-
::Pathname.glob("#{root.to_path}/*#{GEMSPEC_EXTNAME}").first
|
83
|
-
end
|
84
|
-
|
85
|
-
def rakefile_path_uncached
|
86
|
-
root.join('Rakefile')
|
87
|
-
end
|
88
|
-
|
89
|
-
def version_file_uncached
|
90
|
-
::EacRubyGemsUtils::Gem::VersionFile.new(version_file_path)
|
91
|
-
end
|
92
|
-
|
93
|
-
def version_file_path_uncached
|
94
|
-
root.join('lib', *namespace_parts, 'version.rb')
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/fs/logs'
|
5
|
-
require 'eac_ruby_utils/listable'
|
6
|
-
|
7
|
-
module EacRubyGemsUtils
|
8
|
-
module Tests
|
9
|
-
class Base
|
10
|
-
include ::EacRubyUtils::Listable
|
11
|
-
|
12
|
-
enable_simple_cache
|
13
|
-
lists.add_string :result, :failed, :nonexistent, :successful
|
14
|
-
|
15
|
-
common_constructor :gem
|
16
|
-
|
17
|
-
def elegible?
|
18
|
-
dependency_present? && gem.root.join(test_directory).exist?
|
19
|
-
end
|
20
|
-
|
21
|
-
def dependency_present?
|
22
|
-
gem.gemfile_path.exist? && gem.gemfile_lock_gem_version(dependency_gem).present?
|
23
|
-
end
|
24
|
-
|
25
|
-
def name
|
26
|
-
self.class.name.demodulize.gsub(/Test\z/, '')
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_s
|
30
|
-
"#{gem}[#{name}]"
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def logs_uncached
|
36
|
-
::EacRubyUtils::Fs::Logs.new.add(:stdout).add(:stderr)
|
37
|
-
end
|
38
|
-
|
39
|
-
def result_uncached
|
40
|
-
return RESULT_NONEXISTENT unless elegible?
|
41
|
-
|
42
|
-
exec_run_with_log ? RESULT_SUCCESSFUL : RESULT_FAILED
|
43
|
-
end
|
44
|
-
|
45
|
-
def exec_run
|
46
|
-
gem.bundle('exec', *bundle_exec_args).chdir_root.execute
|
47
|
-
end
|
48
|
-
|
49
|
-
def exec_run_with_log
|
50
|
-
r = exec_run
|
51
|
-
logs[:stdout].write(r[:stdout])
|
52
|
-
logs[:stderr].write(r[:stderr])
|
53
|
-
r[:exit_code].zero?
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_gems_utils/tests/base'
|
4
|
-
|
5
|
-
module EacRubyGemsUtils
|
6
|
-
module Tests
|
7
|
-
class Minitest < ::EacRubyGemsUtils::Tests::Base
|
8
|
-
def bundle_exec_args
|
9
|
-
%w[rake test]
|
10
|
-
end
|
11
|
-
|
12
|
-
def dependency_gem
|
13
|
-
'minitest'
|
14
|
-
end
|
15
|
-
|
16
|
-
def elegible?
|
17
|
-
super && gem.rakefile_path.exist?
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_directory
|
21
|
-
'test'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module EacRubyGemsUtils
|
6
|
-
module Tests
|
7
|
-
class Multiple
|
8
|
-
class DecoratedGem < ::SimpleDelegator
|
9
|
-
enable_speaker
|
10
|
-
|
11
|
-
def prepare
|
12
|
-
return unless gemfile_path.exist?
|
13
|
-
|
14
|
-
log('running "bundle install"...')
|
15
|
-
return if bundle('install').execute.fetch(:exit_code).zero?
|
16
|
-
|
17
|
-
unless can_remove_gemfile_lock?
|
18
|
-
raise '"bundle install" failed and the Gemfile.lock is part of gem' \
|
19
|
-
'(Should be changed by developer)'
|
20
|
-
end
|
21
|
-
|
22
|
-
prepare_with_removable_gemfile_lock
|
23
|
-
end
|
24
|
-
|
25
|
-
def tests
|
26
|
-
[::EacRubyGemsUtils::Tests::Minitest.new(__getobj__),
|
27
|
-
::EacRubyGemsUtils::Tests::Rspec.new(__getobj__)]
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def log(message)
|
33
|
-
infov self, message
|
34
|
-
end
|
35
|
-
|
36
|
-
def prepare_with_removable_gemfile_lock
|
37
|
-
log('"bundle install" failed, removing Gemfile.lock and trying again...')
|
38
|
-
gemfile_lock_path.unlink if gemfile_lock_path.exist?
|
39
|
-
bundle('install').execute!
|
40
|
-
end
|
41
|
-
|
42
|
-
def can_remove_gemfile_lock?
|
43
|
-
!files.include?(gemfile_lock_path.relative_path_from(root))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacRubyGemsUtils
|
4
|
-
module Tests
|
5
|
-
class Multiple
|
6
|
-
class Result
|
7
|
-
common_constructor :result
|
8
|
-
|
9
|
-
COLORS = {
|
10
|
-
::EacRubyGemsUtils::Tests::Base::RESULT_FAILED => :red,
|
11
|
-
::EacRubyGemsUtils::Tests::Base::RESULT_NONEXISTENT => :white,
|
12
|
-
::EacRubyGemsUtils::Tests::Base::RESULT_SUCCESSFUL => :green
|
13
|
-
}.freeze
|
14
|
-
|
15
|
-
def tag
|
16
|
-
result.to_s.send(color)
|
17
|
-
end
|
18
|
-
|
19
|
-
def color
|
20
|
-
COLORS.fetch(result)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_gems_utils/tests/minitest'
|
4
|
-
require 'eac_ruby_gems_utils/tests/rspec'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
|
-
|
7
|
-
module EacRubyGemsUtils
|
8
|
-
module Tests
|
9
|
-
class Multiple
|
10
|
-
require_sub __FILE__
|
11
|
-
enable_speaker
|
12
|
-
enable_simple_cache
|
13
|
-
common_constructor :gems, :options, default: [{}]
|
14
|
-
set_callback :initialize, :after, :run
|
15
|
-
|
16
|
-
def ok?
|
17
|
-
failed_tests.none?
|
18
|
-
end
|
19
|
-
|
20
|
-
def only
|
21
|
-
options[:only]
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def all_tests_uncached
|
27
|
-
decorated_gems.flat_map(&:tests)
|
28
|
-
end
|
29
|
-
|
30
|
-
def clear_logs
|
31
|
-
all_tests.each do |test|
|
32
|
-
test.logs.remove_all
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def prepare_all_gems
|
37
|
-
infom 'Preparing all gems...'
|
38
|
-
decorated_gems.each(&:prepare)
|
39
|
-
end
|
40
|
-
|
41
|
-
def decorated_gems_uncached
|
42
|
-
r = gems
|
43
|
-
r = r.select { |gem| only.include?(gem.name) } if only.present?
|
44
|
-
r.map { |gem| DecoratedGem.new(gem) }
|
45
|
-
end
|
46
|
-
|
47
|
-
def failed_tests_uncached
|
48
|
-
all_tests.select { |r| r.result == ::EacRubyGemsUtils::Tests::Base::RESULT_FAILED }
|
49
|
-
end
|
50
|
-
|
51
|
-
def final_results_banner
|
52
|
-
if failed_tests.any?
|
53
|
-
warn 'Some test did not pass:'
|
54
|
-
failed_tests.each do |test|
|
55
|
-
infov ' * Test', test
|
56
|
-
info test.logs.truncate_all
|
57
|
-
end
|
58
|
-
else
|
59
|
-
success 'All tests passed'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def run
|
64
|
-
start_banner
|
65
|
-
prepare_all_gems
|
66
|
-
test_all_gems
|
67
|
-
final_results_banner
|
68
|
-
ensure
|
69
|
-
clear_logs
|
70
|
-
end
|
71
|
-
|
72
|
-
def start_banner
|
73
|
-
infov 'Gems to test', decorated_gems.count
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_all_gems
|
77
|
-
infom 'Running tests...'
|
78
|
-
all_tests.each do |test|
|
79
|
-
infov test, Result.new(test.result).tag
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_gems_utils/tests/base'
|
4
|
-
|
5
|
-
module EacRubyGemsUtils
|
6
|
-
module Tests
|
7
|
-
class Rspec < ::EacRubyGemsUtils::Tests::Base
|
8
|
-
def bundle_exec_args
|
9
|
-
%w[rspec]
|
10
|
-
end
|
11
|
-
|
12
|
-
def dependency_gem
|
13
|
-
'rspec-core'
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_directory
|
17
|
-
'spec'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,14 +0,0 @@
|
|
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
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_gems_utils/gem'
|
4
|
-
|
5
|
-
::RSpec.describe ::EacRubyGemsUtils::Gem do
|
6
|
-
let(:mygem_path) { ::Pathname.new(__dir__).expand_path.parent.parent.join('support', 'mygem') }
|
7
|
-
let(:mygem) { described_class.new(mygem_path) }
|
8
|
-
|
9
|
-
describe '#bundle' do
|
10
|
-
specify do
|
11
|
-
expect(mygem.bundle('exec', 'myrunner').execute!).to include('My Runner')
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#rake' do
|
16
|
-
specify do
|
17
|
-
expect(mygem.rake('mygem:stub').execute!).to include('Stub!')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/spec/support/mygem/Gemfile
DELETED
data/spec/support/mygem/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'bundler/setup'
|
5
|
-
rescue LoadError
|
6
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
-
end
|
8
|
-
|
9
|
-
namespace :mygem do
|
10
|
-
desc 'A stub task.'
|
11
|
-
task :stub do
|
12
|
-
puts 'Stub!'
|
13
|
-
end
|
14
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = 'mygem'
|
7
|
-
s.version = '1.0.0'
|
8
|
-
s.authors = ['Esquilo Azul Company']
|
9
|
-
s.summary = 'Stub gem.'
|
10
|
-
|
11
|
-
s.files = Dir['{exe,lib}/**/*', 'Gemfile', 'Rakefile']
|
12
|
-
s.bindir = 'exe'
|
13
|
-
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
14
|
-
|
15
|
-
s.add_dependency 'rake'
|
16
|
-
end
|