hss 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/hss +10 -11
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c3350d658660241531f6b6e833e16c2ad39eefe5
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 75650def1609b67391d43a76f73b44273014ce7e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
      
 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. 
     | 
| 
      
 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 
     | 
    
         
            -
                     
     | 
| 
       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. 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     |