Sha256: 8cc390040f7428101014d130c2bb1972f780023c96af4c94e98190b6b007b008

Contents?: true

Size: 706 Bytes

Versions: 69

Compression:

Stored size: 706 Bytes

Contents

module Danger
  class PrySetup
    def initialize(cork)
      @cork = cork
    end

    def setup_pry(dangerfile_path)
      return dangerfile_path if dangerfile_path.empty?
      validate_pry_available
      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

    private

    attr_reader :cork

    DANGERFILE_COPY = "_Dangerfile.tmp".freeze

    def validate_pry_available
      Kernel.require "pry"
    rescue LoadError
      cork.warn "Pry was not found, and is required for 'danger pr --pry'."
      cork.print_warnings
      abort
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
danger-5.9.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.9.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.8.2 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.8.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.8.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.7.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.7.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.7 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.6 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.5 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.4 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.3 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.2 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.6.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.5.13 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.5.12 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.5.11 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.5.10 lib/danger/commands/local_helpers/pry_setup.rb
danger-5.5.9 lib/danger/commands/local_helpers/pry_setup.rb