class ManiokBdd::Cli
Public Class Methods
new(args)
click to toggle source
# File lib/maniok_bdd/cli.rb, line 3 def initialize(args) @feature_file = args.first end
Public Instance Methods
create_spec_acceptance_folder()
click to toggle source
# File lib/maniok_bdd/cli.rb, line 16 def create_spec_acceptance_folder create_unless_exists "spec" create_unless_exists File.join("spec", "acceptance") end
ruby_file()
click to toggle source
# File lib/maniok_bdd/cli.rb, line 21 def ruby_file feature_file_basename = File.basename(@feature_file) File.join "spec", "acceptance", "#{feature_file_basename}.rb" end
run()
click to toggle source
# File lib/maniok_bdd/cli.rb, line 7 def run gherkin_formatter = ManiokBdd::GherkinFormatter.build @feature_file create_spec_acceptance_folder write_file ruby_file, gherkin_formatter.to_s 0 # success:) end
Private Instance Methods
create_unless_exists(path)
click to toggle source
# File lib/maniok_bdd/cli.rb, line 32 def create_unless_exists(path) Dir.mkdir(path) unless Dir.exist?(path) end
write_file(file_path, content)
click to toggle source
# File lib/maniok_bdd/cli.rb, line 28 def write_file(file_path, content) open(file_path, 'w') { |f| f << content } end