fixme 1.0.1 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 446328def31c867a17062161e563e6b6a5d292a1
4
- data.tar.gz: 46c74e2f259703dc4e329c2fd3ca78e90206ffe1
3
+ metadata.gz: a739fb14f76d1ecaf78b09daa1ef1bb44d3619dc
4
+ data.tar.gz: 6b4463e54b2eb7c81324fc0d26498b494db25eed
5
5
  SHA512:
6
- metadata.gz: b7ac9527bd3cbced205d5c2200e04acba028345dd1ae6f647b01e671ebd66366ab1b34562a53883390e71b51aa3d8eeed7424ca55b749d196013fb73547c55ea
7
- data.tar.gz: 4c41a4c9aba365850ad2fec9f4024c2e20d0697c5ca9a92f38064f64769e7ac31539fab84783c1709eea9bfc4952fd71e12f0607628c14e3afe0d9c853c53ff4
6
+ metadata.gz: f07137de06cedb7e5141b04f87e2573c3f625068e58bdd7f0b132ec6b3405768d20e5c708c02f729151e6ca9200480f3d0d557d9c4d98f891536c6c1aedb6abf
7
+ data.tar.gz: fd5d5a33abe502db63b0e18dc144d5e4b36197791647e0f1482cd68da5d80697e3f2cb323fcd2d769bbd89247acd23f4c41a66b768f7b9ae3a59591b477618b1
data/README.md CHANGED
@@ -7,17 +7,25 @@ FIXME "2014-07-31: Stop hard-coding currency."
7
7
  currency = "USD"
8
8
  ```
9
9
 
10
- You may want to use them next to:
10
+ This library makes a `FIXME()` method available everywhere.
11
+
12
+ Starting July 31st 2014, the "FIXME" line in the example above would raise `Fixme::UnfixedError` with the message `"Fix by 2014-07-31: Stop hard-coding currency."`
13
+
14
+ You may want to use these bad boys next to:
11
15
 
12
16
  * Temporary quick fixes, to ensure they really *are* temporary.
13
17
  * Code that supports legacy workflows during a transitional period.
14
18
  * Experiments, to remember to evaluate them and make a decision.
15
19
  * Anything else you can't do now but should fix later.
16
20
 
17
- Starting July 31st 2014, the "FIXME" line in the example above would start raising an exception with the given message.
18
-
19
21
  If `Rails.environment` (Ruby on Rails) or `ENV["RACK_ENV"]` (e.g. Sinatra) is present, it will only ever raise in the `"test"` and `"development"` environments. That is, the production app will never raise these exceptions.
20
22
 
23
+ If you don't want your CI server to raise, make it set the environment variable `DO_NOT_RAISE_FIXMES`. I like having CI raise them, though.
24
+
25
+ Protip: make sure it's clear from the exception or from a separate comment just what should be done – sometimes not even the person who wrote the quickfix will remember what you're meant to change.
26
+
27
+ This library is an extraction of a helper (originally called `wip_raise`) we tried and liked at [Barsoom](http://barsoom.se).
28
+
21
29
 
22
30
  ## Installation
23
31
 
@@ -6,6 +6,8 @@ module Fixme
6
6
 
7
7
  module Mixin
8
8
  def FIXME(date_and_message)
9
+ return if ENV["DO_NOT_RAISE_FIXMES"]
10
+
9
11
  raw_date, message = date_and_message.split(": ", 2)
10
12
  due_date = Date.parse(raw_date)
11
13
 
@@ -1,3 +1,3 @@
1
1
  module Fixme
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -19,6 +19,7 @@ describe Fixme, "#TODO" do
19
19
  }.not_to raise_error
20
20
  end
21
21
 
22
+ # Had a bug with ": " in the message.
22
23
  it "parses the date and message flawlessly" do
23
24
  expect {
24
25
  FIXME "2013-12-31: Remove this: and this."
@@ -55,6 +56,10 @@ describe Fixme, "#TODO" do
55
56
  end
56
57
 
57
58
  context "when a Rack environment is detected" do
59
+ before do
60
+ ENV.stub(:[]).with("DO_NOT_RAISE_FIXMES")
61
+ end
62
+
58
63
  it "raises in the 'test' environment" do
59
64
  ENV.stub(:[]).with("RACK_ENV").and_return("test")
60
65
  expect_to_raise
@@ -71,6 +76,11 @@ describe Fixme, "#TODO" do
71
76
  end
72
77
  end
73
78
 
79
+ it "does not raise when the DO_NOT_RAISE_FIXMES environment variable is set" do
80
+ ENV.stub(:[]).with("DO_NOT_RAISE_FIXMES").and_return("true")
81
+ expect_not_to_raise
82
+ end
83
+
74
84
  private
75
85
 
76
86
  def expect_to_raise
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh