Module: DMGen::PluginGenerator

Included in:
Adapter, Is
Defined in:
lib/dm-gen/generators/plugin_generator.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dm-gen/generators/plugin_generator.rb', line 4

def self.included(model)
  model.extend(ClassMethods)

  # all plugins need a name
  model.first_argument :name, :required => true

  # glob the template dir for all templates.
  # since we want text files processed, we have to replace the default
  # extension list.
  model.glob!('', %w[rb txt Rakefile LICENSE README.rdoc])

  model.file :gitignore, '.gitignore'
end

Instance Method Details

#class_nameObject



26
27
28
# File 'lib/dm-gen/generators/plugin_generator.rb', line 26

def class_name
  name.camel_case
end

#destination_rootObject



30
31
32
# File 'lib/dm-gen/generators/plugin_generator.rb', line 30

def destination_root
  File.join(@destination_root, gem_name)
end

#gem_nameObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/dm-gen/generators/plugin_generator.rb', line 18

def gem_name
  raise NotImplementedError
end

#snake_nameObject



22
23
24
# File 'lib/dm-gen/generators/plugin_generator.rb', line 22

def snake_name
  name.snake_case
end