eac_ruby_gem_support 0.1.0 → 0.3.0

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: '0771687402723bdb4db72b4589b556e6d8d08bbe5335837bf40881b54f8b9654'
4
- data.tar.gz: 84cc79cb9748407f8506248a9a120186139b0160f5ed14eefe7db3b3fb511fa6
3
+ metadata.gz: 4a68c6c81f0347a649ef8c9e77653d5119b060d0fd288bc60a926ca94d4d38e4
4
+ data.tar.gz: f54ede8dae8455aa64923620841a7cfa4affc93f54f7e1ae36d4246396a0f6ea
5
5
  SHA512:
6
- metadata.gz: 65fd899bc5cf37a1af70f0e02dfb83ff57267dcb59b7784f12866da974c871ade490c9e26f9c56aa7fbbaf0645b4070f1fcada064bb9b1bd0083e459ba26d361
7
- data.tar.gz: f3248c3613af488add4105d8195c90729296cf6ea2f348a74ffe525d4ccdb675cf5c627843d294281157f1e9340c8896a0d3dc6afa513cc9d41ada579dba4857
6
+ metadata.gz: 3d3f9ca90a5683821f98d603cef434614b41b7c1879cd0cd92452657e632667dee069640f72833f74a7b50dba93b5e717c02e971b601aa6e70f703293527b3b2
7
+ data.tar.gz: 3c886d153dc873c94c3d29f2aa40a5ee5084b1a35fb65e37d280f9e61c094de85f00e0ddfbf8920281c89a4e36eaebae4b3f95fabd6028a7b74c29b89660c24a
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemSupport
4
- require 'eac_ruby_gems_support/spec/examples/rubocop_check'
5
- require 'eac_ruby_gems_support/version'
4
+ require 'eac_ruby_gem_support/rspec'
5
+ require 'eac_ruby_gem_support/version'
6
6
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRubyGemSupport
6
+ module Rspec
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'tmpdir'
5
+ require 'tempfile'
6
+
7
+ module EacRubyGemSupport
8
+ module Rspec
9
+ module Helpers
10
+ module Filesystem
11
+ def purge_temp_files
12
+ ::FileUtils.rm_rf(temp_set.pop) while temp_set.any?
13
+ end
14
+
15
+ # @return [Pathname]
16
+ def temp_copy(source_path)
17
+ source_path = to_pathname(source_path)
18
+ if source_path.file?
19
+ temp_file_copy(source_path)
20
+ elsif source_path.directory?
21
+ temp_dir_copy(source_path)
22
+ else
23
+ raise "Source path \"#{source_path}\" is not a file or directory"
24
+ end
25
+ end
26
+
27
+ # @return [Pathname]
28
+ def temp_dir(*mktmpdir_args)
29
+ add_to_temp_set(::Dir.mktmpdir(*mktmpdir_args))
30
+ end
31
+
32
+ # @return [Pathname]
33
+ def temp_dir_copy(source_path)
34
+ r = temp_dir
35
+ ::FileUtils.cp_r("#{source_path}/.", r.to_path)
36
+ r
37
+ end
38
+
39
+ # @return [Pathname]
40
+ def temp_file(*tempfile_args)
41
+ file = ::Tempfile.new(*tempfile_args)
42
+ path = file.path
43
+ file.close
44
+ add_to_temp_set(path)
45
+ end
46
+
47
+ # @return [Pathname]
48
+ def temp_file_copy(source_path)
49
+ r = temp_file
50
+ ::FileUtils.cp(to_pathname(source_path).to_path, r.to_path)
51
+ r
52
+ end
53
+
54
+ # @return [Pathname]
55
+ def to_pathname(path)
56
+ path.is_a?(::Pathname) ? path : ::Pathname.new(path.to_s)
57
+ end
58
+
59
+ private
60
+
61
+ def add_to_temp_set(path)
62
+ r = to_pathname(path)
63
+ temp_set << r
64
+ r
65
+ end
66
+
67
+ def temp_set
68
+ @temp_set ||= []
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_gem_support/rspec/helpers/filesystem'
5
+ require 'eac_ruby_gem_support/rspec/specs/rubocop'
6
+ require 'tmpdir'
7
+
8
+ module EacRubyGemSupport
9
+ module Rspec
10
+ module SetupInclude
11
+ common_concern do
12
+ include ::EacRubyGemSupport::Rspec::Specs::Rubocop
13
+ end
14
+
15
+ class << self
16
+ def setup(setup_obj)
17
+ setup_load_path(setup_obj)
18
+ setup_example_persistence(setup_obj)
19
+ setup_filesystem_helper(setup_obj)
20
+ end
21
+
22
+ private
23
+
24
+ def setup_filesystem_helper(setup_obj)
25
+ setup_obj.rspec_config.include ::EacRubyGemSupport::Rspec::Helpers::Filesystem
26
+ setup_obj.rspec_config.after(:each) { purge_temp_files }
27
+ end
28
+
29
+ def setup_load_path(setup_obj)
30
+ $LOAD_PATH.push setup_obj.app_root_path.join('lib').to_path
31
+ end
32
+
33
+ def setup_example_persistence(setup_obj)
34
+ setup_obj.rspec_config.example_status_persistence_file_path =
35
+ setup_obj.example_persistence_path.to_path
36
+ end
37
+ end
38
+
39
+ # @return [Pathname]
40
+ def example_persistence_path
41
+ ::File.join(::Dir.tmpdir, app_root_path.basename.to_path.variableize).to_pathname
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec'
4
+ require 'rubocop'
5
+
6
+ module EacRubyGemSupport
7
+ module Rspec
8
+ module Specs
9
+ module Rubocop
10
+ def describe_rubocop # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
11
+ this = self
12
+ ::RSpec.describe ::RuboCop do
13
+ before do
14
+ ::RuboCop::ConfigLoader.ignore_parent_exclusion = true
15
+ end
16
+
17
+ let(:root_path) { this.app_root_path }
18
+ let(:config_store) do
19
+ r = ::RuboCop::ConfigStore.new
20
+ r.for(root_path)
21
+ r
22
+ end
23
+ let(:runner) { ::RuboCop::Runner.new({}, config_store) }
24
+
25
+ it 'rubocop return ok' do
26
+ expect(::Dir.chdir(root_path) { runner.run([]) }).to eq(true)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemSupport
4
- VERSION = '0.1.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_gem_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.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-03-21 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: eac_ruby_utils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.70'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.70'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +87,10 @@ extensions: []
73
87
  extra_rdoc_files: []
