ssh-manager 0.0.7 → 0.0.9

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: e4c65127691cc262a53e1b6be85f842ba415e349
4
- data.tar.gz: 7058ae0879a2d78f69f8cbaa7dfc53317059e111
3
+ metadata.gz: a6902e64d708bfa6f45c209b5a885e0e07aaff9a
4
+ data.tar.gz: 9bf241a439fdb0da8c5d1060153e5c79af85d801
5
5
  SHA512:
6
- metadata.gz: 00fc8b45dab4c90ec36791c0491f6c036fe6ec43b67f51f61053e6ad492905f3ff3c60502a3cad06d7f3b57aa76f27cd91b00391ac2d30e78037ff7c3124b88e
7
- data.tar.gz: 8c423a6806e02655fb5696b35842a6377d228933ab4393eece72f96255154072db8679086bca25e481c87c30108db869680facdc9a5a2d9c50d8eb39565928da
6
+ metadata.gz: 6a3ee0a5bdef1d0d1ce564aec22b0e48436c526db2c2f145e0d29cf8746a54ff3f3cefa6ec4e5679cd2e8f0d9fde340aac047032785994ac9b316d894df27bf8
7
+ data.tar.gz: fb668462fda43158b1b2c30c63743385c64e40d7abe48ac4bb8efff1c5d30345dfe976f3f99c280b086b9327ca2ea1c0d3293258fab533c9b0715bef9ca6d411
data/config/settings.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  terminal : "xfce4-terminal"
2
2
  deletion_interval : "never"
3
3
  tabbed: 'false'
4
+
@@ -3,11 +3,14 @@ require 'yaml'
3
3
  FileUtils.cp ("#{File.dirname(__FILE__)}/../../../config/settings.yml"), ("#{File.join(Dir.home)}" + '/.config/sshm/') unless File.exists?(("#{File.join(Dir.home)}" + '/.config/sshm/settings.yml'))
4
4
  CONFIG = YAML.load_file("#{File.join(ENV['HOME'])}/.config/sshm/settings.yml")
5
5
  require 'debugger'
6
+ require_relative 'version'
6
7
 
7
8
  module SSH
8
9
  module Manager
9
10
  class Cli
10
11
 
12
+ DATABASE = SSH::Manager::Database.new
13
+
11
14
  def initialize(opts = {})
12
15
  @options = opts
13
16
  end
@@ -15,12 +18,13 @@ module SSH
15
18
  def check_term(ip, user)
16
19
  if CONFIG['terminal'] == "xfce4-terminal" || CONFIG['terminal'] == "gnome-terminal"
17
20
  if CONFIG['tabbed'] == 'true'
18
- command = '--tab --command='
21
+ command = "--title=#{user}@#{ip} --tab --command="
19
22
  else
20
- command = '--command='
23
+ command = "--title=#{user}@#{ip} --command="
21
24
  end
22
25
  #TODO: add title --title='connection name to identify '
23
26
  #TODO: bug when no terminal is open => wants to open 2 terms
