danger 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b697f1591c4b33509e536da0cf20d7acaa61e8c
4
- data.tar.gz: 0a9d995a79188ae53f543230fbd9a7007c1641b8
3
+ metadata.gz: d02824eab3497550f11cb1f628aa5b3e94e31ad8
4
+ data.tar.gz: 5f17dbe1aec05cb99751f902f19f2c886893336d
5
5
  SHA512:
6
- metadata.gz: 0a1350d0ce5fbfe8c22c27c04848243a589b07e39e6805ae15343259891153145f2aacc6bee0505101cc53052d35c44b83efb3e3e05733469f9eddb6d8850bd4
7
- data.tar.gz: 0bcc00b71b54a8b4d23ac457feab9793d742c110fa55ee5997a584b7719adad5591fe4faa9f27804cff7c9253759aab6c0a63e63763825e7ea7ff0af56e19019
6
+ metadata.gz: 2788c9f4aa4c1d30efd031a5279d0f64ac29e1f4e98706ba6172d568e5a17207065ea1df78918de37a14ffc956696d9208bcdd2128bb3ef20d10506d33e93daf
7
+ data.tar.gz: 869128a91bfb572210f952ec5ce98ad7dc28f65aa04af219055a0fbde073f2c57cc40776153183125c6f38dcea574bf3ede0d43434a82e8d36c6e0294db79980
@@ -1,5 +1,6 @@
1
1
  require "danger/commands/local_helpers/http_cache"
2
2
  require "faraday/http_cache"
3
+ require "fileutils"
3
4
  require "octokit"
4
5
  require "tmpdir"
5
6
 
@@ -9,16 +10,40 @@ module Danger
9
10
  self.command = "local"
10
11
 
11
12
  def initialize(argv)
12
- @dangerfile_path = "Dangerfile" if File.exist? "Dangerfile"
13
13
  @pr_num = argv.option("use-merged-pr")
14
14
  @clear_http_cache = argv.flag?("clear-http-cache", false)
15
+
15
16
  super
17
+
18
+ setup_pry if should_pry?(argv)
19
+ end
20
+
21
+ def should_pry?(argv)
22
+ argv.flag?("pry", false) && !@dangerfile_path.empty? && validate_pry_available
23
+ end
24
+
25
+ def setup_pry
26
+ File.delete "_Dangerfile.tmp" if File.exist? "_Dangerfile.tmp"
27
+ FileUtils.cp @dangerfile_path, "_Dangerfile.tmp"
28
+ File.open("_Dangerfile.tmp", "a") do |f|
29
+ f.write("binding.pry; File.delete(\"_Dangerfile.tmp\")")
30
+ end
31
+ @dangerfile_path = "_Dangerfile.tmp"
32
+ end
33
+
34
+ def validate_pry_available
35
+ require "pry"
36
+ rescue LoadError
37
+ cork.warn "Pry was not found, and is required for 'danger local --pry'."
38
+ cork.print_warnings
39
+ abort
16
40
  end
17
41
 
18
42
  def self.options
19
43
  [
20
44
  ["--use-merged-pr=[#id]", "The ID of an already merged PR inside your history to use as a reference for the local run."],
21
- ["--clear-http-cache", "Clear the local http cache before running Danger locally."]
45
+ ["--clear-http-cache", "Clear the local http cache before running Danger locally."],
46
+ ["--pry", "Drop into a Pry shell after evaluating the Dangerfile."]
22
47
  ].concat(super)
23
48
  end
24
49
 
@@ -32,5 +32,16 @@ module Danger
32
32
  def self.inherited(plugin)
33
33
  Plugin.all_plugins.push(plugin)
34
34
  end
35
+
36
+ private
37
+
38
+ # When using `danger local --pry`, every plugin had an unreasonable
39
+ # amount of text output due to the Dangerfile reference in every
40
+ # plugin. So, it is filtered out. Users will start out in the context
41
+ # of the Dangerfile, and can view it by just typing `self` into the REPL.
42
+ #
43
+ def pretty_print_instance_variables
44
+ super - [:@dangerfile]
45
+ end
35
46
  end
36
47
  end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "0.10.0".freeze
2
+ VERSION = "0.10.1".freeze
3
3
  DESCRIPTION = "Automate your PR etiquette.".freeze
4
4
  end
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.10.0
4
+ version: 0.10.1
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-07-18 00:00:00.000000000 Z
12
+ date: 2016-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -383,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  version: '0'
384
384
  requirements: []
385
385
  rubyforge_project:
386
- rubygems_version: 2.2.2
386
+ rubygems_version: 2.4.8
387
387
  signing_key:
388
388
  specification_version: 4
389
389
  summary: Automate your PR etiquette.