koi 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Rakefile +1 -1
  2. data/VERSION +1 -1
  3. data/koi.gemspec +5 -5
  4. data/lib/koi.rb +22 -14
  5. metadata +4 -4
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/cloudhead/koi"
12
12
  gem.authors = ["cloudhead"]
13
13
  gem.add_development_dependency "rspec"
14
- gem.add_dependency "mutter", ">= 0.4"
14
+ gem.add_dependency "colored", ">= 1.2"
15
15
  end
16
16
  Jeweler::GemcutterTasks.new
17
17
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/koi.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{koi}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["cloudhead"]
12
- s.date = %q{2010-03-06}
12
+ s.date = %q{2010-03-07}
13
13
  s.default_executable = %q{koi}
14
14
  s.description = %q{minimalist console-based task management for hackers}
15
15
  s.email = %q{self@cloudhead.net}
@@ -47,14 +47,14 @@ Gem::Specification.new do |s|
47
47
 
48
48
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
49
  s.add_development_dependency(%q<rspec>, [">= 0"])
50
- s.add_runtime_dependency(%q<mutter>, [">= 0.4"])
50
+ s.add_runtime_dependency(%q<colored>, [">= 1.2"])
51
51
  else
52
52
  s.add_dependency(%q<rspec>, [">= 0"])
53
- s.add_dependency(%q<mutter>, [">= 0.4"])
53
+ s.add_dependency(%q<colored>, [">= 1.2"])
54
54
  end
55
55
  else
56
56
  s.add_dependency(%q<rspec>, [">= 0"])
57
- s.add_dependency(%q<mutter>, [">= 0.4"])
57
+ s.add_dependency(%q<colored>, [">= 1.2"])
58
58
  end
59
59
  end
60
60
 
data/lib/koi.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'yaml'
3
- require 'mutter'
4
3
  require 'fileutils'
4
+ require 'colored'
5
5
 
6
6
  module Koi
7
7
 
@@ -53,10 +53,10 @@ module Koi
53
53
  :init, :add, :list, :tag,
54
54
  :done, :did, :log, :status,
55
55
  :remove, :float, :sink,
56
- :ls, :rm, :rise
56
+ :ls, :rm, :rise, :x
57
57
  ]
58
58
  Initializers = [:init, :add]
59
- Special = {"!" => :done, "?" => :status}
59
+ Special = {"!" => :done, "?" => :status, "+" => :float}
60
60
 
61
61
  def initialize *all
62
62
  cmd, param, args, options = all
@@ -65,7 +65,6 @@ module Koi
65
65
  @param = param =~ /^\d+$/ ? param.to_i : param
66
66
  @options = options || {}
67
67
  @db = Koi.init?? Database.new(File.join(Koi.root, Path[:db])) : Database.new
68
- @mut = Mutter.new(blue: '#', underline: "''", red: '++', cyan: '@@', green: '!!', yellow: '^').clear(:default)
69
68
  end
70
69
 
71
70
  def run
@@ -106,16 +105,15 @@ module Koi
106
105
  end
107
106
 
108
107
  def status
109
- out "in the water (#{@db.select {|e| e.new? }.size})"
108
+ out "#{@db.select {|e| e.new? }.size} koi in the water"
110
109
 
111
110
  self.list 5
112
111
 
113
112
  @db.select {|e| e[:status] == :completed }.
114
113
  sort_by {|e| e[:completed_at] }[0..3].reverse.each do |e|
115
- out " #[x]# !!#{e[:title]}!!"
116
- end
114
+ out " [x] ".blue + " #{e[:title]}".green
115
+ end.tap {|l| out if l.length > 0 }
117
116
 
118
- out
119
117
  true
120
118
  end
121
119
 
@@ -125,10 +123,13 @@ module Koi
125
123
  def list count = 10, index = -1
126
124
  out
127
125
 
128
- @db.list[0..count].each do |e|
129
- out " #[#{index += 1}]##{e.sticky?? "++ + ++" : " "}''#{e[:title]}'' @@#{e[:tags].join(' ')}@@" unless e[:status] == :removed
126
+ @db.list[0..count].reject {|e| e[:status] == :removed }.each do |e|
127
+ out " [#{index += 1}]".blue +
128
+ "#{e.sticky?? " + ".bold : " "}" +
129
+ e[:title].underline +
130
+ " #{e[:tags].join(' ')}".cyan
130
131
  end.tap do |list|
131
- out " !!nothing left to do!!" if list.size.zero?
132
+ out " nothing left to do".green if list.size.zero?
132
133
  end
133
134
 
134
135
  out
@@ -167,7 +168,7 @@ module Koi
167
168
  } if entity[:"#{status}_at"]
168
169
  end.compact
169
170
  end.flatten.sort_by {|e| e[:time]}.reverse.each do |entry|
170
- out "##{entry[:time]}# ^#{entry[:action]}^ ''#{entry[:title]}''"
171
+ out "#{entry[:time].blue} #{entry[:action].to_s.bold} #{entry[:title].underline}"
171
172
  end
172
173
  end
173
174
 
@@ -175,7 +176,7 @@ module Koi
175
176
  if obj.is_a? Hash
176
177
  puts "#{obj[:title]} : #{obj[:status]}"
177
178
  else
178
- @mut.say obj.to_s
179
+ puts obj.to_s
179
180
  end unless @options[:silent]
180
181
  end
181
182
 
@@ -200,6 +201,7 @@ module Koi
200
201
  end
201
202
  alias :done did
202
203
  alias :fish did
204
+ alias :x did
203
205
 
204
206
  def save
205
207
  File.open(File.join(Koi.root, Path[:db]), 'w') {|f| f.write @db.to_yaml }
@@ -287,7 +289,7 @@ module Koi
287
289
  owner: ENV['USER'],
288
290
  tags: [],
289
291
  sticky: false
290
- merge!(data)
292
+ update data.reduce({}) {|h, (k,v)| h.merge(k.to_sym => v) }
291
293
  end
292
294
 
293
295
  def new?
@@ -303,6 +305,12 @@ module Koi
303
305
  self[:"#{st}_at"] = Time.now
304
306
  end
305
307
 
308
+ def to_yaml *args
309
+ reduce({}) do |h, (k, v)|
310
+ h.merge(k.to_s => v)
311
+ end.to_yaml *args
312
+ end
313
+
306
314
  #
307
315
  # Handle things like `self.removed?`
308
316
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloudhead
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-06 00:00:00 -05:00
12
+ date: 2010-03-07 00:00:00 -05:00
13
13
  default_executable: koi
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -23,14 +23,14 @@ dependencies:
23
23
  version: "0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: mutter
26
+ name: colored
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0.4"
33
+ version: "1.2"
34
34
  version:
35
35
  description: minimalist console-based task management for hackers
36
36
  email: self@cloudhead.net