pry-vterm_aliases 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,2 +1,7 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
+ ruby "1.9.3"
2
3
  gemspec
4
+
5
+ case RUBY_PLATFORM
6
+ when /linux|java/ then gem("rb-inotify")
7
+ end
data/License ADDED
@@ -0,0 +1,5 @@
1
+ Copyright (c) 2011 Jordon Bedwell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,7 +1,10 @@
1
- require './lib/pry-vterm_aliases'
2
- require 'rubygems/package_task'
3
- require 'rake/testtask'
1
+ require "rubygems/package_task"
2
+ require "rake/testtask"
3
+
4
4
  task :default => [:test]
5
+ task :spec => :test
5
6
 
6
- Rake::TestTask.new { |test| test.verbose, test.pattern = true, 'tests/**/*.rb' }
7
- Gem::PackageTask.new(eval(IO.read('pry-vterm_aliases.gemspec'))) { |pkg| pkg.need_tar, pkg.need_zip = true }
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
+ }
@@ -1,31 +1,49 @@
1
- $:.unshift File.dirname(__FILE__) and require "pry"
2
- unless defined? Pry::Plugins
3
- Pry.const_set(:Plugins, Class.new)
4
- end
1
+ require "pry-vterm_aliases/version"
2
+ require "pry"
5
3
 
