Class: Ra10ke::Diff::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/ra10ke/diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTask

Returns a new instance of Task.



11
12
13
14
# File 'lib/ra10ke/diff.rb', line 11

def initialize
  @repo = Git.open('.')
  @original_branch = repo.current_branch
end

Instance Attribute Details

#puppetfileObject (readonly)

Returns the value of attribute puppetfile.



9
10
11
# File 'lib/ra10ke/diff.rb', line 9

def puppetfile
  @puppetfile
end

#repoObject (readonly)

Returns the value of attribute repo.



9
10
11
# File 'lib/ra10ke/diff.rb', line 9

def repo
  @repo
end

Instance Method Details

#run(branch_a:, branch_b:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ra10ke/diff.rb', line 16

def run(branch_a:, branch_b:)
  validate_clean_repo
  validate_branches(branch_a, branch_b)

  modules_a = load_modules(branch_a)
  modules_b = load_modules(branch_b)

  differences = calculate_differences(modules_a, modules_b)
  print_differences(differences)
ensure
  restore_original_branch
end