Sha256: 64ad18630e3b51c9fbe73eba71dc3256ea4b7a88aeec450dc011bdf9f058e989

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

require "danger/commands/local_helpers/pry_setup"
require "fileutils"
require "tmpdir"

module Danger
  class Staging < Runner
    self.summary = "Run the Dangerfile locally against local master"
    self.command = "staging"

    def self.options
      [
          ["--pry", "Drop into a Pry shell after evaluating the Dangerfile."]
      ]
    end

    def initialize(argv)
      show_help = true if argv.arguments == ["-h"]

      # Currently CLAide doesn't support short option like -h https://github.com/CocoaPods/CLAide/pull/60
      # when user pass in -h, mimic the behavior of passing in --help.
      argv = CLAide::ARGV.new ["--help"] if show_help

      super

      if argv.flag?("pry", false)
        @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path, Staging.command)
      end
    end

    def validate!
      super
      unless @dangerfile_path
        help! "Could not find a Dangerfile."
      end
    end

    def run
      ENV["DANGER_USE_LOCAL_ONLY_GIT"] = "YES"

      env = EnvironmentManager.new(ENV, cork)
      dm = Dangerfile.new(env, cork)

      dm.run(
          Danger::EnvironmentManager.danger_base_branch,
          Danger::EnvironmentManager.danger_head_branch,
          @dangerfile_path,
          nil,
          nil,
          nil
      )
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
danger-9.1.0 lib/danger/commands/staging.rb
danger-9.0.0 lib/danger/commands/staging.rb
danger-8.6.1 lib/danger/commands/staging.rb
danger-8.6.0 lib/danger/commands/staging.rb
danger-8.5.0 lib/danger/commands/staging.rb
danger-8.4.5 lib/danger/commands/staging.rb
danger-8.4.4 lib/danger/commands/staging.rb
danger-8.4.3 lib/danger/commands/staging.rb
danger-8.4.2 lib/danger/commands/staging.rb
danger-8.4.1 lib/danger/commands/staging.rb
danger-8.4.0 lib/danger/commands/staging.rb
danger-8.3.1 lib/danger/commands/staging.rb
danger-8.2.3 lib/danger/commands/staging.rb
danger-8.2.2 lib/danger/commands/staging.rb
danger-8.2.1 lib/danger/commands/staging.rb