uberssh 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 00ceb1a29c2b813d5df35a33cd0692de1f2bc2bd
4
+ data.tar.gz: c272b3853e0a0389356f2d97bcbc87de93b71ffe
5
+ SHA512:
6
+ metadata.gz: 30efa33ed2656808ba981f185b5e6e1c615ed8168541804a699df811dda5dd36521eb532125d509006bbab7ebd250023a9e0a9ea3e27f4d5215647eb8766c11a
7
+ data.tar.gz: 18885444f600606bfc994273c5459b87e5264fac1c1ad6f77f4a8574e0387dd0cbc7b15bad24ee860527262fa564d561b501b40de2237e7293fff5869f161c86
data/.gitignore ADDED
@@ -0,0 +1,31 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ Gemfile.lock
31
+ .ruby-version
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in uberssh.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sebastian Oelke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Uberssh
2
+
3
+ Uberssh is a script to select to which of your [Uberspaces](https://uberspace.de/) you want to connect to via ssh in just a few key strokes.
4
+
5
+ The script was initially written by [pixelpogo](https://github.com/pixelpogo/).
6
+
7
+ ## Installation
8
+
9
+ To install the gem use the following command:
10
+
11
+ $ gem install uberssh
12
+
13
+ ## Usage
14
+
15
+ 1. Create the file `.uberssh` in your home directory.
16
+ 2. Define your Uberspaces in `.uberssh`:
17
+
18
+ ```yaml
19
+ # ~/.uberssh
20
+ accounts:
21
+ foo: # your Uberspace account name
22
+ project: "My Foo" # an arbitrary description of the project
23
+ hostname: cepheus.uberspace.de # the hostname of your Uberspace
24
+ ssh-key: ~/.ssh/uberspace_rsa # the ssh key used to connect to your Uberspace
25
+ bar:
26
+ project: "My Bar"
27
+ hostname: perseus.uberspace.de
28
+ ssh-key: ~/.ssh/uberspace_rsa
29
+ # ...
30
+ ```
31
+
32
+ 3. Run `uberssh` from your command line.
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec uberssh` to use the code located in this directory, ignoring other installed copies of this gem.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it ( https://github.com/baschtl/uberssh/fork )
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "uberssh"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/uberssh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "uberssh"
5
+
6
+ Uberssh.connect!
@@ -0,0 +1,28 @@
1
+ require 'yaml'
2
+
3
+ module Uberssh
4
+
5
+ class AccountManager
6
+
7
+ def self.accounts
8
+ raise "No uberssh configuration found in #{config}" unless File.exist?(config)
9
+ YAML.load_file(config)['accounts']
10
+ end
11
+
12
+ def self.ssh(name)
13
+ a = account(name)
14
+ raise "Unknown Uberspace account '#{name}'" if a.nil?
15
+ "ssh -l #{name} #{a['hostname']} -i #{a['ssh-key']}"
16
+ end
17
+
18
+ def self.account(name)
19
+ accounts[name]
20
+ end
21
+
22
+ def self.config
23
+ Etc.getpwuid.dir. + "/.uberssh"
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,3 @@
1
+ module Uberssh
2
+ VERSION = "0.1.0"
3
+ end
data/lib/uberssh.rb ADDED
@@ -0,0 +1,71 @@
1
+ require "uberssh/version"
2
+ require "uberssh/account_manager"
3
+
4
+ require 'optparse'
5
+ require 'ostruct'
6
+ require 'etc'
7
+
8
+ module Uberssh
9
+
10
+ def self.connect!
11
+ options = OpenStruct.new
12
+ OptionParser.new do |opts|
13
+
14
+ opts.banner = "Uberssh"
15
+ opts.define_head "SSH to your uberspace"
16
+ opts.separator ""
17
+ opts.separator "Options:"
18
+
19
+ opts.on_tail("--help", "Show this message") do
20
+ puts opts
21
+ puts "\nTo be written...\n\n"
22
+ exit
23
+ end
24
+
25
+ opts.on_tail("-a", "--account ACCOUNTNAME", "Specify your account") do |a|
26
+ options.account = a
27
+ end
28
+
29
+ begin
30
+ opts.parse!
31
+ rescue OptionParser::ParseError
32
+ puts opts
33
+ exit 1
34
+ end
35
+
36
+ end
37
+
38
+ begin
39
+
40
+ if options.account.nil?
41
+ puts "\n============================================================="
42
+ puts " uberssh - ssh to your uberspace"
43
+ puts "=============================================================\n"
44
+
45
+ accounts = []
46
+ AccountManager.accounts.each_pair do |account, settings|
47
+ accounts << account
48
+ puts "[#{accounts.size}] #{settings['project']}"
49
+ end
50
+ print "\n--> Please select account: "
51
+ index = gets.chomp.to_i
52
+ options.account = accounts[index - 1]
53
+ end
54
+
55
+
56
+ system "clear"
57
+ puts "Connecting to #{AccountManager.account(options.account)['project'].upcase}...\n"
58
+
59
+ AccountManager.ssh(options.account).each_line do |ssh|
60
+ puts ssh
61
+ puts "\n"
62
+ exec ssh
63
+ end
64
+
65
+ rescue Exception => e
66
+ puts e.message
67
+ end
68
+
69
+ end
70
+
71
+ end
data/uberssh.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'uberssh/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "uberssh"
8
+ spec.version = Uberssh::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ["Sebastian Oelke"]
11
+ spec.email = ["dev@soelke.de"]
12
+
13
+ spec.summary = %q{Connect to one of your multiple uberspaces with just one command.}
14
+ spec.description = %q{Uberssh is a script that let's you select to which of your uberspaces you want to connect to via ssh in just a few key strokes.}
15
+ spec.homepage = "https://github.com/baschtl/uberssh.git"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "bundler", "~> 1.9"
24
+
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3"
27
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uberssh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Oelke
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-08 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: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ description: Uberssh is a script that let's you select to which of your uberspaces
56
+ you want to connect to via ssh in just a few key strokes.
57
+ email:
58
+ - dev@soelke.de
59
+ executables:
60
+ - uberssh
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - exe/uberssh
72
+ - lib/uberssh.rb
73
+ - lib/uberssh/account_manager.rb
74
+ - lib/uberssh/version.rb
75
+ - uberssh.gemspec
76
+ homepage: https://github.com/baschtl/uberssh.git
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.4.5
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Connect to one of your multiple uberspaces with just one command.
100
+ test_files: []