class Danger::Staging

Public Class Methods

new(argv) click to toggle source
Calls superclass method Danger::Runner::new
# File lib/danger/commands/staging.rb, line 16
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
options() click to toggle source
# File lib/danger/commands/staging.rb, line 10
def self.options
  [
    ["--pry", "Drop into a Pry shell after evaluating the Dangerfile."]
  ]
end

Public Instance Methods

run() click to toggle source
# File lib/danger/commands/staging.rb, line 37
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
validate!() click to toggle source
Calls superclass method Danger::Runner#validate!
# File lib/danger/commands/staging.rb, line 30
def validate!
  super
  unless @dangerfile_path
    help! "Could not find a Dangerfile."
  end
end