class Mygen::Generator

Attributes

dest_dir[RW]
dry_run[RW]
name[RW]
options[RW]
template_source_dir[RW]

Public Class Methods

descendants() click to toggle source
# File lib/mygen/generator.rb, line 18
def self.descendants
  ObjectSpace.each_object(Class).select { |klass| klass < self }
end
new() click to toggle source
# File lib/mygen/generator.rb, line 14
def initialize
  @template_source_dir = File.join(ENV['HOME'], ".mygen", "plugins", generator_name, "templates").tr('\\', '/')
end

Public Instance Methods

description() click to toggle source
# File lib/mygen/generator.rb, line 22
def description
  "Plugin has no description"
end
fileutils() click to toggle source
# File lib/mygen/generator.rb, line 30
def fileutils
  dry_run ? FileUtils::DryRun : FileUtils::Verbose
end
generator_name() click to toggle source
# File lib/mygen/generator.rb, line 26
def generator_name
  snake_case(self.class.name)
end
parent_dirs_dont_exist?(path) click to toggle source
# File lib/mygen/generator.rb, line 34
def parent_dirs_dont_exist?(path)
  parent_dir = File.expand_path("..", path)
  return false if path.include?('__')
  return !File.exist?(path)
end