Class: Jdt::Generator

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/jdt/generator/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorObject

Returns the value of attribute author.



11
12
13
# File 'lib/jdt/generator/generator.rb', line 11

def author
  @author
end

#creation_dateObject

Returns the value of attribute creation_date.



11
12
13
# File 'lib/jdt/generator/generator.rb', line 11

def creation_date
  @creation_date
end

#descriptionObject

Returns the value of attribute description.



11
12
13
# File 'lib/jdt/generator/generator.rb', line 11

def description
  @description
end

#locationObject

Returns the value of attribute location.



11
12
13
# File 'lib/jdt/generator/generator.rb', line 11

def location
  @location
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/jdt/generator/generator.rb', line 11

def name
  @name
end

Instance Method Details

#generate(name) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jdt/generator/generator.rb', line 15

def generate(name)

  # set up variables with default values
  @name = name
  @version = "0.0.1"
  @author = "AUTHOR"
  @description = "DESCRIPTION"
  @creation_date = "#{Date::MONTHNAMES[Time.now.month]} #{Time.now.year}"
  @location = "."

  # create directory and files which every extension needs
  empty_directory(prefixed_name)
  template("README.erb", "#{prefixed_name}/README")
  #template("LICENSE.erb", "#{prefixed_name}/LICENSE")
  template("CHANGELOG.erb", "#{prefixed_name}/CHANGELOG")
  template("manifest.xml.erb", "#{prefixed_name}/manifest.xml")
end