-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support a danger local
command
#40
Changes from 1 commit
fa09e05
d8d1f2d
7d0b4be
171293c
32bc182
6f29ae0
c132d74
6458ab4
95d56c6
0719140
b730589
456ff79
41a5939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts "ok" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Danger | ||
class Local < Runner | ||
self.description = 'Run the Dangerfile locally.' | ||
self.command = 'local' | ||
|
||
def initialize(argv) | ||
@dangerfile_path = "Dangerfile" if File.exist? "Dangerfile" | ||
super | ||
end | ||
|
||
def validate! | ||
super | ||
unless @dangerfile_path | ||
help! "Could not find a Dangerfile." | ||
end | ||
end | ||
|
||
def run | ||
# The order of the following commands is *really* important | ||
dm = Dangerfile.new | ||
dm.env = EnvironmentManager.new(ENV) | ||
dm.env.ci_source = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace detected. |
||
dm.env.fill_environment_vars | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent the first parameter one step more than the start of the previous line. |
||
dm.env.scm.diff_for_folder(".", dm.env.ci_source.base_commit, dm.env.ci_source.head_commit) | ||
dm.parse Pathname.new(@dangerfile_path) | ||
|
||
post_results(dm) | ||
end | ||
|
||
def post_results(dm) | ||
gh = dm.env.request_source | ||
gh.update_pull_request!(warnings: dm.warnings, errors: dm.errors, messages: dm.messages) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried to make this work like cocoapods, but I'm missing something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CocoaPods shows the sub-commands
Danger doesn't