Class: Danger::Init
- Defined in:
- lib/danger/commands/init.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Runner
Constructor Details
#initialize(argv) ⇒ Init
Returns a new instance of Init.
6 7 8 9 |
# File 'lib/danger/commands/init.rb', line 6 def initialize(argv) @dangerfile_path = "Dangerfile" if File.exist? "Dangerfile" super end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/danger/commands/init.rb', line 17 def run dir = Danger.gem_path content = File.read(File.join(dir, "lib", "assets", "DangerfileTemplate")) File.write("Dangerfile", content) puts "Successfully created 'Dangerfile'" end |
#validate! ⇒ Object
11 12 13 14 15 |
# File 'lib/danger/commands/init.rb', line 11 def validate! if @dangerfile_path help! "Found an existing Dangerfile." end end |