lib/danger/commands/local.rb in danger-3.3.2 vs lib/danger/commands/local.rb in danger-3.4.0

- old
+ new

@@ -7,10 +7,18 @@ module Danger class Local < Runner self.summary = "Run the Dangerfile locally." self.command = "local" + def self.options + [ + ["--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 + def initialize(argv) @pr_num = argv.option("use-merged-pr") @clear_http_cache = argv.flag?("clear-http-cache", false) super @@ -37,18 +45,10 @@ cork.warn "Pry was not found, and is required for 'danger local --pry'." cork.print_warnings abort end - def self.options - [ - ["--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."] - ].concat(super) - end - def validate! super unless @dangerfile_path help! "Could not find a Dangerfile." end @@ -65,10 +65,10 @@ builder.use Faraday::HttpCache, store: cache, serializer: Marshal, shared_cache: false builder.use Octokit::Response::RaiseError builder.adapter Faraday.default_adapter end - env = EnvironmentManager.new(ENV) + env = EnvironmentManager.new(ENV, cork) dm = Dangerfile.new(env, cork) dm.init_plugins source = dm.env.ci_source if source.nil? or source.repo_slug.empty?