archimate 1.1.1 → 1.2.1
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/README.md +0 -47
- data/lib/archimate.rb +0 -11
- data/lib/archimate/cli/archi.rb +0 -8
- data/lib/archimate/data_model/diffable_array.rb +64 -64
- data/lib/archimate/version.rb +1 -1
- metadata +2 -32
- data/exe/archidiff +0 -7
- data/exe/archidiff-summary +0 -7
- data/exe/archimerge +0 -7
- data/exe/fmtxml +0 -7
- data/lib/archimate/cli/conflict_resolver.rb +0 -39
- data/lib/archimate/cli/diff.rb +0 -31
- data/lib/archimate/cli/diff_summary.rb +0 -101
- data/lib/archimate/cli/merge.rb +0 -49
- data/lib/archimate/cli/merger.rb +0 -109
- data/lib/archimate/diff.rb +0 -17
- data/lib/archimate/diff/archimate_array_reference.rb +0 -113
- data/lib/archimate/diff/archimate_identified_node_reference.rb +0 -41
- data/lib/archimate/diff/archimate_node_attribute_reference.rb +0 -70
- data/lib/archimate/diff/archimate_node_reference.rb +0 -80
- data/lib/archimate/diff/change.rb +0 -49
- data/lib/archimate/diff/conflict.rb +0 -31
- data/lib/archimate/diff/conflicts.rb +0 -89
- data/lib/archimate/diff/conflicts/base_conflict.rb +0 -53
- data/lib/archimate/diff/conflicts/deleted_items_child_updated_conflict.rb +0 -30
- data/lib/archimate/diff/conflicts/deleted_items_referenced_conflict.rb +0 -63
- data/lib/archimate/diff/conflicts/path_conflict.rb +0 -51
- data/lib/archimate/diff/delete.rb +0 -41
- data/lib/archimate/diff/difference.rb +0 -113
- data/lib/archimate/diff/insert.rb +0 -43
- data/lib/archimate/diff/merge.rb +0 -70
- data/lib/archimate/diff/move.rb +0 -51
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Archimate
|
3
|
-
module Diff
|
4
|
-
class Insert < Difference
|
5
|
-
using DataModel::DiffableArray
|
6
|
-
|
7
|
-
# Create a new Insert difference
|
8
|
-
#
|
9
|
-
# @param inserted_element [Archimate::DataModel::ArchimateNode] Element
|
10
|
-
# that was inserted
|
11
|
-
# @param sub_path [str] Path under inserted_element for primitive values
|
12
|
-
def initialize(target)
|
13
|
-
super
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_s
|
17
|
-
# Note - the explicit to_s is required to access the DiffableArray
|
18
|
-
# implementation if the parent is an Array.
|
19
|
-
"#{diff_type} #{target} into #{target.parent.to_s}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def apply(to_model)
|
23
|
-
throw TypeError, "Expected a Archimate::DataModel::Model, was a #{to_model.class}" unless to_model.is_a?(DataModel::Model)
|
24
|
-
target.insert(to_model)
|
25
|
-
to_model
|
26
|
-
end
|
27
|
-
|
28
|
-
def insert?
|
29
|
-
true
|
30
|
-
end
|
31
|
-
|
32
|
-
def kind
|
33
|
-
"Insert"
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def diff_type
|
39
|
-
Color.color('INSERT:', :insert)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/archimate/diff/merge.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "parallel"
|
4
|
-
|
5
|
-
module Archimate
|
6
|
-
module Diff
|
7
|
-
class Merge
|
8
|
-
include Archimate::Logging
|
9
|
-
using DataModel::DiffableArray
|
10
|
-
|
11
|
-
def three_way(base, local, remote)
|
12
|
-
debug { "Computing base:local & base:remote diffs" }
|
13
|
-
base_local_diffs, base_remote_diffs = Parallel.map([[base, local], [base, remote]],
|
14
|
-
in_processes: 2) do |base_model, other_model|
|
15
|
-
base_model.diff(other_model)
|
16
|
-
end
|
17
|
-
|
18
|
-
debug "Finding Conflicts in #{base_local_diffs.size + base_remote_diffs.size} diffs"
|
19
|
-
conflicts = Conflicts.new(base_local_diffs, base_remote_diffs)
|
20
|
-
resolved_diffs = conflicts.resolve
|
21
|
-
|
22
|
-
[apply_diffs(resolved_diffs, base.clone), conflicts]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Applies the set of diffs to the model returning a
|
26
|
-
# new model with the diffs applied.
|
27
|
-
def apply_diffs(diffs, model)
|
28
|
-
debug { "Applying #{diffs.size} diffs" }
|
29
|
-
progressbar = ProgressIndicator.new(total: diffs.size, title: "Applying diffs")
|
30
|
-
diffs
|
31
|
-
.inject(model) do |model_a, diff|
|
32
|
-
progressbar.increment
|
33
|
-
diff.apply(model_a)
|
34
|
-
end
|
35
|
-
.rebuild_index
|
36
|
-
.organize
|
37
|
-
ensure
|
38
|
-
progressbar&.finish
|
39
|
-
end
|
40
|
-
|
41
|
-
# # TODO: not currently used
|
42
|
-
# def find_merged_duplicates
|
43
|
-
# [@base_local_diffs, @base_remote_diffs].map do |diffs|
|
44
|
-
# deleted_element_diffs = diffs.select(&:delete?).select(&:element?)
|
45
|
-
# deleted_element_diffs.each_with_object({}) do |diff, a|
|
46
|
-
# element = diff.from_model.elements[diff.element_idx]
|
47
|
-
# found = diff.from_model.elements.select do |el|
|
48
|
-
# el != element && el.type == element.type && el.name == element.name
|
49
|
-
# end
|
50
|
-
# next if found.empty?
|
51
|
-
# a[diff] = found
|
52
|
-
# debug { "\nFound potential de-duplication:" }
|
53
|
-
# debug { "\t#{diff}" }
|
54
|
-
# debug { "Might be replaced with:\n\t#{found.map(&:to_s).join(" }\n\t")}\n\n"
|
55
|
-
# end
|
56
|
-
# end
|
57
|
-
# end
|
58
|
-
|
59
|
-
# # TODO: not currently used
|
60
|
-
# def filter_path_conflicts(diffs)
|
61
|
-
# diffs.sort { |a, b| a.path_to_array.size <=> b.path_to_array.size }.each_with_object([]) do |i, e|
|
62
|
-
# diffs.delete(i)
|
63
|
-
# path_conflicts = diffs.select { |d| d.path.start_with?(i.path) }
|
64
|
-
# path_conflicts.each { |d| diffs.delete(d) }
|
65
|
-
# e << i
|
66
|
-
# end
|
67
|
-
# end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
data/lib/archimate/diff/move.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Archimate
|
3
|
-
module Diff
|
4
|
-
class Move < Difference
|
5
|
-
using DataModel::DiffablePrimitive
|
6
|
-
using DataModel::DiffableArray
|
7
|
-
|
8
|
-
# Create a new Move difference
|
9
|
-
#
|
10
|
-
# @param target [Archimate::Diff::ArchimateNodeReference] reference to
|
11
|
-
# ArchimateNode that was changed
|
12
|
-
# @param changed_from [Archimate::Diff::ArchimateNodeReference] Element
|
13
|
-
# that was changed
|
14
|
-
def initialize(target, changed_from)
|
15
|
-
super(target, changed_from)
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
# Note - the explicit to_s is required to access the DiffableArray
|
20
|
-
# implementation if the parent is an Array.
|
21
|
-
"#{diff_type} #{changed_from.parent&.to_s} #{Color.color(target.to_s, :change)} moved to #{target.array_index}"
|
22
|
-
end
|
23
|
-
|
24
|
-
# TODO: patch is a better name than apply
|
25
|
-
def apply(to_model)
|
26
|
-
unless to_model.is_a?(DataModel::Model)
|
27
|
-
throw(
|
28
|
-
TypeError,
|
29
|
-
"Expected a Archimate::DataModel::Model, was a #{to_model.class}"
|
30
|
-
)
|
31
|
-
end
|
32
|
-
target.move(to_model, changed_from)
|
33
|
-
to_model
|
34
|
-
end
|
35
|
-
|
36
|
-
def move?
|
37
|
-
true
|
38
|
-
end
|
39
|
-
|
40
|
-
def kind
|
41
|
-
"Move"
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def diff_type
|
47
|
-
Color.color('MOVE:', :move)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|