27
+ #TODO: dnslookup
24
28
  %x(#{CONFIG['terminal']} #{command}"ssh #{user}@#{ip}")
25
29
  elsif CONFIG['terminal'] == "xterm" || CONFIG['terminal'] == "urxvt"
26
30
  %x(#{CONFIG['terminal']} -e "ssh #{user}@#{ip}")
@@ -31,13 +35,30 @@ module SSH
31
35
  end
32
36
 
33
37
  def connect_to(id)
34
- @ip = SSH::Manager::Database.new.get_connection_data[id.to_i-1][0]
35
- @user = SSH::Manager::Database.new.get_connection_data[id.to_i-1][1]
38
+ @ip = DATABASE.get_connection_data[id.to_i-1][0]
39
+ @user = DATABASE.get_connection_data[id.to_i-1][1]
36
40
  check_term(@ip, @user)
37
41
  #TODO: check for options
38
42
  #TODO: if db[secure_login] = false => http://linuxcommando.blogspot.de/2008/10/how-to-disable-ssh-host-key-checking.html
39
43
  end
40
44
 
45
+ def update_available
46
+ #Thread.new {
47
+ new_version =%x(gem search ssh-manager).split(' ')[1]
48
+ old_version = SSH::Manager::VERSION
49
+ if new_version<old_version
50
+ puts 'There is a update available -> sudo gem update ssh-manager'
51
+ end
52
+ #}
53
+ end
54
+
55
+
56
+ def transfer_key(id)
57
+ @ip = DATABASE.get_connection_data[id.to_i-1][0]
58
+ @user = DATABASE.get_connection_data[id.to_i-1][1]
59
+ %x(ssh-copy-id #{@user}@#{@ip})
60
+ end
61
+
41
62
  def add_connection(ip)
42
63
  puts 'Username: '
43
64
  user = $stdin.gets.chomp
@@ -57,22 +78,22 @@ module SSH
57
78
  count = 0
58
79
  created_at = Time.now.to_s
59
80
  last_time = Time.now.to_s
60
- SSH::Manager::Database.new.add_new_connection(ip, user, hostname, port, note, created_at, options, count, group, last_time)
81
+ DATABASE.add_new_connection(ip, user, hostname, port, note, created_at, options, count, group, last_time)
61
82
  end
62
83
 
63
84
  def delete(id)
64
85
  id = id.to_i - 1
65
- SSH::Manager::Database.new.delete_connection(SSH::Manager::Database.new.get_connection_data[id][0])
86
+ DATABASE.delete_connection(DATABASE.get_connection_data[id][0])
66
87
  end
67
88
 
68
89
  def list_all
69
90
  cnt = 0
70
- connections = Hash[SSH::Manager::Database.new.get_connection_data.collect { |x| [cnt+=1, x]}]
71
- puts 'ID IP USERNAME HOSTNAME PORT NOTES GROUP'
91
+ connections = Hash[DATABASE.get_connection_data.collect { |x| [cnt+=1, x]}]
92
+ puts 'ID IP USERNAME NOTES GROUP'
72
93
  connections.each do |x|
73
94
  print "#{x[0]}: "
74
95
  x[1].each do |a|
75
- printf '%-20s', a
96
+ printf '%-15s', a
76
97
  end
77
98
  puts "\n"
78
99
  end
@@ -82,22 +103,22 @@ module SSH
82
103
  puts 'Entries wont change of left out blank.'
83
104
  puts 'Username: '
84
105
  user =$stdin.gets.chomp
85
- user = SSH::Manager::Database.new.get_connection_data[id.to_i][1] if user == ''
106
+ user = DATABASE.get_connection_data[id.to_i][1] if user == ''
86
107
  puts 'Hostname: '
87
108
  hostname = $stdin.gets.chomp
88
- hostname = SSH::Manager::Database.new.get_connection_data[id.to_i][2] if hostname == ''
109
+ hostname = DATABASE.get_connection_data[id.to_i][2] if hostname == ''
89
110
  puts 'port: '
90
111
  port = $stdin.gets.chomp
91
- port = SSH::Manager::Database.new.get_connection_data[id.to_i][3] if port == ''
112
+ port = DATABASE.get_connection_data[id.to_i][3] if port == ''
92
113
  puts 'Notes: '
93
114
  note = $stdin.gets.chomp
94
- note = SSH::Manager::Database.new.get_connection_data[id.to_i][4] if note == ''
95
- SSH::Manager::Database.new.update_connection(SSH::Manager::Database.new.get_connection_data[id.to_i][0], user, hostname, port, note)
115
+ note = DATABASE.get_connection_data[id.to_i][4] if note == ''
116
+ DATABASE.update_connection(DATABASE.get_connection_data[id.to_i][0], user, hostname, port, note)
96
117
  end
97
118
 
98
119
  def search_for(term)
99
120
  puts 'IP USERNAME HOSTNAME PORT NOTES GROUP'
100
- SSH::Manager::Database.new.search_for(term).each do |x|
121
+ DATABASE.search_for(term).each do |x|
101
122
  x.all.each do |cons|
102
123
  cons.values.each do |each_con|
103
124
  printf '%-20s', each_con
@@ -109,7 +130,7 @@ module SSH
109
130
  end
110
131
 
111
132
  def multiple_connection(term)
112
- SSH::Manager::Database.new.search_for(term).each do |x|
133
+ DATABASE.search_for(term).each do |x|
113
134
  x.all.each do |dataset|
114
135
  check_term(dataset[:ip], dataset[:user])
115
136
  #TODO: Add terminalposition
@@ -36,6 +36,9 @@ module SSH
36
36
  elsif @options[:multi]
37
37
  puts 'Connecting to multiple ips'
38
38
  cli.new(@options).multiple_connection(@options[:multi])
39
+ elsif @options[:transfer_key]
40
+ puts 'Transfering key'
41
+ cli.new(@options).transfer_key(@options[:transfer_key])
39
42
  elsif @options[:search]
40
43
  puts 'Searching ..'
41
44
  cli.new(@options).search_for(@options[:search])
@@ -56,6 +59,10 @@ module SSH
56
59
  opts.on( '-a', '--add ip', 'Add ip to your Connection list' ) do |opt|
57
60
  @options[:add] = opt
58
61
  end
62
+ @options[:transfer_key] = false
63
+ opts.on( '-t', '--transferkey id', 'transfer key to <id>' ) do |opt|
64
+ @options[:transfer_key] = opt
65
+ end
59
66
  @options[:connect] = false
60
67
  opts.on( '-c', '--connect id', 'connect to <id>' ) do |opt|
61
68
  @options[:connect] = opt
@@ -18,7 +18,7 @@ module SSH
18
18
  end
19
19
 
20
20
  def get_connection_data
21
- @connections.map([:ip, :user, :hostname, :port, :note, :group])
21
+ @connections.map([:ip, :user, :note, :group])
22
22
  end
23
23
 
24
24
  def add_new_connection(ip, user='root', hostname='', port=22, note='', created_at, option, count, group, last_time)
@@ -1,5 +1,5 @@
1
1
  module SSH
2
2
  module Manager
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
data/ssh-manager.gemspec CHANGED
@@ -6,12 +6,12 @@ require 'ssh/manager/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ssh-manager"
8
8
  spec.version = SSH::Manager::VERSION
9
- spec.authors = ["Joshua Schmid, Juraj Hura"]
10
- spec.email = ["jschmid@suse.com, jhura@suse.cz"]
11
- spec.description = %q{ssh connections easy}
12
- spec.summary = %q{manage and connect}
9
+ spec.authors = ["Joshua Schmid"]
10
+ spec.email = ["jschmid@suse.com"]
11
+ spec.description = %q{Manage ssh connections}
12
+ spec.summary = %q{manage and connect ssh}
13
13
  spec.homepage = "https://rubygems.org/profiles/jschmid"
14
- spec.license = "GPL"
14
+ spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_runtime_dependency 'sequel', '=4.13.0'
23
- spec.add_runtime_dependency 'sqlite3', '=1.3.9'
24
- #spec.add_runtime_dependency 'ruby-devel', '=1.3.9'
22
+ spec.add_runtime_dependency 'sequel'
23
+ spec.add_runtime_dependency 'sqlite3'
25
24
  spec.add_development_dependency "rake"
26
25
  end
metadata CHANGED
@@ -1,87 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
- - Joshua Schmid, Juraj Hura
7
+ - Joshua Schmid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.13.0
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 4.13.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.9
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.9
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: ssh connections easy
69
+ description: Manage ssh connections
70
70
  email:
71
- - jschmid@suse.com, jhura@suse.cz
71
+ - jschmid@suse.com
72
72
  executables:
73
73
  - sshm
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .idea/encodings.xml
79
- - .idea/misc.xml
80
- - .idea/modules.xml
81
- - .idea/scopes/scope_settings.xml
82
- - .idea/ssh-manager.iml
83
- - .idea/vcs.xml
84
- - .rspec
77
+ - ".gitignore"
78
+ - ".idea/encodings.xml"
79
+ - ".idea/misc.xml"
80
+ - ".idea/modules.xml"
81
+ - ".idea/scopes/scope_settings.xml"
82
+ - ".idea/ssh-manager.iml"
83
+ - ".idea/vcs.xml"
84
+ - ".rspec"
85
85
  - Gemfile
86
86
  - LICENSE
87
87
  - README.md
@@ -100,7 +100,7 @@ files:
100
100
  - ssh-manager.gemspec
101
101
  homepage: https://rubygems.org/profiles/jschmid
102
102
  licenses:
103
- - GPL
103
+ - MIT
104
104
  metadata: {}
105
105
  post_install_message:
106
106
  rdoc_options: []
@@ -108,20 +108,20 @@ require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.0.3
121
+ rubygems_version: 2.4.5
122
122
  signing_key:
123
123
  specification_version: 4
124
- summary: manage and connect
124
+ summary: manage and connect ssh
125
125
  test_files:
126
126
  - spec/client_spec.rb
127
127
  - spec/spec_helper.rb