Class: PreCommit::Template
- Inherits:
-
Object
- Object
- PreCommit::Template
- Defined in:
- lib/pre-commit/template.rb
Constant Summary collapse
- TEMPLATE_DIR =
File.("../../../templates/gem", __FILE__)
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#copyright ⇒ Object
readonly
Returns the value of attribute copyright.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Template
constructor
A new instance of Template.
- #save ⇒ Object
Constructor Details
#initialize(*args) ⇒ Template
11 12 13 14 15 16 |
# File 'lib/pre-commit/template.rb', line 11 def initialize(*args) @name, , @email, @description = args @gem_name = "pre-commit-#{name}" @copyright = "#{Date.today.year} #{author} #{email}" validate_params end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def end |
#copyright ⇒ Object (readonly)
Returns the value of attribute copyright.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def copyright @copyright end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def description @description end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def email @email end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def gem_name @gem_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/pre-commit/template.rb', line 9 def name @name end |
Instance Method Details
#save ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pre-commit/template.rb', line 18 def save puts "Generating #{gem_name}" all_files.each{|file| parse_and_save(file) } initialize_git puts "\nNext steps:\n- write your checks and tests for them\n- push code to github\n- open a ticket to merge your project: https://github.com/jish/pre-commit/issues\n" end |