Class: DepsGrapher::Command::Init

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/deps_grapher/command/init.rb

Instance Method Summary collapse

Methods included from Logging

#error, #info, #verbose, #warn

Constructor Details

#initialize(context) ⇒ Init

Returns a new instance of Init.



11
12
13
# File 'lib/deps_grapher/command/init.rb', line 11

def initialize(context)
  @context = context
end

Instance Method Details

#run!Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/deps_grapher/command/init.rb', line 15

def run!
  dest = File.expand_path("graphile.rb")

  return if File.exist?(dest) && !ask_yes_no("Overwrite `#{dest}`?")

  context.generate_graphile dest

  info { "\n`#{dest}` was created." }
  info { "Please edit the configuration file." }
  info { "Run `bundle exec deps_grapher -c #{File.basename(dest)}`." }
end