eac_tools 0.34.0 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -18
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +1 -1
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_collector.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_discovery.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager/cached_instance.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager/cached_instances.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context/settings.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/context.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/instances/base/cache.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/instances/base.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/instances/error.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/instances/runner_helper.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/instances/settings.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/paths/logical.rb +0 -0
- data/sub/{avm-tools → avm}/lib/avm/launcher/publish/base.rb +2 -5
- data/sub/avm/lib/avm/registry.rb +0 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +1 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_host.rb +2 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
- data/sub/avm-git/Gemfile +8 -0
- data/sub/avm-git/avm-git.gemspec +22 -0
- data/sub/avm-git/lib/avm/git/auto_commit/commit_info.rb +23 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/base.rb +39 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/last.rb +19 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/manual.rb +45 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/new.rb +24 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/nth.rb +31 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules/unique.rb +21 -0
- data/sub/avm-git/lib/avm/git/auto_commit/rules.rb +31 -0
- data/sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb +20 -0
- data/sub/avm-git/lib/avm/git/auto_commit_path.rb +28 -0
- data/sub/avm-git/lib/avm/git/commit/class_methods.rb +31 -0
- data/sub/avm-git/lib/avm/git/commit/deploy.rb +38 -0
- data/sub/avm-git/lib/avm/git/commit/deploy_methods.rb +19 -0
- data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +32 -0
- data/sub/avm-git/lib/avm/git/commit/file.rb +46 -0
- data/sub/avm-git/lib/avm/git/commit.rb +59 -0
- data/sub/avm-git/lib/avm/git/file_auto_fixup.rb +83 -0
- data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +42 -0
- data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +23 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +61 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/push.rb +60 -0
- data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +33 -0
- data/sub/avm-git/lib/avm/git/issue/complete/test.rb +40 -0
- data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +28 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +53 -0
- data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +19 -0
- data/sub/avm-git/lib/avm/git/issue/complete.rb +66 -0
- data/sub/avm-git/lib/avm/git/issue/deliver.rb +56 -0
- data/sub/avm-git/lib/avm/git/issue.rb +11 -0
- data/sub/avm-git/lib/avm/git/organize/reference_update.rb +34 -0
- data/sub/avm-git/lib/avm/git/organize/repository.rb +76 -0
- data/sub/avm-git/lib/avm/git/organize.rb +11 -0
- data/sub/avm-git/lib/avm/git/revision_test.rb +105 -0
- data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +35 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +55 -0
- data/sub/avm-git/lib/avm/git/scms/git.rb +73 -0
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +39 -0
- data/sub/avm-git/lib/avm/git/scms/provider.rb +19 -0
- data/sub/avm-git/lib/avm/git/scms.rb +11 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/parent.rb +51 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/remote.rb +89 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +32 -0
- data/sub/avm-git/lib/avm/git/subrepo_check.rb +38 -0
- data/sub/avm-git/lib/avm/git/subrepo_checks.rb +59 -0
- data/sub/{avm-tools/lib/avm/launcher → avm-git/lib/avm/git}/vendor/github.rb +1 -1
- data/sub/avm-git/lib/avm/git/vendor.rb +11 -0
- data/sub/avm-git/lib/avm/git/version.rb +7 -0
- data/sub/avm-git/lib/avm/git.rb +11 -0
- data/sub/avm-git/spec/lib/avm/git/auto_commit_path_spec.rb +21 -0
- data/sub/avm-git/spec/lib/avm/git/commit/deploy_spec.rb +93 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +56 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +8 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +8 -0
- data/sub/{avm-tools/spec/lib/avm/launcher → avm-git/spec/lib/avm/git}/vendor/github_spec.rb +4 -4
- data/sub/avm-git/spec/rubocop_spec.rb +3 -0
- data/sub/avm-git/spec/spec_helper.rb +4 -0
- data/sub/avm-tools/avm-tools.gemspec +2 -2
- data/sub/avm-tools/lib/avm/launcher/git/warp_base.rb +2 -2
- data/sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_docker/eac_docker.gemspec +2 -2
- data/sub/eac_docker/lib/eac_docker/images/templatized.rb +7 -1
- data/sub/eac_docker/lib/eac_docker/version.rb +1 -1
- metadata +97 -23
- data/sub/avm-tools/lib/avm/launcher/vendor.rb +0 -3
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/result'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
class SubrepoCheck
|
9
|
+
module Remote
|
10
|
+
private
|
11
|
+
|
12
|
+
def fetch_uncached
|
13
|
+
subrepo.command('clean').execute!
|
14
|
+
subrepo.command('fetch').execute!
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_remote_disabled?
|
18
|
+
!check_remote?
|
19
|
+
end
|
20
|
+
|
21
|
+
def check_remote_disabled_result
|
22
|
+
::Avm::Result.neutral('Check remote disabled')
|
23
|
+
end
|
24
|
+
|
25
|
+
def local_descend_remote?
|
26
|
+
local_id.present? && remote_id.present? && subrepo.local.descendant?(local_id, remote_id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def local_descend_remote_result
|
30
|
+
::Avm::Result.pending(remote_result_value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def local_id_uncached
|
34
|
+
fetch
|
35
|
+
subrepo.command('branch', '--force').execute!
|
36
|
+
subrepo.local.rev_parse("subrepo/#{subrepo.subpath}")
|
37
|
+
end
|
38
|
+
|
39
|
+
def remote_descend_local?
|
40
|
+
local_id.present? && remote_id.present? && subrepo.local.descendant?(remote_id, local_id)
|
41
|
+
end
|
42
|
+
|
43
|
+
def remote_descend_local_result
|
44
|
+
::Avm::Result.outdated(remote_result_value)
|
45
|
+
end
|
46
|
+
|
47
|
+
def remote_branches
|
48
|
+
['', 'refs/heads/', 'refs/tags/'].map { |prefix| "#{prefix}#{subrepo.remote_branch}" }
|
49
|
+
end
|
50
|
+
|
51
|
+
def remote_id_uncached
|
52
|
+
ls_result = subrepo.remote.ls
|
53
|
+
remote_branches.each do |b|
|
54
|
+
return ls_result[b] if ls_result[b].present?
|
55
|
+
end
|
56
|
+
nil
|
57
|
+
end
|
58
|
+
|
59
|
+
def remote_result_uncached
|
60
|
+
%w[check_remote_disabled same_ids local_descend_remote remote_descend_local]
|
61
|
+
.each do |condition|
|
62
|
+
return send("#{condition}_result") if send("#{condition}?")
|
63
|
+
end
|
64
|
+
|
65
|
+
::Avm::Result.error(remote_result_value)
|
66
|
+
end
|
67
|
+
|
68
|
+
def remote_result_value
|
69
|
+
local_s = local_id.presence || blank_text
|
70
|
+
remote_s = remote_id.presence || blank_text
|
71
|
+
|
72
|
+
if local_s == remote_s
|
73
|
+
"[L/R=#{local_s}]"
|
74
|
+
else
|
75
|
+
"[L=#{local_s}, R=#{remote_s}]"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def same_ids?
|
80
|
+
local_id.present? && remote_id.present? && local_id == remote_id
|
81
|
+
end
|
82
|
+
|
83
|
+
def same_ids_result
|
84
|
+
::Avm::Result.success(remote_result_value)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
class SubrepoCheck
|
8
|
+
module ShowResult
|
9
|
+
def show_result
|
10
|
+
out(subrepo.subpath.to_path.cyan)
|
11
|
+
out_attr('parent', parent_result.label)
|
12
|
+
run_fix_parent
|
13
|
+
out_attr('remote', remote_result.label)
|
14
|
+
out("\n")
|
15
|
+
end
|
16
|
+
|
17
|
+
def run_fix_parent
|
18
|
+
return unless fix_parent?
|
19
|
+
return unless parent_result.error?
|
20
|
+
|
21
|
+
out('|Fixing...'.white)
|
22
|
+
self.parent_hash = expected_parent_hash
|
23
|
+
out_attr('new parent', parent_result.label)
|
24
|
+
end
|
25
|
+
|
26
|
+
def out_attr(key, value)
|
27
|
+
out('|' + "#{key}=".white + value)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
class SubrepoCheck
|
8
|
+
require_sub __FILE__, include_modules: true
|
9
|
+
enable_speaker
|
10
|
+
enable_simple_cache
|
11
|
+
|
12
|
+
BLANK_TEXT = 'BLANK'
|
13
|
+
|
14
|
+
common_constructor :subrepo, :options
|
15
|
+
|
16
|
+
def blank_text
|
17
|
+
BLANK_TEXT
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_remote?
|
21
|
+
options.fetch(:check_remote) ? true : false
|
22
|
+
end
|
23
|
+
|
24
|
+
def fix_parent?
|
25
|
+
options.fetch(:fix_parent) ? true : false
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def result_uncached
|
31
|
+
return ::Avm::Result.error('Parent failed') if parent_result.error?
|
32
|
+
return ::Avm::Result.error('Remote failed') if remote_result.error?
|
33
|
+
|
34
|
+
::Avm::Result.success('Parent and remote ok')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/subrepo_check'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
class SubrepoChecks
|
9
|
+
enable_speaker
|
10
|
+
enable_simple_cache
|
11
|
+
attr_accessor :check_remote, :fix_parent
|
12
|
+
common_constructor :repository
|
13
|
+
|
14
|
+
def add_all_subrepos
|
15
|
+
add_subrepos(
|
16
|
+
*repository.command('subrepo', '-q', 'status').execute!.split("\n").map(&:strip)
|
17
|
+
.select(&:present?)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_subrepos(*subpath_list)
|
22
|
+
subpath_list.each do |subpath|
|
23
|
+
subpaths.add(subpath)
|
24
|
+
end
|
25
|
+
reset_cache
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_options
|
30
|
+
{ fix_parent: fix_parent, check_remote: check_remote }
|
31
|
+
end
|
32
|
+
|
33
|
+
def show_result
|
34
|
+
checks.each(&:show_result)
|
35
|
+
infov 'Result', result.label
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def checks_uncached
|
41
|
+
subpaths.map do |subpath|
|
42
|
+
::Avm::Git::SubrepoCheck.new(repository.subrepo(subpath), check_options)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def result_uncached
|
47
|
+
error_count = checks.count { |check| check.result.error? }
|
48
|
+
::Avm::Result.success_or_error(
|
49
|
+
error_count.zero?,
|
50
|
+
"#{error_count} of #{checks.count} subrepos failed"
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def subpaths
|
55
|
+
@subpaths ||= ::Set.new
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit_path'
|
4
|
+
|
5
|
+
RSpec.describe ::Avm::Git::AutoCommitPath, git: true do
|
6
|
+
let(:git) { stubbed_git_local_repo }
|
7
|
+
|
8
|
+
describe '#class_name' do
|
9
|
+
{
|
10
|
+
'app/models/mynamespace/the_class.rb' => 'Mynamespace::TheClass',
|
11
|
+
'lib/ruby/lib/cliutils/eac_redmine_base0/activity.rb' => 'Cliutils::EacRedmineBase0::Activity'
|
12
|
+
}.each do |relative_path, expected_class_name|
|
13
|
+
context "when path is \"#{relative_path}\"" do
|
14
|
+
let(:path) { git.root_path.join(relative_path) }
|
15
|
+
let(:instance) { described_class.new(git, path) }
|
16
|
+
|
17
|
+
it { expect(instance.class_name).to eq(expected_class_name) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/commit'
|
4
|
+
require 'avm/git/commit/deploy'
|
5
|
+
require 'eac_ruby_utils/fs/temp'
|
6
|
+
|
7
|
+
RSpec.describe ::Avm::Git::Commit::Deploy, git: true do
|
8
|
+
class << self
|
9
|
+
FROM_DEPLOY = %w[a.txt b.txt c.txt appended].freeze # rubocop:disable RSpec/LeakyConstantDeclaration
|
10
|
+
NOT_FROM_DEPLOY = %w[to_be_removed].freeze # rubocop:disable RSpec/LeakyConstantDeclaration
|
11
|
+
|
12
|
+
def check_files(from_deploy_exist)
|
13
|
+
if from_deploy_exist
|
14
|
+
check_files_exist(FROM_DEPLOY)
|
15
|
+
check_files_not_exist(NOT_FROM_DEPLOY)
|
16
|
+
else
|
17
|
+
check_files_not_exist(FROM_DEPLOY)
|
18
|
+
check_files_exist(NOT_FROM_DEPLOY)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def check_file_exist(basename)
|
23
|
+
it("expect \"#{basename}\" to exist") { expect(target_dir.join(basename)).to exist }
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_file_not_exist(basename)
|
27
|
+
it("expect \"#{basename}\" to not exist") { expect(target_dir.join(basename)).not_to exist }
|
28
|
+
end
|
29
|
+
|
30
|
+
def check_files_exist(basenames)
|
31
|
+
basenames.each { |basename| check_file_exist(basename) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_files_not_exist(basenames)
|
35
|
+
basenames.each { |basename| check_file_not_exist(basename) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
let(:git) { stubbed_git_local_repo }
|
40
|
+
|
41
|
+
let(:commit_sha1) do
|
42
|
+
git.file('a.txt').write('AAA')
|
43
|
+
git.file('b.txt').write('BBB')
|
44
|
+
git.command('add', '.').execute!
|
45
|
+
git.command('commit', '-m', 'First commit.').execute!
|
46
|
+
git.rev_parse('HEAD')
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:appended_dir) do
|
50
|
+
r = ::EacRubyUtils::Fs::Temp.directory
|
51
|
+
r.join('appended.template').write('Needs a %%ABC%% value.')
|
52
|
+
r
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:target_dir) do
|
56
|
+
r = ::EacRubyUtils::Fs::Temp.directory
|
57
|
+
::FileUtils.touch(r.join('to_be_removed').to_path)
|
58
|
+
r
|
59
|
+
end
|
60
|
+
|
61
|
+
let(:commit) { ::Avm::Git::Commit.new(git, commit_sha1) }
|
62
|
+
let(:variables_source_class) do
|
63
|
+
::Class.new do
|
64
|
+
attr_reader :abc
|
65
|
+
|
66
|
+
def initialize(abc)
|
67
|
+
@abc = abc
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
let(:variables_source) { variables_source_class.new('Any value') }
|
72
|
+
let(:target_env) { ::EacRubyUtils::Envs.local }
|
73
|
+
let(:instance) do
|
74
|
+
described_class.new(commit, target_env, target_dir).append_templatized_directory(appended_dir)
|
75
|
+
.append_file_content('c.txt', 'Any content')
|
76
|
+
.variables_source_set(variables_source)
|
77
|
+
end
|
78
|
+
|
79
|
+
after do
|
80
|
+
appended_dir.remove
|
81
|
+
target_dir.remove
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'without run' do # rubocop:disable RSpec/EmptyExampleGroup
|
85
|
+
check_files(false)
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'with run' do # rubocop:disable RSpec/EmptyExampleGroup
|
89
|
+
before { instance.run }
|
90
|
+
|
91
|
+
check_files(true)
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/commit/diff_tree_line'
|
4
|
+
|
5
|
+
RSpec.describe ::Avm::Git::Commit::DiffTreeLine, git: true do
|
6
|
+
include_examples 'source_target_fixtures', __FILE__ do
|
7
|
+
def source_data(source_file)
|
8
|
+
::File.read(source_file).each_line.map do |line|
|
9
|
+
described_class.new(line).fields
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
:000000 100644 0000000000000000000000000000000000000000 f380aec0bd8dd777edac43b11636e46cad04273a A nomes.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
:100644 100644 40bcdecb4214cd8a3fcf96cd25a2beb87e7e7cd8 4a30dfae816b984f05cfb594e0d5958bb8c387ae M nomes.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
:100644 000000 10728718a2915256ab162f1e05178ebff9efa6ce 0000000000000000000000000000000000000000 D nomes3.txt
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
- src_mode: '100644'
|
3
|
+
dst_mode: '000000'
|
4
|
+
src_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
|
5
|
+
dst_sha1: '0000000000000000000000000000000000000000'
|
6
|
+
status: D
|
7
|
+
path: nomes.txt
|
8
|
+
- src_mode: '000000'
|
9
|
+
dst_mode: '100644'
|
10
|
+
src_sha1: '0000000000000000000000000000000000000000'
|
11
|
+
dst_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
|
12
|
+
status: A
|
13
|
+
path: nomes2.txt
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
- src_mode: '100644'
|
3
|
+
dst_mode: '000000'
|
4
|
+
src_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
|
5
|
+
dst_sha1: '0000000000000000000000000000000000000000'
|
6
|
+
status: D
|
7
|
+
path: nomes2.txt
|
8
|
+
- src_mode: '000000'
|
9
|
+
dst_mode: '100644'
|
10
|
+
src_sha1: '0000000000000000000000000000000000000000'
|
11
|
+
dst_sha1: 10728718a2915256ab162f1e05178ebff9efa6ce
|
12
|
+
status: A
|
13
|
+
path: nomes3.txt
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/commit'
|
4
|
+
|
5
|
+
RSpec.describe ::Avm::Git::Commit, git: true do
|
6
|
+
let(:git) { stubbed_git_local_repo }
|
7
|
+
|
8
|
+
let(:first_commit_sha1) do
|
9
|
+
git.file('a.txt').write('AAA')
|
10
|
+
git.file('b.txt').write('BBB')
|
11
|
+
git.command('add', '.').execute!
|
12
|
+
git.command('commit', '-m', 'First commit.').execute!
|
13
|
+
git.rev_parse('HEAD')
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:second_commit_sha1) do
|
17
|
+
first_commit_sha1
|
18
|
+
git.file('a.txt').write('AAAAA')
|
19
|
+
git.file('b.txt').delete
|
20
|
+
git.file('ç.txt').write('CCC')
|
21
|
+
git.command('add', '.').execute!
|
22
|
+
git.command('commit', '-m', 'Second commit.').execute!
|
23
|
+
git.rev_parse('HEAD')
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:first_commit) { described_class.new(git, first_commit_sha1) }
|
27
|
+
let(:second_commit) { described_class.new(git, second_commit_sha1) }
|
28
|
+
|
29
|
+
describe '#files' do
|
30
|
+
it { expect(first_commit.files.count).to eq(2) }
|
31
|
+
it { expect(second_commit.files.count).to eq(3) }
|
32
|
+
|
33
|
+
{
|
34
|
+
'first_commit' => %w[a.txt b.txt],
|
35
|
+
'second_commit' => %w[a.txt b.txt ç.txt]
|
36
|
+
}.each do |commit_name, filenames|
|
37
|
+
filenames.each do |filename|
|
38
|
+
it "find file \"#{filename}\" in commit \"#{commit_name}\"" do
|
39
|
+
commit = send(commit_name)
|
40
|
+
file = commit.files.find { |f| f.path == filename }
|
41
|
+
expect(file).to be_a(::Avm::Git::Commit::File)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#files_size' do
|
48
|
+
it { expect(first_commit.files_size).to eq(6) }
|
49
|
+
it { expect(second_commit.files_size).to eq(8) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#root_child?' do
|
53
|
+
it { expect(first_commit.root_child?).to eq(true) }
|
54
|
+
it { expect(second_commit.root_child?).to eq(false) }
|
55
|
+
end
|
56
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/git/vendor/github'
|
4
4
|
|
5
|
-
RSpec.describe ::Avm::
|
5
|
+
RSpec.describe ::Avm::Git::Vendor::Github do
|
6
6
|
describe '#to_ssh_url' do
|
7
|
-
SSH_URL = 'git@github.com:esquilo-azul/eac_launcher.git'
|
8
|
-
NO_SSH_URL = 'https://otherhost.com/esquilo-azul/eac_launcher'
|
7
|
+
SSH_URL = 'git@github.com:esquilo-azul/eac_launcher.git' # rubocop:disable RSpec/LeakyConstantDeclaration
|
8
|
+
NO_SSH_URL = 'https://otherhost.com/esquilo-azul/eac_launcher' # rubocop:disable RSpec/LeakyConstantDeclaration
|
9
9
|
|
10
10
|
{
|
11
11
|
nil => nil,
|
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
16
|
|
17
17
|
s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.3'
|
18
|
-
s.add_dependency 'avm', '~> 0.
|
18
|
+
s.add_dependency 'avm', '~> 0.46'
|
19
19
|
s.add_dependency 'avm-eac_ruby_base1', '~> 0.22'
|
20
20
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
21
21
|
s.add_dependency 'avm-files', '~> 0.4', '>= 0.4.1'
|
22
|
-
s.add_dependency 'avm-git', '~> 0.
|
22
|
+
s.add_dependency 'avm-git', '~> 0.5'
|
23
23
|
s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
|
24
24
|
s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
|
25
25
|
s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.3'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'avm/launcher/git/mirror_update'
|
4
4
|
require 'avm/launcher/instances/error'
|
5
|
-
require 'avm/
|
5
|
+
require 'avm/git/vendor/github'
|
6
6
|
require 'avm/projects/stereotypes/git/publish'
|
7
7
|
|
8
8
|
module Avm
|
@@ -59,7 +59,7 @@ module Avm
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def target_remote_url
|
62
|
-
::Avm::
|
62
|
+
::Avm::Git::Vendor::Github.to_ssh_url(source_git.git.remote(source_remote_name).url)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/simple_cache'
|
|
4
4
|
require 'avm/launcher/git/sub_warp_base'
|
5
5
|
require 'avm/launcher/errors/base'
|
6
6
|
require 'avm/launcher/paths/real'
|
7
|
-
require 'avm/
|
7
|
+
require 'avm/git/vendor/github'
|
8
8
|
|
9
9
|
module Avm
|
10
10
|
module Projects
|
@@ -77,7 +77,7 @@ module Avm
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def target_remote_url
|
80
|
-
::Avm::
|
80
|
+
::Avm::Git::Vendor::Github.to_ssh_url(
|
81
81
|
parent_git_warped.subrepo_remote_url(to_parent_git_path)
|
82
82
|
)
|
83
83
|
end
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
-
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.104'
|
16
|
+
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -21,7 +21,7 @@ module EacDocker
|
|
21
21
|
::EacRubyUtils::Fs::Temp.on_directory do |provide_dir|
|
22
22
|
begin
|
23
23
|
self.provide_dir = provide_dir
|
24
|
-
|
24
|
+
write_in_provide_dir
|
25
25
|
coded_image(provide_dir).tag(tag).provide
|
26
26
|
ensure
|
27
27
|
self.provide_dir = nil
|
@@ -33,6 +33,12 @@ module EacDocker
|
|
33
33
|
::EacDocker::Images::Coded.new(provide_dir)
|
34
34
|
end
|
35
35
|
|
36
|
+
protected
|
37
|
+
|
38
|
+
def write_in_provide_dir
|
39
|
+
template.apply(self, provide_dir)
|
40
|
+
end
|
41
|
+
|
36
42
|
private
|
37
43
|
|
38
44
|
attr_writer :provide_dir
|