Sha256: f7a766c64a226a9149ac6ff694042b58fb05ce743a2a474431f4bfd41e6aa6e2

Contents?: true

Size: 668 Bytes

Versions: 52

Compression:

Stored size: 668 Bytes

Contents

context = ChefCLI::Generator.context
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
libraries_dir = File.join(cookbook_dir, 'libraries')
helpers_path = File.join(cookbook_dir, 'libraries', "#{context.new_file_basename}.rb")

directory libraries_dir

def camelize(name)
  name.to_s.split(/[^a-zA-Z]/).map(&:capitalize).join
end

cookbook_class_name = camelize(context.cookbook_name)
helper_class_name = "#{camelize(context.new_file_basename)}Helpers"

template helpers_path do
  source 'helpers.rb.erb'
  helpers(ChefCLI::Generator::TemplateHelper)
  variables(cookbook_class_name: cookbook_class_name, helper_class_name: helper_class_name)
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
chef-cli-5.6.14 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.13 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.12 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.11 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.8 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.1 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.6.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.5.6 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.5.5 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.5.4 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.5.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.4.2 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.4.1 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.3.1 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.3.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.2.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.1.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-5.0.1 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-4.0.1 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb
chef-cli-4.0.0 lib/chef-cli/skeletons/code_generator/recipes/helpers.rb