hss 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hss.gemspec +0 -1
- data/lib/hss.rb +2 -5
- metadata +2 -3
- data/lib/hss +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296e8a47b23eaba852c61e55e6dd50c9a9e47111
|
4
|
+
data.tar.gz: 7c28b0ab9bdcec36a8807a56af87a4de2354df4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3519173088f58a186719f95d03d79ee9cc977120412814e89e806411228dd6e8e6e3136213d8a21cc0c5a8ca1a480522ae901c1e08b2f8cda39b29a83d465815
|
7
|
+
data.tar.gz: e8d402910f413b1201f6c1d4a389563de52ef6fe71faa08ab15a67ab66a8393c30e9db50255c316e99c4cc50aede81fae3d6ae033f6a553fc46d1c85956cf1c3
|
data/hss.gemspec
CHANGED
data/lib/hss.rb
CHANGED
@@ -3,7 +3,7 @@ require 'pathname'
|
|
3
3
|
require 'erb'
|
4
4
|
|
5
5
|
module HSS
|
6
|
-
Version = '0.2.
|
6
|
+
Version = '0.2.2'
|
7
7
|
Default_Config = '~/.hss.yml'
|
8
8
|
Default_Library = Pathname.new(__FILE__).realpath.split()[0].to_s + '/helpers'
|
9
9
|
|
@@ -48,10 +48,6 @@ module HSS
|
|
48
48
|
end
|
49
49
|
raise "Couldn't find a matching host for: #{input}"
|
50
50
|
end
|
51
|
-
|
52
|
-
def woof()
|
53
|
-
puts "bark"
|
54
|
-
end
|
55
51
|
end
|
56
52
|
|
57
53
|
class Parser
|
@@ -69,3 +65,4 @@ module HSS
|
|
69
65
|
end
|
70
66
|
end
|
71
67
|
end
|
68
|
+
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
@@ -27,7 +27,6 @@ files:
|
|
27
27
|
- lib/helpers/default.rb
|
28
28
|
- lib/helpers/expand.rb
|
29
29
|
- lib/helpers/shortcut.rb
|
30
|
-
- lib/hss
|
31
30
|
- lib/hss.rb
|
32
31
|
- test.conf
|
33
32
|
homepage: https://github.com/akerl/hss
|
data/lib/hss
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'yaml'
|
4
|
-
require 'pathname'
|
5
|
-
|
6
|
-
Version = '0.1.19'
|
7
|
-
|
8
|
-
if ARGV.length == 1 and ARGV[0] == 'version'
|
9
|
-
puts Version
|
10
|
-
exit
|
11
|
-
end
|
12
|
-
|
13
|
-
def expand(input)
|
14
|
-
Conf['expansions'].each { |long, shorts| return long if shorts.include? input }
|
15
|
-
raise NameError, "No expansion found for: #{input}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def shortcut(input)
|
19
|
-
return Conf['shortcuts'][input]
|
20
|
-
end
|
21
|
-
|
22
|
-
def command(input)
|
23
|
-
return IO.popen(input) { |cmd| cmd.read }
|
24
|
-
end
|
25
|
-
|
26
|
-
def default(a, b)
|
27
|
-
(a.nil? or a.empty?) ? b : a
|
28
|
-
end
|
29
|
-
|
30
|
-
possible_paths = [
|
31
|
-
File.expand_path(ENV['HSS_CONFIG'].to_s),
|
32
|
-
File.expand_path('~/.hss.yml'),
|
33
|
-
Pathname.new(__FILE__).realpath.split()[0].to_s + '/config.yml',
|
34
|
-
]
|
35
|
-
possible_paths = possible_paths.select { |path| not File.directory? path and File.exists? path }
|
36
|
-
if possible_paths.empty?
|
37
|
-
puts 'No config file found'
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
|
41
|
-
Conf = open(possible_paths[0]) { |file| YAML.load(file.read) }
|
42
|
-
Input = ARGV.delete_at( ARGV.find_index { |x| x[0, 1] != '-' } || 0 )
|
43
|
-
Args = ARGV.inject('') { |memo, obj| memo += " '" + obj.gsub(/([$"])/, '\1') + "'" }
|
44
|
-
Cmd = (ENV.include? 'HSS_DEBUG') ? 'echo ssh' : 'ssh'
|
45
|
-
|
46
|
-
if Input.nil? or Input == 'help'
|
47
|
-
puts 'How to use:'
|
48
|
-
puts '(what you type) -> (where it takes you)'
|
49
|
-
Conf['patterns'].each { |pattern| puts pattern['example'] }
|
50
|
-
else
|
51
|
-
Conf['patterns'].each do |pattern|
|
52
|
-
next unless Input.match(pattern['short'])
|
53
|
-
long_form = eval '"' + pattern['long'] + '"'
|
54
|
-
$stdout.syswrite "\033]0;#{Input}\007" if $stdin.tty? and $stdout.tty?
|
55
|
-
exec "#{Cmd} #{long_form} #{Args}"
|
56
|
-
end
|
57
|
-
puts "Couldn't find a matching host for: #{Input}"
|
58
|
-
exit 1
|
59
|
-
end
|
60
|
-
|