6
- unless RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
7
- Pry::Commands.block_command /\.(.*)/, ".shell commands" do |cmd|
8
- if defined?(Pry::Plugins::VTerm) && Pry::Plugins::VTerm.aliases.include?(cmd)
9
- cmd = Pry::Plugins::VTerm.aliases[cmd]
10
- end
4
+ unless ::RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
5
+ class Pry
6
+ module VTermAliases
7
+ class << self
8
+ def create_aliases
9
+ aliases.each { |k, v|
10
+ ::Pry::Commands.create_command(/.(#{k})(.*)/) {
11
+ description "Alias for: #{v}."
12
+ group "Terminal Aliases"
11
13
 
12
- Pry.config.system.call(Pry.output, cmd, _pry_)
13
- end
14
+ def process(cmd, extra)
15
+ ::Pry::VTermAliases.run_command(cmd, extra, output)
16
+ end
17
+ }
18
+ }
19
+ end
14
20
 
15
- class Pry::Plugins::VTerm
16
- class << self
17
- VERSION = "0.1.0"
18
- def version
19
- VERSION
20
- end
21
+ def aliases
22
+ @aliases ||= if term.nil? || term.empty?
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
33
+ end
34
+
35
+ def term
36
+ @terminal ||= ENV["SHELL"].split("/").last
37
+ end
21
38
 
22
- def aliases
23
- return @@aliases || {}
39
+ def run_command(cmd, extra, output)
40
+ output.puts(`#{aliases[cmd]}#{" " +
41
+ ::Shellwords.escape(extra.sub(/^\s+/, "")) unless extra.empty?}`)
42
+ $?.success?
43
+ end
24
44
  end
25
45
  end
26
46
  end
27
47
 
28
- case ENV['SHELL']
29
- when %r!/(?:bash|zsh)\Z! then require "pry/aliases/common"
30
- end
48
+ ::Pry::VTermAliases.create_aliases
31
49
  end
@@ -0,0 +1,5 @@
1
+ class Pry
2
+ module VTermAliases
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-vterm_aliases
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,88 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-10 00:00:00.000000000 Z
12
+ date: 2012-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: pry
16
15
  requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
17
20
  none: false
21
+ version_requirements: !ruby/object:Gem::Requirement
18
22
  requirements:
19
- - - ~>
23
+ - - ! '>='
20
24
  - !ruby/object:Gem::Version
21
- version: 0.9.8
25
+ version: '0'
26
+ none: false
27
+ name: pry
28
+ prerelease: false
22
29
  type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ none: false
43
+ name: rake
44
+ prerelease: false
45
+ type: :development
46
+ - !ruby/object:Gem::Dependency
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ none: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ none: false
59
+ name: minitest
23
60
  prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ none: false
24
69
  version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
25
74
  none: false
75
+ name: simplecov
76
+ prerelease: false
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ requirement: !ruby/object:Gem::Requirement
26
80
  requirements:
27
- - - ~>
81
+ - - ! '>='
28
82
  - !ruby/object:Gem::Version
29
- version: 0.9.8
83
+ version: '0'
84
+ none: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ none: false
91
+ name: guard-minitest
92
+ prerelease: false
93
+ type: :development
30
94
  description: Enable your Bash and ZSH alises in Pry.
31
95
  email:
32
96
  - jordon@envygeeks.com
@@ -34,15 +98,13 @@ executables: []
34
98
  extensions: []
35
99
  extra_rdoc_files: []
36
100
  files:
37
- - License.txt
38
- - lib/pry-vterm_aliases.rb
39
- - lib/pry/aliases/common.rb
40
- - Rakefile
41
- - tests/pry-vterm_aliases.rb
42
101
  - Readme.md
102
+ - Rakefile
103
+ - License
43
104
  - Gemfile
44
- - pry-vterm_aliases.gemspec
45
- homepage: https://github.com/envygeeks/pry-vterm_aliases
105
+ - lib/pry-vterm_aliases.rb
106
+ - lib/pry-vterm_aliases/version.rb
107
+ homepage: http://envygeeks.com/projects/pry-vterm_aliases/
46
108
  licenses:
47
109
  - MIT
48
110
  post_install_message:
@@ -50,17 +112,23 @@ rdoc_options: []
50
112
  require_paths:
51
113
  - lib
52
114
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
115
  requirements:
55
116
  - - ! '>='
56
117
  - !ruby/object:Gem::Version
118
+ hash: -501587057
57
119
  version: '0'
58
- required_rubygems_version: !ruby/object:Gem::Requirement
120
+ segments:
121
+ - 0
59
122
  none: false
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
124
  requirements:
61
125
  - - ! '>='
62
126
  - !ruby/object:Gem::Version
127
+ hash: -501587057
63
128
  version: '0'
129
+ segments:
130
+ - 0
131
+ none: false
64
132
  requirements: []
65
133
  rubyforge_project:
66
134
  rubygems_version: 1.8.24
data/License.txt DELETED
@@ -1,17 +0,0 @@
1
- Copyright (c) 2011 Jordon Bedwell
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in the
5
- Software without restriction, including without limitation the rights to use,
6
- copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
- Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions: The above copyright notice and this
9
- permission notice shall be included in all copies or substantial portions of
10
- the Software.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
15
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
16
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,23 +0,0 @@
1
- class Pry
2
- class Plugins
3
- class VTerm
4
- class << self
5
- command = "bash"
6
- if ENV["SHELL"] =~ %r!/zsh\Z!
7
- command = "zsh"
8
- end
9
-
10
- @@aliases = `#{command} -i -c 'alias'`.each_line.to_a.map(&:chomp).delete_if { |line|
11
- line !~ /=/ }.inject({}) do |hash, cmd|
12
- cmd = Shellwords.shellwords(cmd.gsub(/\Aalias\s{1}/, "")).join
13
- cmd = cmd.split("=")
14
- cmd[1] = cmd[1..-1].join("=")
15
-
16
- unless cmd[0] =~ /\s/
17
- hash.update({cmd[0] => cmd[1]})
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,15 +0,0 @@
1
- require File.expand_path("../lib/pry-vterm_aliases", __FILE__)
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "pry-vterm_aliases"
5
- spec.version = Pry::Plugins::VTerm.version
6
- spec.email = ["jordon@envygeeks.com"]
7
- spec.authors = ["Jordon Bedwell"]
8
- spec.add_dependency("pry", "~> 0.9.8")
9
- spec.description = "Enable your Bash and ZSH alises in Pry."
10
- spec.files = Dir["**/*"]
11
- spec.homepage = "https://github.com/envygeeks/pry-vterm_aliases"
12
- spec.licenses = ["MIT"]
13
- spec.require_paths = ["lib"]
14
- spec.summary = "Enable your Bash and ZSH alises in Pry."
15
- end
@@ -1,14 +0,0 @@
1
- require "./lib/pry-vterm_aliases"
2
- require "minitest/autorun"
3
- require "minitest/pride"
4
-
5
- describe Pry::Plugins::VTerm do
6
- it "should have a proper version number" do
7
- Pry::Plugins::VTerm.version.split(/\./).delete_if { |val|
8
- val =~ /pre\d{0,2}/ }.length.must_equal 3
9
- end
10
-
11
- it "should output a hash of aliases when calling aliases" do
12
- assert Pry::Plugins::VTerm.aliases.class, Hash
13
- end
14
- end