danger 3.4.2 → 3.5.0

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: 44b2fc8e9ba271755b5995d03991b6039535ef80
4
- data.tar.gz: 20de81281c3a7291570bf4d0cabef7b995806cca
3
+ metadata.gz: af48c7716089bda158a7d4fb5422684cda1cf882
4
+ data.tar.gz: 31bcd2dba47171bf5898a2d0954c385b7aa1e60b
5
5
  SHA512:
6
- metadata.gz: 86f4f302fdf25c27e572f08c2ec7424f52d24c87f8e125cb511e88572645e2f04a507a8aafcb82642acc73f74466695267662262cad34fc6964e9a131964dd4d
7
- data.tar.gz: 35606932eacff700e806a9cb68d629e2f0eff6d27752248f6b6c1c348772d3d7c568c3f2345c2302b112fbfb4b33b624f47ba5ec404c027262e9faac2f1a64e2
6
+ metadata.gz: 18da3b3a61540d5b8725e5d154c5f38e346af10429ef61fbbc280fe9f8bab6206b8442f0c868ca4559bbfe28a011607f1caac4aaccc234f86679c33435fa32c3
7
+ data.tar.gz: de5ffb844e8cd08df544bdde71411d3a2e1a2520fd626f018f3c51ffe44bde1f207a2608713c1cbb7ab134682aea672a2de83e454285b29ca9abd5e033f7e6c8
@@ -0,0 +1,43 @@
1
+ require "claide_plugin"
2
+ require "danger/commands/dangerfile/init"
3
+
4
+ module Danger
5
+ class DangerfileGem < DangerfileCommand
6
+ self.summary = "Create a gem-based Dangerfile quickly."
7
+ def self.description
8
+ <<-DESC
9
+ Creates a scaffold for the development of a new gem based Dangerfile
10
+ named `NAME` according to the best practices.
11
+ DESC
12
+ end
13
+ self.command = "gem"
14
+ self.arguments = [
15
+ CLAide::Argument.new("NAME", true)
16
+ ]
17
+
18
+ def initialize(argv)
19
+ @name = argv.shift_argument
20
+ prefix = "dangerfile" + "-"
21
+ unless @name.nil? || @name.empty? || @name.start_with?(prefix)
22
+ @name = prefix + @name.dup
23
+ end
24
+ @template_url = argv.shift_argument
25
+ super
26
+ end
27
+
28
+ def validate!
29
+ super
30
+ if @name.nil? || @name.empty?
31
+ help! "A name for the plugin is required."
32
+ end
33
+
34
+ help! "The plugin name cannot contain spaces." if @name =~ /\s/
35
+ end
36
+
37
+ def run
38
+ runner = CLAide::TemplateRunner.new(@name, "https://github.com/danger/dangerfile-gem-template")
39
+ runner.clone_template
40
+ runner.configure_template
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+ require "danger/danger_core/dangerfile_generator"
2
+
3
+ # Mainly so we can have a nice strucutre for commands
4
+
5
+ module Danger
6
+ class DangerfileCommand < Runner
7
+ self.summary = "Easily create you Dangerfiles."
8
+ self.command = "dangerfile"
9
+
10
+ self.abstract_command = true
11
+ def self.options
12
+ []
13
+ end
14
+ end
15
+ end
16
+
17
+ # Just a less verbose way of doing the Dangerfile from `danger init`.
18
+
19
+ module Danger
20
+ class DangerfileInit < DangerfileCommand
21
+ self.summary = "Create an example Dangerfile."
22
+ self.command = "init"
23
+
24
+ def run
25
+ content = DangerfileGenerator.create_dangerfile(".", cork)
26
+ File.write("Dangerfile", content)
27
+ cork.puts "Created" + "./Dangerfile".green
28
+ end
29
+ end
30
+ end
@@ -1,4 +1,5 @@
1
1
  require "danger/commands/init_helpers/interviewer"
