activetodo 0.0.2
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/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +58 -0
- data/LICENSE +20 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/activetodo.gemspec +26 -0
- data/lib/activetodo.rb +39 -0
- data/lib/activetodo/version.rb +3 -0
- data/spec/activetodo_spec.rb +69 -0
- data/spec/spec_helper.rb +16 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb46c5773e643c97afe3388f93bd9216eb0c01a0
|
4
|
+
data.tar.gz: 69d339ae2c71ad28df1ba11e438ecc60eb3b018c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57300628de5eba3ee3f7128ac25bc580d267b9e198ab940c4db0a3ce02333007a1357a76cd6bc4d82164cce7d153007511066a083f2cded64dbe60587238bf89
|
7
|
+
data.tar.gz: 7a21708d3eb0a09d77809454358ab0a47ccb453a45f408b8d33e043d6752a6e1306608f51fd638fbd3e0d4bae23d7a247d71b1919ecf4a66949f988e88254cb1
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
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
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Tomas Varaneckas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# ActiveTodo
|
2
|
+
|
3
|
+
[](https://travis-ci.org/spajus/activetodo)
|
4
|
+
[](https://coveralls.io/r/spajus/activetodo)
|
5
|
+
[](https://codeclimate.com/github/spajus/activetodo)
|
6
|
+
|
7
|
+
Forget TODO comments that are sitting in your code forever
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'activetodo'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install activetodo
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Use anywhere in code:
|
26
|
+
```ruby
|
27
|
+
# Generic TODO without deadline
|
28
|
+
TODO 'Add specs'
|
29
|
+
|
30
|
+
# Raises error after 2014-01-01
|
31
|
+
FIXME 'Certificate will expire soon', deadline: '2014-01-01'
|
32
|
+
|
33
|
+
# After 2014-02-28, does Rails.logger.warn in production, raises error in development / test
|
34
|
+
XXX 'Dirty hack, must refactor', deadline: '2014-02-28', warn_only: Rails.env.production?
|
35
|
+
```
|
36
|
+
|
37
|
+
`TODO`, `FIXME` and `XXX` all have same interface: `TODO(<message>, [options_hash])`
|
38
|
+
|
39
|
+
You can use `activetodo` with or without Rails.
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/activetodo.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'activetodo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'activetodo'
|
8
|
+
spec.version = ActiveTodo::VERSION
|
9
|
+
spec.authors = ['Tomas Varaneckas']
|
10
|
+
spec.email = ['tomas.varaneckas@gmail.com']
|
11
|
+
spec.description = %q{This gem provides 'TOD*', 'F*XME' and 'XX*' as methods you can use in code}
|
12
|
+
spec.summary = %q{Forget 'TOD*' comments that are sitting in your code forever}
|
13
|
+
spec.homepage = 'https://github.com/spajus/activetodo'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'timecop'
|
25
|
+
spec.add_development_dependency 'pry-nav'
|
26
|
+
end
|
data/lib/activetodo.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'activetodo/version'
|
2
|
+
|
3
|
+
module ActiveTodo
|
4
|
+
|
5
|
+
class PrivateMethods
|
6
|
+
class << self
|
7
|
+
def log_message(message)
|
8
|
+
if defined?(Rails) && Rails.logger
|
9
|
+
Rails.logger.warn(message)
|
10
|
+
else
|
11
|
+
puts message
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module KernelMethods
|
18
|
+
|
19
|
+
def TODO(what, options = {})
|
20
|
+
deadline = DateTime.parse(options[:deadline]) if options[:deadline]
|
21
|
+
|
22
|
+
if deadline && DateTime.now >= deadline
|
23
|
+
message = "Deadline reached for \"#{what}\" (#{options[:deadline]})"
|
24
|
+
|
25
|
+
if options[:warn_only]
|
26
|
+
PrivateMethods.log_message(message)
|
27
|
+
else
|
28
|
+
raise message
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :FIXME, :TODO
|
34
|
+
alias_method :XXX, :TODO
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
include ActiveTodo::KernelMethods
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'timecop'
|
3
|
+
require 'pry-nav'
|
4
|
+
|
5
|
+
describe ActiveTodo::KernelMethods do
|
6
|
+
|
7
|
+
context '.TODO' do
|
8
|
+
subject { TODO 'stuff' }
|
9
|
+
specify { expect { subject }.to_not raise_error }
|
10
|
+
end
|
11
|
+
|
12
|
+
context '.FIXME' do
|
13
|
+
subject { FIXME 'stuff' }
|
14
|
+
specify { expect { subject }.to_not raise_error }
|
15
|
+
end
|
16
|
+
|
17
|
+
context '.XXX' do
|
18
|
+
subject { XXX 'stuff' }
|
19
|
+
specify { expect { subject }.to_not raise_error }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'options' do
|
23
|
+
|
24
|
+
let(:now) { Time.local(2013, 12, 31, 12, 0, 0) }
|
25
|
+
let(:future) { Time.local(2014, 1, 1, 12, 0, 0) }
|
26
|
+
|
27
|
+
before { Timecop.freeze(now) }
|
28
|
+
|
29
|
+
context 'deadline' do
|
30
|
+
|
31
|
+
subject { FIXME 'Refactor shit', deadline: '2014-01-01' }
|
32
|
+
|
33
|
+
context 'no error before it is reached' do
|
34
|
+
specify { expect { subject }.to_not raise_error }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'raises error after it was reached' do
|
38
|
+
let(:now) { future }
|
39
|
+
specify { expect { subject }.to raise_error }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'warn_only' do
|
44
|
+
|
45
|
+
let(:now) { future }
|
46
|
+
|
47
|
+
subject { FIXME 'Refactor shit', deadline: '2014-01-01', warn_only: true }
|
48
|
+
|
49
|
+
context 'outside Rails' do
|
50
|
+
before { ActiveTodo::PrivateMethods.should_receive(:log_message) }
|
51
|
+
specify { expect { subject }.not_to raise_error }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'within Rails' do
|
55
|
+
|
56
|
+
let(:rails) { double(:rails) }
|
57
|
+
let(:logger) { double(:logger) }
|
58
|
+
|
59
|
+
before do
|
60
|
+
stub_const('Rails', rails)
|
61
|
+
Rails.should_receive(:logger).twice.and_return(logger)
|
62
|
+
logger.should_receive(:warn)
|
63
|
+
end
|
64
|
+
|
65
|
+
specify { expect { subject }.not_to raise_error }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'activetodo'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
8
|
+
config.run_all_when_everything_filtered = true
|
9
|
+
config.filter_run :focus
|
10
|
+
|
11
|
+
# Run specs in random order to surface order dependencies. If you find an
|
12
|
+
# order dependency and want to debug it, you can fix the order by providing
|
13
|
+
# the seed, which is printed after each run.
|
14
|
+
# --seed 1234
|
15
|
+
config.order = 'random'
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activetodo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomas Varaneckas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: timecop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: This gem provides 'TOD*', 'F*XME' and 'XX*' as methods you can use in
|
84
|
+
code
|
85
|
+
email:
|
86
|
+
- tomas.varaneckas@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .rspec
|
93
|
+
- .travis.yml
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- activetodo.gemspec
|
100
|
+
- lib/activetodo.rb
|
101
|
+
- lib/activetodo/version.rb
|
102
|
+
- spec/activetodo_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
homepage: https://github.com/spajus/activetodo
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.0.6
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Forget 'TOD*' comments that are sitting in your code forever
|
128
|
+
test_files:
|
129
|
+
- spec/activetodo_spec.rb
|
130
|
+
- spec/spec_helper.rb
|