ssh-manager 0.0.2 → 0.0.4

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: 5dcda00a24bcba3bca0dfa44eeb18a49e481b827
4
- data.tar.gz: aca2781e8fea7ed5c5531ee5dce68af933393352
3
+ metadata.gz: e9777e60f944ffc271486cfa37d2ad112e8f17c5
4
+ data.tar.gz: eebe6798b222dd3de38655d2417d883a1c3cc882
5
5
  SHA512:
6
- metadata.gz: d533766bba6fb794b5c50ceb1b0f2ecc10c11ef02627a62b3fe947e6ade5d264d60e2686de929f28bba57cfcc10f730ad4bdc1e9584e721ce18e82ee6d1d3575
7
- data.tar.gz: ed012e88158d72d30c65bef7894f5998a6f1378821593af0706a0d379d5c45f3ec5dce3f490198440e46528f7074c2ff83aeb74de8f0ff81205b83259b77b33e
6
+ metadata.gz: 242c2d496e2441cef66f49393108042106d28893454d2b1a69d3e496267811f8423711962596991caf78508968585385987902f99d26838b77812207a94e5f53
7
+ data.tar.gz: 5d26eb6486331fb49cc3d2cba3bf5bd026617ef5f5eccdc96d34baf4673a5a922ae783d6657801ba2932a22d8fdded2b4a57841a4ca8a854a6dd28384f5771c6
data/README.md CHANGED
@@ -19,35 +19,63 @@ Or install it yourself as:
19
19
 
20
20
  ## Usage
21
21
 
22
- `sshm add 192.168.0.1 -u -p -h -n`
23
22
 
24
- -a == add
23
+ Usage: sshm [options] ...
25
24
 
26
- -u == user
25
+ -a, --add ip Add ip to your Connection list
27
26
 
28
- -p == port[optional]
27
+ -c, --connect id connect to <id>
29
28
 
30
- -h == hostname[optional]
29
+ -d, --delete id delete connection <id>
31
30
 
32
- -n == notes[optional]
31
+ -u, --update id update connection <id>
33
32
 
33
+ -s, --search string search connection for given criteria
34
34
 
35
- `sshm`
35
+ -l, --list list all connections
36
36
 
37
- 1. 192.168.0.1 | your first connection
38
- 2. 10.120.0.1 | some
39
- 3. 192.168.1.1 | more
40
- 4. 10.10.120.0 | connections
41
- 5. 188.42.69.88 | you added
42
- connect to: [1-5]
37
+ -h, --help Display this screen
43
38
 
39
+ -v, --version Print programs version
44
40
 
45
41
 
46
- `sshm update [1-5]`
47
42
 
48
- `sshm delete [1-5]`
43
+ `sshm -l`
49
44
 
50
45
 
46
+ Listing ..
47
+
48
+ ID IP USERNAME HOSTNAME PORT NOTES
49
+
50
+ 1: 10.120.66.8 user hostname 22 mylap
51
+
52
+ 2: 192.168.0.14 user hostname 22 phone
53
+
54
+ 3: 10.120.4.63 user hsotname 22 worklap
55
+
56
+ 4: 192.168.0.193 user hostname 22 rasp home
57
+
58
+
59
+
60
+
61
+ `sshm -u [1-5]`
62
+
63
+ `sshm -d [1-5]`
64
+
65
+ `sshm -c [1-5]`
66
+
67
+ or quickconnect
68
+
69
+ `sshm [1-5]`
70
+
71
+
72
+
73
+ ## Config
74
+
75
+ Configfile and database is located in ~/.config/sshm/
76
+
77
+ Change the `terminal` entry to your prefered term.
78
+
51
79
 
52
80
  ## Contributing
53
81
 
File without changes
data/config/settings.yml CHANGED
@@ -1,2 +1,2 @@
1
- terminal : "xfce4-terminal"
1
+ terminal : "xterm"
2
2
  deletion_interval : "never"
data/config/sshm.db ADDED
Binary file
@@ -2,6 +2,7 @@ require_relative 'db'
2
2
  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
+ require 'debugger'
5
6
 
6
7
  module SSH
7
8
  module Manager
@@ -14,9 +15,17 @@ module SSH
14
15
  def connect_to(id)
15
16
  ip = SSH::Manager::Database.new.get_connection_data[id.to_i-1][0]
16
17
  user = SSH::Manager::Database.new.get_connection_data[id.to_i-1][1]
17
- # different terminals different behaviour .. i.e. xterm -C 'ssh...'
18
- # TODO: add function for different terms
19
- %x(#{CONFIG['terminal']} --command="ssh #{user}@#{ip}")
18
+ if CONFIG['terminal'] == "xfce4-terminal" || "gnome-terminal"
19
+ %x(#{CONFIG['terminal']} --command="ssh #{user}@#{ip}")
20
+ elsif CONFIG['terminal'] == "xterm"
21
+ %x(#{CONFIG['terminal']} -C "ssh #{user}@#{ip}")
22
+ else
23
+ puts "We dont support #{CONFIG['terminal']} right now"
24
+ puts "Check Github for further development or contributing"
25
+ end
26
+
27
+
28
+
20
29
  end
21
30
 
22
31
  def add_connection(ip)
@@ -1,5 +1,4 @@
1
1
  #require_relative "../manager"
2
- require 'debugger'
3
2
  require 'optparse'
4
3
  require_relative 'db'
5
4
  require_relative 'client'
@@ -37,7 +36,8 @@ module SSH
37
36
  puts 'Searching ..'
38
37
  cli.new(@options).search_for(@options[:search])
39
38
  else
40
- puts @optparse
39
+ cli.new(@argv.first).connect_to(@argv.first) if @argv != []
40
+ puts @optparse if @argv ==[]
41
41
  exit
42
42
  end
43
43
  end
@@ -58,7 +58,7 @@ module SSH
58
58
  @options[:delete] = opt
59
59
  end
60
60
  @options[:update] = false
61
- opts.on( '-u', '--delete id', 'update connection <id>' ) do |opt|
61
+ opts.on( '-u', '--update id', 'update connection <id>' ) do |opt|
62
62
  @options[:update] = opt
63
63
  end
64
64
  @options[:search] = false
@@ -5,8 +5,8 @@ module SSH
5
5
  module Manager
6
6
  class Database
7
7
 
8
+ FileUtils.cp ("#{File.dirname(__FILE__)}/../../../config/sshm.db"), ("#{File.join(Dir.home)}" + '/.config/sshm/') unless File.exists?(("#{File.join(Dir.home)}" + '/.config/sshm/sshm.db'))
8
9
  FileUtils.mkdir_p("#{File.join(ENV['HOME'])}/.config/sshm/") unless Dir.exists?("#{ENV['HOME']}/.config/sshm")
9
- FileUtils.cp ("#{File.dirname(__FILE__)}/../../../sshm.db"), ("#{File.join(Dir.home)}" + '/.config/sshm/') unless File.exists?(("#{File.join(Dir.home)}" + '/.config/sshm/sshm.db'))
10
10
 
11
11
  @path = "#{File.join(ENV['HOME'])}/.config/sshm"
12
12
  DATABASE = Sequel.connect("sqlite://#{@path}/sshm.db")
@@ -1,5 +1,5 @@
1
1
  module SSH
2
2
  module Manager
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
data/ssh-manager.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://rubygems.org/profiles/jschmid"
14
14
  spec.license = "GPL"
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
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: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Schmid, Juraj Hura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,7 +70,7 @@ description: ssh connections easy
70
70
  email:
71
71
  - jschmid@suse.com, jhura@suse.cz
72
72
  executables:
73
- - sshm.rb
73
+ - sshm
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
@@ -86,8 +86,9 @@ files:
86
86
  - LICENSE
87
87
  - README.md
88
88
  - Rakefile
89
- - bin/sshm.rb
89
+ - bin/sshm
90
90
  - config/settings.yml
91
+ - config/sshm.db
91
92
  - doc/user_spec
92
93
  - lib/ssh/manager.rb
93
94
  - lib/ssh/manager/cli.rb