honkdo 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Sven
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = honkdo
2
+
3
+ Description may follow
4
+
5
+ == Contributing to honkdo
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Sven Winkler. See LICENSE.txt for
18
+ further details.
19
+
data/bin/honkdo ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require "honkdo/commander.rb"
6
+ Honkdo::Commander.new.run
@@ -0,0 +1,50 @@
1
+ module Honkdo
2
+
3
+ class Commander
4
+
5
+ def initialize
6
+ @closures = {}
7
+ @workflow = [:grep, :extract, :prune, :sanitize, :tag, :prioritize,
8
+ :sort, :print]
9
+ load_workflow_files
10
+ load_user_file
11
+ end
12
+
13
+ def step name, &blk
14
+ @closures[name] = blk
15
+ end
16
+
17
+ def extend_step name, &blk
18
+ old_step = @closures[name]
19
+ step(name) do |values|
20
+ blk.call(values, old_step)
21
+ end
22
+ end
23
+
24
+ def run
25
+ @workflow.inject([]) do |values, closure|
26
+ @closures[closure].call(values)
27
+ end
28
+ end
29
+
30
+ def load_workflow_files
31
+ path = File.dirname(__FILE__)
32
+ @workflow.each do |step|
33
+ load_file(path + "/steps/#{step}.rb")
34
+ end
35
+ end
36
+
37
+ def load_user_file
38
+ user_file = ".honkdo"
39
+ load_file user_file if File.exists? user_file
40
+ end
41
+
42
+ private
43
+
44
+ def load_file file
45
+ instance_eval File.read(file)
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,9 @@
1
+ step :extract do |lines|
2
+ lines.split("\n").collect do |l|
3
+ if m = l.match(/(.*):(\d+):(.*)/)
4
+ file, line, text = m.to_a[1..-1]
5
+ {:line => line, :file => file, :text => text}
6
+ end
7
+ end.compact
8
+ end
9
+
@@ -0,0 +1,7 @@
1
+ step :grep do
2
+ grep = `git grep -H -n -i TO[D]O .`
3
+ unless $?.exitstatus.zero?
4
+ grep = `grep -r -H -n -i TO[D]O .`
5
+ end
6
+ grep.gsub("--\n","")
7
+ end
@@ -0,0 +1,16 @@
1
+ step :print do |todos|
2
+
3
+ last_tag, last_file = nil
4
+ todos.each do |t|
5
+ unless last_tag == t[:tag]
6
+ last_tag = t[:tag]
7
+ puts last_tag
8
+ end
9
+ unless last_file == t[:file]
10
+ last_file = t[:file]
11
+ puts " #{last_file}"
12
+ end
13
+ puts " #{t[:line]}: #{t[:text]}"
14
+ end
15
+ end
16
+
@@ -0,0 +1,14 @@
1
+ step :prioritize do |todos|
2
+ todos.collect do |t|
3
+ prio = if n = t[:tag].match(/\d+/)
4
+ (n.to_a.first.to_i - 1) * 100
5
+ elsif t[:tag] == "unclassified"
6
+ 100000
7
+ else
8
+ t[:tag].length
9
+ end
10
+ t[:priority] = prio
11
+ t
12
+ end
13
+ end
14
+
@@ -0,0 +1,3 @@
1
+ step :prune do |todos|
2
+ todos
3
+ end
@@ -0,0 +1,8 @@
1
+ step :sanitize do |todos|
2
+ todos.collect do |t|
3
+ t[:line] = t[:line].to_i
4
+ t[:text] = t[:text].strip
5
+ t[:tag] = "unclassified"
6
+ t
7
+ end.compact
8
+ end
@@ -0,0 +1,7 @@
1
+ step :sort do |todos|
2
+ todos.sort do |a,b|
3
+ (a[:priority] <=> b[:priority]) * 10000 +
4
+ (a[:file] <=> b[:file])
5
+ end
6
+ end
7
+
@@ -0,0 +1,14 @@
1
+ step :tag do |todos|
2
+ todos.collect do |t|
3
+ if m = t[:text].match(/.*TO[d|D]O\s*(.*):(.*)/i)
4
+ tag, text = m.to_a[1..-1]
5
+ tag = "Prio 1" if tag.empty?
6
+ t[:text] = text.strip
7
+ t[:tag] = tag
8
+ t
9
+ elsif m = t[:text].match(/.*[\/]|[\"]|[\*]|[\#]+.*TO[D]O.*/i)
10
+ t
11
+ end
12
+ end.compact
13
+ end
14
+
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'honkdo'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.fail_fast = true
12
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: honkdo
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Sven
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-08 00:00:00 +02:00
19
+ default_executable: honkdo
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 2
30
+ - 3
31
+ - 0
32
+ version: 2.3.0
33
+ version_requirements: *id001
34
+ name: rspec
35
+ prerelease: false
36
+ type: :development
37
+ - !ruby/object:Gem::Dependency
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 23
44
+ segments:
45
+ - 1
46
+ - 0
47
+ - 0
48
+ version: 1.0.0
49
+ version_requirements: *id002
50
+ name: bundler
51
+ prerelease: false
52
+ type: :development
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 15
60
+ segments:
61
+ - 1
62
+ - 6
63
+ - 0
64
+ version: 1.6.0
65
+ version_requirements: *id003
66
+ name: jeweler
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ version_requirements: *id004
80
+ name: rcov
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ version_requirements: *id005
94
+ name: autotest
95
+ prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ version_requirements: *id006
108
+ name: autotest-growl
109
+ prerelease: false
110
+ type: :development
111
+ description: Some love for your to-dos
112
+ email: svenwin@gmail.com
113
+ executables:
114
+ - honkdo
115
+ extensions: []
116
+
117
+ extra_rdoc_files:
118
+ - LICENSE.txt
119
+ - README.rdoc
120
+ files:
121
+ - bin/honkdo
122
+ - lib/honkdo/commander.rb
123
+ - lib/honkdo/steps/extract.rb
124
+ - lib/honkdo/steps/grep.rb
125
+ - lib/honkdo/steps/print.rb
126
+ - lib/honkdo/steps/prioritize.rb
127
+ - lib/honkdo/steps/prune.rb
128
+ - lib/honkdo/steps/sanitize.rb
129
+ - lib/honkdo/steps/sort.rb
130
+ - lib/honkdo/steps/tag.rb
131
+ - spec/spec_helper.rb
132
+ - LICENSE.txt
133
+ - README.rdoc
134
+ has_rdoc: true
135
+ homepage: http://github.com/sven-q/honkdo
136
+ licenses:
137
+ - MIT
138
+ post_install_message:
139
+ rdoc_options: []
140
+
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ requirements: []
162
+
163
+ rubyforge_project:
164
+ rubygems_version: 1.6.1
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Love your prioritized to-dos
168
+ test_files: []
169
+