danger 0.7.2 ā 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/commands/init.rb +8 -8
- data/lib/danger/core_ext/string.rb +4 -0
- data/lib/danger/plugin.rb +1 -2
- data/lib/danger/request_sources/github.rb +4 -4
- data/lib/danger/scm_source/git_repo.rb +6 -0
- data/lib/danger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d97659425a77d1d4f21f22f7ba9fd43afd47d974
|
4
|
+
data.tar.gz: 4d3eb4ce159a4deb8326bebb05073e81cc91e233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba7e1f9b4fb554dc663d81bf58b260a51914625c245ef9a30b6265f67155e1a1ba164df8c7db9a4c6895897b0761301df2bbe1f7a896bbf61dd5f6f7e70b002
|
7
|
+
data.tar.gz: bd2495aa7cc47436669f8c4d9d190a501bf7273cb53997b97f93abb1541c2eabf17e8b8906d9b2b7f8ee4f580225680243804e58776a59b642ba2c08ae0ef84f
|
data/lib/danger/commands/init.rb
CHANGED
@@ -23,7 +23,7 @@ module Danger
|
|
23
23
|
|
24
24
|
def run
|
25
25
|
ui = Interviewer.new
|
26
|
-
ui.say "\nOK, thanks #{ENV['LOGNAME']},
|
26
|
+
ui.say "\nOK, thanks #{ENV['LOGNAME']}, have a seat and we'll get you started.\n".yellow
|
27
27
|
ui.pause 1
|
28
28
|
|
29
29
|
show_todo_state
|
@@ -43,11 +43,11 @@ module Danger
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def show_todo_state
|
46
|
-
ui.say "We need to do the following
|
46
|
+
ui.say "We need to do the following:\n"
|
47
47
|
ui.pause 0.6
|
48
48
|
ui.say " - [ ] Create a Dangerfile and add a few simple rules."
|
49
49
|
ui.pause 0.6
|
50
|
-
ui.say " - [#{@account_created ? 'x' : ' '}] Create a GitHub account for Danger use for messaging."
|
50
|
+
ui.say " - [#{@account_created ? 'x' : ' '}] Create a GitHub account for Danger to use, for messaging."
|
51
51
|
ui.pause 0.6
|
52
52
|
ui.say " - [ ] Set up an access token for Danger."
|
53
53
|
ui.pause 0.6
|
@@ -71,7 +71,7 @@ module Danger
|
|
71
71
|
ui.pause 2
|
72
72
|
|
73
73
|
ui.say "There's a collection of small, simple ideas in here, but Danger is about being able to easily"
|
74
|
-
ui.say "iterate. The power comes from you
|
74
|
+
ui.say "iterate. The power comes from you having the ability to codify fixes for some of the problems"
|
75
75
|
ui.say "that come up in day to day programming. It can be difficult to try and see those from day 1."
|
76
76
|
|
77
77
|
ui.say "\nIf you'd like to investigate the file, and make some changes - I'll wait here,"
|
@@ -113,7 +113,7 @@ module Danger
|
|
113
113
|
ui.say "For Open Source projects, I'd recommend giving the token the smallest scope possible."
|
114
114
|
ui.say "This means only providing access to " + "public_repo".yellow + " in the token.\n\n"
|
115
115
|
ui.pause 1
|
116
|
-
ui.say "This token limits Danger's abilities to just
|
116
|
+
ui.say "This token limits Danger's abilities to just writing comments on OSS projects. I recommend"
|
117
117
|
ui.say "this because the token can quite easily be extracted from the environment via pull requests."
|
118
118
|
ui.say "#{@bot_name} does not need admin access to your repo. So its ability to cause chaos is minimalized.\n"
|
119
119
|
|
@@ -148,7 +148,7 @@ module Danger
|
|
148
148
|
ui.say "\nOK, I'll give you a moment to do this..."
|
149
149
|
ui.wait_for_return
|
150
150
|
|
151
|
-
ui.
|
151
|
+
ui.header "Final step: exposing the GitHub token as an environment build variable."
|
152
152
|
ui.pause 0.4
|
153
153
|
if considered_an_oss_repo?
|
154
154
|
ui.say "As you have an Open Source repo, this token should be considered public, otherwise you cannot"
|
@@ -207,7 +207,7 @@ module Danger
|
|
207
207
|
# https://travis-ci.org/artsy/eigen/settings
|
208
208
|
ui.say "In order to add an environment variable, go to:"
|
209
209
|
ui.link "https://travis-ci.org/#{current_repo_slug}/settings"
|
210
|
-
ui.say "\nThe name is " + "DANGER_GITHUB_API_TOKEN".yellow + " and the value is the GitHub Personal
|
210
|
+
ui.say "\nThe name is " + "DANGER_GITHUB_API_TOKEN".yellow + " and the value is the GitHub Personal Access Token."
|
211
211
|
if @is_open_source
|
212
212
|
ui.say "Make sure to have \"Display value in build log\" enabled."
|
213
213
|
end
|
@@ -262,7 +262,7 @@ module Danger
|
|
262
262
|
ui.say "\n\nš"
|
263
263
|
ui.pause 0.6
|
264
264
|
|
265
|
-
ui.say "And you're
|
265
|
+
ui.say "And you're good to go. Danger is a collaboration between Orta Therox, Gem 'Danger' McShane and Felix Krause."
|
266
266
|
ui.say "If you like it, let others know. If you want to know more, follow " + "@orta".yellow + " and " + "@KrauseFx".yellow + " on Twitter."
|
267
267
|
ui.say "If you don't like it, help us improve it! xxx"
|
268
268
|
end
|
data/lib/danger/plugin.rb
CHANGED
@@ -9,8 +9,7 @@ module Danger
|
|
9
9
|
# Since we have a reference to the DSL containing all the information
|
10
10
|
# We need to redirect the self calls to the DSL
|
11
11
|
def method_missing(method_sym, *arguments, &_block)
|
12
|
-
|
13
|
-
return @dsl.method_missing(method_sym, *arguments)
|
12
|
+
@dsl.send(method_sym, *arguments)
|
14
13
|
end
|
15
14
|
|
16
15
|
def run
|
@@ -20,7 +20,7 @@ module Danger
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def client
|
23
|
-
raise "No API given, please provide one using `DANGER_GITHUB_API_TOKEN`" if !@token && !support_tokenless_auth
|
23
|
+
raise "No API token given, please provide one using `DANGER_GITHUB_API_TOKEN`" if !@token && !support_tokenless_auth
|
24
24
|
|
25
25
|
@client ||= Octokit::Client.new(
|
26
26
|
access_token: @token
|
@@ -129,7 +129,7 @@ module Danger
|
|
129
129
|
# use a read-only GitHub account
|
130
130
|
if errors.count > 0
|
131
131
|
# We need to fail the actual build here
|
132
|
-
abort("\nDanger has failed this build. \nFound #{errors.count}
|
132
|
+
abort("\nDanger has failed this build. \nFound #{'error'.danger_pluralize(errors.count)} and I don't have write access to the PR set a PR status.")
|
133
133
|
else
|
134
134
|
puts message
|
135
135
|
end
|
@@ -156,8 +156,8 @@ module Danger
|
|
156
156
|
return "All green. #{random_compliment}"
|
157
157
|
else
|
158
158
|
message = "ā "
|
159
|
-
message += "#{
|
160
|
-
message += "#{
|
159
|
+
message += "#{'Error'.danger_pluralize(errors.count)}. " unless errors.empty?
|
160
|
+
message += "#{'Warning'.danger_pluralize(warnings.count)}. " unless warnings.empty?
|
161
161
|
message += "Don't worry, everything is fixable."
|
162
162
|
return message
|
163
163
|
end
|
@@ -5,10 +5,12 @@ require 'git'
|
|
5
5
|
module Danger
|
6
6
|
class GitRepo
|
7
7
|
attr_accessor :diff
|
8
|
+
attr_accessor :log
|
8
9
|
|
9
10
|
def diff_for_folder(folder, from: "master", to: 'HEAD')
|
10
11
|
repo = Git.open folder
|
11
12
|
self.diff = repo.diff(from, to)
|
13
|
+
self.log = repo.log.between(from, to)
|
12
14
|
end
|
13
15
|
|
14
16
|
def exec(string)
|
@@ -38,5 +40,9 @@ module Danger
|
|
38
40
|
def insertions
|
39
41
|
@diff.insertions
|
40
42
|
end
|
43
|
+
|
44
|
+
def commits
|
45
|
+
log.to_a
|
46
|
+
end
|
41
47
|
end
|
42
48
|
end
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|