Class: Uttk::Generators::Generator

Inherits:
Rails::Generator::NamedBase
  • Object
show all
Defined in:
lib/uttk/generators/generator.rb

Defined Under Namespace

Classes: DirSource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ Generator

Returns a new instance of Generator.



27
28
29
30
31
32
33
34
35
# File 'lib/uttk/generators/generator.rb', line 27

def initialize ( runtime_args, runtime_options={} )
  @fullname = ENV['FULLNAME'] || raise('The FULLNAME environement variable is not set')
  @email = ENV['EMAIL'] || raise('The EMAIL environement variable is not set')
  @root = __FILE__.to_path.dirname.parent.parent.parent.expand_path.cleanpath
  @year = Time.now.year
  super(runtime_args,
        { :destination => @root.to_s }.merge!(runtime_options))
  @root = '.'.to_path
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



42
43
44
# File 'lib/uttk/generators/generator.rb', line 42

def email
  @email
end

#fullnameObject (readonly)

Returns the value of attribute fullname.



42
43
44
# File 'lib/uttk/generators/generator.rb', line 42

def fullname
  @fullname
end

#rootObject (readonly)

Returns the value of attribute root.



42
43
44
# File 'lib/uttk/generators/generator.rb', line 42

def root
  @root
end

#yearObject (readonly)

Returns the value of attribute year.



42
43
44
# File 'lib/uttk/generators/generator.rb', line 42

def year
  @year
end

Instance Method Details

#dir_nameObject



44
45
46
# File 'lib/uttk/generators/generator.rb', line 44

def dir_name
  module_name.to_s.underscore
end