Class: BunBo

Inherits:
Object
  • Object
show all
Defined in:
lib/bun_bo.rb,
lib/bun_bo/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#run(input_path) ⇒ Object



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

def run(input_path)
  if File.file?(input_path)
    folder_path, file_name = File.split(input_path)
    extension = File.extname(file_name)
    base_name = File.basename(file_name, extension)

    test_folder = File.join('spec', folder_path)
    test_path = File.join(test_folder, "#{base_name}_spec#{extension}")

    FileUtils.mkdir_p(test_folder)
    File.write(test_path, '')
  else
    puts "File does not exists"
  end
end