hss 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hss +10 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 183948d88f7b2935a6282e65c8c2a7516a21ac02
4
- data.tar.gz: 8115548ff012d8a166658f4c93198dc7e419c214
3
+ metadata.gz: c3350d658660241531f6b6e833e16c2ad39eefe5
4
+ data.tar.gz: 75650def1609b67391d43a76f73b44273014ce7e
5
5
  SHA512:
6
- metadata.gz: aacaad14ddcfb54597a32aedd3c0222dd3b836db4c5144e5b23d4551581373e0215b62299fb3532098780b038300f20e7e003587dade8f75d4a7055a7b2b00da
7
- data.tar.gz: dd2a9d31e0a47b2a2e31f077caac6c38e4ecb3ae5d2191cd8c819682d08e96e27de3964c1b51c3a9449da94634546bcd72dbba4438617a242e357829dec2d493
6
+ metadata.gz: 59152cc4450198817df9fa2434e9e7905b780393d758ccfafa569ebe1ffddda1bc1da9b43b828b851cc4432b609e841ac77257a0088f3cbd57ee3976213083e1
7
+ data.tar.gz: 34293d256d5719f845133fc03a5dd7d4d08e7439644c7a434296bf9bc036f9f8a129b44419020bd8c2c6b5eb8e18284592e6d56ff633fa410ef495ef51fc443b
data/lib/hss CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'pathname'
5
- require 'erb'
5
+
6
+ Version = '0.1.11'
7
+
8
+ if ARGV.length == 1 and ARGV[0] == 'version'
9
+ puts Version
10
+ exit
11
+ end
6
12
 
7
13
  def expand(input)
8
14
  Conf['expansions'].each { |long, shorts| return long if shorts.include? input }
@@ -21,8 +27,6 @@ def default(a, b)
21
27
  a.nil? ? a : b
22
28
  end
23
29
 
24
- Debug = (ENV.include? 'HSS_DEBUG') ? true : false
25
-
26
30
  possible_paths = [
27
31
  File.expand_path(ENV['HSS_CONFIG'].to_s),
28
32
  File.expand_path('~/.hss.yml'),
@@ -35,8 +39,9 @@ if possible_paths.empty?
35
39
  end
36
40
 
37
41
  Conf = open(possible_paths[0]) { |file| YAML.load(file.read) }
38
- Input = ARGV.shift
42
+ Input = ARGV.delete_at ( ARGV.find_index { |x| x[0] != '-' } || 0 )
39
43
  Args = ARGV.inject('') { |memo, obj| memo += " '" + obj.gsub(/([$"])/, '\1') + "'" }
44
+ Cmd = (ENV.include? 'HSS_DEBUG') ? 'echo ssh' : 'ssh'
40
45
 
41
46
  if Input.nil? or Input == 'help'
42
47
  puts 'How to use:'
@@ -46,13 +51,7 @@ else
46
51
  Conf['patterns'].each do |pattern|
47
52
  next unless Input.match(pattern['short'])
48
53
  long_form = eval '"' + pattern['long'] + '"'
49
- #long_form = ERB.new('<%= "' + pattern['long'] + '" %>').result
50
- if Debug
51
- puts "ssh #{long_form} #{Args}"
52
- exit
53
- else
54
- exec "ssh #{long_form} #{Args}"
55
- end
54
+ exec "#{Cmd} #{long_form} #{Args}"
56
55
  end
57
56
  puts "Couldn't find a matching host for: #{Input}"
58
57
  exit 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: lib
10
10
  cert_chain: []
11
- date: 2013-08-09 00:00:00.000000000 Z
11
+ date: 2013-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Regex-based SSH shortcut tool
14
14
  email: me@lesaker.org