warnings_logger 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +132 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/bin/setup +7 -0
- data/lib/warnings_logger.rb +6 -0
- data/lib/warnings_logger/configuration.rb +10 -0
- data/lib/warnings_logger/filesystem.rb +48 -0
- data/lib/warnings_logger/partitioner.rb +30 -0
- data/lib/warnings_logger/reader.rb +56 -0
- data/lib/warnings_logger/reporter.rb +94 -0
- data/lib/warnings_logger/spy.rb +85 -0
- data/lib/warnings_logger/version.rb +3 -0
- data/warnings_logger.gemspec +43 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4212c6b04c9e279f94862a0f2f4b91c32f673edb8496243cd1827b8f288a3317
|
4
|
+
data.tar.gz: 8497994515a8223fa011f24801f63a485af6af2ba011f2b5d18c2ab50b20ed89
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 58243246de25954f2bc8febee114b3a07189fed4ef8abc19249f445fbf851b2bf658c8c1d2e077f7314010ccabf3037064095d7d00642e378bee2eb9153cd3c6
|
7
|
+
data.tar.gz: 2e42de94cc388528cb3f20e374accf6ade750443b29793e2c24fc68c97e479848b37c6a4618fdc0843ad485c9f495212442ca3befdf090df6a732d36fb7dea65
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
- db/schema.rb
|
5
|
+
TargetRubyVersion: 2.5
|
6
|
+
Layout/AlignParameters:
|
7
|
+
EnforcedStyle: with_fixed_indentation
|
8
|
+
Layout/ClassStructure:
|
9
|
+
Enabled: true
|
10
|
+
Layout/DotPosition:
|
11
|
+
EnforcedStyle: trailing
|
12
|
+
Layout/InitialIndentation:
|
13
|
+
Enabled: false
|
14
|
+
Layout/IndentArray:
|
15
|
+
EnforcedStyle: "consistent"
|
16
|
+
Layout/IndentHash:
|
17
|
+
EnforcedStyle: "consistent"
|
18
|
+
Layout/IndentHeredoc:
|
19
|
+
Enabled: false
|
20
|
+
Layout/MultilineOperationIndentation:
|
21
|
+
EnforcedStyle: indented
|
22
|
+
Layout/MultilineMethodCallIndentation:
|
23
|
+
EnforcedStyle: indented
|
24
|
+
Layout/SpaceInLambdaLiteral:
|
25
|
+
Enabled: false
|
26
|
+
Layout/SpaceInsideStringInterpolation:
|
27
|
+
Enabled: false
|
28
|
+
Lint/AssignmentInCondition:
|
29
|
+
Enabled: false
|
30
|
+
Lint/HandleExceptions:
|
31
|
+
Enabled: false
|
32
|
+
Lint/RequireParentheses:
|
33
|
+
Enabled: false
|
34
|
+
Metrics/AbcSize:
|
35
|
+
Max: 32
|
36
|
+
Metrics/BlockLength:
|
37
|
+
ExcludedMethods:
|
38
|
+
- describe
|
39
|
+
- context
|
40
|
+
- it
|
41
|
+
- colored
|
42
|
+
Metrics/ClassLength:
|
43
|
+
Enabled: false
|
44
|
+
Metrics/LineLength:
|
45
|
+
Max: 80
|
46
|
+
IgnoredPatterns:
|
47
|
+
- "^\\s*describe"
|
48
|
+
- "^\\s*context"
|
49
|
+
- "^\\s*it"
|
50
|
+
Metrics/MethodLength:
|
51
|
+
Enabled: false
|
52
|
+
Metrics/ModuleLength:
|
53
|
+
Enabled: false
|
54
|
+
Metrics/ParameterLists:
|
55
|
+
CountKeywordArgs: false
|
56
|
+
Naming/MemoizedInstanceVariableName:
|
57
|
+
EnforcedStyleForLeadingUnderscores: required
|
58
|
+
Naming/PredicateName:
|
59
|
+
NamePrefixBlacklist:
|
60
|
+
- is_
|
61
|
+
Exclude:
|
62
|
+
- spec/**/*
|
63
|
+
Naming/UncommunicativeMethodParamName:
|
64
|
+
Enabled: false
|
65
|
+
Style/Alias:
|
66
|
+
Enabled: false
|
67
|
+
Style/BracesAroundHashParameters:
|
68
|
+
EnforcedStyle: context_dependent
|
69
|
+
Style/CollectionMethods:
|
70
|
+
Enabled: true
|
71
|
+
Style/Documentation:
|
72
|
+
Enabled: false
|
73
|
+
Style/EachWithObject:
|
74
|
+
Enabled: false
|
75
|
+
Style/EmptyMethod:
|
76
|
+
EnforcedStyle: expanded
|
77
|
+
Style/FormatString:
|
78
|
+
EnforcedStyle: percent
|
79
|
+
Style/FrozenStringLiteralComment:
|
80
|
+
Enabled: false
|
81
|
+
Style/GuardClause:
|
82
|
+
Enabled: false
|
83
|
+
Style/IfUnlessModifier:
|
84
|
+
Enabled: false
|
85
|
+
Style/Lambda:
|
86
|
+
Enabled: false
|
87
|
+
Style/LineEndConcatenation:
|
88
|
+
Enabled: false
|
89
|
+
Style/MethodCalledOnDoEndBlock:
|
90
|
+
Enabled: true
|
91
|
+
Style/MultilineBlockChain:
|
92
|
+
Enabled: false
|
93
|
+
Style/NegatedIf:
|
94
|
+
Enabled: false
|
95
|
+
Style/NegatedWhile:
|
96
|
+
Enabled: false
|
97
|
+
Style/OneLineConditional:
|
98
|
+
Enabled: false
|
99
|
+
Style/PercentLiteralDelimiters:
|
100
|
+
Enabled: false
|
101
|
+
Style/PreferredHashMethods:
|
102
|
+
Enabled: false
|
103
|
+
Style/RaiseArgs:
|
104
|
+
Enabled: false
|
105
|
+
Style/SafeNavigation:
|
106
|
+
Enabled: false
|
107
|
+
Style/Send:
|
108
|
+
Enabled: true
|
109
|
+
Style/SignalException:
|
110
|
+
Enabled: false
|
111
|
+
Style/SpecialGlobalVars:
|
112
|
+
Enabled: false
|
113
|
+
Style/StringLiterals:
|
114
|
+
EnforcedStyle: double_quotes
|
115
|
+
Style/StringLiteralsInInterpolation:
|
116
|
+
EnforcedStyle: double_quotes
|
117
|
+
Style/StringMethods:
|
118
|
+
Enabled: true
|
119
|
+
Style/SymbolArray:
|
120
|
+
Enabled: false
|
121
|
+
Style/TrailingCommaInArguments:
|
122
|
+
EnforcedStyleForMultiline: comma
|
123
|
+
Style/TrailingCommaInArrayLiteral:
|
124
|
+
EnforcedStyleForMultiline: comma
|
125
|
+
Style/TrailingCommaInHashLiteral:
|
126
|
+
EnforcedStyleForMultiline: comma
|
127
|
+
Style/UnneededCondition:
|
128
|
+
Enabled: false
|
129
|
+
Style/WhileUntilModifier:
|
130
|
+
Enabled: false
|
131
|
+
Style/WordArray:
|
132
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Elliot Winkler
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Warnings Logger
|
2
|
+
|
3
|
+
Easily log warnings in your gems.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your gem's gemspec:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
spec.add_development_dependency('warnings_logger')
|
11
|
+
```
|
12
|
+
|
13
|
+
If you have a Gemfile, run:
|
14
|
+
|
15
|
+
``` bash
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or, install the gem yourself:
|
20
|
+
|
21
|
+
``` bash
|
22
|
+
gem install warnings_logger
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
To use this gem, place the following in `spec/spec_helper.rb` or
|
28
|
+
`test/test_helper.rb`, replacing `<project name>` with the name of the gem
|
29
|
+
you're developing:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
WarningsLogger::Spy.call(
|
33
|
+
project_name: '<project name>',
|
34
|
+
project_directory: Pathname.new('../..').expand_path(__FILE__),
|
35
|
+
)
|
36
|
+
```
|
37
|
+
|
38
|
+
We also recommend you run your tests by enabling warnings in general. For RSpec
|
39
|
+
this means updating the RSpec::Core::RakeTask by setting `config.warnings =
|
40
|
+
true` and setting `$VERBOSE = true` in your spec helper. For Minitest, this
|
41
|
+
means updating your Rake::Task::TestTask by setting `t.verbose = true` and
|
42
|
+
setting `$VERBOSE = true` in your test helper.
|
43
|
+
|
44
|
+
With the above code in place, now when you run your tests, if your gem emits any
|
45
|
+
warnings, they will be written to a file (which is printed to your terminal) and
|
46
|
+
the exit code of the test run will be 1. This helps you ensure that your gem is
|
47
|
+
warning-free before you release a new version.
|
48
|
+
|
49
|
+
## Developing
|
50
|
+
|
51
|
+
* `bin/setup` to get started
|
52
|
+
* `bundle exec rake release` to release a new version
|
53
|
+
|
54
|
+
## Author/License
|
55
|
+
|
56
|
+
Snowglobe is © 2019 Elliot Winkler (<elliot.winkler@gmail.com>) and is released
|
57
|
+
under the [MIT license](LICENSE).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/setup
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
require_relative "warnings_logger/configuration"
|
2
|
+
require_relative "warnings_logger/filesystem"
|
3
|
+
require_relative "warnings_logger/partitioner"
|
4
|
+
require_relative "warnings_logger/reader"
|
5
|
+
require_relative "warnings_logger/reporter"
|
6
|
+
require_relative "warnings_logger/spy"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
module WarningsLogger
|
4
|
+
class Filesystem
|
5
|
+
ROOT_TEMPORARY_DIRECTORY = Pathname.new("/tmp/warnings_logger")
|
6
|
+
|
7
|
+
def initialize(configuration)
|
8
|
+
@temporary_directory = ROOT_TEMPORARY_DIRECTORY.join(
|
9
|
+
configuration.project_name,
|
10
|
+
)
|
11
|
+
@files_by_name = Hash.new do |hash, name|
|
12
|
+
hash[name] = file_for(name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
if temporary_directory.exist?
|
18
|
+
temporary_directory.rmtree
|
19
|
+
end
|
20
|
+
|
21
|
+
temporary_directory.mkpath
|
22
|
+
end
|
23
|
+
|
24
|
+
def warnings_file
|
25
|
+
files_by_name["all_warnings"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def irrelevant_warnings_file
|
29
|
+
files_by_name["irrelevant_warnings"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def relevant_warnings_file
|
33
|
+
files_by_name["relevant_warnings"]
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :temporary_directory, :files_by_name
|
39
|
+
|
40
|
+
def file_for(name)
|
41
|
+
path_for(name).open("w+")
|
42
|
+
end
|
43
|
+
|
44
|
+
def path_for(name)
|
45
|
+
temporary_directory.join("#{name}.txt")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module WarningsLogger
|
4
|
+
class Partitioner
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
attr_reader :relevant_warning_groups, :irrelevant_warning_groups
|
8
|
+
|
9
|
+
def initialize(configuration:, reader:)
|
10
|
+
@configuration = configuration
|
11
|
+
@reader = reader
|
12
|
+
end
|
13
|
+
|
14
|
+
def partition
|
15
|
+
@relevant_warning_groups, @irrelevant_warning_groups =
|
16
|
+
warning_groups.partition { |group| relevant_warnings?(group) }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :configuration, :reader
|
22
|
+
|
23
|
+
def_delegators :configuration, :project_directory
|
24
|
+
def_delegators :reader, :warning_groups
|
25
|
+
|
26
|
+
def relevant_warnings?(lines_in_group)
|
27
|
+
lines_in_group[0].start_with?("#{project_directory}/lib")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module WarningsLogger
|
4
|
+
class Reader
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
attr_reader :warning_groups
|
8
|
+
|
9
|
+
def initialize(filesystem)
|
10
|
+
@filesystem = filesystem
|
11
|
+
@current_group = []
|
12
|
+
@warning_groups = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def read
|
16
|
+
warnings_file.rewind
|
17
|
+
|
18
|
+
warnings_file.each_line do |line|
|
19
|
+
process_line(line)
|
20
|
+
end
|
21
|
+
|
22
|
+
add_group(current_group)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :filesystem, :current_group
|
28
|
+
|
29
|
+
def_delegators :filesystem, :warnings_file
|
30
|
+
|
31
|
+
def process_line(line)
|
32
|
+
if start_of_group?(line)
|
33
|
+
add_group(current_group)
|
34
|
+
@current_group = []
|
35
|
+
end
|
36
|
+
|
37
|
+
current_group << line
|
38
|
+
end
|
39
|
+
|
40
|
+
def start_of_group?(line)
|
41
|
+
line =~ /^\S/
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_group(group)
|
45
|
+
unless group.empty? || group_already_added?(group)
|
46
|
+
warning_groups << group
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def group_already_added?(group_to_be_added)
|
51
|
+
warning_groups.any? do |group|
|
52
|
+
group == group_to_be_added
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module WarningsLogger
|
4
|
+
class Reporter
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def initialize(configuration:, filesystem:, partitioner:)
|
8
|
+
@configuration = configuration
|
9
|
+
@filesystem = filesystem
|
10
|
+
@partitioner = partitioner
|
11
|
+
end
|
12
|
+
|
13
|
+
def report
|
14
|
+
reporting_all_groups do
|
15
|
+
report_relevant_warning_groups
|
16
|
+
report_irrelevant_warning_groups
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :configuration, :filesystem, :partitioner
|
23
|
+
|
24
|
+
def_delegators :configuration, :project_name
|
25
|
+
|
26
|
+
def_delegators :filesystem, :warnings_file,
|
27
|
+
:relevant_warnings_file, :irrelevant_warnings_file
|
28
|
+
|
29
|
+
def_delegators :partitioner, :relevant_warning_groups,
|
30
|
+
:irrelevant_warning_groups
|
31
|
+
|
32
|
+
def reporting_all_groups
|
33
|
+
if relevant_warning_groups.any? || irrelevant_warning_groups.any?
|
34
|
+
puts
|
35
|
+
yield
|
36
|
+
puts "All warnings were written to #{warnings_file.path}."
|
37
|
+
puts
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def report_relevant_warning_groups
|
42
|
+
if relevant_warning_groups.any?
|
43
|
+
print_divider("-", 75, header: " #{project_name} warnings:")
|
44
|
+
relevant_warning_groups.each do |group|
|
45
|
+
group.each do |line|
|
46
|
+
relevant_warnings_file.puts(line)
|
47
|
+
puts line
|
48
|
+
end
|
49
|
+
end
|
50
|
+
print_divider("-", 75)
|
51
|
+
puts(
|
52
|
+
"#{project_name} warnings written to " +
|
53
|
+
"#{relevant_warnings_file.path}.",
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def report_irrelevant_warning_groups
|
59
|
+
if irrelevant_warning_groups.any?
|
60
|
+
irrelevant_warning_groups.each do |group|
|
61
|
+
group.each do |line|
|
62
|
+
irrelevant_warnings_file.puts(line)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
puts(
|
66
|
+
"Non #{project_name} warnings were raised during the test run. " +
|
67
|
+
"These have been written to #{irrelevant_warnings_file.path}.",
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def print_divider(character, count, options = {})
|
73
|
+
puts
|
74
|
+
|
75
|
+
if options[:header]
|
76
|
+
first_count = 10
|
77
|
+
second_count = options[:header].length - first_count
|
78
|
+
string =
|
79
|
+
horizontal_rule(character, first_count) +
|
80
|
+
options[:header] +
|
81
|
+
horizontal_rule(character, second_count)
|
82
|
+
puts string
|
83
|
+
else
|
84
|
+
puts horizontal_rule(character, count)
|
85
|
+
end
|
86
|
+
|
87
|
+
puts
|
88
|
+
end
|
89
|
+
|
90
|
+
def horizontal_rule(character, count)
|
91
|
+
character * count
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module WarningsLogger
|
4
|
+
# Adapted from <http://myronmars.to/n/dev-blog/2011/08/making-your-gem-warning-free>
|
5
|
+
class Spy
|
6
|
+
def self.call(args)
|
7
|
+
configuration = Configuration.new(args)
|
8
|
+
new(configuration).call
|
9
|
+
end
|
10
|
+
|
11
|
+
extend Forwardable
|
12
|
+
|
13
|
+
def initialize(configuration)
|
14
|
+
@filesystem = Filesystem.new(configuration)
|
15
|
+
@reader = Reader.new(filesystem)
|
16
|
+
@partitioner = Partitioner.new(
|
17
|
+
configuration: configuration,
|
18
|
+
reader: reader,
|
19
|
+
)
|
20
|
+
@reporter = Reporter.new(
|
21
|
+
configuration: configuration,
|
22
|
+
filesystem: filesystem,
|
23
|
+
partitioner: partitioner,
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def call
|
28
|
+
filesystem.prepare
|
29
|
+
capture_warnings
|
30
|
+
report_warnings_at_exit
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :filesystem, :reader, :partitioner, :reporter
|
36
|
+
|
37
|
+
def_delegators :filesystem, :warnings_file
|
38
|
+
|
39
|
+
def_delegators :partitioner, :relevant_warning_groups,
|
40
|
+
:irrelevant_warning_groups
|
41
|
+
|
42
|
+
def capture_warnings
|
43
|
+
$stderr.reopen(warnings_file.path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def report_warnings_at_exit
|
47
|
+
at_exit do
|
48
|
+
printing_exceptions do
|
49
|
+
report_and_exit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def printing_exceptions
|
55
|
+
yield
|
56
|
+
rescue StandardError => error
|
57
|
+
puts "\n--- ERROR IN AT_EXIT --------------------------------"
|
58
|
+
puts "#{error.class}: #{error.message}"
|
59
|
+
puts error.backtrace.join("\n")
|
60
|
+
puts "-----------------------------------------------------"
|
61
|
+
raise error
|
62
|
+
end
|
63
|
+
|
64
|
+
def report_and_exit
|
65
|
+
reader.read
|
66
|
+
partitioner.partition
|
67
|
+
|
68
|
+
if relevant_warning_groups.any?
|
69
|
+
report_warnings_and_fail
|
70
|
+
else
|
71
|
+
print_warnings_and_fail
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def report_warnings_and_fail
|
76
|
+
reporter.report
|
77
|
+
exit(1)
|
78
|
+
end
|
79
|
+
|
80
|
+
def print_warnings_and_fail
|
81
|
+
filesystem.warnings_file.rewind
|
82
|
+
puts filesystem.warnings_file.read
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "warnings_logger/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "warnings_logger"
|
7
|
+
spec.version = WarningsLogger::VERSION
|
8
|
+
spec.authors = ["Elliot Winkler"]
|
9
|
+
spec.email = ["elliot.winkler@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Easily log warnings in your gems"
|
12
|
+
spec.homepage = "https://github.com/mcmire/warnings_logger"
|
13
|
+
|
14
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the
|
15
|
+
# 'allowed_push_host' to allow pushing to a single host or delete this section
|
16
|
+
# to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
+
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/mcmire/warnings_logger"
|
22
|
+
else
|
23
|
+
raise(
|
24
|
+
"RubyGems 2.0 or newer is required to protect against public gem " +
|
25
|
+
"pushes.",
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released. The `git
|
30
|
+
# ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
33
|
+
f.match(%r{^(test|spec|features)/})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
spec.bindir = "exe"
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: warnings_logger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elliot Winkler
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-15 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.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.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: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- elliot.winkler@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/setup
|
71
|
+
- lib/warnings_logger.rb
|
72
|
+
- lib/warnings_logger/configuration.rb
|
73
|
+
- lib/warnings_logger/filesystem.rb
|
74
|
+
- lib/warnings_logger/partitioner.rb
|
75
|
+
- lib/warnings_logger/reader.rb
|
76
|
+
- lib/warnings_logger/reporter.rb
|
77
|
+
- lib/warnings_logger/spy.rb
|
78
|
+
- lib/warnings_logger/version.rb
|
79
|
+
- warnings_logger.gemspec
|
80
|
+
homepage: https://github.com/mcmire/warnings_logger
|
81
|
+
licenses: []
|
82
|
+
metadata:
|
83
|
+
allowed_push_host: https://rubygems.org
|
84
|
+
homepage_uri: https://github.com/mcmire/warnings_logger
|
85
|
+
source_code_uri: https://github.com/mcmire/warnings_logger
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.7.9
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Easily log warnings in your gems
|
106
|
+
test_files: []
|