abort_if 0.1.0 → 0.1.1

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: 8920fab9f3ebdde4cc0e63f1d98bb12c7e6ab8f7
4
- data.tar.gz: 3625e065379e1a1a4ff007edf0c67f82e5279b25
3
+ metadata.gz: 9382641ec11c37ac30b41e19e894327898bd87cb
4
+ data.tar.gz: 6b2c23d5e9e3ff6898ec5515c51f7039be43132f
5
5
  SHA512:
6
- metadata.gz: 7a078a3409e0f489417fa9747b413fa4881f9e1aa54bdd20fc81cfa890afab6c3bf7c978890a9fb7471b18c4fde271b1b13721a87ec5ed8b59c34a3d8b1bb78b
7
- data.tar.gz: cfaba8f1d9ed5d568a28f364a0e59eedcf8dfdf43228e50dd30e9730a63fcee641d47d7757f76066cba4452786f4657d0537891fab02f3a8ed824a47036b56d2
6
+ metadata.gz: da1482e773e97e38268b7d8544f9f5ab60f426ca872e04c93463ea339c282207ab23e46777fa64c4effc9786d3921e3288ed08b70a719f71437e6c2713eda3a4
7
+ data.tar.gz: 86e36eb1ea400665994d6ab25cbb2dea44263fd6cb83286034c6e44b03c62123ab439de1a87264f0e6c2dacf7426a487a37d7fdc9b4db99b934924dcfabcb305
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AbortIf
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/AbortIf.svg)](http://badge.fury.io/rb/AbortIf) [![Build Status](https://travis-ci.org/mooreryan/abort_if.svg?branch=master)](https://travis-ci.org/mooreryan/abort_if) [![Coverage Status](https://coveralls.io/repos/github/mooreryan/abort_if/badge.svg?branch=master)](https://coveralls.io/github/mooreryan/abort_if?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/abort_if.svg)](https://badge.fury.io/rb/abort_if) [![Build Status](https://travis-ci.org/mooreryan/abort_if.svg?branch=master)](https://travis-ci.org/mooreryan/abort_if) [![Coverage Status](https://coveralls.io/repos/github/mooreryan/abort_if/badge.svg?branch=master)](https://coveralls.io/github/mooreryan/abort_if?branch=master)
4
4
 
5
5
  Simple error logging and assertions for Ruby.
6
6
 
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- See [documentation](http://www.rubydoc.info/gems/AbortIf) for complete
25
+ See [documentation](http://www.rubydoc.info/gems/abort_if) for complete
26
26
  usage.
27
27
 
28
28
  ### Example ###
@@ -19,6 +19,7 @@
19
19
  require "abort_if/version"
20
20
  require "abort_if/error"
21
21
  require "abort_if/argument_error"
22
+ require "abort_if/exit"
22
23
  require "assert/assert"
23
24
  require "logger"
24
25
 
@@ -44,7 +45,7 @@ module AbortIf
44
45
  # @param msg [String] the message written by the
45
46
  # error logger
46
47
  #
47
- # @raise [SystemExit] if test is truthy
48
+ # @raise [AbortIf::Exit] if test is truthy
48
49
  #
49
50
  # @return [nil] if test is false or nil
50
51
  #
@@ -53,7 +54,7 @@ module AbortIf
53
54
  def abort_if test, msg="Fatal error"
54
55
  if test
55
56
  logger.fatal msg
56
- abort
57
+ raise Exit
57
58
  end
58
59
  end
59
60
 
@@ -62,7 +63,7 @@ module AbortIf
62
63
  #
63
64
  # @param fname [String] name of a file
64
65
  #
65
- # @raise [SystemExit] if file exists
66
+ # @raise [AbortIf::Exit] if file exists
66
67
  #
67
68
  # @return [nil] if file does not exist
68
69
  def abort_if_file_exists fname
@@ -86,7 +87,7 @@ module AbortIf
86
87
  #
87
88
  # @param (see #abort_if)
88
89
  #
89
- # @raise [SystemExit] if test is false or nil
90
+ # @raise [AbortIf::Exit] if test is false or nil
90
91
  #
91
92
  # @return [nil] if test is truthy
92
93
  def abort_unless test, msg="Fatal error"
@@ -98,7 +99,7 @@ module AbortIf
98
99
  #
99
100
  # @param (see #abort_if_file_exists)
100
101
  #
101
- # @raise [SystemExit] if file does not exist
102
+ # @raise [AbortIf::Exit] if file does not exist
102
103
  #
103
104
  # @return [nil] if file exists
104
105
  def abort_unless_file_exists fname
@@ -0,0 +1,24 @@
1
+ # Copyright 2016 Ryan Moore
2
+ # Contact: moorer@udel.edu
3
+ #
4
+ # This file is part of AbortIf.
5
+ #
6
+ # AbortIf is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # AbortIf is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with AbortIf. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ module AbortIf
20
+ # Raised instead of standard SystemExit so you can catch SystemExit
21
+ # raised by AbortIf module
22
+ class Exit < Object::SystemExit
23
+ end
24
+ end
@@ -17,5 +17,5 @@
17
17
  # along with AbortIf. If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
19
  module AbortIf
20
- VERSION = "0.1.0"
20
+ VERSION = "0.1.1"
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abort_if
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moore
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - lib/abort_if.rb
124
124
  - lib/abort_if/argument_error.rb
125
125
  - lib/abort_if/error.rb
126
+ - lib/abort_if/exit.rb
126
127
  - lib/abort_if/version.rb
127
128
  - lib/assert/assert.rb
128
129
  homepage: https://github.com/mooreryan/abort_if