toadie 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.adapters.define 'gem' do
4
+ add_filter '/spec/'
5
+ add_filter '/autotest/'
6
+ add_group 'Libraries', '/lib/'
7
+ end
8
+ SimpleCov.start 'gem'
9
+
10
+ require 'toadie'
11
+ Toadie.test = true
12
+
13
+ RSpec.configure do |config|
14
+ config.color_enabled = true
15
+ config.mock_with :rspec
16
+
17
+ config.after(:each) { Toadie::Author.destroy_all }
18
+ end
data/spec/todo_spec.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe Toadie::Todo do
4
+ let(:todo) { Toadie::Todo.new('fakefile', 42, 'TODO text') }
5
+
6
+ describe "#initialize" do
7
+ it "assigns the given attributes" do
8
+ todo.file.should == 'fakefile'
9
+ todo.line.should == 42
10
+ todo.text.should == 'TODO text'
11
+ end
12
+
13
+ it "converts provided input into string without failing" do
14
+ todo = Toadie::Todo.new('fakefile', 42, self.class)
15
+ todo.text.should be_a String
16
+ end
17
+ end
18
+
19
+ it "finds reassignment if present" do
20
+ picard = Toadie::Author.create(emails: ['picard@uss-enterprise.com'], nicknames: ['captain', 'jean-luc'])
21
+ todo = Toadie::Todo.new('fakefile', 42, 'TODO jean-luc go to the doctor!')
22
+ crusher = Toadie::Author.find_by_email('crusher@uss-enterprise.com') # created by fake blame
23
+
24
+ todo.author.should == crusher
25
+ todo.responsible.should == picard
26
+ todo.should be_reassigned
27
+ end
28
+
29
+ describe "#to_s" do
30
+ it "returns the text is present" do
31
+ todo.to_s.should == todo.text
32
+ end
33
+
34
+ it "returns a no-text message otherwise" do
35
+ todo.text = ''
36
+ todo.to_s.should == '<no content>'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Toadie::Todolist do
4
+ let(:todolist) do
5
+ Toadie::Todolist.new([
6
+ ['fakefile', 42, 'Refactor warp engine'],
7
+ ['fakefile', 666, 'Clean up the bridge']
8
+ ])
9
+ end
10
+
11
+ it "builds Todos for the input data" do
12
+ todolist.size.should == todolist.todos.size.should
13
+ todolist.size.should == 2
14
+ todolist.todos.first.should be_a Toadie::Todo
15
+ todolist.todos.last.should be_a Toadie::Todo
16
+ end
17
+
18
+ it "groups todos by responsible author" do
19
+ responsible = todolist.todos.first.responsible
20
+ grouped = todolist.grouped
21
+
22
+ grouped.should be_a Hash
23
+ grouped.should have_key responsible
24
+ grouped[responsible].should == todolist.todos
25
+ end
26
+ end
data/toadie.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/toadie/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Johannes Opper"]
6
+ gem.email = ["xijo@gmx.de"]
7
+ gem.description = "Analyze your source code, find open todos and output a nice html report."
8
+ gem.summary = "Analyze your source code, find open todos and output a nice html report."
9
+ gem.homepage = "http://github.com/xijo/toadie"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "toadie"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Toadie::VERSION
17
+
18
+ gem.add_runtime_dependency 'slop', '~> 3.3.3'
19
+ gem.add_runtime_dependency 'slim'
20
+
21
+ gem.add_development_dependency 'rake'
22
+ gem.add_development_dependency 'rspec'
23
+ gem.add_development_dependency 'simplecov'
24
+ end
data/views/report.slim ADDED
@@ -0,0 +1,93 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title Toadie report
5
+ meta name='keywords' content='template language'
6
+ meta name='author' content='Toadwart'
7
+ link href=Toadie.assets_path('bootstrap.min.css') rel='stylesheet'
8
+ link href=Toadie.assets_path('toadie.css') rel='stylesheet'
9
+ script src=Toadie.assets_path('jquery-1.8.2.min.js')
10
+ script src=Toadie.assets_path('bootstrap.min.js')
11
+
12
+ body
13
+ .navbar.navbar-fixed-top
14
+ .navbar-inner
15
+ .container
16
+ a class="brand" href="#" Toadie
17
+
18
+ .container
19
+ h1 Report
20
+ p
21
+ ' Toadie searched in
22
+ code= Toadie.root
23
+ ' and found #{size}
24
+ span.label TODO
25
+ ' tags, broken down by author email as follows:
26
+
27
+ .progress
28
+ - grouped.each_with_index do |group, index|
29
+ - author, todos = group
30
+ - percent = ((todos.size / size.to_f) * 100).round(2)
31
+ a.bar href="##{author.identifier}_tab" data-toggle='tab' style="width: #{percent}%;" rel='tooltip' title="#{author}, #{todos.size} hits, #{percent}%" data-placement='bottom' class=%w(bar-danger bar-success bar-info bar-warning)[index%5]
32
+ = author if percent > 5
33
+
34
+ .tabbable.tabs-left
35
+ ul.nav.nav-tabs
36
+ - grouped.each do |author, todos|
37
+ li
38
+ a href="##{author.identifier}_tab" data-toggle='tab'
39
+ span.badge=' todos.size
40
+ =' author
41
+
42
+ .tab-content
43
+ .tab-pane.active
44
+ | Erklaerung und so weiter ganz klasse und alles..
45
+
46
+ - grouped.each do |author, todos|
47
+ .tab-pane id="#{author.identifier}_tab"
48
+ .alert.alert-info
49
+ p.lead=' author.name
50
+ dl.dl-horizontal
51
+ - if !author.emails.empty?
52
+ dt Email adresses
53
+ dd= author.emails * ', '
54
+ - if !author.nicknames.empty?
55
+ dt Nicknames
56
+ dd= author.nicknames * ', '
57
+
58
+ - todos.each do |todo|
59
+ blockquote
60
+ p= todo
61
+ - if todo.reassigned?
62
+ span.muted
63
+ ' assigned by
64
+ span.label.label-warning
65
+ =' todo.author
66
+ small= todo.file
67
+
68
+
69
+ - if false
70
+ - grouped.each do |author, todos|
71
+ h2= author
72
+ a href="##{author.gsub(/\W/, '')}" role="button" class="btn" data-toggle="modal" #{todos.size} Todos
73
+
74
+ .modal.hide tabindex='-1' role='dialog' id=author.gsub(/\W/, '')
75
+ .modal-header
76
+ button type='button' class='close' data-dismiss='modal' &times;
77
+ h3= author
78
+
79
+ .modal-body
80
+ dl
81
+ - todos.each do |todo|
82
+ dt= todo.file
83
+ dd
84
+ = todo
85
+ - if todo.assigned_by
86
+ span.label.label-warning= todo.assigned_by
87
+
88
+
89
+ .modal-footer
90
+ button.btn data-dismiss='modal' Close
91
+
92
+ javascript:
93
+ $('[rel=tooltip]').tooltip()
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: toadie
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Johannes Opper
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: slop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.3.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.3.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: slim
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Analyze your source code, find open todos and output a nice html report.
95
+ email:
96
+ - xijo@gmx.de
97
+ executables:
98
+ - toadie
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - .rvmrc
104
+ - .travis.yml
105
+ - Gemfile
106
+ - LICENSE
107
+ - README.md
108
+ - Rakefile
109
+ - assets/bootstrap.min.css
110
+ - assets/bootstrap.min.js
111
+ - assets/jquery-1.8.2.min.js
112
+ - assets/toadie.css
113
+ - bin/toadie
114
+ - lib/toadie.rb
115
+ - lib/toadie/blame.rb
116
+ - lib/toadie/configuration.rb
117
+ - lib/toadie/report.rb
118
+ - lib/toadie/todo.rb
119
+ - lib/toadie/todolist.rb
120
+ - lib/toadie/version.rb
121
+ - spec/author_spec.rb
122
+ - spec/blame_spec.rb
123
+ - spec/spec_helper.rb
124
+ - spec/todo_spec.rb
125
+ - spec/todolist_spec.rb
126
+ - toadie.gemspec
127
+ - views/report.slim
128
+ homepage: http://github.com/xijo/toadie
129
+ licenses: []
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ segments:
141
+ - 0
142
+ hash: 4139721596909819408
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
150
+ - 0
151
+ hash: 4139721596909819408
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 1.8.24
155
+ signing_key:
156
+ specification_version: 3
157
+ summary: Analyze your source code, find open todos and output a nice html report.
158
+ test_files:
159
+ - spec/author_spec.rb
160
+ - spec/blame_spec.rb
161
+ - spec/spec_helper.rb
162
+ - spec/todo_spec.rb
163
+ - spec/todolist_spec.rb