pry-try 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +98 -66
- data/lib/pry-try/version.rb +1 -1
- data/pry-try.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3a1cff65259eb8f5139dbf5f96c2c7d49fea65
|
4
|
+
data.tar.gz: 9920060648bb293ea23dfb7979be94d1d4f7b595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a55804801f3d858a7634042a15dabd97ce5f34e23a7da8f3c84919a3b3b8e9b012ad4c554a4ce13938ee9f02664ae2bf316e69f7013279386998383b7f0b610
|
7
|
+
data.tar.gz: 3554b3ccb80b6bfc4de7b79e48d5e22830edc3db3b717ed1d10c516cca07389a484709640e881d6b7fa5681fb748e652ce23e1cd35d9c3579ca012179348c05f
|
data/README.md
CHANGED
@@ -1,89 +1,121 @@
|
|
1
1
|
# pry-try
|
2
2
|
|
3
|
-
Start a pry-session with specific gems or a (remote) script
|
3
|
+
Start a pry-session with specific gems or a (remote) script preloaded.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
7
|
+
This gem allows you to get a pry-session with either...
|
8
|
+
|
9
|
+
1. gems preloaded
|
10
|
+
2. a script preloaded
|
11
|
+
|
12
|
+
### pry-session with gems pre-loaded
|
13
|
+
|
14
|
+
This requires pry-try to be [installed system-wide](#system-wide).
|
15
|
+
|
16
|
+
```bash
|
17
|
+
$ pry-try activesupport
|
18
|
+
Fetching gem metadata from https://rubygems.org/.........
|
19
|
+
Fetching version metadata from https://rubygems.org/.
|
20
|
+
Resolving dependencies...
|
21
|
+
Using concurrent-ruby 1.0.5
|
22
|
+
Using i18n 0.8.1
|
23
|
+
Using minitest 5.10.1
|
24
|
+
Using thread_safe 0.3.6
|
25
|
+
Using coderay 1.1.1
|
26
|
+
Using method_source 0.8.2
|
27
|
+
Using slop 3.6.0
|
28
|
+
Using bundler 1.14.5
|
29
|
+
Using tzinfo 1.2.2
|
30
|
+
Using pry 0.10.4
|
31
|
+
Using activesupport 5.0.2
|
32
|
+
[2] pry(main)> 1.second
|
33
|
+
=> 1 second
|
34
|
+
```
|
28
35
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
Use a specific version:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
# any version notation that is accepted in a Gemfile will work
|
40
|
+
$ pry-try activesupport '~> 4.2'
|
41
|
+
...
|
42
|
+
[2] pry(main)>
|
43
|
+
```
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
```bash
|
40
|
-
$ pry-try activesupport '~>4.2' redis
|
41
|
-
...
|
42
|
-
[2] pry(main)>
|
43
|
-
```
|
44
|
-
|
45
|
-
* start pry-session from within pry:
|
46
|
-
|
47
|
-
```bash
|
48
|
-
$ pry
|
49
|
-
[1] pry(main)> .pry-try activesupport
|
50
|
-
...
|
51
|
-
[2] pry(main)>
|
52
|
-
This session is isolated from the initial session.
|
53
|
-
^d to return to initial session
|
54
|
-
```
|
45
|
+
Multiple gems:
|
55
46
|
|
56
|
-
|
47
|
+
```bash
|
48
|
+
$ pry-try activesupport '~> 4.2' redis
|
49
|
+
...
|
50
|
+
[2] pry(main)>
|
51
|
+
```
|
57
52
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
53
|
+
### pry-session with script preloaded
|
54
|
+
|
55
|
+
Anything piped to pry-try will be evaluated before the pry-session starts:
|
56
|
+
|
57
|
+
```bash
|
58
|
+
$ echo '@a = 1' | pry-try
|
59
|
+
[1] pry(main)> @a
|
60
|
+
=> 1
|
61
|
+
```
|
62
|
+
|
63
|
+
```bash
|
64
|
+
# handy when sharing code with others:
|
65
|
+
$ curl https://gist.githubusercontent.com/eval/76955c57512c1e4ac01cdd913b76c92d/raw/bf714a15789eca3e968c3544f85b9b786b8eae8f/hello.rb | pry-try
|
66
|
+
|
67
|
+
# or via the gist command:
|
68
|
+
$ gist -r 76955c57512c1e4ac01cdd913b76c92d | pry-try
|
69
|
+
```
|
70
70
|
|
71
|
-
|
71
|
+
**NOTE:** curl-pipe-runtime is [not without risk](https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/). A tool like [vipe](https://github.com/madx/moreutils/blob/master/vipe) ([npm variant](https://github.com/juliangruber/vipe#vipe)) allows you to inspect the fetched script before handing it over to pry-try.
|
72
72
|
|
73
|
+
#### within a (Rails-)project
|
74
|
+
|
75
|
+
When the script needs to be evaluated within a project (i.e. use the gems of your project), make sure pry-try is [part of your project](#within-project).
|
76
|
+
|
77
|
+
A script for a Rails project would typically look like this:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
# script.rb
|
81
|
+
require './config/environment' # load Rails-application
|
82
|
+
@user = User.first
|
83
|
+
```
|
84
|
+
|
85
|
+
Evaluate via:
|
86
|
+
```
|
87
|
+
cat script.rb | bundle exec pry-try
|
88
|
+
...
|
89
|
+
[1] pry(main)> @user
|
90
|
+
#<User id: 1, username: ...
|
91
|
+
```
|
73
92
|
|
74
93
|
## Installation
|
75
94
|
|
76
|
-
|
95
|
+
### System-wide
|
77
96
|
|
78
|
-
|
97
|
+
```bash
|
98
|
+
$ gem install pry-try
|
99
|
+
```
|
79
100
|
|
101
|
+
### Within project
|
80
102
|
|
81
|
-
|
103
|
+
Add the following to `Gemfile`:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
# Gemfile
|
107
|
+
gem 'pry-try', group: :development
|
108
|
+
```
|
82
109
|
|
83
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
84
110
|
|
85
|
-
|
111
|
+
## Development
|
112
|
+
|
113
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
114
|
+
Then run the tool via:
|
86
115
|
|
116
|
+
```
|
117
|
+
$ ruby -Ilib exe/pry-try activesupport
|
118
|
+
```
|
87
119
|
|
88
120
|
## License
|
89
121
|
|
data/lib/pry-try/version.rb
CHANGED
data/pry-try.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency "pry", "~>0.10"
|
25
|
-
spec.
|
25
|
+
spec.add_dependency "bundler", "~> 1.10"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-try
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gert Goet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
34
|
-
type: :
|
33
|
+
version: '1.10'
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|