extended_bundler-errors 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +35 -2
- data/lib/extended_bundler/errors/version.rb +1 -1
- data/lib/extended_bundler/errors.rb +10 -1
- data/lib/extended_bundler/handlers/http_parser.yml +10 -9
- data/lib/extended_bundler/handlers/mysql2.yml +18 -0
- data/lib/extended_bundler/handlers/rmagick.yml +11 -10
- data/lib/extended_bundler/handlers/testing_stuff.yml +3 -1
- data/lib/extended_bundler/handlers/testing_stuff_2.yml +3 -1
- data/lib/extended_bundler/handlers/unf_ext.yml +12 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef86ec43e8663245ff3b5235c78b3b196f5adf0e24d50e51bf213b2ce5c89a2a
|
4
|
+
data.tar.gz: 37c869234b9ffac8082fed75e6281c8b7a4958e06281001a22fdf454f1370593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e117c4d6356d1841f11a13968fb94b815a3b05722ba1382b1f480fb1f360e02f550217749a9f0a485b66d81b28eb0da766d244541638f0d33d2039dc1479511
|
7
|
+
data.tar.gz: 40c7ce2b56bfd46f558fdfa60c613f60fefb3dd0c574b823158b266630a7426b6858881a4d90f274ddc530dc4e6306908fef2dd11db36d5f9492ca8d3645d8bb
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ These are hard to follow, particularly for people new to Ruby, because it requir
|
|
8
8
|
|
9
9
|
This gem instead will try to match the output of the gem to a series of handlers (see `lib/extended_bundler/handlers` for a list). Each handler is specific to a gem, an matches one of many potential output. Once matched, we replace the error with something that explains the known problem, how to fix it, and (if possible) include a link to the original output.
|
10
10
|
|
11
|
-
|
11
|
+
## Example
|
12
12
|
|
13
13
|
Before when RMagick fails to install, you got a verbose log.
|
14
14
|
|
@@ -20,7 +20,7 @@ After when it fails to install you get a specific, actionable reason and step-by
|
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
23
|
-
While this is a gem, you need to install it as a plugin:
|
23
|
+
While this is a gem, you need to install it as a [Bundler plugin](https://bundler.io/v1.16/guides/bundler_plugins.html):
|
24
24
|
|
25
25
|
`bundler plugin install extended_bundler-errors`
|
26
26
|
|
@@ -38,6 +38,39 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
38
38
|
|
39
39
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
40
|
|
41
|
+
### Adding special handling for a bad error message
|
42
|
+
|
43
|
+
Errors will happen so we want to make sure we can respond to them properly. Instead of finding an answer on StackOverflow or somewhere ese, let's make sure everyone in the future can get a better error message directly in their terminal during the install.
|
44
|
+
|
45
|
+
To do this, you should:
|
46
|
+
|
47
|
+
1. Create a file under [lib/extended_bundler/handlers](https://github.com/jules2689/extended_bundler-errors/tree/master/lib/extended_bundler/handlers) named "GEM_NAME.yml"
|
48
|
+
2. Start with this template:
|
49
|
+
```yaml
|
50
|
+
-
|
51
|
+
versions: all
|
52
|
+
matching:
|
53
|
+
- "Matching Text"
|
54
|
+
messages:
|
55
|
+
en: |
|
56
|
+
My Message
|
57
|
+
```
|
58
|
+
3. Customize the template.
|
59
|
+
|
60
|
+
#### Customizing the template
|
61
|
+
|
62
|
+
There are a few keys to keep in mind:
|
63
|
+
|
64
|
+
- `versions` can be the word `all` or a hash with `min` and/or `max` versions
|
65
|
+
- This is the versions to which the handler applies
|
66
|
+
- `matching` is an array of strings (escapped regex is ok) that will be applied against the original bad error message
|
67
|
+
- You should find a unique string(s) that identifies a specific error
|
68
|
+
- `messages` is a hash of messages that we might be able to give to a user
|
69
|
+
- `en` is required and is the default/English response
|
70
|
+
- Other language iso codes can be provided. Users will be given a response based on their `LANG` env var setting
|
71
|
+
|
72
|
+
Note, this is an array of "matchers". We will try each one iteratively against the `GEM_NAME` until the first one matches. So if you have multiple handlers for a single gem, just continue expanding the yaml file.
|
73
|
+
|
41
74
|
## Contributing
|
42
75
|
|
43
76
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/extended_bundler-errors. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -66,7 +66,7 @@ module ExtendedBundler
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def build_error(spec_install, handler)
|
69
|
-
body = handler
|
69
|
+
body = message(handler)
|
70
70
|
# If we can pull out the original logs, add those to the message
|
71
71
|
if log = spec_install.error.match(/Results logged to (?<message>.*)/)
|
72
72
|
body += "\n{{bold:Original Logs are available at:}}\n" + log[:message]
|
@@ -79,6 +79,15 @@ module ExtendedBundler
|
|
79
79
|
ExtendedBundler::Errors::Formatter.new(formatted_lines.join("\n")).format
|
80
80
|
end
|
81
81
|
|
82
|
+
def message(handler)
|
83
|
+
# Grab the LANG environment variable
|
84
|
+
# Assume it's in Posix compliant ISO 15897 format (which is approx lang_region.encoding).
|
85
|
+
# Grab the lang out of that. If for some reason this isn't available, default back to
|
86
|
+
# English on any issue.
|
87
|
+
iso_15897_posix_lang = ENV.fetch('LANG', 'en').split('_').first
|
88
|
+
handler['messages'][iso_15897_posix_lang] || handler['messages']['en']
|
89
|
+
end
|
90
|
+
|
82
91
|
def handler_path(gem_name)
|
83
92
|
File.expand_path("../handlers/#{gem_name}.yml", __FILE__)
|
84
93
|
end
|
@@ -2,15 +2,16 @@
|
|
2
2
|
versions: all
|
3
3
|
matching:
|
4
4
|
- "ld: library not found for -lgmp"
|
5
|
-
|
6
|
-
|
5
|
+
messages:
|
6
|
+
en: |
|
7
|
+
You need to install developer tools for your system.
|
7
8
|
|
8
|
-
|
9
|
+
One of the following commands may help:
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
Ubuntu:
|
12
|
+
- `apt-get install build-essential`
|
13
|
+
- `apt-get install libgmp-dev`
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
Mac:
|
16
|
+
- `xcode-select --install`
|
17
|
+
- `brew uninstall gmp` and `brew install gmp`
|
@@ -0,0 +1,18 @@
|
|
1
|
+
-
|
2
|
+
versions:
|
3
|
+
max: "0.5.0"
|
4
|
+
matching:
|
5
|
+
- use of undeclared identifier 'MYSQL_SECURE_AUTH'
|
6
|
+
messages:
|
7
|
+
en: |
|
8
|
+
{{bold:What is the problem?}}
|
9
|
+
The issue is {{underline:likely that the version of MySQL on your computer is incompatible.}}
|
10
|
+
This has more info: {{underline:https://github.com/brianmario/mysql2/issues/891}}
|
11
|
+
|
12
|
+
{{bold:Compatible versions of MySQL}}
|
13
|
+
- {{underline:MySQL 5.7.x}} and lower
|
14
|
+
|
15
|
+
{{bold:What can I do?}}
|
16
|
+
One of the following steps may help:
|
17
|
+
- install a compatible MySQL
|
18
|
+
- upgrade the mysql2 gem to at least 0.5.0
|
@@ -4,15 +4,16 @@
|
|
4
4
|
matching:
|
5
5
|
- Can't install RMagick [\d\.]+. Can't find MagickWand.h.
|
6
6
|
- No package 'MagickCore' found
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
messages:
|
8
|
+
en: |
|
9
|
+
{{bold:What is the problem?}}
|
10
|
+
The issue is {{underline:likely that the version of Imagemagick on your computer is incompatible.}}
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
{{bold:Compatible versions of Imagemagick}}
|
13
|
+
- {{underline:ImageMagick 6.9.9-40}} and lower
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
{{bold:What can I do?}}
|
16
|
+
One of the following steps may help:
|
17
|
+
- install a compatible Imagemagick
|
18
|
+
- upgrade RMagick
|
19
|
+
- use a different gem (like mini_magick)
|
@@ -2,17 +2,18 @@
|
|
2
2
|
versions: all
|
3
3
|
matching:
|
4
4
|
- "ld: library not found for -lgmp"
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
messages:
|
6
|
+
en: |
|
7
|
+
{{bold:What is the problem?}}
|
8
|
+
You need to install developer tools for your system.
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
{{bold:What can I do?}}
|
11
|
+
One of the following commands may help:
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
{{italic:Ubuntu:}}
|
14
|
+
- {{command:apt-get install build-essential}}
|
15
|
+
- {{command:apt-get install libgmp-dev}}
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
{{italic:Mac:}}
|
18
|
+
- {{command:xcode-select --install}}
|
19
|
+
- {{command:brew uninstall gmp}} and {{command:brew install gmp}}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extended_bundler-errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jules2689
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/extended_bundler/errors/formatter.rb
|
76
76
|
- lib/extended_bundler/errors/version.rb
|
77
77
|
- lib/extended_bundler/handlers/http_parser.yml
|
78
|
+
- lib/extended_bundler/handlers/mysql2.yml
|
78
79
|
- lib/extended_bundler/handlers/rmagick.yml
|
79
80
|
- lib/extended_bundler/handlers/testing_stuff.yml
|
80
81
|
- lib/extended_bundler/handlers/testing_stuff_2.yml
|