toadie 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,4 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- toadie
18
+ toadie/
data/README.md CHANGED
@@ -4,9 +4,7 @@ Toadie greps your (ruby) source code for TODO tags and associate them with your
4
4
 
5
5
  It's meant to be part of a CI process, so everyone should be able to find her/his open TODOs.
6
6
 
7
- ![toadie build status][1]
8
-
9
- [1]:http://travis-ci.org/xijo/toadie.png
7
+ [![Build Status](https://secure.travis-ci.org/xijo/toadie.png?branch=master)](https://travis-ci.org/xijo/toadie)
10
8
 
11
9
  ## Features
12
10
 
@@ -80,4 +78,9 @@ The TODO will be assigned to Riker.
80
78
  ## Todos (haha)
81
79
 
82
80
  1. Add customizable file endings to the configuration
83
- 2. Make output directory/format configurable
81
+ 2. Make output directory/format configurable
82
+ 3. Do a little benchmarking and profiling
83
+ 4. Refine descriptions and texts
84
+ 5. Detect multiline TODOs
85
+ 6. Support more languages
86
+ 7. Link source to github
@@ -0,0 +1,45 @@
1
+ module Toadie
2
+ class Author
3
+ @@authors = []
4
+
5
+ attr_accessor :name, :nicknames, :emails
6
+
7
+ def self.find_or_create(email, opts = {})
8
+ find_by_email(email) || create(opts.merge(emails: [email]))
9
+ end
10
+
11
+ def self.find_by_email(email)
12
+ @@authors.find { |author| author.emails.include?(email) }
13
+ end
14
+
15
+ def self.create(opts = {})
16
+ opts.keys.each do |key|
17
+ key.is_a?(String) and opts[key.to_sym] = opts.delete(key)
18
+ end
19
+ raise MissingEmail if opts[:emails].nil? || opts[:emails].empty?
20
+ opts[:nicknames] ||= []
21
+ @@authors << author = Author.new(opts)
22
+ author
23
+ end
24
+
25
+ def self.all
26
+ @@authors
27
+ end
28
+
29
+ def self.destroy_all
30
+ @@authors.clear
31
+ end
32
+
33
+ def initialize(params = {})
34
+ params.each { |key, value| __send__("#{key}=", value) }
35
+ end
36
+
37
+ def identifier
38
+ @identifier ||= emails.first.downcase.gsub(/\W/, '')
39
+ end
40
+
41
+ def to_s
42
+ name || nicknames.first || emails.first
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,7 @@
1
+ module Toadie
2
+ class Error < StandardError; end
3
+
4
+ class Author
5
+ class MissingEmail < Toadie::Error; end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ module Toadie
2
+ class ExtractTodos
3
+ def self.execute
4
+ if Toadie.test?
5
+ Toadie::FakeResults.extract_todos
6
+ else
7
+ IO.popen('grep TODO -rn --include=\*.{rb,erb,haml,slim,feature} .').readlines
8
+ end
9
+ end
10
+
11
+ # Expected input format is: file:line:information
12
+ def self.split_result(value)
13
+ value.split(':', 3)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,25 @@
1
+ module Toadie
2
+ class FakeResults
3
+ def self.blame
4
+ <<-EOS
5
+ 1337 1 1 4
6
+ author Beverly Crusher
7
+ author-mail <crusher@uss-enterprise.com>
8
+ author-time 1352532060
9
+ author-tz +0100
10
+ committer Worf
11
+ committer-mail <worf@uss-enterprise.com>
12
+ committer-time 1352532060
13
+ committer-tz +0100
14
+ summary Initial commit.
15
+ EOS
16
+ end
17
+
18
+ def self.extract_todos
19
+ [
20
+ 'fakefile:42:# TODO geordi Refactor warp engine',
21
+ 'fakefile:666:# TODO no1 Clean up the bridge'
22
+ ]
23
+ end
24
+ end
25
+ end
data/lib/toadie/run.rb ADDED
@@ -0,0 +1,11 @@
1
+ module Toadie
2
+ class Run
3
+ def start
4
+ results = ExtractTodos.execute
5
+ results = results.map { |result| ExtractTodos.split_result(result) }
6
+ list = Todolist.new(results)
7
+
8
+ Report.publish(list)
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Toadie
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/toadie.rb CHANGED
@@ -2,7 +2,7 @@ require 'toadie/version'
2
2
  require 'toadie/todo'
3
3
  require 'toadie/todolist'
4
4
  require 'toadie/blame'
5
- require 'toadie/grep'
5
+ require 'toadie/extract_todos'
6
6
  require 'toadie/author'
7
7
  require 'toadie/report'
8
8
  require 'toadie/run'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toadie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-11 00:00:00.000000000 Z
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop
@@ -112,9 +112,14 @@ files:
112
112
  - assets/toadie.css
113
113
  - bin/toadie
114
114
  - lib/toadie.rb
115
+ - lib/toadie/author.rb
115
116
  - lib/toadie/blame.rb
116
117
  - lib/toadie/configuration.rb
118
+ - lib/toadie/errors.rb
119
+ - lib/toadie/extract_todos.rb
120
+ - lib/toadie/fake_results.rb
117
121
  - lib/toadie/report.rb
122
+ - lib/toadie/run.rb
118
123
  - lib/toadie/todo.rb
119
124
  - lib/toadie/todolist.rb
120
125
  - lib/toadie/version.rb
@@ -139,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
144
  version: '0'
140
145
  segments:
141
146
  - 0
142
- hash: 4139721596909819408
147
+ hash: -1469595575753713698
143
148
  required_rubygems_version: !ruby/object:Gem::Requirement
144
149
  none: false
145
150
  requirements:
@@ -148,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
153
  version: '0'
149
154
  segments:
150
155
  - 0
151
- hash: 4139721596909819408
156
+ hash: -1469595575753713698
152
157
  requirements: []
153
158
  rubyforge_project:
154
159
  rubygems_version: 1.8.24