Class: Acclir::Command::New
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Acclir::Command::New
- Includes:
- Thor::Actions
- Defined in:
- lib/acclir/command/new.rb
Overview
Generate files for the contest
Constant Summary collapse
- BASE_NAME =
"main"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#contest ⇒ Object
Returns the value of attribute contest.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/acclir/command/new.rb', line 13 def config @config end |
#contest ⇒ Object
Returns the value of attribute contest.
13 14 15 |
# File 'lib/acclir/command/new.rb', line 13 def contest @contest end |
Class Method Details
.source_root ⇒ Object
15 16 17 |
# File 'lib/acclir/command/new.rb', line 15 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#create_contest_files ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/acclir/command/new.rb', line 23 def create_contest_files contest.tasks.each do |task| dir = "#{contest.id}/#{task.id}/" file_path = "./#{dir}/#{BASE_NAME}.rb" test_file_path = "./#{dir}/#{BASE_NAME}_test.rb" create_file file_path template( "../templates/new/#{BASE_NAME}_test.rb.tt", test_file_path, { file_path: file_path, task: task } ) end end |