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-8.2.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.1.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.6 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.5 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.4 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.3 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.2 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-8.0.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-7.0.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-7.0.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.3.2 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.3.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.3.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.2.2 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.2.1 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.2.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.1.0 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.0.9 lib/danger/commands/local_helpers/pry_setup.rb
danger-6.0.8 lib/danger/commands/local_helpers/pry_setup.rb