Sha256: a852ae9ae72339b423c7620d73383291145a2aa99b51b46d45bf9524eec6169b

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

module Danger
  class Init < 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

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.3.0 lib/danger/commands/init.rb