hss 0.0.1
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 +7 -0
- data/hss +49 -0
- metadata +45 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: d59ba79bdfc467f15a21b8a54d515bf1ee363750
         | 
| 4 | 
            +
              data.tar.gz: 2f5c8218bfb2c818927a9a4c685c8e67effacd06
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: ee1f1f63499e8cee3ef84212dd75810fe26f4d90cae9b7ecc962abd71b3a93248d387347c802347dc4ce26a3e19cfbaa7f74210b07bc0212189e29880a33f2b7
         | 
| 7 | 
            +
              data.tar.gz: 8b7c500544393c80cea108144e8ef8227f07fa8add8165c0c97f2a48cc01173dca093e5b2a5f2d7cdee5307a283ac6338cbc01803bbf87c2d0e43eff5a3e1906
         | 
    
        data/hss
    ADDED
    
    | @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'yaml'
         | 
| 4 | 
            +
            require 'pathname'
         | 
| 5 | 
            +
            require 'erb'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            def expand(input)
         | 
| 8 | 
            +
                Config['expansions'].each { |long, shorts| return long if shorts.include? input }
         | 
| 9 | 
            +
                raise NameError, "No expansion found for: #{input}"
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            def shortcut(input)
         | 
| 13 | 
            +
                return Config['shortcuts'][input]
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            def command(input)
         | 
| 17 | 
            +
                return IO.popen(input) { |cmd| cmd.read }
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            possible_paths = [
         | 
| 21 | 
            +
                File.expand_path(ENV['HSS_CONFIG'].to_s),
         | 
| 22 | 
            +
                File.expand_path('~/.hss.yml'),
         | 
| 23 | 
            +
                Pathname.new(__FILE__).realpath.split()[0].to_s + '/config.yml',
         | 
| 24 | 
            +
            ]
         | 
| 25 | 
            +
            possible_paths = possible_paths.select { |path| not File.directory? path and File.exists? path }
         | 
| 26 | 
            +
            if possible_paths.empty?
         | 
| 27 | 
            +
                puts 'No config file found'
         | 
| 28 | 
            +
                exit 1
         | 
| 29 | 
            +
            end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            Config = open(possible_paths[0]) { |file| YAML.load(file.read) }
         | 
| 32 | 
            +
            Input = ARGV.pop
         | 
| 33 | 
            +
            Args = ARGV.join(' ')
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            if Input.nil? or Input == 'help'
         | 
| 36 | 
            +
                puts 'How to use:'
         | 
| 37 | 
            +
                puts '(what you type) -> (where it takes you)'
         | 
| 38 | 
            +
                Config['patterns'].each { |pattern| puts pattern['example'] }
         | 
| 39 | 
            +
            else
         | 
| 40 | 
            +
                Config['patterns'].each do |pattern|
         | 
| 41 | 
            +
                    next unless Input.match(pattern['short'])
         | 
| 42 | 
            +
                    long_form = ERB.new('<%= "' + pattern['long'] + '" %>').result
         | 
| 43 | 
            +
                    exec "ssh #{Args} #{long_form}"
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
            end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            puts "Couldn't find a matching host for: #{Input}"
         | 
| 48 | 
            +
            exit 1
         | 
| 49 | 
            +
             | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: hss
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Les Aker
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: .
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2013-08-09 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies: []
         | 
| 13 | 
            +
            description: Regex-based SSH shortcut tool
         | 
| 14 | 
            +
            email: me@lesaker.org
         | 
| 15 | 
            +
            executables:
         | 
| 16 | 
            +
            - hss
         | 
| 17 | 
            +
            extensions: []
         | 
| 18 | 
            +
            extra_rdoc_files: []
         | 
| 19 | 
            +
            files:
         | 
| 20 | 
            +
            - ./hss
         | 
| 21 | 
            +
            homepage: https://github.com/akerl/hss
         | 
| 22 | 
            +
            licenses:
         | 
| 23 | 
            +
            - MIT
         | 
| 24 | 
            +
            metadata: {}
         | 
| 25 | 
            +
            post_install_message: 
         | 
| 26 | 
            +
            rdoc_options: []
         | 
| 27 | 
            +
            require_paths:
         | 
| 28 | 
            +
            - lib
         | 
| 29 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
              requirements:
         | 
| 31 | 
            +
              - - '>='
         | 
| 32 | 
            +
                - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                  version: '0'
         | 
| 34 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 35 | 
            +
              requirements:
         | 
| 36 | 
            +
              - - '>='
         | 
| 37 | 
            +
                - !ruby/object:Gem::Version
         | 
| 38 | 
            +
                  version: '0'
         | 
| 39 | 
            +
            requirements: []
         | 
| 40 | 
            +
            rubyforge_project: 
         | 
| 41 | 
            +
            rubygems_version: 2.0.3
         | 
| 42 | 
            +
            signing_key: 
         | 
| 43 | 
            +
            specification_version: 4
         | 
| 44 | 
            +
            summary: SSH helper
         | 
| 45 | 
            +
            test_files: []
         |