Class: Miron::Command::Init

Inherits:
Miron::Command show all
Defined in:
lib/miron/command/init.rb

Instance Method Summary collapse

Methods inherited from Miron::Command

options, run

Constructor Details

#initialize(argv) ⇒ Init

Returns a new instance of Init


9
10
11
12
# File 'lib/miron/command/init.rb', line 9

def initialize(argv)
  @mironfile_path = Pathname.pwd + 'Mironfile.rb'
  super
end

Instance Method Details

#runObject


19
20
21
# File 'lib/miron/command/init.rb', line 19

def run
  @mironfile_path.open('w') { |f| f << mironfile_template }
end

#validate!Object


14
15
16
17
# File 'lib/miron/command/init.rb', line 14

def validate!
  super
  help! 'Existing Mironfile found in directory' if Miron::Utils.mironfile_in_dir(Pathname.pwd)
end