prysless 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +23 -0
- data/.travis.yml +8 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +9 -0
- data/bin/prysless +3 -0
- data/lib/prysless/version.rb +3 -0
- data/lib/prysless.rb +62 -0
- data/prysless.gemspec +25 -0
- data/test/test_prysless.rb +22 -0
- metadata +113 -0
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
.*.swp
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
*.bundle
|
20
|
+
*.so
|
21
|
+
*.o
|
22
|
+
*.a
|
23
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 yazgoo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Prysless
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/yazgoo/prysless.svg?branch=master)](https://travis-ci.org/yazgoo/prysless)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/yazgoo/prysless/coverage.png)](https://codeclimate.com/github/yazgoo/prysless)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/yazgoo/prysless.png)](https://codeclimate.com/github/yazgoo/prysless)
|
6
|
+
[![Inline docs](http://inch-ci.org/github/yazgoo/prysless.png?branch=master)](http://inch-ci.org/github/yazgoo/prysless)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/prysless.svg)](http://badge.fury.io/rb/prysless)
|
8
|
+
|
9
|
+
TODO: Write a gem description
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'prysless'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install prysless
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
TODO: Write usage instructions here
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it ( https://github.com/[my-github-username]/prysless/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/prysless
ADDED
data/lib/prysless.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require "prysless/version"
|
2
|
+
require 'pry'
|
3
|
+
# Public: Utilities to make ruby object accessible via pry
|
4
|
+
#
|
5
|
+
# Examples
|
6
|
+
#
|
7
|
+
# Prysless::Shell.new
|
8
|
+
module Prysless
|
9
|
+
# Public: Pry shell allowing to use user defined objects, based on two variables:
|
10
|
+
# * PRYSLESS_LIBRARY_PATH: path to load additional libraries, ":"-separated
|
11
|
+
# * PRYSLESS_REQUIRE: variable definitions
|
12
|
+
#
|
13
|
+
# Examples
|
14
|
+
#
|
15
|
+
# ENV['PRYSLESS_REQUIRE'] = "e=ec2l/Ec2l/Client.new:a=pry/[]"
|
16
|
+
# Shell.new
|
17
|
+
# # will load an ec2l client in variable e and a new array in variable a
|
18
|
+
#
|
19
|
+
class Shell
|
20
|
+
def initialize
|
21
|
+
load_objects
|
22
|
+
shell
|
23
|
+
end
|
24
|
+
private
|
25
|
+
def shell() binding.pry end
|
26
|
+
def var name
|
27
|
+
value = ENV[name]
|
28
|
+
value = if value == nil then [] else value.split(":") end
|
29
|
+
value.each { |p| yield p }
|
30
|
+
end
|
31
|
+
def load_objects
|
32
|
+
@a = {}
|
33
|
+
var('PRYSLESS_LIBRARY_PATH') { |p| $LOAD_PATH << p }
|
34
|
+
var('PRYSLESS_REQUIRE') do |p|
|
35
|
+
name , value = p.split("=", 2)
|
36
|
+
gem, object = value.split("/", 2)
|
37
|
+
require gem
|
38
|
+
@a[name] = eval(object.gsub("/", "::"))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# Internal: try and find user defined variable named with the method
|
42
|
+
# if its result is nil, super
|
43
|
+
#
|
44
|
+
# Examples
|
45
|
+
#
|
46
|
+
# h
|
47
|
+
# NameError: undefined local variable or method `h' for #<Prysless::Shell:0x000000019f1c20>
|
48
|
+
# from .../lib/prysless.rb:45:in `method_missing'
|
49
|
+
#
|
50
|
+
# a # with PRYSLESS_REQUIRE="a=pry/[]"
|
51
|
+
# => []
|
52
|
+
#
|
53
|
+
# Return the declared variable from PRYSLESS_REQUIRE or calls super
|
54
|
+
def method_missing method, *params, &block
|
55
|
+
if @a[method.to_s]
|
56
|
+
@a[method.to_s]
|
57
|
+
else
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/prysless.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'prysless/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "prysless"
|
8
|
+
spec.version = Prysless::VERSION
|
9
|
+
spec.authors = ["yazgoo"]
|
10
|
+
spec.email = ["yazgoo@github.com"]
|
11
|
+
spec.summary = "a pry REPL to rule the all"
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "pry"
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
require 'test/unit'
|
4
|
+
require 'prysless'
|
5
|
+
Pry.config.input = StringIO.new("exit\n")
|
6
|
+
class PryslessTest < Test::Unit::TestCase
|
7
|
+
def test_run
|
8
|
+
ENV['PRYSLESS_LIBRARY_PATH'] = "/tmp:/"
|
9
|
+
ENV['PRYSLESS_REQUIRE'] = "a=pry/[]:b=pry/{}"
|
10
|
+
shell = Prysless::Shell.new
|
11
|
+
assert shell.a == []
|
12
|
+
assert shell.b == {}
|
13
|
+
x = nil
|
14
|
+
begin
|
15
|
+
shell.help
|
16
|
+
rescue Exception => e
|
17
|
+
x = e
|
18
|
+
end
|
19
|
+
assert_not_nil e
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prysless
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- yazgoo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-07-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: pry
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: a pry REPL to rule the all
|
63
|
+
email:
|
64
|
+
- yazgoo@github.com
|
65
|
+
executables:
|
66
|
+
- prysless
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .travis.yml
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- bin/prysless
|
77
|
+
- lib/prysless.rb
|
78
|
+
- lib/prysless/version.rb
|
79
|
+
- prysless.gemspec
|
80
|
+
- test/test_prysless.rb
|
81
|
+
homepage: ''
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
hash: -4030277097249573203
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
hash: -4030277097249573203
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 1.8.23
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: a pry REPL to rule the all
|
112
|
+
test_files:
|
113
|
+
- test/test_prysless.rb
|