pry-vterm_aliases 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,21 @@
1
- class Pry::Plugins::VTerm
2
- class << self
3
- command = 'bash'
4
- if ENV['SHELL'] =~ %r!/zsh\Z!
5
- command = 'zsh'
6
- end
1
+ if defined? Pry::Plugins::VTerm
2
+ class Pry::Plugins::VTerm
3
+ class << self
4
+ command = 'bash'
5
+ if ENV['SHELL'] =~ %r!/zsh\Z!
6
+ command = 'zsh'
7
+ end
7
8
 
8
- @@aliases = `#{command} -i -c 'alias'`.gsub(/\Aalias\s{1}/, '').split(/\salias/).inject({}) do |hash, cmd|
9
- cmd = cmd.split('=\'')
10
- hash.update({cmd.first.strip => cmd.last.gsub(/'\Z/, '')})
9
+ @@aliases = `#{command} -i -c 'alias'`.each_line.to_a.map(&:chomp).delete_if { |line| line !~ /=/ }.inject({}) do |hash, cmd|
10
+ cmd = Shellwords.shellwords(cmd.gsub(/\Aalias\s{1}/, '')).join
11
+ cmd = cmd.split('=')
12
+ cmd[1] = cmd[1..-1].join('=')
13
+
14
+ # Just double check...
15
+ unless cmd[0] =~ /\s/
16
+ hash.update({cmd[0] => cmd[1]})
17
+ end
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -15,7 +15,7 @@ unless RbConfig::CONFIG['host_os'] =~ /mswin/
15
15
  class Pry::Plugins::VTerm
16
16
  class << self
17
17
  def version
18
- '0.0.5'
18
+ '0.0.6'
19
19
  end
20
20
 
21
21
  def aliases
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.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-11 00:00:00.000000000 Z
12
+ date: 2012-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
16
- requirement: &20786700 !ruby/object:Gem::Requirement
16
+ requirement: &21626840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.9.8
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20786700
24
+ version_requirements: *21626840
25
25
  description: Preserve your VTerm aliases in Pry.
26
26
  email:
27
27
  - jordon@envygeeks.com