todo_or_die 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e96cc61c209d86d2cc3c4caddf881ada4c803ab16f20f5184b43fae0542c6032
4
- data.tar.gz: 73ae688e244d5ce0b960a5a931f53c98dc94813d38833aab0126168c2ad17ef8
3
+ metadata.gz: b194253e28740bfc137b7ef030efcf8387fe3acf0b91983eb69b961691a1c4eb
4
+ data.tar.gz: 8566f5e5b156ff958ee22aaca60f663d372cd0bea69ffacc5218c86441ce2a1c
5
5
  SHA512:
6
- metadata.gz: 8c1775674c7f182cb34633e5f0ddeed7dd2272f041d2ccbd93b3f693382884eea36d06a557bbdc9633f6e29741d291ff09ffb1a8a53e28ba4a4f8ec481666326
7
- data.tar.gz: abebfad5178929b2237c88d25a1ee0df15190377b207a99371d6d27314edb74fd1e8f31898628222d424536e19289f70291c42925505e83cfe9ae5e3757cf434
6
+ metadata.gz: fe91f1b1b86bb5a7077a8fa5f35bb25d25f598e4f6c40a319c0a771d755d79905191aa9a2b06982cf33cfc5bdcfa1af0553cd798d53d80580d6c5e27be70ae3e
7
+ data.tar.gz: 75480ce8dbf70cf14db4ba6e9592530ef40ef15fa173f841dc7cba0e1a1be3f1965031472ec7cd6def55b9a00d737994d984c4f41dc916436b267ec004b1349c
@@ -0,0 +1,24 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ - image: circleci/ruby:2.4.1-node-browsers
10
+
11
+ working_directory: ~/repo
12
+
13
+ steps:
14
+ - checkout
15
+
16
+ - run:
17
+ name: install dependencies
18
+ command: |
19
+ bundle install --retry=3
20
+
21
+ - run:
22
+ name: run tests
23
+ command: bundle exec rake
24
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- todo_or_die (0.0.1)
4
+ todo_or_die (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,4 +41,4 @@ DEPENDENCIES
41
41
  todo_or_die!
42
42
 
43
43
  BUNDLED WITH
44
- 1.17.2
44
+ 1.17.3
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2019 Justin Searls
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # TODO or Die!
2
2
 
3
+ <img src="https://user-images.githubusercontent.com/79303/50570550-f41a6180-0d5d-11e9-8033-7ea4dfb7261c.jpg" height="360" alt="TODO or Die NES cart"/>
4
+
5
+ [![CircleCI](https://circleci.com/gh/searls/todo_or_die/tree/master.svg?style=svg)](https://circleci.com/gh/searls/todo_or_die/tree/master)
6
+
3
7
  ## Usage
4
8
 
5
9
  Stick this in your Gemfile and bundle it:
@@ -18,11 +22,9 @@ To understand why you would ever call a method to write a comment, read on.
18
22
 
19
23
  ### The awful way you used to procrastinate
20
24
 
21
- In the Bad Old Days™, if you had a bit of code you knew needed to change later,
22
- you might leave yourself a code comment to remind yourself or some future
23
- traveler to implement it.
24
-
25
- Here's the real world example code comment that inspired this gem:
25
+ In the Bad Old Days™, if you had a bit of code you knew you needed to change
26
+ later, you might leave yourself a code comment to remind yourself to change it.
27
+ For example, here's the real world code comment that inspired this gem:
26
28
 
27
29
  ``` ruby
28
30
  class UsersController < ApiController
@@ -41,11 +43,10 @@ actual support incident (long story).
41
43
  ### The cool new way you put off coding now
42
44
 
43
45
  So I did what any programmer would do in the face of an intractable social
44
- problem: I wrote code in the vain hope of solving it without having to talk to
45
- anyone.
46
+ problem: I wrote code in the vain hope of solving things without needing to talk
47
+ to anyone. And now this gem exists.
46
48
 
47
- To use the gem, try replacing one of your TODO comments with something like
48
- this:
49
+ To use it, try replacing one of your TODO comments with something like this:
49
50
 
50
51
  ``` ruby
51
52
  class UsersController < ApiController
@@ -61,7 +62,7 @@ raise an error whenever this class is loaded until someone deals with it.
61
62
 
62
63
  ### What kind of error?
63
64
 
64
- It depends on whether `Rails` is defined.
65
+ It depends on whether you're using [Rails](https://rubyonrails.org) or not.
65
66
 
66
67
  #### When you're writing Real Ruby
67
68
 
@@ -70,26 +71,28 @@ raise a `TodoOrDie::OverdueError` whenever a TODO is overdue. The message looks
70
71
  like this:
71
72
 
72
73
  ```
73
- TODO: "Visit Wisconsin" came due on 2016-11-9. Do it!
74
+ TODO: "Visit Wisconsin" came due on 2016-11-09. Do it!
74
75
  ```
75
76
 
76
77
  #### When `Rails` is a thing
77
78
 
78
79
  If TodoOrDie sees that `Rails` is defined, it'll assume you probably don't want
79
80
  this tool to run outside development and test, so it'll log the error message to
80
- `Rails.logger.warn` in production and raise the error otherwise.
81
+ `Rails.logger.warn` in production (while still raising the error in development
82
+ and test).
81
83
 
82
- ### Wait, won't raising time-based errors throughout my app ruin my weekend?
84
+ ### Wait, won't sprinkling time bombs throughout my app ruin my weekend?
83
85
 
84
- Sure will! It's TODO or Die, not TODO and Remember to Pace Yourself.
86
+ Sure will! It's "TODO or Die", not "TODO and Remember to Pace Yourself".
85
87
 
86
- Still, people will probably get mad if you break production because you forgot
87
- to remove an A/B test, so I'd [strongly recommend you read what the default hook
88
- actually does](lib/todo_or_die.rb) before you commit any to-do items to your
89
- codebase.
88
+ Still, someone will probably get mad if you break production because you forgot
89
+ to follow through on removing an A/B test, so I'd [strongly recommend you read
90
+ what the default hook actually does](lib/todo_or_die.rb#L8-L16) before this gem
91
+ leads to you losing your job. (Speaking of, please note the lack of any warranty
92
+ in `todo_or_die`'s [license](LICENSE.txt).)
90
93
 
91
- You can customize the gem's behavior by passing in your own callable
92
- lambda/proc/thing like this:
94
+ To appease your boss, you may customize the gem's behavior by passing in your
95
+ own `call`'able lambda/proc/dingus like this:
93
96
 
94
97
  ```ruby
95
98
  TodoOrDie.config(
@@ -102,29 +105,30 @@ TodoOrDie.config(
102
105
  ```
103
106
 
104
107
  Now, any `TodoOrDie()` invocations in your codebase (other than Karen's) will be
105
- ignored. (You can reset this with `TodoOrDie.reset`).
108
+ ignored. (You can restore the default hook with `TodoOrDie.reset`).
106
109
 
107
110
  ## When is this useful?
108
111
 
109
- Any time you know the code needs to change, but it can't change right now, and
110
- you lack some other reliable means of ensuring yourself (or your team)
111
- will actually follow through on making the change later.
112
+ This gem may come in handy whenever you know the code _will_ need to change,
113
+ but it can't be changed just yet, and you lack some other reliable means of
114
+ ensuring yourself (or your team) will actually follow through on making the
115
+ change later.
112
116
 
113
- However, recall that [LeBlanc's
114
- Law](https://www.quora.com/What-resources-could-I-read-about-Leblancs-law)
115
- states that `Later == Never`, countless proofs of which have been demonstrated
116
- by software teams around the world. Some common examples:
117
+ This is a good time to recall [LeBlanc's
118
+ Law](https://www.quora.com/What-resources-could-I-read-about-Leblancs-law),
119
+ which states that `Later == Never`. Countless proofs of this theorem have been
120
+ reproduced by software teams around the world. Some common examples:
117
121
 
118
- * A feature flag was added to the app, and the old code path is still present,
119
- long after all production traffic has been migrated with a useless `TODO:
120
- delete` comment to keep it company
121
- * A failing test is blocking the build and there's an urgent pressure to deploy,
122
- and insufficient time to fix the test, so somebody wants to comment the test
123
- out "for now"
124
- * You're a real funny person and you think it'd be hilarious to make a bunch of
125
- Jim's tests start failing on Christmas morning
122
+ * A feature flag was added to the app a long time ago, but the old code path is
123
+ still present, even after the flag had been enabled for everyone. Except now
124
+ there's also a useless `TODO: delete` comment to keep it company
125
+ * A failing test was blocking the build and someone felt an urgent pressure to
126
+ deploy the app anyway. So, rather than fix the test, Bill commented it out
127
+ "for now"
128
+ * You're a real funny guy and you think it'd be hilarious to make a bunch of
129
+ Aaron's tests start failing on Christmas morning
126
130
 
127
- # Pro-tip
131
+ ## Pro-tip
128
132
 
129
133
  Cute Rails date helpers are awesome, but don't think you're going to be able to
130
134
  do this and actually accomplish anything:
@@ -133,4 +137,4 @@ do this and actually accomplish anything:
133
137
  TodoOrDie("Update after APIv2 goes live", 2.weeks.from_now)
134
138
  ```
135
139
 
136
-
140
+ It will never be two weeks from now.
@@ -12,7 +12,7 @@ module TodoOrDie
12
12
  if defined?(Rails) && Rails.env.production?
13
13
  Rails.logger.warn(error_message)
14
14
  else
15
- raise TodoOrDie::OverdueTodo.new(error_message)
15
+ raise TodoOrDie::OverdueTodo, error_message, TodoOrDie.__clean_backtrace(caller)
16
16
  end
17
17
  },
18
18
  }.freeze
@@ -25,6 +25,11 @@ module TodoOrDie
25
25
  def self.reset
26
26
  @config = DEFAULT_CONFIG.dup
27
27
  end
28
+
29
+ FILE_PATH_REGEX = Regexp.new(Regexp.quote(__dir__)).freeze
30
+ def self.__clean_backtrace(stack)
31
+ stack.delete_if {|line| line =~ FILE_PATH_REGEX }
32
+ end
28
33
  end
29
34
 
30
35
  # The main event
@@ -1,3 +1,3 @@
1
1
  module TodoOrDie
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["searls@gmail.com"]
10
10
 
11
11
  spec.summary = "Write TO​DOs in code that ensure you actually do them"
12
- spec.homepage = "https://github.com/testdouble/todo_or_die"
12
+ spec.homepage = "https://github.com/searls/todo_or_die"
13
13
 
14
14
  spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
15
15
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo_or_die
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-01 00:00:00.000000000 Z
11
+ date: 2019-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,9 +87,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".circleci/config.yml"
90
91
  - ".gitignore"
91
92
  - Gemfile
92
93
  - Gemfile.lock
94
+ - LICENSE.txt
93
95
  - README.md
94
96
  - Rakefile
95
97
  - bin/console
@@ -98,7 +100,7 @@ files:
98
100
  - lib/todo_or_die/overdue_error.rb
99
101
  - lib/todo_or_die/version.rb
100
102
  - todo_or_die.gemspec
101
- homepage: https://github.com/testdouble/todo_or_die
103
+ homepage: https://github.com/searls/todo_or_die
102
104
  licenses: []
103
105
  metadata: {}
104
106
  post_install_message: