pry-drb 0.0.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 +7 -0
- data/.gitignore +1 -0
- data/LICENSE.MIT +19 -0
- data/README.md +48 -0
- data/bin/pry-drb +75 -0
- data/lib/pry-drb.rb +2 -0
- data/lib/pry-drb/version.rb +3 -0
- data/pry-drb.gemspec +23 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3616a5090bc974b093ebfcb36f65aa0c9642a9d0
|
4
|
+
data.tar.gz: a51d2b6cf21eb21673a8c425334763ea5c1b9505
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0578f96afd91f97159785d300a67159984dc0860136fbcdf58aab8edbdd8d0e33748bbaea59aeca09d641d45804b2cc58b76b29eb40eb536e9198593439299a5
|
7
|
+
data.tar.gz: c6d6d45f832baf6e61d7bf2480f45c909b805ea3a7edefddce5a793e8e9c1bda6fce79c5c82cc499395aff53992b098ad8b1bd5346728ecc8a6bbd4c8dadcdf9
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/LICENSE.MIT
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2012 Shannon Skipper <shannonskipper@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
Pry DRb gives you a way to keep variables alive across pry sessions!
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
For just vanilla Rubygems: 'gem install pry-drb'
|
6
|
+
|
7
|
+
If you're using Bundler:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :development do
|
11
|
+
gem 'pry'
|
12
|
+
gem 'pry-drb'
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
1. Run the pry-drb daemon:
|
19
|
+
|
20
|
+
```shell
|
21
|
+
$ pry-drb
|
22
|
+
```
|
23
|
+
|
24
|
+
2. Inside Pry, you can then store values in DRB:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
pry(main) [1]> DRB[:awesome] = 5
|
28
|
+
=> 5
|
29
|
+
```
|
30
|
+
|
31
|
+
3. In another Pry, you can then access that value!:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
pry(main) [1]> DRB[:awesome]
|
35
|
+
=> 5
|
36
|
+
```
|
37
|
+
|
38
|
+
Objects that you put into DRb can be accessed in other Pry sessions running at
|
39
|
+
the same time, or even by a Pry that open later in the day!
|
40
|
+
|
41
|
+
If you need to stop the DRb server you can run `pry-drb stop`. This will throw
|
42
|
+
away anything you've stored in `DRB` from within Pry.
|
43
|
+
|
44
|
+
## Meta-foo
|
45
|
+
|
46
|
+
pry-drb is licensed under the MIT licence. See LICENCE.MIT for details.
|
47
|
+
|
48
|
+
Issues and pull requests are welcome!
|
data/bin/pry-drb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'drb'
|
3
|
+
require 'pry-drb'
|
4
|
+
|
5
|
+
module PryDrb
|
6
|
+
class << self
|
7
|
+
def call
|
8
|
+
setup
|
9
|
+
|
10
|
+
if @params && @params != 'start'
|
11
|
+
if @params == 'stop'
|
12
|
+
stop
|
13
|
+
elsif @params == 'status'
|
14
|
+
status
|
15
|
+
elsif @params.include? '-v'
|
16
|
+
version
|
17
|
+
else
|
18
|
+
help
|
19
|
+
end
|
20
|
+
else
|
21
|
+
start
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@processes = `pgrep -f drb`.split
|
29
|
+
@params = ARGV.first
|
30
|
+
end
|
31
|
+
|
32
|
+
def version
|
33
|
+
puts PryDrb::VERSION
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop
|
37
|
+
if @processes.size > 1
|
38
|
+
puts 'Stopping drb service.'
|
39
|
+
`kill -9 #{@processes.join ' '}`
|
40
|
+
else
|
41
|
+
puts 'No drb service running.'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def status
|
46
|
+
if @processes.size > 1
|
47
|
+
puts 'Running.'
|
48
|
+
else
|
49
|
+
puts 'Stopped.'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def help
|
54
|
+
puts 'Usage:'
|
55
|
+
puts "\tdrb -h/--help"
|
56
|
+
puts "\tdrb -v/--version"
|
57
|
+
puts "\tdrb [start|stop|status]"
|
58
|
+
end
|
59
|
+
|
60
|
+
def start
|
61
|
+
if @processes.size <= 1
|
62
|
+
puts 'Starting drb service.'
|
63
|
+
fork do
|
64
|
+
DRb.start_service 'druby://localhost:55555', {}
|
65
|
+
DRb.thread.join
|
66
|
+
end
|
67
|
+
Process.daemon
|
68
|
+
else
|
69
|
+
abort "Drb service already running."
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
PryDrb.call
|
data/lib/pry-drb.rb
ADDED
data/pry-drb.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/pry-drb/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'pry-drb'
|
6
|
+
gem.version = PryDrb::VERSION
|
7
|
+
|
8
|
+
gem.summary = 'Store objects persistently in your pry session!'
|
9
|
+
gem.description = "Uses DRb to let you stash variables across pry sessions."
|
10
|
+
|
11
|
+
gem.authors = ['Shannon Skipper']
|
12
|
+
gem.email = %w(shannonskipper@gmail.com)
|
13
|
+
gem.homepage = 'http://github.com/havenwood/pry-drb'
|
14
|
+
|
15
|
+
gem.license = 'MIT'
|
16
|
+
|
17
|
+
gem.required_ruby_version = '>= 1.8.7'
|
18
|
+
|
19
|
+
gem.add_dependency 'pry'
|
20
|
+
|
21
|
+
gem.files = `git ls-files`.split("\n")
|
22
|
+
gem.executables = "pry-drb"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pry-drb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shannon Skipper
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Uses DRb to let you stash variables across pry sessions.
|
28
|
+
email:
|
29
|
+
- shannonskipper@gmail.com
|
30
|
+
executables:
|
31
|
+
- pry-drb
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- LICENSE.MIT
|
37
|
+
- README.md
|
38
|
+
- bin/pry-drb
|
39
|
+
- lib/pry-drb.rb
|
40
|
+
- lib/pry-drb/version.rb
|
41
|
+
- pry-drb.gemspec
|
42
|
+
homepage: http://github.com/havenwood/pry-drb
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.8.7
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.1.10
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Store objects persistently in your pry session!
|
66
|
+
test_files: []
|
67
|
+
has_rdoc:
|