Module: Bosh::PluginGenerator::Helpers

Extended by:
Forwardable
Included in:
Cli::Command::PluginGenerator
Defined in:
lib/bosh/plugin_generator/helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commands_folderObject

Returns the value of attribute commands_folder.



7
8
9
# File 'lib/bosh/plugin_generator/helpers.rb', line 7

def commands_folder
  @commands_folder
end

#helpers_folderObject

Returns the value of attribute helpers_folder.



7
8
9
# File 'lib/bosh/plugin_generator/helpers.rb', line 7

def helpers_folder
  @helpers_folder
end

#lib_folderObject

Returns the value of attribute lib_folder.



7
8
9
# File 'lib/bosh/plugin_generator/helpers.rb', line 7

def lib_folder
  @lib_folder
end

#plugin_folderObject

Returns the value of attribute plugin_folder.



7
8
9
# File 'lib/bosh/plugin_generator/helpers.rb', line 7

def plugin_folder
  @plugin_folder
end

#plugin_nameObject

Returns the value of attribute plugin_name.



7
8
9
# File 'lib/bosh/plugin_generator/helpers.rb', line 7

def plugin_name
  @plugin_name
end

Instance Method Details

#extract_options(plugin_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bosh/plugin_generator/helpers.rb', line 12

def extract_options(plugin_name)
  @plugin_name     = plugin_name
  @plugin_folder   = plugin_name
  @license_type    = options[:license]
  @lib_folder      = File.join(plugin_name, 'lib', 'bosh')
  @spec_folder     = File.join(plugin_name, 'spec')
  @helpers_folder  = File.join(lib_folder, short_plugin_name)
  @commands_folder = File.join(lib_folder, 'cli', 'commands')

  default_context = {
    email: Git.global_config["user.email"],
    author: Git.global_config["user.name"],
    description: "Short description.",
    license: nil,
    full_plugin_name: full_plugin_name,
    short_plugin_name: short_plugin_name,
    class_name: short_plugin_name.split('_').collect(&:capitalize).join
  }
  context = default_context.merge(options)
  raise "You need to specify email and author" if context[:email].nil? || context[:author].nil?
  templates_folder = File.expand_path("../../../../templates", __FILE__)
  @generator = Bosh::PluginGenerator::Generator.new(context, source_folder: templates_folder)
end

#generate_filesObject



36
37
38
39
40
41
42
43
44
# File 'lib/bosh/plugin_generator/helpers.rb', line 36

def generate_files
  generate_command_class
  generate_helpers
  generate_version
  generate_gemspec
  generate_readme
  generate_license if license?
  generate_developer_environment
end