eac_ruby_gems_utils 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/eac_ruby_gems_utils.rb +2 -0
- data/lib/eac_ruby_gems_utils/gem.rb +32 -6
- data/lib/eac_ruby_gems_utils/gem/command.rb +33 -0
- data/lib/eac_ruby_gems_utils/tests/base.rb +8 -5
- data/lib/eac_ruby_gems_utils/tests/minitest.rb +4 -0
- data/lib/eac_ruby_gems_utils/tests/multiple.rb +8 -2
- data/lib/eac_ruby_gems_utils/version.rb +3 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03ed15ab71663ad44165776c7ad4b0993af1a11b1886cb02118a46d31339f503
|
4
|
+
data.tar.gz: fe497eb1240ae1190394dab833df4814965fe852ce3df4c451edf570c9a7a912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7382fe287f7caeebeb731f0f33085aedaaa97185352088bb68e32fe7ac0443df1810e60562e9be16ebdcb9cfa982e2747654cf6a3ca191862784645dc0699de
|
7
|
+
data.tar.gz: e3fa0d3c3533ef63aaa396d54b40e958c69e6a472c903811d7c7e89c33f565e787cfb75bca150542a268497c31739252f74eed53dd7295d2d519f0adbd474b0b
|
data/lib/eac_ruby_gems_utils.rb
CHANGED
@@ -5,21 +5,21 @@ require 'eac_ruby_utils/envs'
|
|
5
5
|
|
6
6
|
module EacRubyGemsUtils
|
7
7
|
class Gem
|
8
|
+
require_sub __FILE__
|
8
9
|
enable_simple_cache
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
GEMSPEC_EXTNAME = '.gemspec'
|
12
|
+
|
13
|
+
common_constructor :root do
|
12
14
|
@root = ::Pathname.new(root).expand_path
|
13
15
|
end
|
14
16
|
|
15
17
|
def to_s
|
16
|
-
|
18
|
+
name
|
17
19
|
end
|
18
20
|
|
19
21
|
def bundle(*args)
|
20
|
-
::
|
21
|
-
.envvar('BUNDLE_GEMFILE', gemfile_path)
|
22
|
-
.chdir(root)
|
22
|
+
::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile
|
23
23
|
end
|
24
24
|
|
25
25
|
def gemfile_lock_gem_version(gem_name)
|
@@ -30,6 +30,24 @@ module EacRubyGemsUtils
|
|
30
30
|
::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path))
|
31
31
|
end
|
32
32
|
|
33
|
+
def name
|
34
|
+
name_by_gemspec || name_by_path
|
35
|
+
end
|
36
|
+
|
37
|
+
def name_by_gemspec
|
38
|
+
gemspec_path.if_present { |v| v.basename(GEMSPEC_EXTNAME).to_path }
|
39
|
+
end
|
40
|
+
|
41
|
+
def name_by_path
|
42
|
+
root.basename.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
def rake(*args)
|
46
|
+
raise "File \"#{rakefile_path}\" does not exist" unless rakefile_path.exist?
|
47
|
+
|
48
|
+
bundle('exec', 'rake', '--rakefile', rakefile_path, *args)
|
49
|
+
end
|
50
|
+
|
33
51
|
private
|
34
52
|
|
35
53
|
def gemfile_path_uncached
|
@@ -39,5 +57,13 @@ module EacRubyGemsUtils
|
|
39
57
|
def gemfile_lock_path_uncached
|
40
58
|
root.join('Gemfile.lock')
|
41
59
|
end
|
60
|
+
|
61
|
+
def gemspec_path_uncached
|
62
|
+
::Pathname.glob("#{root.to_path}/*#{GEMSPEC_EXTNAME}").first
|
63
|
+
end
|
64
|
+
|
65
|
+
def rakefile_path_uncached
|
66
|
+
root.join('Rakefile')
|
67
|
+
end
|
42
68
|
end
|
43
69
|
end
|
@@ -0,0 +1,33 @@
|
|
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)
|
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
|
@@ -43,13 +43,16 @@ module EacRubyGemsUtils
|
|
43
43
|
|
44
44
|
def result_uncached
|
45
45
|
return RESULT_NONEXISTENT unless elegible?
|
46
|
-
|
46
|
+
|
47
|
+
exec_run_with_log ? RESULT_SUCCESSFUL : RESULT_FAILED
|
48
|
+
end
|
49
|
+
|
50
|
+
def exec_run
|
51
|
+
gem.bundle('exec', *bundle_exec_args).chdir_root.execute
|
47
52
|
end
|
48
53
|
|
49
|
-
def
|
50
|
-
r =
|
51
|
-
gem.bundle('exec', *bundle_exec_args).execute
|
52
|
-
end
|
54
|
+
def exec_run_with_log
|
55
|
+
r = exec_run
|
53
56
|
stdout_cache.write(r[:stdout])
|
54
57
|
stderr_cache.write(r[:stderr])
|
55
58
|
r[:exit_code].zero?
|
@@ -9,13 +9,17 @@ module EacRubyGemsUtils
|
|
9
9
|
class Multiple
|
10
10
|
enable_console_speaker
|
11
11
|
enable_simple_cache
|
12
|
-
common_constructor :gems
|
12
|
+
common_constructor :gems, :options, default: [{}]
|
13
13
|
set_callback :initialize, :after, :run
|
14
14
|
|
15
15
|
def ok?
|
16
16
|
failed_tests.none?
|
17
17
|
end
|
18
18
|
|
19
|
+
def only
|
20
|
+
options[:only]
|
21
|
+
end
|
22
|
+
|
19
23
|
private
|
20
24
|
|
21
25
|
def all_tests_uncached
|
@@ -33,7 +37,9 @@ module EacRubyGemsUtils
|
|
33
37
|
end
|
34
38
|
|
35
39
|
def decorated_gems_uncached
|
36
|
-
|
40
|
+
r = gems
|
41
|
+
r = r.select { |gem| only.include?(gem.name) } if only.present?
|
42
|
+
r.map { |gem| DecoratedGem.new(gem) }
|
37
43
|
end
|
38
44
|
|
39
45
|
def failed_tests_uncached
|
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.5.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: 2020-
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.29'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.29'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: eac_ruby_gem_support
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
executables: []
|
@@ -33,6 +47,7 @@ files:
|
|
33
47
|
- README.rdoc
|
34
48
|
- lib/eac_ruby_gems_utils.rb
|
35
49
|
- lib/eac_ruby_gems_utils/gem.rb
|
50
|
+
- lib/eac_ruby_gems_utils/gem/command.rb
|
36
51
|
- lib/eac_ruby_gems_utils/tests.rb
|
37
52
|
- lib/eac_ruby_gems_utils/tests/base.rb
|
38
53
|
- lib/eac_ruby_gems_utils/tests/minitest.rb
|