activetodo 0.0.2 → 0.0.3
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +21 -3
- data/lib/activetodo.rb +18 -1
- data/lib/activetodo/version.rb +1 -1
- data/spec/activetodo_spec.rb +19 -0
- metadata +2 -3
- data/Gemfile.lock +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e34aacbfddd41896e87811832fcb596e6bef87
|
4
|
+
data.tar.gz: d4a34e7e3b84356653fb173a4d7949fb001e1623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 186285aac96fc6b24828f2cd931cb51bd1149316547f2d15667b6a1906b6c6d9f5c343ebee780c50a5e4fbf0fe3a0f6bf3ed044f95a5660cdda0947e824dd2ed
|
7
|
+
data.tar.gz: 16dfab5227fccefe7c759bc59adad3d8d8af456afa6c518aeabed8f48d96cf441d8ff16787f0d427db77253d550236e2ddb03d58866523d6fc77de881dcbabc4
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -27,17 +27,35 @@ Use anywhere in code:
|
|
27
27
|
# Generic TODO without deadline
|
28
28
|
TODO 'Add specs'
|
29
29
|
|
30
|
-
#
|
30
|
+
# After 2014-01-01 it will `Rails.logger.warn` or `puts` if outside Rails
|
31
31
|
FIXME 'Certificate will expire soon', deadline: '2014-01-01'
|
32
32
|
|
33
|
-
#
|
34
|
-
XXX 'Dirty hack, must refactor', deadline: '2014-02-28', warn_only:
|
33
|
+
# Raises error after 2014-02-28
|
34
|
+
XXX 'Dirty hack, must refactor', deadline: '2014-02-28', warn_only: false
|
35
35
|
```
|
36
36
|
|
37
37
|
`TODO`, `FIXME` and `XXX` all have same interface: `TODO(<message>, [options_hash])`
|
38
38
|
|
39
39
|
You can use `activetodo` with or without Rails.
|
40
40
|
|
41
|
+
## Configuring default deadline behavior
|
42
|
+
|
43
|
+
By default, ActiveTodo will not raise errors when deadline is reached. You may want to enabled that
|
44
|
+
depending on your environment. In Rails, do that by creating `config/initializers/activetodo.rb`
|
45
|
+
with following lines:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
ActiveTodo.configure do |config|
|
49
|
+
# Log deadline warnings in Production, raise errors in Development / Test
|
50
|
+
config.warn_only = Rails.env.production?
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
You can still override the default configuration by passing `warn_only` option:
|
55
|
+
```ruby
|
56
|
+
TODO 'Remove this internal testing controller', deadline: '2013-05-01', warn_only: false
|
57
|
+
```
|
58
|
+
|
41
59
|
## Contributing
|
42
60
|
|
43
61
|
1. Fork it
|
data/lib/activetodo.rb
CHANGED
@@ -2,6 +2,23 @@ require 'activetodo/version'
|
|
2
2
|
|
3
3
|
module ActiveTodo
|
4
4
|
|
5
|
+
class Configuration
|
6
|
+
class << self
|
7
|
+
def warn_only?(options = {})
|
8
|
+
return options[:warn_only] if options.keys.include?(:warn_only)
|
9
|
+
@@warn_only ||= false
|
10
|
+
end
|
11
|
+
|
12
|
+
def warn_only=(condition)
|
13
|
+
@@warn_only = condition
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure
|
19
|
+
yield Configuration if block_given?
|
20
|
+
end
|
21
|
+
|
5
22
|
class PrivateMethods
|
6
23
|
class << self
|
7
24
|
def log_message(message)
|
@@ -22,7 +39,7 @@ module ActiveTodo
|
|
22
39
|
if deadline && DateTime.now >= deadline
|
23
40
|
message = "Deadline reached for \"#{what}\" (#{options[:deadline]})"
|
24
41
|
|
25
|
-
if options
|
42
|
+
if Configuration.warn_only?(options)
|
26
43
|
PrivateMethods.log_message(message)
|
27
44
|
else
|
28
45
|
raise message
|
data/lib/activetodo/version.rb
CHANGED
data/spec/activetodo_spec.rb
CHANGED
@@ -46,6 +46,25 @@ describe ActiveTodo::KernelMethods do
|
|
46
46
|
|
47
47
|
subject { FIXME 'Refactor shit', deadline: '2014-01-01', warn_only: true }
|
48
48
|
|
49
|
+
context 'preconfigured' do
|
50
|
+
|
51
|
+
before { ActiveTodo.configure { |c| c.warn_only = true } }
|
52
|
+
|
53
|
+
context 'without override' do
|
54
|
+
subject { FIXME 'Refactor shit', deadline: '2014-01-01' }
|
55
|
+
|
56
|
+
before { ActiveTodo::PrivateMethods.should_receive(:log_message) }
|
57
|
+
|
58
|
+
specify { expect { subject }.not_to raise_error }
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'with override' do
|
62
|
+
subject { FIXME 'Refactor shit', deadline: '2014-01-01', warn_only: false }
|
63
|
+
|
64
|
+
specify { expect { subject }.to raise_error }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
49
68
|
context 'outside Rails' do
|
50
69
|
before { ActiveTodo::PrivateMethods.should_receive(:log_message) }
|
51
70
|
specify { expect { subject }.not_to raise_error }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activetodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Varaneckas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,6 @@ files:
|
|
92
92
|
- .rspec
|
93
93
|
- .travis.yml
|
94
94
|
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
95
|
- LICENSE
|
97
96
|
- README.md
|
98
97
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
activetodo (0.0.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
coderay (1.0.9)
|
10
|
-
coveralls (0.6.9)
|
11
|
-
multi_json (~> 1.3)
|
12
|
-
rest-client
|
13
|
-
simplecov (>= 0.7)
|
14
|
-
term-ansicolor
|
15
|
-
thor
|
16
|
-
diff-lcs (1.2.4)
|
17
|
-
method_source (0.8.2)
|
18
|
-
mime-types (1.25)
|
19
|
-
multi_json (1.8.0)
|
20
|
-
pry (0.9.12.2)
|
21
|
-
coderay (~> 1.0.5)
|
22
|
-
method_source (~> 0.8)
|
23
|
-
slop (~> 3.4)
|
24
|
-
pry-nav (0.2.3)
|
25
|
-
pry (~> 0.9.10)
|
26
|
-
rake (10.1.0)
|
27
|
-
rest-client (1.6.7)
|
28
|
-
mime-types (>= 1.16)
|
29
|
-
rspec (2.14.1)
|
30
|
-
rspec-core (~> 2.14.0)
|
31
|
-
rspec-expectations (~> 2.14.0)
|
32
|
-
rspec-mocks (~> 2.14.0)
|
33
|
-
rspec-core (2.14.5)
|
34
|
-
rspec-expectations (2.14.2)
|
35
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
36
|
-
rspec-mocks (2.14.3)
|
37
|
-
simplecov (0.7.1)
|
38
|
-
multi_json (~> 1.0)
|
39
|
-
simplecov-html (~> 0.7.1)
|
40
|
-
simplecov-html (0.7.1)
|
41
|
-
slop (3.4.6)
|
42
|
-
term-ansicolor (1.2.2)
|
43
|
-
tins (~> 0.8)
|
44
|
-
thor (0.18.1)
|
45
|
-
timecop (0.6.3)
|
46
|
-
tins (0.9.0)
|
47
|
-
|
48
|
-
PLATFORMS
|
49
|
-
ruby
|
50
|
-
|
51
|
-
DEPENDENCIES
|
52
|
-
activetodo!
|
53
|
-
bundler (~> 1.3)
|
54
|
-
coveralls
|
55
|
-
pry-nav
|
56
|
-
rake
|
57
|
-
rspec
|
58
|
-
timecop
|