Sha256: 77e7a44e61dafc066b3093dd1fcd9824a3f7654a2f20fd9c4a3c8a0aaa64a131

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

require_relative '../lib/chefspec_bootstrap'
require 'optparse'

options = { template: nil }

optparse = OptionParser.new do |opts|
  opts.banner = 'Usage: chefspec-bootstrap <recipe.rb> [options]'

  opts.on('-t', '--template <file>', 'ERB template file used to generate specs') do |t|
    options[:template] = t
  end

  opts.on('-s', '--spec-helper <file>', 'spec_helper.rb file. By default, looks in spec/spec_helper.rb') do |s|
    options[:spec_helper] = s
  end

  opts.on('-o', '--output <file>', 'File to output spec. Prints to stdout if not specified.') do |o|
    options[:output_file] = o
  end

  opts.on('-c', '--cookbook-path <dir>', 'Cookbook path (directory). Your spec_helper file can override this.') do |c|
    options[:cookbook_path] = c
  end
end

abort 'Recipe not specified!' if ARGV.empty?

optparse.parse!

recipe = ARGV[0]
bootstrap = ChefSpec::Bootstrap.new(
  recipe,
  options[:template],
  options[:spec_helper],
  options[:output_file],
  options[:cookbook_path]
)
bootstrap.generate

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chefspec-bootstrap-0.1.0 bin/chefspec-bootstrap
chefspec-bootstrap-0.0.5 bin/chefspec-bootstrap