danger-todoist 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 910d2aa0929cc3af3260a88dfbf1a98fe27f3435
4
- data.tar.gz: 18aa2c8dafb84287ff5e97051cb7d31f2cae6b8e
3
+ metadata.gz: d941d9cf8a4d93953bd2fdd630461f6c40c6b900
4
+ data.tar.gz: f2b5c54ec7d8f496f72305e5d1aed1e12ff82b5e
5
5
  SHA512:
6
- metadata.gz: c52239b8a95725323d644886222bd174f3a5cc90d57ffde7b37a0b750ef8269aada7977dc557b1bf29a3459a0b2943c7c07e1473813686ef0471b4f658f07daf
7
- data.tar.gz: 5e2a73ded27db0de67804511aa9cb7d23892f6725e1f3c3f70c09d8b1210571780aaf0e6c7b9fc3ca612900acf015ace3bf072f100bc5aafdc1d10cdc0bc864e
6
+ metadata.gz: c48ca6ecb0f9cb8953314f1f8e80c2ba62b9e340ab7c513286849e26a17359b40e62eb681405f5b07bc9250450c8464fa5bc5f34746d5572571cc31270d31dc9
7
+ data.tar.gz: a93783d880b1e71d429e324490bed8b6e4fa1752ac9368a2fb9100c6ed0a3be3f137037999836fb00378382b64d662df05410ef9724ba0baa23f2bf7474282b7
@@ -1,5 +1,10 @@
1
1
  ## master
2
2
 
3
+ ## 1.2.2
4
+
5
+ rescue from exception in git gem - hanneskaeufler
6
+ update documentation in readme - hanneskaeufler
7
+
3
8
  ## 1.2.1
4
9
 
5
10
  * fix issue #32 crash on nil - hanneskaeufler
data/README.md CHANGED
@@ -45,6 +45,8 @@ todoist.todos.each { |todo| puts todo.text }</pre>
45
45
 
46
46
  `message` - Message to be shown
47
47
 
48
+ `keywords` - Keywords to recognize as todos
49
+
48
50
  #### Methods
49
51
 
50
52
  `warn_for_todos` - Adds a warning if there are todos found in the modified code
@@ -1,3 +1,3 @@
1
1
  module Todoist
2
- VERSION = "1.2.1".freeze
2
+ VERSION = "1.2.2".freeze
3
3
  end
@@ -128,9 +128,26 @@ module Danger
128
128
  # into the files_of_interest. We have to make sure to only
129
129
  # try to look up diffs for actual filepaths (strings)
130
130
  def diffs_of_interest
131
- files_of_interest
132
- .select { |file| file.is_a?(String) }
133
- .map { |file| git.diff_for_file(file) }
131
+ files_of_interest.map do |file|
132
+ diff = EmptyDiff.new
133
+ begin
134
+ diff = git.diff_for_file(file)
135
+ rescue
136
+ log_unable_to_find_diff(file.inspect)
137
+ end
138
+ diff
139
+ end
140
+ end
141
+
142
+ def log_unable_to_find_diff(file)
143
+ markdown("* danger-todoist was unable to determine diff for \"#{file}\".")
144
+ end
145
+ end
146
+
147
+ # Null object incase a diff cannot be determined
148
+ class EmptyDiff
149
+ def patch
150
+ ""
134
151
  end
135
152
  end
136
153
  end
@@ -131,12 +131,21 @@ PATCH
131
131
  expect(markdowns).to be_empty
132
132
  end
133
133
 
134
- it "does not raise when git returns nil" do
134
+ it "does not raise when git raises, but warns" do
135
135
  invalid = [nil, 0, false]
136
136
  allow(@dangerfile.git).to receive(:modified_files).and_return(invalid)
137
137
  allow(@dangerfile.git).to receive(:added_files).and_return(invalid)
138
138
 
139
139
  expect { @todoist.warn_for_todos }.to_not raise_error
140
+ expect(markdowns).to include(
141
+ "* danger-todoist was unable to determine diff for \"nil\"."
142
+ )
143
+ expect(markdowns).to include(
144
+ "* danger-todoist was unable to determine diff for \"0\"."
145
+ )
146
+ expect(markdowns).to include(
147
+ "* danger-todoist was unable to determine diff for \"false\"."
148
+ )
140
149
  end
141
150
  end
142
151
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-todoist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannes Käufler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api