2
+ require "danger/danger_core/dangerfile_generator"
2
3
  require "danger/ci_source/local_git_repo"
3
4
  require "yaml"
4
5
 
@@ -53,8 +54,7 @@ module Danger
53
54
  end
54
55
 
55
56
  def setup_dangerfile
56
- dir = Danger.gem_path
57
- content = File.read(File.join(dir, "lib", "assets", "DangerfileTemplate"))
57
+ content = DangerfileGenerator.create_dangerfile(".", cork)
58
58
  File.write("Dangerfile", content)
59
59
 
60
60
  ui.header "Step 1: Creating a starter Dangerfile"
@@ -19,6 +19,9 @@ module Danger
19
19
  require "danger/commands/plugins/plugin_json"
20
20
  require "danger/commands/plugins/plugin_readme"
21
21
 
22
+ require "danger/commands/dangerfile/init"
23
+ require "danger/commands/dangerfile/gem"
24
+
22
25
  attr_accessor :cork
23
26
 
24
27
  self.summary = "Run the Dangerfile."
@@ -0,0 +1,11 @@
1
+ module Danger
2
+ class DangerfileGenerator
3
+ # returns the string for a Dangerfile based on a folder's contents'
4
+ def self.create_dangerfile(_path, _ui)
5
+ # Use this template for now, but this is a really ripe place to
6
+ # improve now!
7
+ dir = Danger.gem_path
8
+ File.read(File.join(dir, "lib", "assets", "DangerfileTemplate"))
9
+ end
10
+ end
11
+ end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "3.4.2".freeze
2
+ VERSION = "3.5.0".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".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: 3.4.2
4
+ version: 3.5.0
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-10-03 00:00:00.000000000 Z
12
+ date: 2016-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -29,16 +29,16 @@ dependencies:
29
29
  name: claide-plugins
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 0.9.0
34
+ version: 0.9.2
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.9.0
41
+ version: 0.9.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: git
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -374,7 +374,6 @@ files:
374
374
  - README.md
375
375
  - bin/danger
376
376
  - lib/assets/DangerfileTemplate
377
- - lib/assets/PluginTemplate.rb.template
378
377
  - lib/danger.rb
379
378
  - lib/danger/ci_source/bitrise.rb
380
379
  - lib/danger/ci_source/buildkite.rb
@@ -393,6 +392,8 @@ files:
393
392
  - lib/danger/ci_source/travis.rb
394
393
  - lib/danger/ci_source/xcode_server.rb
395
394
  - lib/danger/clients/rubygems_client.rb
395
+ - lib/danger/commands/dangerfile/gem.rb
396
+ - lib/danger/commands/dangerfile/init.rb
396
397
  - lib/danger/commands/init.rb
397
398
  - lib/danger/commands/init_helpers/interviewer.rb
398
399
  - lib/danger/commands/local.rb
@@ -410,6 +411,7 @@ files:
410
411
  - lib/danger/core_ext/string.rb
411
412
  - lib/danger/danger_core/dangerfile.rb
412
413
  - lib/danger/danger_core/dangerfile_dsl.rb
414
+ - lib/danger/danger_core/dangerfile_generator.rb
413
415
  - lib/danger/danger_core/environment_manager.rb
414
416
  - lib/danger/danger_core/executor.rb
415
417
  - lib/danger/danger_core/messages/markdown.rb
@@ -1,20 +0,0 @@
1
- module Danger
2
- class Dangerfile
3
- module DSL
4
- class [[CLASS_NAME]] < Plugin
5
- def run(parameter1: nil, parameter2: nil)
6
- if (pr_body + pr_title).include?("WIP")
7
- warn "Pull Request is Work in Progress"
8
- end
9
- end
10
-
11
- def self.description
12
- [
13
- "Describe what this plugin does",
14
- "and how the user can use it"
15
- ].join(" ")
16
- end
17
- end
18
- end
19
- end
20
- end