Class: Rexer::Commands::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/rexer/commands/init.rb

Instance Method Summary collapse

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rexer/commands/init.rb', line 4

def call
  unless redmine_root_dir?
    puts Paint["Please run in the Redmine root directory.", :red]
    exit 1
  end

  definition_file = Pathname.new(Rexer.definition_file)

  if definition_file.exist?
    puts Paint["#{definition_file.basename} already exists", :red]
    exit 1
  end

  definition_file.write(template)

  puts Paint["#{definition_file.expand_path} created", :green]
end