Class: Danger::Local
- Defined in:
- lib/danger/commands/local.rb
Instance Attribute Summary
Attributes inherited from Runner
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Local
constructor
A new instance of Local.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Local
Returns a new instance of Local.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/danger/commands/local.rb', line 22 def initialize(argv) @pr_num = argv.option("use-merged-pr") @clear_http_cache = argv.flag?("clear-http-cache", false) super if argv.flag?("pry", false) @dangerfile_path = PrySetup.new(cork).setup_pry(@dangerfile_path) end end |
Class Method Details
.options ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/danger/commands/local.rb', line 14 def self. [ ["--use-merged-pr=[#id]", "The ID of an already merged PR inside your history to use as a reference for the local run."], ["--clear-http-cache", "Clear the local http cache before running Danger locally."], ["--pry", "Drop into a Pry shell after evaluating the Dangerfile."] ] end |
Instance Method Details
#run ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/danger/commands/local.rb', line 40 def run ENV["DANGER_USE_LOCAL_GIT"] = "YES" ENV["LOCAL_GIT_PR_ID"] = @pr_num if @pr_num configure_octokit(ENV["DANGER_TMPDIR"] || Dir.tmpdir) env = EnvironmentManager.new(ENV, cork) dm = Dangerfile.new(env, cork) LocalSetup.new(dm, cork).setup(verbose: verbose) do dm.run( Danger::EnvironmentManager.danger_base_branch, Danger::EnvironmentManager.danger_head_branch, @dangerfile_path, nil, nil ) end end |
#validate! ⇒ Object
33 34 35 36 37 38 |
# File 'lib/danger/commands/local.rb', line 33 def validate! super unless @dangerfile_path help! "Could not find a Dangerfile." end end |