sshyguy 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 +7 -0
- data/.gitignore +8 -0
- data/Gemfile +4 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/sshyguy/version.rb +3 -0
- data/lib/sshyguy.rb +69 -0
- data/sshyguy.gemspec +30 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 38deab61564670b6d4384b92b108e8bc3856f2df
|
4
|
+
data.tar.gz: 4898a7d9689af44018baaf64e91fe6e5aca2652f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e847fb9691cd8f87070225df4d1fc472a294b6ad7e5098bb9a41d2791c1cfbec93215530a830adca818d6f393c1eb1543c83e291154313c0afcb2f8710d9e057
|
7
|
+
data.tar.gz: d72bd03a67c3b7f7f7a4d106bd7433f401853fd3c6c0ac2a4ec2776a6ccf61d3ebcf4c75b6135d70184285a91696d06c9fb3bdd2529c79306d44266eaeea5055
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# SSHyGuy
|
2
|
+
|
3
|
+
A command-line tool to manage your SSH connections in a manner that's at least one magnitude better than `history | grep ssh`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install it yourself as:
|
8
|
+
|
9
|
+
$ gem install sshyguy
|
10
|
+
|
11
|
+
Then copy over a sample config file to `~/.sshyguy.json`:
|
12
|
+
|
13
|
+
$ sshyguy --install
|
14
|
+
|
15
|
+
## Setup
|
16
|
+
|
17
|
+
Edit your config file add servers.
|
18
|
+
|
19
|
+
```
|
20
|
+
{
|
21
|
+
"hostname": "192.168.0.123",
|
22
|
+
"port": "60301",
|
23
|
+
"user": "deploy",
|
24
|
+
"label": "Production",
|
25
|
+
"shortcut": "production",
|
26
|
+
"folder": "Unicorn Inc."
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Feeling lazy?
|
33
|
+
|
34
|
+
$ sshyguy
|
35
|
+
|
36
|
+
Will pull up a prompt that allows you to select what server to SSH into:
|
37
|
+
|
38
|
+
Select a server (Use ↑/↓ arrow or number (1-4) keys, press Enter to select)
|
39
|
+
‣ 1. Production (prod)
|
40
|
+
2. Production Database (prod-db)
|
41
|
+
3. Staging (staging)
|
42
|
+
4. Staging Database (staging-db)
|
43
|
+
|
44
|
+
And then it will spawn an SSH connection so you can screw up production.
|
45
|
+
|
46
|
+
You can also get into Staging Database with just one line:
|
47
|
+
|
48
|
+
$ sshyguy -s staging-dbs
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sshyguy"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/sshyguy.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require "sshyguy/version"
|
2
|
+
require 'tty-prompt'
|
3
|
+
require 'optionparser'
|
4
|
+
require 'json'
|
5
|
+
require 'sshyguy/config'
|
6
|
+
require 'sshyguy/prompt'
|
7
|
+
require 'sshyguy/core_ext'
|
8
|
+
require 'sshyguy/menu'
|
9
|
+
require 'sshyguy/server'
|
10
|
+
require 'sshyguy/command'
|
11
|
+
require 'sshyguy/cli'
|
12
|
+
|
13
|
+
module SshyGuy
|
14
|
+
def self.params
|
15
|
+
@params ||= {}
|
16
|
+
end
|
17
|
+
def self.params=(val)
|
18
|
+
@params = val
|
19
|
+
end
|
20
|
+
def self.reload_params!
|
21
|
+
self.params = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.servers=(val)
|
25
|
+
@servers = val
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.servers
|
29
|
+
@servers ||= []
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.configuration
|
33
|
+
@configuration ||= Config.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.config
|
37
|
+
configuration
|
38
|
+
end
|
39
|
+
class Error < StandardError; end
|
40
|
+
|
41
|
+
def self.log(str)
|
42
|
+
if SshyGuy.config.debug?
|
43
|
+
puts str
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.config_file
|
48
|
+
File.expand_path("~/.sshyguy.json")
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.load_config!
|
52
|
+
unless File.exist?(self.config_file)
|
53
|
+
puts "No config file found at #{self.config_file}"
|
54
|
+
puts "Install this with sshyguy --install"
|
55
|
+
exit
|
56
|
+
end
|
57
|
+
begin
|
58
|
+
json = JSON.parse(File.read(self.config_file))
|
59
|
+
json['config'].each do |k,v|
|
60
|
+
configuration.send("#{k}=", v)
|
61
|
+
end
|
62
|
+
Server.build(json['servers'].reject { |server| !server['command'].present? && !server['hostname'].present? })
|
63
|
+
rescue => e
|
64
|
+
puts e
|
65
|
+
puts "Unable to parse config file. Ensure it's valid JSON."
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/sshyguy.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "sshyguy/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sshyguy"
|
7
|
+
spec.version = SshyGuy::VERSION
|
8
|
+
spec.authors = ["Josh Brody"]
|
9
|
+
spec.email = ["josh@josh.mn"]
|
10
|
+
|
11
|
+
spec.summary = "A lazy SSH manager."
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = "https://github.com/joshmn/sshyguy"
|
14
|
+
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "executables"
|
24
|
+
spec.executables = spec.files.grep(%r{^executables/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_dependency "tty-prompt"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sshyguy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Brody
|
8
|
+
autorequire:
|
9
|
+
bindir: executables
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tty-prompt
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: A lazy SSH manager.
|
56
|
+
email:
|
57
|
+
- josh@josh.mn
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- bin/console
|
67
|
+
- bin/setup
|
68
|
+
- lib/sshyguy.rb
|
69
|
+
- lib/sshyguy/version.rb
|
70
|
+
- sshyguy.gemspec
|
71
|
+
homepage: https://github.com/joshmn/sshyguy
|
72
|
+
licenses: []
|
73
|
+
metadata:
|
74
|
+
homepage_uri: https://github.com/joshmn/sshyguy
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.6.13
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: A lazy SSH manager.
|
95
|
+
test_files: []
|