swatch 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG.rdoc +10 -0
  2. data/README.rdoc +25 -0
  3. data/bin/swatch +11 -4
  4. data/lib/swatch.rb +10 -0
  5. metadata +2 -1
@@ -0,0 +1,10 @@
1
+ = Changelog
2
+
3
+ == 0.2.1
4
+ Minor update to add config file support
5
+
6
+ == 0.2
7
+ Add a simple support of todo.txt
8
+
9
+ == 0.1
10
+ First usable version, with no support of todo.txt
@@ -2,3 +2,28 @@
2
2
 
3
3
  A simple command line utility in Ruby to track your time.
4
4
  Can be use with todo.txt task list.
5
+
6
+ == Usage
7
+
8
+ swatch command [option] arg
9
+
10
+ Going in a task :
11
+ swatch in My awesome task
12
+
13
+ Getting out:
14
+ swatch out
15
+
16
+ Timing a todo.txt task:
17
+ swatch in -t 42
18
+
19
+ == Config
20
+
21
+ Swatch look for the ~/.swatchrc file. If it's present swatch will parse it to get track_file and todo_file path.
22
+ Exemple :
23
+ track_file = "~/todo/swatchtrack.txt"
24
+ todo_file = "~/todo/todo.txt"
25
+
26
+ By default (i.e if there is no ~/.swatchrc file), swatch will look for todo file in ~/.todo.txt and track_file in ~/.swatch.txt.
27
+
28
+ == Todo
29
+ * parse todo to remove the priority
data/bin/swatch CHANGED
@@ -11,15 +11,23 @@
11
11
 
12
12
  require 'trollop'
13
13
  require 'swatch'
14
+ require ('parseconfig')
14
15
 
15
16
  # ###############
16
17
  # Global variable
17
18
  # ###############
18
19
 
19
20
  CONF_FILE = File.expand_path("~/.swatchrc")
20
- TRACK_FILE = File.expand_path("~/todo/swatchtrack.txt")
21
- TODO_FILE = File.expand_path("~/todo/todo.txt")
22
- VERSION = 0.2
21
+ VERSION = '0.2.1'
22
+
23
+ if File.exist? CONF_FILE
24
+ config = ParseConfig.new(CONF_FILE)
25
+ TRACK_FILE = File.expand_path config.get_value 'track_file'
26
+ TODO_FILE = File.expand_path config.get_value 'todo_file'
27
+ else
28
+ TRACK_FILE = File.expand_path("~/.swatch.txt")
29
+ TODO_FILE = File.expand_path("~/.todo.txt")
30
+ end
23
31
 
24
32
  # #####################
25
33
  # Subcommand definition
@@ -48,7 +56,6 @@ end
48
56
  cmd = ARGV.shift # get the subcommand
49
57
  cmd_opts = case cmd
50
58
  when "in", "i"
51
- # TODO add todo.txt support
52
59
  Trollop::options do
53
60
  opt :todo, "Track a todo.txt task", :type => :int, :short => "-t"
54
61
  end
@@ -1,3 +1,12 @@
1
+ #
2
+ #------------------------------------------------------------------------------
3
+ # "THE BEER-WARE LICENSE" (Revision 42):
4
+ # <mayeu.tik@gmail.com> wrote this file. As long as you retain this notice you
5
+ # can do whatever you want with this stuff. If we meet some day, and you think
6
+ # this stuff is worth it, you can buy me a beer in return. Matthieu Maury
7
+ #------------------------------------------------------------------------------
8
+ #
9
+
1
10
  module Swatch
2
11
 
3
12
  module_function
@@ -65,6 +74,7 @@ module Swatch
65
74
 
66
75
  # Return the todo associated to the given number
67
76
  def get_todo (nb)
77
+ # TODO: parse todo to remove the priority
68
78
  IO.readlines(TODO_FILE)[nb-1]
69
79
  end
70
80
 
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- version: "0.2"
8
+ - 1
9
+ version: 0.2.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - Matthieu Maury