Module: Superbot::Validations

Included in:
CLI::RunCommand
Defined in:
lib/superbot/cli/validations.rb

Instance Method Summary collapse

Instance Method Details

#validates_project_path(path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/superbot/cli/validations.rb', line 5

def validates_project_path(path)
  unless Dir.exist? path
    raise ArgumentError, "directory #{path} does not exist"
  end

  entrypoint = File.join path, "main.rb"
  unless File.exist? entrypoint
    raise ArgumentError, "file #{entrypoint} does not exist"
  end

  path
end