Class: TaskLoop::Init
- Defined in:
- lib/taskloop/command/init.rb
Constant Summary
Constants inherited from Command
Command::DOLPHIN, Command::LOGO
Instance Method Summary collapse
Methods inherited from Command
#create_dir_if_needed, #create_file_if_needed, #create_taskloop_file_structure_if_needed, #initialize, #taskloop_cron_log_path, #taskloop_cron_tab_path, #taskloop_data_dir, #taskloop_data_proj_dirs, #taskloop_dir, #taskloop_environments_path, #taskloop_proj_list_dirs, #taskloop_proj_list_path, #taskloop_taskfile_paths, #tasklooprc_path
Constructor Details
This class inherits a constructor from TaskLoop::Command
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/taskloop/command/init.rb', line 13 def run super # check if Taskfile exist in current directory if File.exists?(:Taskfile.to_s) puts "Warning: Taskfile exists! There is no need to execute `taskloop init` command in current directory!".ansi.yellow puts "" return end file = File.new(:Taskfile.to_s, "w+") content = <<-DESC # env to set environment variables which are shared by all tasks defined in the Taskfile. <Optional> # env "ENV_NAME", "ENV_VALUE" TaskLoop::Task.new do |t| t.name = 'TODO: task name. <Required>' t.path = 'TODO: task job path. For example, t.path = "./Job.sh". <Required>' t.week = 'TODO: week rule. <Optional>' t.year = "TODO: year rule. <Optional>" t.month = "TODO: month rule. <Optional>" t.day = "TODO: day rule. <Optional>" t.hour = "TODO: hour rule. <Optional>" t.minute = "TODO: minute rule. <Optional>" t.date = "TODO: date list rule. <Optional>" t.time = "TODO: time list rule. <Optional>" t.loop = "TODO: loop count. <Optional>" t.start_point = "TODO: start point boundary rule. <Optional>" t.end_point = "TODO: end point boundary rule. <Optional>" end DESC file.puts content file.close end |