74
88
  files:
75
89
  - lib/eac_ruby_gem_support.rb
76
- - lib/eac_ruby_gem_support/spec/examples/rubocop_check.rb
90
+ - lib/eac_ruby_gem_support/rspec.rb
91
+ - lib/eac_ruby_gem_support/rspec/helpers/filesystem.rb
92
+ - lib/eac_ruby_gem_support/rspec/setup_include.rb
93
+ - lib/eac_ruby_gem_support/rspec/specs/rubocop.rb
77
94
  - lib/eac_ruby_gem_support/version.rb
78
95
  homepage: https://github.com/esquilo-azul/eac_ruby_gem_support
79
96
  licenses: []
@@ -94,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
111
  - !ruby/object:Gem::Version
95
112
  version: '0'
96
113
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.7.7
114
+ rubygems_version: 3.1.6
99
115
  signing_key:
100
116
  specification_version: 4
101
117
  summary: Development support for Ruby' Gem.
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubocop'
4
-
5
- RSpec.shared_examples 'rubocop_check' do |root_path|
6
- before do
7
- ::RuboCop::ConfigLoader.ignore_parent_exclusion = true
8
- end
9
-
10
- let(:root_path) { root_path }
11
- let(:config_store) do
12
- r = ::RuboCop::ConfigStore.new
13
- r.for(root_path)
14
- r
15
- end
16
- let(:runner) { ::RuboCop::Runner.new({}, config_store) }
17
-
18
- it 'rubocop return ok' do
19
- expect(runner.run([])).to eq(true)
20
- end
21
- end