Class: Danger::PrySetup

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/commands/local_helpers/pry_setup.rb

Instance Method Summary collapse

Constructor Details

#initialize(cork) ⇒ PrySetup

Returns a new instance of PrySetup.



3
4
5
# File 'lib/danger/commands/local_helpers/pry_setup.rb', line 3

def initialize(cork)
  @cork = cork
end

Instance Method Details

#setup_pry(dangerfile_path, command) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/danger/commands/local_helpers/pry_setup.rb', line 7

def setup_pry(dangerfile_path, command)
  return dangerfile_path if dangerfile_path.empty?

  validate_pry_available(command)
  FileUtils.cp dangerfile_path, DANGERFILE_COPY
  File.open(DANGERFILE_COPY, "a") do |f|
    f.write("\nbinding.pry; File.delete(\"#{DANGERFILE_COPY}\")")
  end
  DANGERFILE_COPY
end