Sha256: 0a04764490233d0b6ba75a19f9c349dca8a3126d23399c4b8791f5e0ce6e0620

Contents?: true

Size: 1.19 KB

Versions: 31

Compression:

Stored size: 1.19 KB

Contents

require "danger/plugin_support/plugin"

# Danger
module Danger
  # Handles interacting with local only plugin inside a Dangerfile.
  # It is support pluggin for dry_run command and does not expose any methods.
  # But you can still use other plugins like git
  #
  # @example Check that added lines contains agreed form of words 
  #
  #       git.diff.each do |chunk|
  #         chunk.patch.lines.grep(/^\+/).each do |added_line|
  #           if added_line.gsub!(/(?<cancel>cancel)(?<rest>[^l[[:space:]][[:punct:]]]+)/i, '>>\k<cancel>-l-\k<rest><<')
  #             fail "Single 'L' for cancellation-alike words in '#{added_line}'" 
  #           end
  #         end
  #       end
  #
  # @see  danger/danger
  # @tags core, local_only
  #
  class DangerfileLocalOnlyPlugin < Plugin
    # So that this init can fail.
    def self.new(dangerfile)
      return nil if dangerfile.env.request_source.class != Danger::RequestSources::LocalOnly
      super
    end

    def initialize(dangerfile)
      super(dangerfile)

      @local_repo = dangerfile.env.request_source
    end

    # The instance name used in the Dangerfile
    # @return [String]
    #
    def self.instance_name
      "local_repo"
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
danger-9.0.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.6.1 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.6.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.5.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.5 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.4 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.3 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.2 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.1 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.4.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.3.1 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.2.3 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.2.2 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.2.1 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.2.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.1.0 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.0.6 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.0.5 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.0.4 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb
danger-8.0.3 lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb