todonotes 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/examples/todonotes_how_to.rb +71 -34
- data/examples/todonotes_prim.rb +1 -1
- data/examples/todonotes_prim2.rb +4 -3
- data/lib/todonotes.rb +1 -2
- data/lib/todonotes/kernel.rb +4 -0
- data/lib/todonotes/log4r.rb +24 -24
- data/lib/todonotes/todo.rb +3 -0
- data/lib/todonotes/todonotes.rb +52 -42
- data/lib/todonotes/version.rb +24 -0
- data/readme.rdoc +13 -1
- data/unittest/{unittest_todonotes.rb → minitest_todonotes.rb} +52 -104
- metadata +41 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7389bd639f730f1add29445531890571a944a3c
|
4
|
+
data.tar.gz: 269d6ba203fe59cb65f8a89e553b0c1b2f058d54
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9b36358f77a841003b1191c8187baa4000c5b8dcaa5beaab97dd40bcc20e1f2584da2bf6e670a47ee7d3b0c56ffc4034c55c768287bc24b53a176cb25a44076
|
7
|
+
data.tar.gz: 18a58bd0763699c26bde72f36094752ba53db4b34a6d7f50ff838f531551e58f1cb07822d24a891e56312948365c625755c0ff884ef26e84b7f4f6b9ab8afb36
|
@@ -2,57 +2,94 @@
|
|
2
2
|
Examples of the different syntax version of the fixme/and todo-command.
|
3
3
|
=end
|
4
4
|
$:.unshift('../lib')
|
5
|
+
require 'rake'
|
5
6
|
require 'todonotes'
|
6
7
|
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
#Decide if we want to get only the first or all
|
9
|
+
Todonotes.logger.level = Log4r::WARN #only first time of callinf a fixme/todo
|
10
|
+
Todonotes.logger.level = Log4r::INFO #report all calls of fixme/todo
|
11
|
+
#~ Todonotes::TODONOTES.raise_fixme = true #Throw exception if a fixme is evaluated
|
12
|
+
#~ Todonotes::TODONOTES.raise_todo = true #Throw exception if a todo is evaluated
|
11
13
|
|
12
|
-
#a ToDo without temporary result
|
13
|
-
todo "my description of the missing code"
|
14
14
|
|
15
|
-
|
16
|
-
todo
|
15
|
+
desc "Show examples of todo-command"
|
16
|
+
task :todo do
|
17
|
+
#a ToDo with default text 'ToDo' and without temporary result
|
18
|
+
to do
|
19
|
+
"my temporary result"
|
20
|
+
end
|
17
21
|
|
18
|
-
#a ToDo
|
19
|
-
todo
|
22
|
+
#a ToDo without temporary result
|
23
|
+
todo "my description of the missing code"
|
20
24
|
|
25
|
+
#a ToDo without description, but a temporary result
|
26
|
+
todo { "my temporary result" }
|
27
|
+
|
28
|
+
#a ToDo with description and temporary result
|
29
|
+
todo ('my description of the missing code' ) { "my temporary result" }
|
21
30
|
|
22
|
-
#a ToDo without description, but a temporary result
|
23
|
-
todo do
|
24
|
-
"my temporary result"
|
25
|
-
end
|
26
31
|
|
27
|
-
#a ToDo
|
28
|
-
todo
|
29
|
-
|
32
|
+
#a ToDo without description, but a temporary result
|
33
|
+
todo do
|
34
|
+
"my temporary result"
|
35
|
+
end
|
36
|
+
|
37
|
+
#a ToDo with description and temporary result
|
38
|
+
todo 'Text' do
|
39
|
+
"my temporary result"
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
43
|
####################
|
44
|
+
desc "Show examples of fixme-command"
|
45
|
+
task :fixme do
|
46
|
+
#a FixMe without result, but a description
|
47
|
+
fixme( "something is missing" )
|
48
|
+
|
49
|
+
#a FixMe without description, but a temporary result
|
50
|
+
fixme { "my temporary result" }
|
33
51
|
|
34
|
-
#a FixMe
|
35
|
-
fixme { "my temporary result" }
|
52
|
+
#a FixMe with description and temporary result
|
53
|
+
fixme ('my description if the wrong code' ) { "my temporary result" }
|
36
54
|
|
37
|
-
#a FixMe
|
38
|
-
fixme
|
55
|
+
#a FixMe without description, but a temporary result
|
56
|
+
fixme do
|
57
|
+
"my temporary result"
|
58
|
+
end
|
39
59
|
|
40
|
-
#a FixMe
|
41
|
-
fixme do
|
42
|
-
|
60
|
+
#a FixMe with description and temporary result
|
61
|
+
fixme 'my description if the wrong code' do
|
62
|
+
"my temporary result"
|
63
|
+
end
|
43
64
|
end
|
44
65
|
|
45
|
-
|
46
|
-
|
47
|
-
|
66
|
+
desc "Show example of repetion of fixme-commands"
|
67
|
+
task :loops do
|
68
|
+
####################
|
69
|
+
#a Fixme is called twice
|
70
|
+
2.times { fixme "my first description of the missing code" }
|
71
|
+
#a ToDo is called three times
|
72
|
+
3.times { todo "my second description of the missing code" }
|
73
|
+
|
74
|
+
3.times { |i| todo "my %i call" % i }
|
48
75
|
end
|
49
76
|
####################
|
50
|
-
#a Fixme is called twice
|
51
|
-
2.times { fixme "my description of the missing code" }
|
52
|
-
#a ToDo is called three times
|
53
|
-
3.times { todo "my description of the missing code" }
|
54
77
|
|
55
|
-
|
78
|
+
desc "Show example of print_stats"
|
79
|
+
task :stat do
|
80
|
+
puts "=========Exampe Statistic========="
|
81
|
+
#Get an overview of all ToDos and FixMes
|
82
|
+
puts Todonotes.print_stats
|
83
|
+
end
|
84
|
+
|
85
|
+
=begin
|
86
|
+
=end
|
87
|
+
|
88
|
+
#~ task :default => :todo
|
89
|
+
#~ task :default => :fixme
|
90
|
+
task :default => :loops
|
91
|
+
#~ task :default => :stat
|
56
92
|
|
57
|
-
|
58
|
-
|
93
|
+
if $0 == __FILE__
|
94
|
+
Rake.application[:default].invoke
|
95
|
+
end
|
data/examples/todonotes_prim.rb
CHANGED
data/examples/todonotes_prim2.rb
CHANGED
@@ -13,23 +13,24 @@ require 'todonotes'
|
|
13
13
|
|
14
14
|
#
|
15
15
|
Todonotes.logger.level = Log4r::WARN #only first time of callinf a fixme/todo
|
16
|
-
Todonotes.logger.level = Log4r::INFO #report all calls of fixme/todo
|
16
|
+
#~ Todonotes.logger.level = Log4r::INFO #report all calls of fixme/todo
|
17
17
|
|
18
18
|
class Fixnum
|
19
19
|
#Decide if Fixnum is a prime.
|
20
20
|
#This method is only a temporarysolution.
|
21
21
|
def prime?
|
22
22
|
fixme "Calculate if prime" do
|
23
|
-
self.odd? #tempory: odd =
|
23
|
+
self.odd? #tempory: odd = prime
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
|
28
29
|
primecount = 0
|
29
30
|
10.times do|i|
|
30
31
|
if i.prime?
|
31
32
|
primecount += 1
|
32
|
-
puts "#{i} is a
|
33
|
+
puts "#{i} is a prime number"
|
33
34
|
else
|
34
35
|
puts "#{i} is no prime number"
|
35
36
|
end
|
data/lib/todonotes.rb
CHANGED
@@ -20,7 +20,7 @@ Disadvantage:
|
|
20
20
|
to see the ToDo/FixMe
|
21
21
|
|
22
22
|
Gem based on a proposal in http://forum.ruby-portal.de/viewtopic.php?f=11&t=11957
|
23
|
-
|
23
|
+
See also http://stackoverflow.com/a/13668213/676874
|
24
24
|
=end
|
25
25
|
|
26
26
|
require 'singleton'
|
@@ -39,7 +39,6 @@ Encapsuate:
|
|
39
39
|
* Todonotes::FixmeFormatter
|
40
40
|
=end
|
41
41
|
module Todonotes
|
42
|
-
VERSION = '0.1.1'
|
43
42
|
#'singleton'-instance of Todonotes
|
44
43
|
TODONOTES = Todonotes.new()
|
45
44
|
=begin rdoc
|
data/lib/todonotes/kernel.rb
CHANGED
@@ -20,6 +20,7 @@ Usage 3(message and temporary result):
|
|
20
20
|
|
21
21
|
=end
|
22
22
|
def todo( comment = 'ToDo', &block)
|
23
|
+
raise NotImplementedError if Todonotes::TODONOTES.raise_todo?
|
23
24
|
Todonotes::TODONOTES.todo(comment, &block)
|
24
25
|
end
|
25
26
|
=begin rdoc
|
@@ -33,8 +34,11 @@ Usage:
|
|
33
34
|
Add a fixme-command.
|
34
35
|
|
35
36
|
Can be used to mark available code.
|
37
|
+
|
38
|
+
See also #todo for the usage.
|
36
39
|
=end
|
37
40
|
def fixme( comment = 'FixMe', &block)
|
41
|
+
raise NotImplementedError if Todonotes::TODONOTES.raise_fixme?
|
38
42
|
Todonotes::TODONOTES.todo(comment, :FixMe, &block)
|
39
43
|
end
|
40
44
|
end #module Kernel
|
data/lib/todonotes/log4r.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
module Todonotes
|
2
|
-
=begin rdoc
|
3
|
-
Define a formatter.
|
4
|
-
=end
|
5
|
-
class FixmeFormatter < Log4r::BasicFormatter
|
6
|
-
=begin rdoc
|
7
|
-
If event is an Array, the output is adapted.
|
8
|
-
|
9
|
-
This outputter is only for internal use via Todonotes.
|
10
|
-
=end
|
11
|
-
def format(event)
|
12
|
-
#@@basicformat "%*s %s"
|
13
|
-
#~ buff = sprintf("%-*s %-5s", Log4r::MaxLevelLength, Log4r::LNAMES[event.level],
|
14
|
-
#~ event.data.is_a?(Array) ? event.data.first : event.name)
|
15
|
-
buff = "
|
16
|
-
#~ buff += (event.tracer.nil? ? "" : "(#{event.tracer[2]})") + ": "
|
17
|
-
buff << ": "
|
18
|
-
buff << format_object(event.data.is_a?(Array) ? event.data.last : event.data)
|
19
|
-
buff << (event.tracer.nil? ? "" : " (#{event.tracer.join('/')})")
|
20
|
-
buff << "\n"
|
21
|
-
buff
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end #module Todonotes
|
1
|
+
module Todonotes
|
2
|
+
=begin rdoc
|
3
|
+
Define a formatter.
|
4
|
+
=end
|
5
|
+
class FixmeFormatter < Log4r::BasicFormatter
|
6
|
+
=begin rdoc
|
7
|
+
If event is an Array, the output is adapted.
|
8
|
+
|
9
|
+
This outputter is only for internal use via Todonotes.
|
10
|
+
=end
|
11
|
+
def format(event)
|
12
|
+
#@@basicformat "%*s %s"
|
13
|
+
#~ buff = sprintf("%-*s %-5s", Log4r::MaxLevelLength, Log4r::LNAMES[event.level],
|
14
|
+
#~ event.data.is_a?(Array) ? event.data.first : event.name)
|
15
|
+
buff = "%5s" % (event.data.is_a?(Array) ? event.data.first : event.name)
|
16
|
+
#~ buff += (event.tracer.nil? ? "" : "(#{event.tracer[2]})") + ": "
|
17
|
+
buff << ": "
|
18
|
+
buff << format_object(event.data.is_a?(Array) ? event.data.last : event.data)
|
19
|
+
buff << (event.tracer.nil? ? "" : " (#{event.tracer.join('/')})")
|
20
|
+
buff << "\n"
|
21
|
+
buff
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end #module Todonotes
|
data/lib/todonotes/todo.rb
CHANGED
@@ -20,6 +20,7 @@ next occurences are informations.
|
|
20
20
|
#Build result
|
21
21
|
@result = yield if block_given?
|
22
22
|
|
23
|
+
#The Todonotes::FixmeFormatter can handle array in a special way to reformat the output.
|
23
24
|
@logger.warn([@type, "#{@codeline} #{@shortdescription} (temporary: #{@result.inspect})"])
|
24
25
|
|
25
26
|
end
|
@@ -31,8 +32,10 @@ next occurences are informations.
|
|
31
32
|
Todo/Fixme is called again
|
32
33
|
=end
|
33
34
|
def call()
|
35
|
+
#The Todonotes::FixmeFormatter can handle array in a special way to reformat the output.
|
34
36
|
@logger.info([@type, "#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})"])
|
35
37
|
@count += 1
|
38
|
+
@result = yield if block_given? #re-evaluate block
|
36
39
|
end
|
37
40
|
=begin rdoc
|
38
41
|
=end
|
data/lib/todonotes/todonotes.rb
CHANGED
@@ -11,56 +11,66 @@ You can set settings with
|
|
11
11
|
* Todonotes::Todonotes#codelines get Hash with counter per ToDo-locations.
|
12
12
|
* Todonotes::Todonotes#overview get overview text with ToDo-locations.
|
13
13
|
=end
|
14
|
-
class Todonotes
|
14
|
+
class Todonotes
|
15
15
|
|
16
16
|
=begin rdoc
|
17
17
|
Define the singleton-instance.
|
18
18
|
=end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
def initialize()
|
20
|
+
@codelines = Hash.new()
|
21
|
+
|
22
|
+
@logger = Log4r::Logger.new('ToDo')
|
23
|
+
@logger.outputters = Log4r::StdoutOutputter.new('ToDo',
|
24
|
+
:level => Log4r::ALL,
|
25
|
+
:formatter => FixmeFormatter
|
26
|
+
)
|
27
|
+
#~ @logger.trace = true
|
28
|
+
@raise_todo = false
|
29
|
+
@raise_fixme = false
|
30
|
+
|
31
|
+
end
|
32
|
+
#Get logger to define alternative outputters...
|
33
|
+
attr_reader :logger
|
34
|
+
attr_writer :raise_todo
|
35
|
+
attr_writer :raise_fixme
|
36
|
+
#Check if a todo should throw an exception
|
37
|
+
def raise_todo?; @raise_todo; end
|
38
|
+
#Check if a fixme should throw an exception
|
39
|
+
def raise_fixme?; @raise_fixme;end
|
40
|
+
|
31
41
|
=begin rdoc
|
32
42
|
Write the todo's in a logging file.
|
33
43
|
|
34
44
|
Default filename is $0.todo
|
35
45
|
=end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)
|
47
|
+
@logger.add( Log4r::FileOutputter.new('ToDo',
|
48
|
+
:filename => filename,
|
49
|
+
:level => level,
|
50
|
+
:formatter => FixmeFormatter
|
51
|
+
))
|
52
|
+
|
53
|
+
end
|
54
|
+
#Direct access to the codelines list. See also #overview
|
55
|
+
#Accessible via Todonotes::Todonotes.instance.codelines()
|
56
|
+
attr_reader :codelines
|
47
57
|
=begin rdoc
|
48
58
|
Report a FixMe or a ToDo.
|
49
59
|
Create a Todonotes::Todo
|
50
60
|
|
51
61
|
The block is evaluated to get a temporary result.
|
52
62
|
=end
|
53
|
-
|
54
|
-
|
55
|
-
|
63
|
+
def todo( comment, type = :ToDo, &block)
|
64
|
+
codeline = caller[1].split(':in').first
|
65
|
+
codelinekey = "#{codeline} (#{type})"
|
56
66
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
if @codelines[codelinekey] #2nd or more calls
|
68
|
+
@codelines[codelinekey].call &block
|
69
|
+
else #First occurence?
|
70
|
+
@codelines[codelinekey] = Todo.new(codeline, type, comment, @logger, &block)
|
71
|
+
end
|
72
|
+
@codelines[codelinekey].result
|
73
|
+
end #todo
|
64
74
|
|
65
75
|
=begin rdoc
|
66
76
|
Return a text to be printed
|
@@ -85,13 +95,13 @@ Example :with_type:
|
|
85
95
|
todonotes.rb:234 (FixMe): 1 call
|
86
96
|
todonotes.rb:235 (ToDo): 1 call
|
87
97
|
=end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
98
|
+
def overview( *settings )
|
99
|
+
txt = []
|
100
|
+
txt << "List of ToDos/FixMes:"
|
101
|
+
@codelines.each do |key, todo|
|
102
|
+
txt << todo.infoline(settings)
|
103
|
+
end
|
104
|
+
txt.join("\n")
|
93
105
|
end
|
94
|
-
|
95
|
-
end
|
96
|
-
end #class Todonotes
|
106
|
+
end #class Todonotes
|
97
107
|
end #module Todonotes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
=begin rdoc
|
3
|
+
=Changes
|
4
|
+
0.1.0 2011-06-24:
|
5
|
+
* Initial version, copied from todo_gem
|
6
|
+
|
7
|
+
0.1.1 2012-12-02
|
8
|
+
* correction in documentation
|
9
|
+
* example in English
|
10
|
+
* Todonotes#codeline -> Todonotes#codelines
|
11
|
+
* Implement module Todonotes with methods overview, codelines, logger, log2file
|
12
|
+
|
13
|
+
See also
|
14
|
+
* http://stackoverflow.com/questions/13668068/ruby-how-to-signal-not-implemented-yet
|
15
|
+
* http://stackoverflow.com/a/13668213/676874
|
16
|
+
|
17
|
+
0.1.2:
|
18
|
+
* Use Minitest
|
19
|
+
* Evaluate block for each call (allows dynamic results)
|
20
|
+
* raise NotImplementedError on request
|
21
|
+
=end
|
22
|
+
module Todonotes
|
23
|
+
VERSION = '0.2.0'
|
24
|
+
end
|
data/readme.rdoc
CHANGED
@@ -114,4 +114,16 @@ Example:
|
|
114
114
|
todonotes_prim.rb:11: 10 calls
|
115
115
|
todonotes_prim.rb:21: 1 call
|
116
116
|
|
117
|
-
There is a fixme/todo in line 11 and 21 in todonotes_prim.rb.
|
117
|
+
There is a fixme/todo in line 11 and 21 in todonotes_prim.rb.
|
118
|
+
|
119
|
+
==Go productive
|
120
|
+
Before you go productive with your application you should remove this
|
121
|
+
gem and delete all fixme- and todo-commands.
|
122
|
+
|
123
|
+
You may also set
|
124
|
+
|
125
|
+
Todonotes::TODONOTES.raise_fixme = true
|
126
|
+
Todonotes::TODONOTES.raise_todo = true
|
127
|
+
|
128
|
+
After this you will get a ImplementationError-Exception if Kernel#fixme or Kernel.todo is called.
|
129
|
+
|
@@ -1,121 +1,69 @@
|
|
1
|
-
gem '
|
2
|
-
|
1
|
+
gem 'minitest'
|
2
|
+
gem 'minitest-logger'
|
3
|
+
$:.unshift('c:/usr/script/minitest-logger/lib')
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'minitest/log4r'
|
3
7
|
|
4
8
|
$:.unshift('../lib')
|
5
9
|
require 'todonotes'
|
10
|
+
Todonotes::TODONOTES.logger.outputters.first.level = Log4r::OFF #No visible logging output
|
6
11
|
|
7
|
-
|
8
|
-
Define a new outputter to catch data into an array
|
9
|
-
=end
|
10
|
-
class ArrayOutputter < Log4r::StdoutOutputter
|
11
|
-
=begin rdoc
|
12
|
-
Collect messages in array.
|
13
|
-
=end
|
14
|
-
def write(message)
|
15
|
-
@messages ||= [] #create with first call
|
16
|
-
@messages << message
|
17
|
-
end
|
18
|
-
=begin rdoc
|
19
|
-
Clear message array and return messages
|
20
|
-
=end
|
21
|
-
def flush
|
22
|
-
@messages ||= [] #create with first call
|
23
|
-
messages = @messages.dup
|
24
|
-
@messages.clear
|
25
|
-
messages
|
26
|
-
end
|
27
|
-
end #ArrayOutputter
|
28
|
-
|
29
|
-
#~ Todonotes::TODONOTES.logger.level = Log4r::OFF #No logging
|
30
|
-
Todonotes::TODONOTES.logger.outputters.first.level = Log4r::OFF
|
31
|
-
Todonotes::TODONOTES.logger.outputters << $testlog = ArrayOutputter.new('testlog')
|
32
|
-
$testlog.formatter = Todonotes::FixmeFormatter.new
|
33
|
-
|
34
|
-
class Test_syntax < Test::Unit::TestCase
|
35
|
-
def test_todo()
|
36
|
-
assert_nothing_raised{
|
37
|
-
to do
|
38
|
-
"mein Ergebnis"
|
39
|
-
end
|
40
|
-
}
|
41
|
-
assert_nothing_raised{
|
42
|
-
todo "mein Text"
|
43
|
-
}
|
44
|
-
assert_nothing_raised{
|
45
|
-
todo { "mein Ergebnis" }
|
46
|
-
}
|
47
|
-
assert_nothing_raised{
|
48
|
-
todo ('mein Text' ) { "mein Ergebnis" }
|
49
|
-
}
|
50
|
-
assert_nothing_raised{
|
51
|
-
todo do
|
52
|
-
"mein Ergebnis"
|
53
|
-
end
|
54
|
-
}
|
55
|
-
assert_nothing_raised{
|
56
|
-
todo 'Text' do
|
57
|
-
"mein Ergebnis"
|
58
|
-
end
|
59
|
-
}
|
60
|
-
end
|
61
|
-
def test_fixme
|
62
|
-
assert_nothing_raised{
|
63
|
-
fixme "mein Text"
|
64
|
-
}
|
65
|
-
assert_nothing_raised{
|
66
|
-
fixme { "mein Ergebnis" }
|
67
|
-
}
|
68
|
-
assert_nothing_raised{
|
69
|
-
fixme ('mein Text' ) { "mein Ergebnis" }
|
70
|
-
}
|
71
|
-
assert_nothing_raised{
|
72
|
-
fixme do
|
73
|
-
"mein Ergebnis"
|
74
|
-
end
|
75
|
-
}
|
76
|
-
assert_nothing_raised{
|
77
|
-
fixme 'Text' do
|
78
|
-
"mein Ergebnis"
|
79
|
-
end
|
80
|
-
}
|
81
|
-
end
|
82
|
-
#~ def test_print_stats
|
83
|
-
#~ assert_nothing_raised{ print_stats }
|
84
|
-
#~ end
|
85
|
-
end
|
86
|
-
|
87
|
-
class Test_value_and_log < Test::Unit::TestCase
|
12
|
+
class Test_value_and_log < Minitest::Test
|
88
13
|
def setup()
|
89
|
-
|
14
|
+
@log = Todonotes::TODONOTES.logger
|
15
|
+
@formatter = Todonotes::FixmeFormatter
|
90
16
|
end
|
91
17
|
|
92
|
-
def
|
18
|
+
def test_todo_no_comment
|
93
19
|
assert_equal("mein Ergebnis", todo() { "mein Ergebnis" } )
|
94
|
-
|
95
|
-
|
20
|
+
assert_log(" ToDo: #{__FILE__}:#{__LINE__} ToDo (temporary: \"mein Ergebnis\")\n") {todo() { "mein Ergebnis" } }
|
21
|
+
end
|
22
|
+
def test_todo_comment_and_block
|
96
23
|
assert_equal("mein Ergebnis", todo( 'text' ){"mein Ergebnis"} )
|
97
|
-
|
98
|
-
|
24
|
+
assert_log(" ToDo: #{__FILE__}:#{__LINE__ } text (temporary: \"mein Ergebnis\")\n"){ todo( 'text' ){"mein Ergebnis"} }
|
25
|
+
end
|
26
|
+
def test_todo_no_block
|
99
27
|
assert_equal(nil, todo( "my text"))
|
100
|
-
|
101
|
-
|
28
|
+
assert_log(" ToDo: #{__FILE__}:#{__LINE__} my text (temporary: nil)\n"){ todo( "my text") }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_fixme_block_and_comment
|
32
|
+
assert_equal("mein Ergebnis", fixme( 'text' ){ "mein Ergebnis"} )
|
33
|
+
assert_log("FixMe: #{__FILE__}:#{__LINE__} text (temporary: \"mein Ergebnis\")\n"){ fixme( 'text' ){"mein Ergebnis"} }
|
102
34
|
end
|
103
|
-
def
|
35
|
+
def test_fixme_no_comment
|
104
36
|
assert_equal("mein Ergebnis", fixme() {"mein Ergebnis"} )
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
assert_equal(["FixMe: #{__FILE__}:#{__LINE__ - 1} text (temporary: \"mein Ergebnis\")\n"], $testlog.flush )
|
109
|
-
|
37
|
+
assert_log("FixMe: #{__FILE__}:#{__LINE__} FixMe (temporary: \"mein Ergebnis\")\n"){ fixme() {"mein Ergebnis"} }
|
38
|
+
end
|
39
|
+
def test_fixme_no_block
|
110
40
|
assert_equal(nil, fixme( "my text"))
|
111
|
-
|
41
|
+
assert_log("FixMe: #{__FILE__}:#{__LINE__} my text (temporary: nil)\n"){ fixme( "my text") }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_raise_fixme
|
45
|
+
Todonotes::TODONOTES.raise_fixme = true
|
46
|
+
assert_raises(NotImplementedError){ fixme }
|
47
|
+
Todonotes::TODONOTES.raise_fixme = false #reset again the default
|
48
|
+
end
|
49
|
+
def test_raise_todo
|
50
|
+
Todonotes::TODONOTES.raise_todo = true
|
51
|
+
assert_raises(NotImplementedError){ todo }
|
52
|
+
Todonotes::TODONOTES.raise_todo = false #reset again the default
|
112
53
|
end
|
113
54
|
end
|
114
55
|
|
115
|
-
class Test_overview < Test
|
56
|
+
class Test_overview < Minitest::Test
|
116
57
|
def setup()
|
117
58
|
Todonotes::TODONOTES.codelines.clear
|
118
59
|
end
|
60
|
+
=begin
|
61
|
+
Show if overview is:
|
62
|
+
|
63
|
+
List of ToDos/FixMes:
|
64
|
+
minitest_todonotes.rb:66: 1 call
|
65
|
+
minitest_todonotes.rb:76: 1 call
|
66
|
+
=end
|
119
67
|
def test_overview()
|
120
68
|
#check empty fixme/todo
|
121
69
|
text = "List of ToDos/FixMes:"
|
@@ -196,7 +144,7 @@ class Test_overview < Test::Unit::TestCase
|
|
196
144
|
end
|
197
145
|
end
|
198
146
|
|
199
|
-
class Test_log_with_file < Test
|
147
|
+
class Test_log_with_file < Minitest::Test
|
200
148
|
@@logfilename = 'test.log'
|
201
149
|
@@logfilename_default = File.basename($0) + '.todo'
|
202
150
|
def setup()
|
@@ -208,18 +156,18 @@ class Test_log_with_file < Test::Unit::TestCase
|
|
208
156
|
File.delete(@@logfilename_default) if File.exist?(@@logfilename_default)
|
209
157
|
end
|
210
158
|
def test_logfile()
|
211
|
-
|
159
|
+
refute(File.exist?(@@logfilename))
|
212
160
|
Todonotes::TODONOTES.log2file(@@logfilename)
|
213
161
|
assert_equal(@@logfilename, Todonotes::TODONOTES.logger.outputters.last.filename)
|
214
|
-
|
162
|
+
assert(File.exist?(@@logfilename))
|
215
163
|
Todonotes::TODONOTES.logger.outputters.last.close #
|
216
164
|
Todonotes::TODONOTES.logger.outputters.pop #
|
217
165
|
end
|
218
166
|
def test_logfile_default()
|
219
|
-
|
167
|
+
refute(File.exist?(@@logfilename_default))
|
220
168
|
Todonotes::TODONOTES.log2file() #no filename
|
221
169
|
assert_equal(@@logfilename_default, Todonotes::TODONOTES.logger.outputters.last.filename)
|
222
|
-
|
170
|
+
assert(File.exist?(@@logfilename_default))
|
223
171
|
Todonotes::TODONOTES.logger.outputters.last.close #
|
224
172
|
Todonotes::TODONOTES.logger.outputters.pop #
|
225
173
|
end
|
metadata
CHANGED
@@ -1,81 +1,92 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todonotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Knut Lickert
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest-logger
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.1.1
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.1
|
14
33
|
- !ruby/object:Gem::Dependency
|
15
34
|
name: log4r
|
16
35
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
36
|
requirements:
|
19
|
-
- -
|
37
|
+
- - "~>"
|
20
38
|
- !ruby/object:Gem::Version
|
21
39
|
version: '0'
|
22
40
|
type: :runtime
|
23
41
|
prerelease: false
|
24
42
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
43
|
requirements:
|
27
|
-
- -
|
44
|
+
- - "~>"
|
28
45
|
- !ruby/object:Gem::Version
|
29
46
|
version: '0'
|
30
|
-
description:
|
31
|
-
|
32
|
-
Support programming by fixme/todo commands.
|
33
|
-
|
34
|
-
|
35
|
-
Gem based on a proposal in http://forum.ruby-portal.de/viewtopic.php?f=11&t=11957
|
36
|
-
|
37
|
-
'
|
47
|
+
description: "Support programming by fixme/todo commands.\nGem based on a proposal
|
48
|
+
in http://forum.ruby-portal.de/viewtopic.php?f=11&t=11957, \nsee also http://stackoverflow.com/a/13668213/676874\n"
|
38
49
|
email: knut@lickert.net
|
39
50
|
executables: []
|
40
51
|
extensions: []
|
41
52
|
extra_rdoc_files:
|
42
53
|
- readme.rdoc
|
43
54
|
files:
|
44
|
-
- readme.rdoc
|
45
|
-
- lib/todonotes.rb
|
46
|
-
- lib/todonotes/todonotes.rb
|
47
|
-
- lib/todonotes/todo.rb
|
48
|
-
- lib/todonotes/kernel.rb
|
49
|
-
- lib/todonotes/log4r.rb
|
50
55
|
- examples/todonotes_how_to.rb
|
51
56
|
- examples/todonotes_prim.rb
|
52
57
|
- examples/todonotes_prim2.rb
|
53
|
-
-
|
58
|
+
- lib/todonotes.rb
|
59
|
+
- lib/todonotes/kernel.rb
|
60
|
+
- lib/todonotes/log4r.rb
|
61
|
+
- lib/todonotes/todo.rb
|
62
|
+
- lib/todonotes/todonotes.rb
|
63
|
+
- lib/todonotes/version.rb
|
64
|
+
- readme.rdoc
|
65
|
+
- unittest/minitest_todonotes.rb
|
54
66
|
homepage: http://rubypla.net/todonotes
|
55
67
|
licenses: []
|
68
|
+
metadata: {}
|
56
69
|
post_install_message:
|
57
70
|
rdoc_options:
|
58
71
|
- lib/**/*.rb
|
59
|
-
- --main readme.rdoc
|
72
|
+
- "--main readme.rdoc"
|
60
73
|
require_paths:
|
61
74
|
- lib
|
62
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
76
|
requirements:
|
65
|
-
- -
|
77
|
+
- - ">="
|
66
78
|
- !ruby/object:Gem::Version
|
67
79
|
version: '0'
|
68
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
81
|
requirements:
|
71
|
-
- -
|
82
|
+
- - ">="
|
72
83
|
- !ruby/object:Gem::Version
|
73
84
|
version: '0'
|
74
85
|
requirements: []
|
75
86
|
rubyforge_project:
|
76
|
-
rubygems_version:
|
87
|
+
rubygems_version: 2.4.5
|
77
88
|
signing_key:
|
78
|
-
specification_version:
|
89
|
+
specification_version: 4
|
79
90
|
summary: Support programming by todonotes/todo commands.
|
80
91
|
test_files:
|
81
|
-
- unittest/
|
92
|
+
- unittest/minitest_todonotes.rb
|