better_errors-pry 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.travis.yml +19 -0
- data/Appraisals +11 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +8 -0
- data/better_errors-pry.gemspec +33 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/better_errors/pry.rb +9 -0
- data/lib/better_errors/pry/version.rb +5 -0
- data/lib/better_errors/repl/pry.rb +88 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c28e10d4cfe3d0309f4beee69156ba66747927fd
|
4
|
+
data.tar.gz: 91817a6deb4158598e87ac186e4b105371830475
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a1047789cad3b92b30ab995b813c920da91268400e8cc49b0f3ec53241fd914517dea2e4fe191acc41ff996c7aa7c9ee3f3a30defe95a0a1f7a67ea3739ed2e
|
7
|
+
data.tar.gz: 233844dc943b08d68a6a57914797fc6616ec04657d14ee2d34969292d37118342901f2fe0058c3bd6cb00fe9249e0914a6e8c34b2a4bb64355f8844514df26b1
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.0
|
6
|
+
- 2.1
|
7
|
+
- 2.2
|
8
|
+
- 2.3
|
9
|
+
- 2.4
|
10
|
+
- ruby-head
|
11
|
+
gemfile:
|
12
|
+
- gemfiles/pry_0.9.gemfile
|
13
|
+
- gemfiles/pry_0.10.gemfile
|
14
|
+
- gemfiles/pry_0.11.gemfile
|
15
|
+
matrix:
|
16
|
+
fast_finish: true
|
17
|
+
allow_failures:
|
18
|
+
- gemfile: gemfiles/pry_0.11.gemfile
|
19
|
+
- rvm: ruby-head
|
data/Appraisals
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Robin Daugherty
|
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,66 @@
|
|
1
|
+
[![Gem Version](https://img.shields.io/gem/v/better_errors-pry.svg)](https://rubygems.org/gems/better_errors-pry)
|
2
|
+
[![Build Status](https://travis-ci.org/RobinDaugherty/better_errors-pry.svg?branch=master)](https://travis-ci.org/RobinDaugherty/better_errors-pry)
|
3
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6140d26c9789476f84cc3963631e7860)](https://www.codacy.com/app/robindaugherty/better_errors-pry?utm_source=github.com&utm_medium=referral&utm_content=RobinDaugherty/better_errors-pry&utm_campaign=Badge_Grade)
|
4
|
+
|
5
|
+
# BetterErrors::Pry
|
6
|
+
|
7
|
+
[Better Errors](https://github.com/charliesome/better_errors) is a gem that provides a very useful error page for Ruby web/API applications.
|
8
|
+
This gem adds [Pry](http://pryrepl.org) support to Better Errors.
|
9
|
+
|
10
|
+
(This support was previously added directly to Better Errors.
|
11
|
+
This gem exists to extract Pry support from the main project.)
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this to your application's Gemfile, in the same group as better_errors:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
group :development do
|
19
|
+
gem 'better_errors'
|
20
|
+
gem 'binding_of_caller'
|
21
|
+
gem 'better_errors-pry'
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
**It's important to keep this in the development group.**
|
26
|
+
See [Better Errors](https://github.com/charliesome/better_errors) for more information.
|
27
|
+
|
28
|
+
[`binding_of_caller`](https://github.com/banister/binding_of_caller) is required by this gem, since it's necessary to be able to run Pry in the context of the exception that was raised.
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
$ bundle
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
See [Better Errors](https://github.com/charliesome/better_errors#usage) for more information.
|
37
|
+
|
38
|
+
When you see the Better Errors console, you can issue Pry-specific commands, such as `ls` and `cd`.
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bundle install` to install the basic dependencies.
|
43
|
+
|
44
|
+
You can run the tests with the most recent versions of Pry and Better Errors by running `bundle exec rake`.
|
45
|
+
|
46
|
+
To run the tests against the other sets of dependencies, though, you will need to use Appraisal.
|
47
|
+
Run `appraisal install` to run install the dependencies for each of the possible combinations.
|
48
|
+
|
49
|
+
Then you can run `appraisal rake` to run all tests, or `appraisal pry_0.09 rake` (for example) to only run the specs with Pry 0.09.
|
50
|
+
|
51
|
+
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).
|
52
|
+
|
53
|
+
On CI, the specs are run against each major release of Ruby in addition to each Appraisal gemfile.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
1. Fork it
|
58
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
61
|
+
5. Create new Pull Request
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
66
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'better_errors/pry/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "better_errors-pry"
|
8
|
+
spec.version = BetterErrors::Pry::VERSION
|
9
|
+
spec.authors = ["Charlie Somerville", "Robin Daugherty"]
|
10
|
+
spec.email = ["charlie@charliesomerville.com", "robin@robindaugherty.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Add Pry support to Better Errors}
|
13
|
+
spec.description = %q{Addon to Better Errors that adds Pry to the REPL.}
|
14
|
+
spec.homepage = "https://github.com/RobinDaugherty/better_errors-pry"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features|gemfiles)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.required_ruby_version = ">= 2.0.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
|
30
|
+
spec.add_dependency "better_errors", '~> 2.3.0', '>= 2.3.0'
|
31
|
+
spec.add_dependency "pry", ">= 0.9"
|
32
|
+
spec.add_dependency "binding_of_caller"
|
33
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "better_errors/pry"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require "fiber"
|
2
|
+
require "pry"
|
3
|
+
|
4
|
+
module BetterErrors
|
5
|
+
module REPL
|
6
|
+
class Pry
|
7
|
+
class Input
|
8
|
+
def readline
|
9
|
+
Fiber.yield
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Output
|
14
|
+
def initialize
|
15
|
+
@buffer = ""
|
16
|
+
end
|
17
|
+
|
18
|
+
def puts(*args)
|
19
|
+
args.each do |arg|
|
20
|
+
@buffer << "#{arg.chomp}\n"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def tty?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def read_buffer
|
29
|
+
@buffer
|
30
|
+
ensure
|
31
|
+
@buffer = ""
|
32
|
+
end
|
33
|
+
|
34
|
+
def print(*args)
|
35
|
+
@buffer << args.join(' ')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(binding, exception)
|
40
|
+
@fiber = Fiber.new do
|
41
|
+
@pry.repl binding
|
42
|
+
end
|
43
|
+
@input = BetterErrors::REPL::Pry::Input.new
|
44
|
+
@output = BetterErrors::REPL::Pry::Output.new
|
45
|
+
@pry = ::Pry.new input: @input, output: @output
|
46
|
+
@pry.hooks.clear_all if defined?(@pry.hooks.clear_all)
|
47
|
+
store_last_exception exception
|
48
|
+
@fiber.resume
|
49
|
+
end
|
50
|
+
|
51
|
+
def store_last_exception(exception)
|
52
|
+
return unless defined? ::Pry::LastException
|
53
|
+
@pry.instance_variable_set(:@last_exception, ::Pry::LastException.new(exception.exception))
|
54
|
+
end
|
55
|
+
|
56
|
+
def send_input(str)
|
57
|
+
local ::Pry.config, color: false, pager: false do
|
58
|
+
@fiber.resume "#{str}\n"
|
59
|
+
[@output.read_buffer, *prompt]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def prompt
|
64
|
+
if indent = @pry.instance_variable_get(:@indent) and !indent.indent_level.empty?
|
65
|
+
["..", indent.indent_level]
|
66
|
+
else
|
67
|
+
[">>", ""]
|
68
|
+
end
|
69
|
+
rescue
|
70
|
+
[">>", ""]
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
def local(obj, attrs)
|
75
|
+
old_attrs = {}
|
76
|
+
attrs.each do |k, v|
|
77
|
+
old_attrs[k] = obj.send k
|
78
|
+
obj.send "#{k}=", v
|
79
|
+
end
|
80
|
+
yield
|
81
|
+
ensure
|
82
|
+
old_attrs.each do |k, v|
|
83
|
+
obj.send "#{k}=", v
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: better_errors-pry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charlie Somerville
|
8
|
+
- Robin Daugherty
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.13'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.13'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: better_errors
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.3.0
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.3.0
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.3.0
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.3.0
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: pry
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: binding_of_caller
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
type: :runtime
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
description: Addon to Better Errors that adds Pry to the REPL.
|
105
|
+
email:
|
106
|
+
- charlie@charliesomerville.com
|
107
|
+
- robin@robindaugherty.net
|
108
|
+
executables: []
|
109
|
+
extensions: []
|
110
|
+
extra_rdoc_files: []
|
111
|
+
files:
|
112
|
+
- ".gitignore"
|
113
|
+
- ".rspec"
|
114
|
+
- ".travis.yml"
|
115
|
+
- Appraisals
|
116
|
+
- Gemfile
|
117
|
+
- LICENSE.txt
|
118
|
+
- README.md
|
119
|
+
- Rakefile
|
120
|
+
- better_errors-pry.gemspec
|
121
|
+
- bin/console
|
122
|
+
- bin/setup
|
123
|
+
- lib/better_errors/pry.rb
|
124
|
+
- lib/better_errors/pry/version.rb
|
125
|
+
- lib/better_errors/repl/pry.rb
|
126
|
+
homepage: https://github.com/RobinDaugherty/better_errors-pry
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.0.0
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.6.8
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Add Pry support to Better Errors
|
150
|
+
test_files: []
|