Class: PullBranchFileExtractor

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

Instance Method Summary collapse

Constructor Details

#initialize(temp_dir, pull_details) ⇒ PullBranchFileExtractor

Returns a new instance of PullBranchFileExtractor.



2
3
4
5
# File 'lib/pull_branch_file_extractor.rb', line 2

def initialize(temp_dir, pull_details)
  @temp_dir = temp_dir
  @pull_details = pull_details
end

Instance Method Details

#cleanupObject



20
21
22
# File 'lib/pull_branch_file_extractor.rb', line 20

def cleanup
  clean_tmp_dir
end

#extractObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pull_branch_file_extractor.rb', line 7

def extract
  clean_tmp_dir
  create_tmp_dir

  commands = @pull_details.map &command_orgnaizer()

  commands.flatten.each do |command|
    prepared_command = command.call
    puts prepared_command unless prepared_command.empty?
    `#{prepared_command}` unless prepared_command.empty?
  end
end