eac_tools 0.84.1 → 0.84.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -23
- data/lib/eac_tools/version.rb +1 -1
- data/sub/eac_git/Gemfile +2 -2
- data/sub/eac_git/eac_git.gemspec +3 -3
- data/sub/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +1 -1
- data/sub/eac_git/lib/eac_git/local/dirty_files.rb +13 -2
- data/sub/eac_git/lib/eac_git/local/remotes.rb +1 -1
- data/sub/eac_git/lib/eac_git/local/subrepo/config.rb +2 -2
- data/sub/eac_git/lib/eac_git/local.rb +3 -3
- data/sub/eac_git/lib/eac_git/remote.rb +2 -2
- data/sub/eac_git/lib/eac_git/remote_like/ls_result.rb +2 -2
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/directory.rb +36 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/file.rb +22 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/fs_object.rb +27 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/repository.rb +34 -0
- data/sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb +3 -45
- data/sub/eac_git/lib/eac_git/version.rb +1 -1
- data/sub/eac_git/spec/lib/eac_git/executables_spec.rb +1 -1
- data/sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +2 -2
- data/sub/eac_git/spec/lib/eac_git/local/commit_spec.rb +4 -4
- data/sub/eac_git/spec/lib/eac_git/local/dirty_files_spec.rb +20 -0
- data/sub/eac_git/spec/rubocop_spec.rb +1 -1
- data/sub/eac_git/spec/spec_helper.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 426bb81a4b1393fbdb489ab64fd85fcc811f17ca1fee7404bb84f5993d7ec5cd
|
4
|
+
data.tar.gz: 259cfc5f414750cec4069beae7a82bfec4ec42af55ef63f849ddb58b878f160f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4008c654fd75e3cdabe7a4fe696b0f8984d8ef3e2804be898e89685c3bdf27554c09d500d1ec40737585328786b09de496b5665d9dab7c96773074da2cc5b12
|
7
|
+
data.tar.gz: 636c07ffd3fcead12c1c3142d170832b93ac6abd04b5e598192f049348406d5da7d72ccdfd80c0d072bc3a38fdc21b5db9fc17b7fad086875b24f25ed41d3d3d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.84.
|
4
|
+
eac_tools (0.84.2)
|
5
5
|
avm (~> 0.84, >= 0.84.2)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.21)
|
7
7
|
avm-eac_generic_base0 (~> 0.12, >= 0.12.2)
|
@@ -143,8 +143,8 @@ PATH
|
|
143
143
|
PATH
|
144
144
|
remote: sub/eac_git
|
145
145
|
specs:
|
146
|
-
eac_git (0.
|
147
|
-
eac_ruby_utils (~> 0.
|
146
|
+
eac_git (0.15.0)
|
147
|
+
eac_ruby_utils (~> 0.120)
|
148
148
|
parseconfig (~> 1.1, >= 1.1.2)
|
149
149
|
|
150
150
|
GEM
|
@@ -156,7 +156,7 @@ GEM
|
|
156
156
|
minitest (>= 5.1)
|
157
157
|
tzinfo (~> 2.0)
|
158
158
|
zeitwerk (~> 2.3)
|
159
|
-
addressable (2.8.
|
159
|
+
addressable (2.8.6)
|
160
160
|
public_suffix (>= 2.0.2, < 6.0)
|
161
161
|
aranha-parsers (0.22.0)
|
162
162
|
activesupport (>= 4.0.0)
|
@@ -215,10 +215,10 @@ GEM
|
|
215
215
|
parslet (~> 2.0)
|
216
216
|
curb (0.9.11)
|
217
217
|
diff-lcs (1.5.0)
|
218
|
-
eac_cli (0.
|
218
|
+
eac_cli (0.40.0)
|
219
219
|
colorize (~> 0.8, >= 0.8.1)
|
220
220
|
eac_config (~> 0.14, >= 0.14.1)
|
221
|
-
eac_ruby_utils (~> 0.
|
221
|
+
eac_ruby_utils (~> 0.120)
|
222
222
|
tty-table (~> 0.12)
|
223
223
|
eac_config (0.14.1)
|
224
224
|
addressable (~> 2.8, >= 2.8.5)
|
@@ -226,22 +226,22 @@ GEM
|
|
226
226
|
eac_docker (0.7.0)
|
227
227
|
eac_ruby_utils (~> 0.112)
|
228
228
|
eac_templates (~> 0.3, >= 0.3.2)
|
229
|
-
eac_envs-http (0.
|
230
|
-
eac_fs (~> 0.
|
231
|
-
eac_ruby_utils (~> 0.
|
232
|
-
faraday (~> 2.7, >= 2.7.
|
229
|
+
eac_envs-http (0.5.1)
|
230
|
+
eac_fs (~> 0.17)
|
231
|
+
eac_ruby_utils (~> 0.120)
|
232
|
+
faraday (~> 2.7, >= 2.7.12)
|
233
233
|
faraday-follow_redirects (~> 0.3)
|
234
234
|
faraday-gzip (~> 0.1)
|
235
235
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
236
236
|
faraday-retry (~> 2.2)
|
237
|
-
eac_fs (0.
|
237
|
+
eac_fs (0.17.0)
|
238
238
|
content-type (~> 0.0, >= 0.0.2)
|
239
|
-
eac_ruby_utils (~> 0.
|
239
|
+
eac_ruby_utils (~> 0.120)
|
240
240
|
ruby-filemagic (~> 0.7, >= 0.7.3)
|
241
|
-
eac_rest (0.
|
242
|
-
eac_envs-http (~> 0.
|
241
|
+
eac_rest (0.12.0)
|
242
|
+
eac_envs-http (~> 0.5)
|
243
243
|
eac_fs (~> 0.16)
|
244
|
-
eac_ruby_utils (~> 0.
|
244
|
+
eac_ruby_utils (~> 0.120)
|
245
245
|
eac_ruby_base0 (0.19.0)
|
246
246
|
avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
|
247
247
|
eac_cli (~> 0.35)
|
@@ -262,7 +262,7 @@ GEM
|
|
262
262
|
eac_templates (0.5.0)
|
263
263
|
eac_config (~> 0.12)
|
264
264
|
eac_ruby_utils (~> 0.112)
|
265
|
-
faraday (2.
|
265
|
+
faraday (2.8.0)
|
266
266
|
base64
|
267
267
|
faraday-net_http (>= 2.0, < 3.1)
|
268
268
|
ruby2_keywords (>= 0.0.4)
|
@@ -284,7 +284,7 @@ GEM
|
|
284
284
|
htmlbeautifier (1.4.2)
|
285
285
|
i18n (1.14.1)
|
286
286
|
concurrent-ruby (~> 1.0)
|
287
|
-
json (2.
|
287
|
+
json (2.7.1)
|
288
288
|
language_server-protocol (3.17.0.3)
|
289
289
|
minitar (0.9)
|
290
290
|
minitest (5.20.0)
|
@@ -295,7 +295,7 @@ GEM
|
|
295
295
|
ofx-parser (1.1.0)
|
296
296
|
hpricot (>= 0.6)
|
297
297
|
os (1.1.4)
|
298
|
-
parallel (1.
|
298
|
+
parallel (1.24.0)
|
299
299
|
parseconfig (1.1.2)
|
300
300
|
parser (3.2.2.4)
|
301
301
|
ast (~> 2.4.1)
|
@@ -308,7 +308,7 @@ GEM
|
|
308
308
|
rack (3.0.8)
|
309
309
|
rainbow (3.1.1)
|
310
310
|
rchardet (1.8.0)
|
311
|
-
regexp_parser (2.8.
|
311
|
+
regexp_parser (2.8.3)
|
312
312
|
rexml (3.2.6)
|
313
313
|
rouge (3.30.0)
|
314
314
|
rspec (3.12.0)
|
@@ -324,7 +324,7 @@ GEM
|
|
324
324
|
diff-lcs (>= 1.2.0, < 2.0)
|
325
325
|
rspec-support (~> 3.12.0)
|
326
326
|
rspec-support (3.12.1)
|
327
|
-
rubocop (1.
|
327
|
+
rubocop (1.59.0)
|
328
328
|
json (~> 2.3)
|
329
329
|
language_server-protocol (>= 3.17.0)
|
330
330
|
parallel (~> 1.10)
|
@@ -332,7 +332,7 @@ GEM
|
|
332
332
|
rainbow (>= 2.2.2, < 4.0)
|
333
333
|
regexp_parser (>= 1.8, < 3.0)
|
334
334
|
rexml (>= 3.2.5, < 4.0)
|
335
|
-
rubocop-ast (>= 1.
|
335
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
336
336
|
ruby-progressbar (~> 1.7)
|
337
337
|
unicode-display_width (>= 2.4.0, < 3.0)
|
338
338
|
rubocop-ast (1.30.0)
|
@@ -341,7 +341,7 @@ GEM
|
|
341
341
|
rubocop (~> 1.41)
|
342
342
|
rubocop-factory_bot (2.24.0)
|
343
343
|
rubocop (~> 1.33)
|
344
|
-
rubocop-rails (2.
|
344
|
+
rubocop-rails (2.23.0)
|
345
345
|
activesupport (>= 4.2.0)
|
346
346
|
rack (>= 1.1)
|
347
347
|
rubocop (>= 1.33.0, < 2.0)
|
@@ -359,7 +359,7 @@ GEM
|
|
359
359
|
unicode_utils (~> 1.4)
|
360
360
|
strings-ansi (0.2.0)
|
361
361
|
tty-color (0.6.0)
|
362
|
-
tty-screen (0.8.
|
362
|
+
tty-screen (0.8.2)
|
363
363
|
tty-table (0.12.0)
|
364
364
|
pastel (~> 0.8)
|
365
365
|
strings (~> 0.2.0)
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/eac_git/Gemfile
CHANGED
@@ -4,5 +4,5 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
local_gemfile =
|
8
|
-
eval_gemfile local_gemfile if
|
7
|
+
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
|
8
|
+
eval_gemfile local_gemfile if File.exist?(local_gemfile)
|
data/sub/eac_git/eac_git.gemspec
CHANGED
@@ -11,10 +11,10 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = 'Put here de description.'
|
12
12
|
|
13
13
|
s.files = Dir['{lib,vendor}/**/*']
|
14
|
+
s.required_ruby_version = '>= 2.7'
|
14
15
|
|
15
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.120'
|
16
17
|
s.add_dependency 'parseconfig', '~> 1.1', '>= 1.1.2'
|
17
18
|
|
18
|
-
s.add_development_dependency '
|
19
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.9'
|
20
20
|
end
|
@@ -6,6 +6,7 @@ require 'ostruct'
|
|
6
6
|
module EacGit
|
7
7
|
class Local
|
8
8
|
module DirtyFiles
|
9
|
+
QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
|
9
10
|
STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
|
10
11
|
|
11
12
|
def dirty?
|
@@ -26,12 +27,22 @@ module EacGit
|
|
26
27
|
|
27
28
|
private
|
28
29
|
|
30
|
+
# @param line [String]
|
31
|
+
# @return [Struct]
|
29
32
|
def parse_status_line(line)
|
30
33
|
STATUS_LINE_PATTERN.if_match(line) do |m|
|
31
|
-
|
32
|
-
|
34
|
+
path = parse_status_line_path(m[3]).to_pathname
|
35
|
+
{ index: m[1], worktree: m[2], path: path, absolute_path: path.expand_path(root_path) }
|
36
|
+
.to_struct
|
33
37
|
end
|
34
38
|
end
|
39
|
+
|
40
|
+
# @param path [String]
|
41
|
+
# @return [String]
|
42
|
+
def parse_status_line_path(path)
|
43
|
+
m = QUOTED_PATH_PATTERN.match(path)
|
44
|
+
m ? m[1] : path
|
45
|
+
end
|
35
46
|
end
|
36
47
|
end
|
37
48
|
end
|
@@ -24,7 +24,7 @@ module EacGit
|
|
24
24
|
self.values = values.with_indifferent_access
|
25
25
|
end
|
26
26
|
|
27
|
-
MAPPING.
|
27
|
+
MAPPING.each_key do |method_name|
|
28
28
|
define_method(method_name) do
|
29
29
|
values[MAPPING.fetch(method_name)]
|
30
30
|
end
|
@@ -35,7 +35,7 @@ module EacGit
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def to_content
|
38
|
-
"[subrepo]\n" + MAPPING.map { |k, v| " #{v} = #{send(k)}\n" }.join
|
38
|
+
"[subrepo]\n" + MAPPING.map { |k, v| " #{v} = #{send(k)}\n" }.join # rubocop:disable Style/StringConcatenation
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -38,7 +38,7 @@ module EacGit
|
|
38
38
|
::EacGit::Local::Branch.new(self, name)
|
39
39
|
end
|
40
40
|
|
41
|
-
def commit(ref, required = false)
|
41
|
+
def commit(ref, required = false) # rubocop:disable Style/OptionalBooleanParameter
|
42
42
|
rev_parse(ref, required).if_present { |v| ::EacGit::Local::Commit.new(self, v) }
|
43
43
|
end
|
44
44
|
|
@@ -71,7 +71,7 @@ module EacGit
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# @return [EacGit::Local::Commit
|
74
|
-
def head(required = true)
|
74
|
+
def head(required = true) # rubocop:disable Style/OptionalBooleanParameter
|
75
75
|
commit(HEAD_REFERENCE, required)
|
76
76
|
end
|
77
77
|
|
@@ -94,7 +94,7 @@ module EacGit
|
|
94
94
|
raise "#{root_path}: #{message}"
|
95
95
|
end
|
96
96
|
|
97
|
-
def rev_parse(ref, required = false)
|
97
|
+
def rev_parse(ref, required = false) # rubocop:disable Style/OptionalBooleanParameter
|
98
98
|
r = command('rev-parse', ref).execute!(exit_outputs: { 128 => nil, 32_768 => nil })
|
99
99
|
r.strip! if r.is_a?(String)
|
100
100
|
return r if r.present?
|
@@ -12,8 +12,8 @@ module EacGit
|
|
12
12
|
common_constructor :uri
|
13
13
|
|
14
14
|
# @return [EacRubyUtils::Envs::Command
|
15
|
-
def git_command(
|
16
|
-
::EacGit::Executables.git.command(
|
15
|
+
def git_command(...)
|
16
|
+
::EacGit::Executables.git.command(...)
|
17
17
|
end
|
18
18
|
|
19
19
|
# @return [String]
|
@@ -8,13 +8,13 @@ module EacGit
|
|
8
8
|
class << self
|
9
9
|
def by_ls_remote_command_output(output)
|
10
10
|
new(
|
11
|
-
output.each_line.map { |line| line.strip.split(/\s+/) }.
|
11
|
+
output.each_line.map { |line| line.strip.split(/\s+/) }.to_h { |x| [x[1], x[0]] } # rubocop:disable Style/MapToHash
|
12
12
|
)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
common_constructor :hashes
|
17
|
-
delegate :fetch, :
|
17
|
+
delegate :fetch, :[], :count, :any?, :empty?, to: :hashes
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module EacGit
|
7
|
+
module Rspec
|
8
|
+
module StubbedGitLocalRepo
|
9
|
+
class Directory < ::EacGit::Rspec::StubbedGitLocalRepo::FsObject
|
10
|
+
# @return [self]
|
11
|
+
def create
|
12
|
+
::FileUtils.mkdir_p(path)
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [self]
|
17
|
+
def delete
|
18
|
+
::FileUtils.rm_rf(path)
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param subpath [Array<String>]
|
23
|
+
# @return [EacGit::Rspec::StubbedGitLocalRepo::Directory]
|
24
|
+
def directory(*subpath)
|
25
|
+
git.directory(*self.subpath, *subpath)
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param subpath [Array<String>]
|
29
|
+
# @return [EacGit::Rspec::StubbedGitLocalRepo::File]
|
30
|
+
def file(*subpath)
|
31
|
+
git.file(*self.subpath, *subpath)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module EacGit
|
7
|
+
module Rspec
|
8
|
+
module StubbedGitLocalRepo
|
9
|
+
class File < ::EacGit::Rspec::StubbedGitLocalRepo::FsObject
|
10
|
+
def touch
|
11
|
+
::FileUtils.touch(path.to_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
path.unlink
|
16
|
+
end
|
17
|
+
|
18
|
+
delegate :write, to: :path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacGit
|
6
|
+
module Rspec
|
7
|
+
module StubbedGitLocalRepo
|
8
|
+
class FsObject
|
9
|
+
# @!attribute [r] git
|
10
|
+
# @param git [EacGit::Rspec::StubbedGitLocalRepo::Repository]
|
11
|
+
|
12
|
+
# @!attribute [r] subpath
|
13
|
+
# @param git [Array<String>]
|
14
|
+
|
15
|
+
# @!method initialize(git, subpath)
|
16
|
+
# @param git [EacGit::Rspec::StubbedGitLocalRepo::Repository]
|
17
|
+
# @param subpath [Array<String>
|
18
|
+
common_constructor :git, :subpath
|
19
|
+
|
20
|
+
# @return [Pathname]
|
21
|
+
def path
|
22
|
+
git.root_path.join(*subpath)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/local'
|
4
|
+
require 'eac_git/rspec/stubbed_git_local_repo/directory'
|
5
|
+
require 'eac_git/rspec/stubbed_git_local_repo/file'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
require 'securerandom'
|
8
|
+
|
9
|
+
module EacGit
|
10
|
+
module Rspec
|
11
|
+
module StubbedGitLocalRepo
|
12
|
+
class Repository < ::EacGit::Local
|
13
|
+
# @return [EacGit::Rspec::StubbedGitLocalRepo::Directory]
|
14
|
+
def directory(*subpath)
|
15
|
+
::EacGit::Rspec::StubbedGitLocalRepo::Directory.new(self, subpath)
|
16
|
+
end
|
17
|
+
|
18
|
+
def file(*subpath)
|
19
|
+
::EacGit::Rspec::StubbedGitLocalRepo::File.new(self, subpath)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [EacGit::Local::Commit
|
23
|
+
def random_commit
|
24
|
+
content = ::SecureRandom.hex
|
25
|
+
file = "#{content}.txt"
|
26
|
+
file(file).write(content)
|
27
|
+
command('add', file).execute!
|
28
|
+
command('commit', '-m', "Random commit: #{file}.").execute!
|
29
|
+
head
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,18 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_git/local'
|
4
3
|
require 'eac_ruby_utils/envs'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'securerandom'
|
7
4
|
require 'tmpdir'
|
8
5
|
|
9
6
|
module EacGit
|
10
7
|
module Rspec
|
11
8
|
module StubbedGitLocalRepo
|
12
|
-
def stubbed_git_local_repo(bare = false)
|
9
|
+
def stubbed_git_local_repo(bare = false) # rubocop:disable Style/OptionalBooleanParameter
|
13
10
|
path = ::Dir.mktmpdir
|
14
11
|
::EacRubyUtils::Envs.local.command(stubbed_git_local_repo_args(path, bare)).execute!
|
15
|
-
repo =
|
12
|
+
repo = ::EacGit::Rspec::StubbedGitLocalRepo::Repository.new(path)
|
16
13
|
repo.command('config', 'user.email', 'theuser@example.net').execute!
|
17
14
|
repo.command('config', 'user.name', 'The User').execute!
|
18
15
|
repo
|
@@ -26,46 +23,7 @@ module EacGit
|
|
26
23
|
r + [path]
|
27
24
|
end
|
28
25
|
|
29
|
-
|
30
|
-
def file(*subpath)
|
31
|
-
StubbedGitRepositoryFile.new(self, subpath)
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [EacGit::Local::Commit
|
35
|
-
def random_commit
|
36
|
-
content = ::SecureRandom.hex
|
37
|
-
file = "#{content}.txt"
|
38
|
-
file(file).write(content)
|
39
|
-
command('add', file).execute!
|
40
|
-
command('commit', '-m', "Random commit: #{file}.").execute!
|
41
|
-
head
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class StubbedGitRepositoryFile
|
46
|
-
attr_reader :git, :subpath
|
47
|
-
|
48
|
-
def initialize(git, subpath)
|
49
|
-
@git = git
|
50
|
-
@subpath = subpath
|
51
|
-
end
|
52
|
-
|
53
|
-
def path
|
54
|
-
git.root_path.join(*subpath)
|
55
|
-
end
|
56
|
-
|
57
|
-
def touch
|
58
|
-
::FileUtils.touch(path.to_path)
|
59
|
-
end
|
60
|
-
|
61
|
-
def delete
|
62
|
-
path.unlink
|
63
|
-
end
|
64
|
-
|
65
|
-
def write(content)
|
66
|
-
path.write(content)
|
67
|
-
end
|
68
|
-
end
|
26
|
+
require_sub __FILE__
|
69
27
|
end
|
70
28
|
end
|
71
29
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'eac_git/local/commit/diff_tree_line'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe EacGit::Local::Commit::DiffTreeLine, :git do
|
6
6
|
include_examples 'source_target_fixtures', __FILE__ do
|
7
7
|
def source_data(source_file)
|
8
|
-
|
8
|
+
File.read(source_file).each_line.map do |line|
|
9
9
|
described_class.new(line).fields
|
10
10
|
end
|
11
11
|
end
|
@@ -4,7 +4,7 @@ require 'eac_git/local'
|
|
4
4
|
require 'eac_git/local/commit'
|
5
5
|
require 'tmpdir'
|
6
6
|
|
7
|
-
RSpec.describe
|
7
|
+
RSpec.describe EacGit::Local::Commit, :git do
|
8
8
|
let(:git) { stubbed_git_local_repo }
|
9
9
|
|
10
10
|
let(:first_commit_sha1) do
|
@@ -40,7 +40,7 @@ RSpec.describe ::EacGit::Local::Commit, git: true do
|
|
40
40
|
it "find file \"#{filename}\" in commit \"#{commit_name}\"" do
|
41
41
|
commit = send(commit_name)
|
42
42
|
file = commit.changed_files.find { |f| f.path == filename }
|
43
|
-
expect(file).to be_a(
|
43
|
+
expect(file).to be_a(EacGit::Local::Commit::ChangedFile)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -52,7 +52,7 @@ RSpec.describe ::EacGit::Local::Commit, git: true do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '#root_child?' do
|
55
|
-
it { expect(first_commit.root_child?).to
|
56
|
-
it { expect(second_commit.root_child?).to
|
55
|
+
it { expect(first_commit.root_child?).to be(true) }
|
56
|
+
it { expect(second_commit.root_child?).to be(false) }
|
57
57
|
end
|
58
58
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/local'
|
4
|
+
require 'eac_git/local/commit'
|
5
|
+
require 'tmpdir'
|
6
|
+
|
7
|
+
RSpec.describe EacGit::Local, '#dirty_files', :git do
|
8
|
+
let(:repo) { stubbed_git_local_repo }
|
9
|
+
let(:dirty_files_paths) { Set.new(repo.dirty_files.lazy.map(&:path).map(&:to_path)) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
repo.file('a_file').touch
|
13
|
+
repo.directory('b_directory').create.file('c_file').touch
|
14
|
+
repo.file('d file').touch
|
15
|
+
end
|
16
|
+
|
17
|
+
it do
|
18
|
+
expect(dirty_files_paths).to eq(Set.new(['a_file', 'b_directory/c_file', 'd file']))
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.84.
|
4
|
+
version: 0.84.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -996,6 +996,10 @@ files:
|
|
996
996
|
- sub/eac_git/lib/eac_git/rspec.rb
|
997
997
|
- sub/eac_git/lib/eac_git/rspec/setup.rb
|
998
998
|
- sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
|
999
|
+
- sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/directory.rb
|
1000
|
+
- sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/file.rb
|
1001
|
+
- sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/fs_object.rb
|
1002
|
+
- sub/eac_git/lib/eac_git/rspec/stubbed_git_local_repo/repository.rb
|
999
1003
|
- sub/eac_git/lib/eac_git/version.rb
|
1000
1004
|
- sub/eac_git/spec/lib/eac_git/executables_spec.rb
|
1001
1005
|
- sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb
|
@@ -1010,6 +1014,7 @@ files:
|
|
1010
1014
|
- sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out
|
1011
1015
|
- sub/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml
|
1012
1016
|
- sub/eac_git/spec/lib/eac_git/local/commit_spec.rb
|
1017
|
+
- sub/eac_git/spec/lib/eac_git/local/dirty_files_spec.rb
|
1013
1018
|
- sub/eac_git/spec/rubocop_spec.rb
|
1014
1019
|
- sub/eac_git/spec/spec_helper.rb
|
1015
1020
|
- sub/eac_git/vendor/git-subrepo/Changes
|