Class: ConfCtl::Swpins::ChangeSet
- Inherits:
-
Object
- Object
- ConfCtl::Swpins::ChangeSet
show all
- Defined in:
- lib/confctl/swpins/change_set.rb
Defined Under Namespace
Classes: SpecOwner, SpecSet
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ChangeSet.
33
34
35
|
# File 'lib/confctl/swpins/change_set.rb', line 33
def initialize
@owners = {}
end
|
Instance Method Details
#add(owner, spec) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/confctl/swpins/change_set.rb', line 39
def add(owner, spec)
@owners[owner] ||= []
@owners[owner] << SpecSet.new(
spec:,
original_version: spec.valid? ? spec.version : nil,
original_info: spec.valid? ? spec.info : nil
)
nil
end
|
#any_changes? ⇒ Boolean
70
71
72
|
# File 'lib/confctl/swpins/change_set.rb', line 70
def any_changes?
@owners.any? { |_, spec_sets| spec_sets.any?(&:changed?) }
end
|
#commit(type: :upgrade, changelog: false, editor: true) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/confctl/swpins/change_set.rb', line 52
def commit(type: :upgrade, changelog: false, editor: true)
return if @owners.empty?
git_commit = [
'git',
'commit',
use_editor?(editor) ? '-e' : nil,
'-m', build_message(type, changelog),
*changed_files
].compact
ret = Kernel.system(*git_commit)
return if ret
raise 'git commit exited with non-zero status code'
end
|