ssh-manager 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56dbc7d6e9248cc66a7a3840669ffc4cf0056555
4
- data.tar.gz: 54cae9ac4705336ad6dbbb39628cb18003d101c2
3
+ metadata.gz: 59aa22da8f515be9a7fe111618dd3ea02d7e790a
4
+ data.tar.gz: e459ee67d54e5a0f2a38ebc429a653eedc3b2397
5
5
  SHA512:
6
- metadata.gz: e15cc62eb68e761da4214faa7b1e5b4191aef724436386b045e593cfc7b8ed7fc4bf67481d599b2550aaeed28fb3849f1bc161c30e0c36fe763f444b67ea8ec2
7
- data.tar.gz: 603a5b658f4db6f72a9725448f53f671fd09bfb875c9c7c19baeaee71db7d11e742700f979b28b3b5b0672302e5309a85d6be7c4180626aa3a8c033d7fb94089
6
+ metadata.gz: 3d6016baa8e8264fe02a57c77b301f643293bb27b352093b998a91d9cffd83f38f78b009def347a57d6787b04b8799e9db383f922301ed4a92a6e7d4ff1fdb36
7
+ data.tar.gz: 41d3e995cf4b7e39a20d6fb98e0af35f81d4e4a6e0c1fe96eddf24243014a6219b4ec2be17657ff7993f43992e6e86522275a3083eab73cbe2caa77b73ce977f
@@ -26,6 +26,14 @@ module SSH
26
26
  @column_width = 15 #TODO make this dynamic or a yaml setting
27
27
  end
28
28
 
29
+ def check_connection_type(connection)
30
+ if connection.class == String
31
+ "hostname"
32
+ else
33
+ "ip"
34
+ end
35
+ end
36
+
29
37
  def connect_to(id)
30
38
  id.each do |conn|
31
39
  conn.to_i
@@ -114,10 +122,7 @@ module SSH
114
122
  exec("ping #{connection[:ip]} -c 3")
115
123
  end
116
124
  end
117
-
118
- def test(type)
119
- require 'byebug'
120
- byebug
125
+ def test(id)
121
126
  end
122
127
 
123
128
  def transfer_file(filename, id='', dest_path="/home/#{user}/")
@@ -9,6 +9,8 @@ module SSH
9
9
  class Client
10
10
 
11
11
  attr_accessor :options
12
+ CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
13
+ CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
12
14
 
13
15
  def initialize(argv)
14
16
  @options = {}
@@ -16,6 +18,7 @@ module SSH
16
18
  extract_options
17
19
  end
18
20
 
21
+
19
22
  def execute!
20
23
  cli = SSH::Manager::Cli
21
24
  # TODO id.to_i is not good enough. we want to support hostnames too
@@ -54,6 +57,9 @@ module SSH
54
57
  elsif @options[:transfer_key]
55
58
  puts 'Transfering key..'
56
59
  cli.new(@options).transfer_key(@options[:transfer_key].to_i)
60
+ elsif @options[:codeing]
61
+ puts 'coding key..'
62
+ cli.new(@options).test(@options[:coding].to_i)
57
63
  elsif @options[:search]
58
64
  puts 'Searching ..'
59
65
  cli.new(@options).search_for(@options[:search])
@@ -61,7 +67,11 @@ module SSH
61
67
  # puts 'Settings'
62
68
  # cli.new(@options).settings(@options[:settings])
63
69
  else
64
- cli.new(@argv.first).connect_to(@argv.first) if @argv != []
70
+ if @argv.count == 1
71
+ cli.new(@options).connect_to(@argv.first.split(',')) if @argv != []
72
+ else
73
+ cli.new(@options).connect_to(@argv) if @argv != []
74
+ end
65
75
  puts @optparse if @argv ==[]
66
76
  exit
67
77
  end
@@ -82,6 +92,10 @@ module SSH
82
92
  opts.on( '-r', '--transferfile filename', 'file or dir / connection_ID / dest_path(default is /home/user/)' ) do |opt|
83
93
  @options[:transfer_file] = opt
84
94
  end
95
+ code_list = (CODE_ALIASES.keys + CODES).join(',')
96
+ opts.on("--code CODE", CODES, CODE_ALIASES, "Select encoding"," (#{code_list})") do |encoding|
97
+ options.encoding = encoding
98
+ end
85
99
  @options[:connect] = false
86
100
  opts.on( '-c', '--connect x y z', Array, 'connect to <ids>' ) do |opt|
87
101
  @options[:connect] = opt
@@ -1,5 +1,5 @@
1
1
  module SSH
2
2
  module Manager
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Schmid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-11 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,4 +127,3 @@ summary: manage and connect ssh
127
127
  test_files:
128
128
  - spec/client_spec.rb
129
129
  - spec/spec_helper.rb
130
- has_rdoc: