ssh-manager 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9956cca04770f069803782321b4abbb01812d592
4
- data.tar.gz: dcaba9ecf7dbe4b855d1904a918331afaa9e16ab
3
+ metadata.gz: 10e0a6ecfbd52c188a0252c5374c33bd92656e57
4
+ data.tar.gz: 59be4d7b2cd671355dcb606e1ec171997d05ef67
5
5
  SHA512:
6
- metadata.gz: 0b54ac5bd84f5b2d6ad784b31d3f109e23d9e74c470b889814cf2fdfcd155ac3937d45cf7a16b950afa3fb3e539c7788e814555494550e09b2ad6be67c847a86
7
- data.tar.gz: c2f12318bedf54398bae2615b0d24218a8286dcb0925ef673c6db0aaa8cceaa21b069336871e43d1e8c31b078190d31933f71931310ca6377fa776b487ad8adf
6
+ metadata.gz: 582dd5364afc293035e2663aee1d40f85679a6f31622bf3e4d9c7def2488278b9165aa299a6ebfc26d00850730c05d663abd1747ff6124d5bf2627ba4d3968f9
7
+ data.tar.gz: b8da76fd9719cddf3704418870bbf007283a6950513db0df2c9d28bb7333c6228e0a96970b33ad88b5b963e804c588d50d963d0c04928b2a6909fba0c0481b6d
data/config/sshm.db CHANGED
Binary file
@@ -42,22 +42,28 @@ module SSH
42
42
  end
43
43
 
44
44
  def update_available
45
- #Thread.new {
46
- new_version =%x(gem search ssh-manager).split(' ')[1]
45
+ new_version =%x(gem search ssh-manager).split(' ')[1].gsub /\((.*)\)/, '\1'
47
46
  old_version = SSH::Manager::VERSION
48
47
  if new_version<old_version
49
- puts 'There is a update available -> sudo gem update ssh-manager'
48
+ puts "There is a update available #{new_version} was released. -> sudo gem update ssh-manager"
49
+ else
50
+ puts "Version: #{old_version} is up to date."
50
51
  end
51
- #}
52
52
  end
53
53
 
54
-
55
54
  def transfer_key(id)
56
55
  @ip = DATABASE.get_connection_data[id.to_i-1][0]
57
56
  @user = DATABASE.get_connection_data[id.to_i-1][1]
58
57
  %x(ssh-copy-id #{@user}@#{@ip})
59
58
  end
60
59
 
60
+ def transfer_file(filename, id='', dest_path="/home/#{user}/")
61
+ @ip = DATABASE.get_connection_data[id.to_i-1][0]
62
+ @user = DATABASE.get_connection_data[id.to_i-1][1]
63
+ %x(scp #{filename} #{@user}@#{@ip}:#{dest_path}) if File.file?(filename)
64
+ %x(scp -r #{filename} #{@user}@#{@ip}:#{dest_path}) if File.directory?(filename)
65
+ end
66
+
61
67
  def add_connection(ip)
62
68
  puts 'Username: '
63
69
  user = $stdin.gets.chomp
@@ -74,6 +80,11 @@ module SSH
74
80
  options = '' if options == ''
75
81
  puts 'Group: '
76
82
  group = $stdin.gets.chomp
83
+ # puts 'Connect via(ip): '
84
+ # connect_via_ip = $stdin.gets.chomp
85
+ # puts 'With Username: '
86
+ # connect_via_user = $stdin.gets.chomp
87
+ # connect_via= "#{connect_via_user}@#{connect_via_ip}"
77
88
  count = 0
78
89
  created_at = Time.now.to_s
79
90
  last_time = Time.now.to_s
@@ -3,6 +3,7 @@ require 'optparse'
3
3
  require_relative 'db'
4
4
  require_relative 'client'
5
5
  require_relative 'version'
6
+ require 'byebug'
6
7
 
7
8
  module SSH
8
9
  module Manager
@@ -24,20 +25,26 @@ module SSH
24
25
  elsif @options[:connect]
25
26
  puts 'Connecting ..'
26
27
  cli.new(@options).connect_to(@options[:connect])
28
+ elsif @options[:transfer_file]
29
+ puts 'Transfering file..'
30
+ cli.new(@options).transfer_file(@options[:transfer_file], @argv[2], @argv[3])
27
31
  elsif @options[:delete]
28
32
  puts 'Deleting ..'
29
33
  cli.new(@options).delete(@options[:delete])
30
34
  elsif @options[:list]
31
35
  puts 'Listing ..'
32
36
  cli.new(@options).list_all
37
+ elsif @options[:upgrade]
38
+ puts 'Checking for new updates ..'
39
+ cli.new(@options).update_available
33
40
  elsif @options[:update]
34
41
  puts 'Updating ..'
35
42
  cli.new(@options).update(@options[:update])
36
43
  elsif @options[:multi]
37
- puts 'Connecting to multiple ips'
44
+ puts 'Connecting to multiple ips..'
38
45
  cli.new(@options).multiple_connection(@options[:multi])
39
46
  elsif @options[:transfer_key]
40
- puts 'Transfering key'
47
+ puts 'Transfering key..'
41
48
  cli.new(@options).transfer_key(@options[:transfer_key])
42
49
  elsif @options[:search]
43
50
  puts 'Searching ..'
@@ -63,6 +70,10 @@ module SSH
63
70
  opts.on( '-t', '--transferkey id', 'transfer key to <id>' ) do |opt|
64
71
  @options[:transfer_key] = opt
65
72
  end
73
+ @options[:transfer_file] = false
74
+ opts.on( '-r', '--transferfile filename', 'file or dir / connection_ID / dest_path(default is /home/user/)' ) do |opt|
75
+ @options[:transfer_file] = opt
76
+ end
66
77
  @options[:connect] = false
67
78
  opts.on( '-c', '--connect id', 'connect to <id>' ) do |opt|
68
79
  @options[:connect] = opt
@@ -87,6 +98,10 @@ module SSH
87
98
  opts.on( '-l', '--list', 'list all connections' ) do
88
99
  @options[:list] = true
89
100
  end
101
+ @options[:upgrade] = false
102
+ opts.on( '-g', '--upgrade', 'checks for upgrade' ) do
103
+ @options[:upgrade] = true
104
+ end
90
105
  opts.on( '-h', '--help', 'Display this screen' ) do
91
106
  puts opts
92
107
  exit
@@ -18,7 +18,7 @@ module SSH
18
18
  end
19
19
 
20
20
  def get_connection_data
21
- @connections.map([:ip, :user, :note, :group])
21
+ @connections.map([:ip, :user, :note, :group, :connect_via])
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 = "1.0.0"
3
+ VERSION = "1.0.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.0.0
4
+ version: 1.0.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: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler