sushi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +22 -0
- data/lib/sushi.rb +1 -0
- data/lib/sushi/ssh.rb +31 -0
- data/lib/sushi/version.rb +3 -0
- data/sushi.gemspec +16 -0
- metadata +67 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 presskey
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= Sushi
|
2
|
+
|
3
|
+
Capistrano SSH recipe that starts a SSH connection to remote server.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
gem install sushi
|
8
|
+
|
9
|
+
== Configuration
|
10
|
+
|
11
|
+
Add next line to config/deploy.rb:
|
12
|
+
|
13
|
+
require 'sushi'
|
14
|
+
|
15
|
+
== Usage
|
16
|
+
|
17
|
+
cap ssh
|
18
|
+
|
19
|
+
# or when multistage support used:
|
20
|
+
cap staging ssh
|
21
|
+
cap production ssh
|
22
|
+
|
data/lib/sushi.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'sushi/ssh'
|
data/lib/sushi/ssh.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'capistrano'
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
4
|
+
|
5
|
+
desc 'Start a SSH connection to remote server'
|
6
|
+
task :ssh do
|
7
|
+
servers = find_servers_for_task(current_task)
|
8
|
+
case servers.count
|
9
|
+
when 0
|
10
|
+
logger.debug "no servers found"
|
11
|
+
when 1
|
12
|
+
ssh_connect servers.first
|
13
|
+
else
|
14
|
+
HighLine.new.choose do |menu|
|
15
|
+
menu.prompt = "Please choose your server: "
|
16
|
+
menu.choices(*servers.map(&:host)) {|choice| ssh_connect servers.select { |s| s.host == choice }.first }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def ssh_connect(server)
|
22
|
+
Capistrano::SSH.connection_strategy(server, self) do |host, user, options|
|
23
|
+
params = "#{user}@#{host}"
|
24
|
+
params += " -p #{options[:port]}" unless options[:port].nil?
|
25
|
+
logger.debug "connecting to #{host}"
|
26
|
+
logger.info "password: #{password}" if self.variables[:password].kind_of?(String)
|
27
|
+
exec "ssh #{params}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/sushi.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'sushi/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'sushi'
|
7
|
+
s.version = Sushi::VERSION.dup
|
8
|
+
s.summary = 'Capistrano SSH recipe.'
|
9
|
+
s.description = 'Capistrano SSH recipe that starts a SSH connection to remote server.'
|
10
|
+
s.author = 'presskey'
|
11
|
+
s.email = 'hello.from.code@gmail.com'
|
12
|
+
s.homepage = 'http://github.com/presskey/sushi'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sushi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- presskey
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-12-01 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Capistrano SSH recipe that starts a SSH connection to remote server.
|
22
|
+
email: hello.from.code@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- LICENSE
|
31
|
+
- README.rdoc
|
32
|
+
- lib/sushi.rb
|
33
|
+
- lib/sushi/ssh.rb
|
34
|
+
- lib/sushi/version.rb
|
35
|
+
- sushi.gemspec
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/presskey/sushi
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.3.6
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Capistrano SSH recipe.
|
66
|
+
test_files: []
|
67
|
+
|