capistrano-ssh 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/capistrano-ssh.gemspec +22 -0
- data/lib/capistrano-ssh.rb +0 -0
- data/lib/capistrano/ssh.rb +41 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3c17906b318fca7de6888d10b3da41cafeaa2b11
|
4
|
+
data.tar.gz: 51c86d4164189b975ab8d69e15264546287bc09c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b87d4c4a7980d3d118edf5d911b09c86b25ecfeba2b2dea761037b1fa469da1fe9ace193bfd32729a4eeb8fe7f87841bc321997fea89276b11a218cc7b014765
|
7
|
+
data.tar.gz: 98f0cd3ed61053046bad236c6fc22df1666ead652fe986ebddc627293900d2b4dbdd0643f0adbce15d375264d1ee019ecc0e26bbd990a83d3f34fd58ea4cf400
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jad Bitar (bitarjad@gmail.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Capistrano::SSH
|
2
|
+
|
3
|
+
SSH tasks for Capistrano v3.*
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano', '~> 3.0.0'
|
11
|
+
gem 'capistrano-ssh'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install capistrano-ssh
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Require the module in your `Capfile`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'capistrano/ssh'
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'capistrano-ssh'
|
6
|
+
spec.version = '0.0.1'
|
7
|
+
spec.authors = ['Jad Bitar']
|
8
|
+
spec.email = ['bitarjad@gmail.com']
|
9
|
+
spec.description = %q{SSH tasks for Capistrano v3.*}
|
10
|
+
spec.summary = %q{SSH tasks for Capistrano v3.*}
|
11
|
+
spec.homepage = 'https://github.com/jadb/capistrano-ssh'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
|
14
|
+
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ['lib']
|
17
|
+
|
18
|
+
spec.add_dependency 'capistrano', '~> 3.0', '>= 3.0.0'
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
21
|
+
spec.add_development_dependency 'rake', '~> 0'
|
22
|
+
end
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
namespace :ssh do
|
2
|
+
desc <<-DESC
|
3
|
+
Uploads a shared key to the given host
|
4
|
+
DESC
|
5
|
+
task :key, [:user, :key] do |t, args|
|
6
|
+
file = args.key
|
7
|
+
|
8
|
+
if not File.exists?(file) or not File.exists?("#{file}.pub")
|
9
|
+
fail "SSH key #{args.key} does not exist."
|
10
|
+
end
|
11
|
+
|
12
|
+
on roles(:all) do |s|
|
13
|
+
homedir = capture("echo $(eval echo ~#{args.user})")
|
14
|
+
if (test("[ -d #{homedir} ]"))
|
15
|
+
sshdir = "#{homedir}/.ssh"
|
16
|
+
sudo "mkdir -p #{sshdir}"
|
17
|
+
upload_to file, sshdir
|
18
|
+
upload_to "#{file}.pub", sshdir
|
19
|
+
else
|
20
|
+
fail "#{args.user} does not exist on #{s}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc <<-DESC
|
26
|
+
Runs an arbitrary SSH command and prints the output
|
27
|
+
DESC
|
28
|
+
task :cmd, [:command] do |t, args|
|
29
|
+
on roles(:all) do |s|
|
30
|
+
puts capture("sudo #{args.command}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def upload_to src, dst
|
35
|
+
if File.exists?(src)
|
36
|
+
file = File.basename(src)
|
37
|
+
upload! src, './'
|
38
|
+
sudo "mv ./#{file} #{dst}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-ssh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jad Bitar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: SSH tasks for Capistrano v3.*
|
62
|
+
email:
|
63
|
+
- bitarjad@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- ".gitignore"
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- capistrano-ssh.gemspec
|
74
|
+
- lib/capistrano-ssh.rb
|
75
|
+
- lib/capistrano/ssh.rb
|
76
|
+
homepage: https://github.com/jadb/capistrano-ssh
|
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.2.2
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: SSH tasks for Capistrano v3.*
|
100
|
+
test_files: []
|