Module: Cog::Controllers::PluginController
- Defined in:
- lib/cog/controllers/plugin_controller.rb
Overview
Manage cog
plugins
Class Method Summary collapse
-
.create(name) ⇒ nil
Generate a new project plugin with the given name.
-
.list ⇒ Array<String>
A list of available plugins.
Class Method Details
.create(name) ⇒ nil
Generate a new project plugin with the given name
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cog/controllers/plugin_controller.rb', line 12 def self.create(name) raise Errors::DuplicatePlugin.new(name) unless Cog.plugin(name).nil? @cogfile_type = :plugin @prefix = '' @cog_version = Cog::VERSION @plugin_name = name.to_s.underscore @plugin_module = name.to_s.camelize prefix = Cog.project_plugin_path prefix = prefix ? "#{prefix}/" : '' opt = { :absolute_destination => true, :binding => binding } [ ['Cogfile', 'Cogfile'], ['plugin/plugin.rb', "lib/#{@plugin_name}.rb"], ['plugin/generator.rb.erb', "templates/#{@plugin_name}/generator.rb.erb"], ].each do |tm, dest| Generator.stamp "cog/#{tm}", "#{prefix}#{@plugin_name}/#{dest}", opt end nil end |