pry-vterm_aliases 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +0 -5
- data/License +15 -2
- data/Rakefile +4 -9
- data/Readme.md +7 -5
- data/lib/pry-vterm_aliases.rb +45 -29
- data/lib/pry-vterm_aliases/version.rb +1 -1
- metadata +51 -51
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 91b358dcf706009083e602135d8ee31e22180954
|
4
|
+
data.tar.gz: 58b298d90b6b76cf8a355124366fd8a9657b48b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6739af5381d6a26fef7d0668fbe48deef5167fb1d21cd645b8eda95eed9152f6c5643df418ecf2db699c302fc15c3e13f711fdb27941918f2cb19b97a6797eb8
|
7
|
+
data.tar.gz: 15f56e411b4cac475bd24c04da44ca5ce2a47e798b8b1565d4aafdb00ca4ff63242f925b46036ea9b3c43246115ab1d4bb11d5515988889bac8f698a2b981916
|
data/Gemfile
CHANGED
data/License
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
Copyright (c) 2011-2013 Jordon Bedwell
|
2
2
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
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: The above copyright
|
9
|
+
notice and this permission notice shall be included in all copies or
|
10
|
+
substantial portions of the Software.
|
4
11
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
require "rake/testtask"
|
1
|
+
require "rspec/core/rake_task"
|
3
2
|
|
4
|
-
task :default => [:
|
5
|
-
task :
|
6
|
-
|
7
|
-
Rake::TestTask.new { |t| t.verbose, t.pattern = true, "test/**/*_test.rb" }
|
8
|
-
Gem::PackageTask.new(eval(IO.read("pry-vterm_aliases.gemspec"))) { |p|
|
9
|
-
p.need_tar, p.need_zip = true
|
10
|
-
}
|
3
|
+
task :default => [:spec]
|
4
|
+
task :test => :spec
|
5
|
+
RSpec::Core::RakeTask.new :spec
|
data/Readme.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# Pry-Vterm_Aliases
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/envygeeks/pry-vterm_aliases.png?branch=master)](https://travis-ci.org/envygeeks/pry-vterm_aliases) [![Coverage Status](https://coveralls.io/repos/envygeeks/pry-vterm_aliases/badge.png?branch=master)](https://coveralls.io/r/envygeeks/pry-vterm_aliases) [![Code Climate](https://codeclimate.com/github/envygeeks/pry-vterm_aliases.png)](https://codeclimate.com/github/envygeeks/pry-vterm_aliases)
|
2
4
|
|
3
5
|
Enable your ZSH and Bash aliases inside of Pry.
|
4
6
|
|
@@ -13,8 +15,8 @@ Enable your ZSH and Bash aliases inside of Pry.
|
|
13
15
|
|
14
16
|
|
15
17
|
|
16
|
-
> .ll |grep
|
17
|
-
-rw-r-r-- 1 jordon jordon 2197 Dec 17 03:30
|
18
|
+
> .ll |grep 4
|
19
|
+
-rw-r-r-- 1 jordon jordon 2197 Dec 17 03:30 file_name4
|
18
20
|
|
19
21
|
|
20
22
|
|
@@ -28,7 +30,7 @@ Enable your ZSH and Bash aliases inside of Pry.
|
|
28
30
|
|
29
31
|
|
30
32
|
|
31
|
-
> capture = capture_vterm_alias(".ll", "|grep
|
33
|
+
> capture = capture_vterm_alias(".ll", "|grep 4")
|
32
34
|
> out.puts capture
|
33
|
-
-rw-r-r-- 1 jordon jordon 2197 Dec 17 03:30
|
35
|
+
-rw-r-r-- 1 jordon jordon 2197 Dec 17 03:30 file_name4
|
34
36
|
```
|
data/lib/pry-vterm_aliases.rb
CHANGED
@@ -6,53 +6,69 @@ unless ::RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
|
|
6
6
|
module VTermAliases
|
7
7
|
class << self
|
8
8
|
def create_aliases
|
9
|
-
aliases.each { |
|
10
|
-
|
11
|
-
description "AKA: .#{Pry::Helpers::Text.bold(k)} - an alias for: #{Pry::Helpers::Text.bold(v)}."
|
12
|
-
group "Terminal Aliases [pry-vterm_aliases] (#{Pry::VTermAliases::VERSION})"
|
9
|
+
aliases.each { |als, cmd| create_alias(als, cmd) }
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
def create_alias(als, desc = nil)
|
13
|
+
Pry::Commands.create_command(cmd_regexp(als), listing: ".#{als}") do
|
14
|
+
description("alias to: #{Pry::Helpers::Text.bold(desc)}.") if desc
|
15
|
+
group("Terminal Aliases")
|
16
|
+
|
17
|
+
def process(cmd, extra)
|
18
|
+
Pry::VTermAliases.run_alias(cmd, extra, output)
|
19
|
+
end
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
def aliases
|
22
|
-
@aliases ||=
|
23
|
-
{}
|
24
|
-
else
|
25
|
-
`#{term} -i -c 'alias'`.split(/\n/).inject({}) { |h, (a)|
|
26
|
-
a = a.sub(/^alias\s/, "").split("=")
|
27
|
-
unless a.first =~ /\s/
|
28
|
-
h.update(a.shift => ::Shellwords.shellwords(a.join("=")).join)
|
29
|
-
end
|
30
|
-
h
|
31
|
-
}
|
32
|
-
end
|
24
|
+
@aliases ||= (shell.nil? || shell.empty?) ? {} : find_aliases
|
33
25
|
end
|
34
26
|
|
35
|
-
def
|
36
|
-
@
|
27
|
+
def shell
|
28
|
+
@shell ||= ENV["SHELL"].split("/").last
|
37
29
|
end
|
38
30
|
|
39
|
-
def
|
40
|
-
|
31
|
+
def run_alias(cmd, extra, output)
|
32
|
+
raise ArgumentError, "unknown alias" unless (cmd = aliases[cmd])
|
33
|
+
output.puts(`#{cmd}#{" " + extra if extra}`)
|
41
34
|
$?.success?
|
42
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def strip_wrapping_quotes(str)
|
39
|
+
str =~ /\A'(.*)'\Z/ ? $1 : str
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def cmd_regexp(str)
|
44
|
+
/\A\.(?:(#{Regexp.escape(str)})(?:\Z|\s+(.*)))/
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def find_aliases
|
49
|
+
`#{shell} -ic 'alias'`.split(/\n/).inject({}) do |hash, alius|
|
50
|
+
alius = alius.sub(/\Aalias\s/, "").split("=")
|
51
|
+
unless alius.first =~ /\s/
|
52
|
+
strip_wrapping_quotes(alius.shift).tap do |k|
|
53
|
+
hash.update(k => Shellwords.shellwords(alius.join("=")).join)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
hash
|
57
|
+
end
|
58
|
+
end
|
43
59
|
end
|
44
60
|
|
45
61
|
# Better way?!?!
|
46
62
|
module ObjectExt
|
47
63
|
private
|
48
|
-
def capture_vterm_alias(
|
49
|
-
Pry::VTermAliases.
|
50
|
-
|
64
|
+
def capture_vterm_alias(als, extra = nil, out = StringIO.new)
|
65
|
+
Pry::VTermAliases.run_alias(als.gsub(/\A\./, ""), extra, out)
|
66
|
+
StringIO === out ? out.string : out
|
51
67
|
end
|
52
68
|
end
|
53
69
|
end
|
54
70
|
end
|
55
71
|
|
56
|
-
|
57
|
-
|
72
|
+
Pry::VTermAliases.create_aliases
|
73
|
+
Object.send(:include, Pry::VTermAliases::ObjectExt)
|
58
74
|
end
|
metadata
CHANGED
@@ -1,113 +1,114 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-vterm_aliases
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.0.2
|
4
|
+
version: 1.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jordon Bedwell
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
14
|
+
name: luna-rspec-formatters
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - '>='
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: '0'
|
21
|
-
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
none: false
|
28
|
-
type: :runtime
|
29
|
-
name: pry
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
28
|
+
name: coveralls
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
30
|
requirements:
|
34
|
-
- -
|
31
|
+
- - '>='
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '0'
|
37
|
-
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
38
36
|
version_requirements: !ruby/object:Gem::Requirement
|
39
37
|
requirements:
|
40
|
-
- -
|
38
|
+
- - '>='
|
41
39
|
- !ruby/object:Gem::Version
|
42
40
|
version: '0'
|
43
|
-
none: false
|
44
|
-
type: :development
|
45
|
-
name: pry-doc
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
42
|
+
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
44
|
requirements:
|
50
|
-
- -
|
45
|
+
- - '>='
|
51
46
|
- !ruby/object:Gem::Version
|
52
47
|
version: '0'
|
53
|
-
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
54
50
|
version_requirements: !ruby/object:Gem::Requirement
|
55
51
|
requirements:
|
56
|
-
- -
|
52
|
+
- - '>='
|
57
53
|
- !ruby/object:Gem::Version
|
58
54
|
version: '0'
|
59
|
-
none: false
|
60
|
-
type: :development
|
61
|
-
name: rake
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
56
|
+
name: pry
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - '>='
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: '0'
|
69
|
-
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
|
-
- -
|
66
|
+
- - '>='
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: '0'
|
75
|
-
none: false
|
76
|
-
type: :development
|
77
|
-
name: minitest
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
70
|
+
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
72
|
requirements:
|
82
|
-
- -
|
73
|
+
- - '>='
|
83
74
|
- !ruby/object:Gem::Version
|
84
75
|
version: '0'
|
85
|
-
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
86
78
|
version_requirements: !ruby/object:Gem::Requirement
|
87
79
|
requirements:
|
88
|
-
- -
|
80
|
+
- - '>='
|
89
81
|
- !ruby/object:Gem::Version
|
90
82
|
version: '0'
|
91
|
-
none: false
|
92
|
-
type: :development
|
93
|
-
name: simplecov
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
|
84
|
+
name: simplecov
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
86
|
requirements:
|
98
|
-
- -
|
87
|
+
- - '>='
|
99
88
|
- !ruby/object:Gem::Version
|
100
89
|
version: '0'
|
101
|
-
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
102
92
|
version_requirements: !ruby/object:Gem::Requirement
|
103
93
|
requirements:
|
104
|
-
- -
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '0'
|
107
|
-
none: false
|
108
104
|
type: :development
|
109
|
-
|
110
|
-
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Enable your Bash and ZSH alises in Pry shell.
|
111
112
|
email:
|
112
113
|
- envygeeks@gmail.com
|
113
114
|
executables: []
|
@@ -123,26 +124,25 @@ files:
|
|
123
124
|
homepage: http://envygeeks.com/projects/pry-vterm_aliases/
|
124
125
|
licenses:
|
125
126
|
- MIT
|
127
|
+
metadata: {}
|
126
128
|
post_install_message:
|
127
129
|
rdoc_options: []
|
128
130
|
require_paths:
|
129
131
|
- lib
|
130
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
133
|
requirements:
|
132
|
-
- -
|
134
|
+
- - '>='
|
133
135
|
- !ruby/object:Gem::Version
|
134
136
|
version: '0'
|
135
|
-
none: false
|
136
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
138
|
requirements:
|
138
|
-
- -
|
139
|
+
- - '>='
|
139
140
|
- !ruby/object:Gem::Version
|
140
141
|
version: '0'
|
141
|
-
none: false
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
144
|
+
rubygems_version: 2.0.3
|
145
145
|
signing_key:
|
146
|
-
specification_version:
|
146
|
+
specification_version: 4
|
147
147
|
summary: Enable your Bash and ZSH alises in Pry.
|
148
148
|
test_files: []
|