Sha256: 5822d83f10135b1e4b79940ae879426c2c1b88f6b2919d54b6ea4424f4211334

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module Danger
  class Init < Danger::Runner
    self.description = 'Creates a Dangerfile.'
    self.command = 'init'

    def initialize(argv)
      @dangerfile_path = "Dangerfile" if File.exist? "Dangerfile"
      super
    end

    def validate!
      if @dangerfile_path
        help! "Found an existing Dangerfile."
      end
    end

    def run
      dir = Danger.gem_path

      content = File.read(File.join(dir, "lib", "assets", "DangerfileTemplate"))
      File.write("Dangerfile", content)
      puts "Successfully created 'Dangerfile'"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-0.2.1 lib/danger/init.rb
danger-0.2.0 lib/danger/init.rb
danger-0.1.1 lib/danger/init.rb