├── yukitask ├── graph.html ├── graph-recent.html ├── log.json ├── here_aliases ├── TODO ├── config.rb ├── command_aliases ├── makefile.latex ├── makefile.default ├── touch_task ├── show_todo ├── here ├── zip_to_backup └── update_graph └── README.md /yukitask/graph.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /yukitask/graph-recent.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /yukitask/log.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /yukitask/here_aliases: -------------------------------------------------------------------------------- 1 | # vim: set filetype=sh: 2 | -------------------------------------------------------------------------------- /yukitask/TODO: -------------------------------------------------------------------------------- 1 | This is your global TODO file. 2 | Use 'TT' command to edit this file. 3 | -------------------------------------------------------------------------------- /yukitask/config.rb: -------------------------------------------------------------------------------- 1 | CONFIG = {} 2 | 3 | CONFIG["PREFIX_PATHS"] = [ 4 | %r(^/Users/YOURNAME/), 5 | %r(^/Users/YOURNAME/VERY/LONG/LONG/PATH/NAME/), 6 | ] 7 | 8 | CONFIG["BACKUP_DESTDIR"] = '/Users/YOURNAME/BACKUP/DIR' 9 | -------------------------------------------------------------------------------- /yukitask/command_aliases: -------------------------------------------------------------------------------- 1 | # vim: set filetype=sh: 2 | if test "$EDITOR" = "" ; then 3 | echo "YukiTask: Warning: 'EDITOR' is not set." 4 | fi 5 | alias mk='touch_task; make' 6 | alias bk='make bk' 7 | alias e='make e' 8 | alias show='make show' 9 | alias main='make main' 10 | alias m='$EDITOR makefile' 11 | alias T='$EDITOR TODO' 12 | alias TT='$EDITOR ~/yukitask/TODO' 13 | -------------------------------------------------------------------------------- /yukitask/makefile.latex: -------------------------------------------------------------------------------- 1 | main = mydocument 2 | current = mychapter 3 | 4 | all: 5 | platex $(main).tex 6 | dvipdfmx $(main).dvi 7 | open $(main).pdf 8 | 9 | e: 10 | $(EDITOR) $(current).tex 11 | 12 | show: 13 | open $(main).pdf 14 | 15 | main: 16 | $(EDITOR) $(main).tex 17 | 18 | bk: 19 | # (pushd ..; zip -r PROJECT-BACKUP.zip PROJECT-DIRNAME; popd) 20 | @echo You are executing \'bk\' command. Please edit your \'makefile\'. 21 | 22 | # vim: set filetype=make: 23 | -------------------------------------------------------------------------------- /yukitask/makefile.default: -------------------------------------------------------------------------------- 1 | all: 2 | @echo You are executing \'mk\' command. Please edit your \'makefile\'. 3 | 4 | e: 5 | @echo You are executing \'e\' command. Please edit your \'makefile\'. 6 | 7 | show: 8 | @echo You are executing \'show\' command. Please edit your \'makefile\'. 9 | 10 | main: 11 | @echo You are executing \'main\' command. Please edit your \'makefile\'. 12 | 13 | bk: 14 | @echo You are executing \'bk\' command. Please edit your \'makefile\'. 15 | 16 | # vim: set filetype=make: 17 | -------------------------------------------------------------------------------- /yukitask/touch_task: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'json' 4 | 5 | JSON_FILENAME = "~/yukitask/log.json" 6 | 7 | date = Time.now.strftime("%Y-%m-%d") 8 | pwd = Dir.getwd 9 | hash = { 'pwd' => pwd, 'date' => date } 10 | 11 | ar = [] 12 | File::open(File.expand_path(JSON_FILENAME)) do |file| 13 | ar = JSON.load(file) 14 | ar << hash 15 | end 16 | 17 | File::open(File.expand_path(JSON_FILENAME), "w") do |file| 18 | file.puts(JSON.pretty_generate(ar)) 19 | end 20 | 21 | system("update_graph") 22 | 23 | # vim: set filetype=ruby: 24 | -------------------------------------------------------------------------------- /yukitask/show_todo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | COMMON_TODO = '$HOME/yukitask/TODO' 4 | CURRENT_TODO = 'TODO' 5 | PARENTS = 3 6 | 7 | RED = "\033[31m" 8 | BLUE = "\033[34m" 9 | DEFAULT = "\033[0m" 10 | 11 | print BLUE 12 | system("cat #{COMMON_TODO}") 13 | print RED 14 | 15 | todo = CURRENT_TODO 16 | PARENTS.times do 17 | if File.exists?(todo) 18 | if todo != CURRENT_TODO 19 | puts "(This TODO is not in the current directory.)" 20 | end 21 | system("cat #{todo}") 22 | break 23 | else 24 | todo = '../' + todo 25 | end 26 | end 27 | print DEFAULT 28 | 29 | # vim: set filetype=ruby: 30 | -------------------------------------------------------------------------------- /yukitask/here: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ALIAS_FILE = '~/yukitask/here_aliases' 4 | 5 | if ARGV.length != 1 6 | puts "Usage: here project-code" 7 | puts "Example: here foo" 8 | abort 9 | end 10 | 11 | PROJECT_CODE = ARGV[0] 12 | 13 | CMDLINE = "alias #{PROJECT_CODE}='pushd #{Dir.pwd}; show_todo'" 14 | 15 | File::open(File.expand_path(ALIAS_FILE), "a+") do |f| 16 | f.puts(CMDLINE) 17 | end 18 | 19 | puts "#{ALIAS_FILE} is updated.\n#{CMDLINE}" 20 | 21 | system("echo source #{ALIAS_FILE} | pbcopy") 22 | puts "Execute Command+V on the command line to update aliases." 23 | 24 | # vim: set filetype=ruby: 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## YukiTask - A Simple Task Manager for Command Line Lovers. 2 | 3 | http://yukitask.textfile.org/ 4 | 5 | ## INSTALL 6 | 7 | * Download zip and extract it. 8 | 9 | * Move YukiTask files to your home directory. 10 | 11 | ``` 12 | $ mv yukitask ~/ 13 | ``` 14 | 15 | * Add following lines at end of your ~/.bashrc. 16 | 17 | ``` sh 18 | export EDITOR=vim 19 | PATH=~/yukitask:$PATH 20 | source ~/yukitask/command_aliases 21 | source ~/yukitask/here_aliases 22 | ``` 23 | 24 | * Reload `~/.bashrc' 25 | 26 | ``` 27 | $ source ~/.bashrc 28 | ``` 29 | 30 | * That is all. 31 | 32 | ## Web site 33 | 34 | http://yukitask.textfile.org 35 | 36 | -------------------------------------------------------------------------------- /yukitask/zip_to_backup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | load '~/yukitask/config.rb' 4 | DESTDIR = CONFIG["BACKUP_DESTDIR"] 5 | 6 | if ARGV.length < 2 7 | puts "Usage: zip_to_backup projectname srcdirname ... " 8 | puts "Example: 1) zip_to_backup girldoc doc" 9 | puts "It will create #{DESTDIR}/girldoc_yyyy-mm-dd-hhmmss.zip." 10 | puts 11 | puts "Example: 2) zip_to_backup notetex note/*.tex tex images" 12 | puts "It will create #{DESTDIR}/notetex_yyyy-mm-dd-hhmmss.zip." 13 | abort 14 | end 15 | PROJECTNAME = ARGV.shift 16 | SRCDIRNAME = ARGV.join(' ') 17 | ZIPNAME = Time.now.strftime("#{DESTDIR}/#{PROJECTNAME}_%Y-%m-%d-%H%M%S.zip") 18 | COMMAND = "zip -r #{ZIPNAME} #{SRCDIRNAME}" 19 | puts "Executing #{COMMAND}..."; 20 | system(COMMAND); 21 | puts "#{ZIPNAME} is created." 22 | 23 | # vim: set filetype=ruby: 24 | -------------------------------------------------------------------------------- /yukitask/update_graph: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'json' 4 | require 'date' 5 | 6 | load '~/yukitask/config.rb' 7 | 8 | PREFIX_PATHS = CONFIG["PREFIX_PATHS"] 9 | W = 16 10 | H = 16 11 | PADDING = 2 12 | RECENT_DAYS = 10 13 | LOG_FILENAME = "~/yukitask/log.json" 14 | GRAPH_FILENAME = "~/yukitask/graph.html" 15 | GRAPH_RECENT_FILENAME = "~/yukitask/graph-recent.html" 16 | 17 | def write_svg(a, filename, width, height) 18 | d = Hash.new {|hash, key| hash[key] = Hash.new(0) } 19 | p = Hash.new {|hash, key| hash[key] = Hash.new(0) } 20 | a.each do |item| 21 | d[item["date"]][item["pwd"]] += 1 22 | p[item["pwd"]][item["date"]] += 1 23 | end 24 | File::open(File.expand_path(filename), "w") do |f| 25 | f.puts <<"EOD" 26 | 27 | 28 |
29 | 30 | 52 | 53 | 54 | EOD 55 | end 56 | end 57 | 58 | a = nil 59 | File::open(File.expand_path(LOG_FILENAME), "r") do |file| 60 | a = JSON.load(file) 61 | end 62 | write_svg(a, GRAPH_FILENAME, 1000, 500) 63 | 64 | # Recent 10 days only 65 | latest = (Time.now - RECENT_DAYS * 24 * 60 * 60).strftime("%Y-%m-%d") 66 | a = a.delete_if do |e| 67 | e["date"] < latest 68 | end 69 | a.each do |e| 70 | PREFIX_PATHS.each do |prefix| 71 | e["pwd"].sub!(prefix, "") 72 | end 73 | end 74 | write_svg(a, GRAPH_RECENT_FILENAME, 1000, 500) 75 | 76 | # vim: set filetype=ruby: 77 | --------------------------------------------------------------------------------