Class: TaskLoop::List

Inherits:
Command
  • Object
show all
Includes:
DSL, ProjTaskList
Defined in:
lib/taskloop/command/list.rb

Constant Summary

Constants inherited from Command

Command::DOLPHIN, Command::LOGO

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ProjTaskList

#clean_cache_file_if_needed, #construct_proj_tasklist_map, #create_data_proj_description_if_needed, #create_data_proj_dir_if_needed, #eval_taskfile

Methods included from DSL

#after, #at, #before, #between, #date, #env, #from, #interval, #loop, #time, #to

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 Attribute Details

#proj_tasklist_mapObject (readonly)

Returns the value of attribute proj_tasklist_map.



17
18
19
# File 'lib/taskloop/command/list.rb', line 17

def proj_tasklist_map
  @proj_tasklist_map
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/taskloop/command/list.rb', line 23

def run
  super
  create_data_proj_dir_if_needed
  create_data_proj_description_if_needed

  construct_proj_tasklist_map
  setup_task_property

  show_proj_tasklist_info
end

#show_proj_tasklist_infoObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/taskloop/command/list.rb', line 34

def show_proj_tasklist_info
  unless @proj_tasklist_map != nil && !@proj_tasklist_map.empty?
    puts "Warning: there is no task in taskloop.".ansi.yellow
    return
  end
  @proj_tasklist_map.each do |proj, list|
    unless list.length > 0
      next
    end
    puts "=============================".ansi.blue
    puts "Tasks above are defined in Taskfile of <#{proj}>".ansi.blue
    list.each do |task|
      puts "  #{task.desc}".ansi.blue
      puts "    t.name        = #{task.name}".ansi.blue
      puts "    t.path        = #{task.path}".ansi.blue
      puts "    t.year        = #{task.year.desc}".ansi.blue
      puts "    t.month       = #{task.month.desc}".ansi.blue
      puts "    t.day         = #{task.day.desc}".ansi.blue
      puts "    t.hour        = #{task.hour.desc}".ansi.blue
      puts "    t.minute      = #{task.minute.desc}".ansi.blue
      puts "    t.loop        = #{task.loop.desc}".ansi.blue
      puts "    t.start_point = #{task.start_point.desc}".ansi.blue
      puts "    t.end_point   = #{task.end_point.desc}".ansi.blue
    end
  end
end