capistrano-shell 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cce5ddd775a920494e728a20765425cdc0b12226
4
+ data.tar.gz: 7f8e712670942a5c91e360931508ddc0b99d1adb
5
+ SHA512:
6
+ metadata.gz: a480b48b843aea37fa36ada0842171f9fff73bc2168745437a5fb27a033044b97af7cb0db3ae1804793ea50a7539db2d5c17d2c194767881fb4bb1461f0a0f7a
7
+ data.tar.gz: 8d01b7941037dfe481f24d94856e455ae5c546f4d471577a58f5a59fada5d77088b37ca4f80867154db31eef7a241b5fefa39f175e97af6e492e96f74d8058dd
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Vladimir Kochnev
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Capistrano::Shell
2
+
3
+ Opens SSH shell on remote host in current release directory. Requires Capistrano 3.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano-shell'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-shell
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ # Capfile
25
+ require 'capistrano/shell'
26
+ ```
27
+
28
+ ```ruby
29
+ # config/deploy/production.rb
30
+
31
+ server 'server1', user: 'deploy', roles: %w{app}
32
+ server 'server2', user: 'deploy', roles: %w{db}, no_release: true
33
+ ```
34
+
35
+ Then you should be able to do something like this:
36
+
37
+ $ cap production shell
38
+ $ cap production shell ROLES=app
39
+ $ cap production shell HOSTS=server1
40
+ $ cap production shell HOSTS=server2
41
+
42
+ When connecting to `server1` ssh will cd into `/var/www/your_app/current` directory(`release_path`). But when connecting to `server2` just `/home/deploy` will be opened because `server2` is marked as `no_release`.
43
+
44
+ In the last two example the `HOSTS` environment variable is used. However, you probably don't need to use it because `capistrano/shell` asks you what server to use when there are many.
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( https://github.com/marshall-lee/capistrano-shell/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'capistrano-shell'
7
+ spec.version = '0.1.0'
8
+ spec.authors = ['Vladimir Kochnev']
9
+ spec.email = ['hashtable@yandex.ru']
10
+
11
+ spec.summary = 'Opens SSH shell on remote host in current release directory'
12
+ spec.homepage = 'https://github.com/marshall-lee/capistrano-shell'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_development_dependency 'bundler', '~> 1.8'
19
+ spec.add_development_dependency 'rake', '~> 10.0'
20
+
21
+ spec.add_dependency 'capistrano', '~> 3.1'
22
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/shell.rake", __FILE__)
@@ -0,0 +1,50 @@
1
+ desc 'Opens SSH shell on remote host in current release directory'
2
+ task :shell do
3
+ hosts = []
4
+ on roles(:all), in: :sequence, wait: 0 do |host|
5
+ hosts << host
6
+ end
7
+
8
+ if hosts.none?
9
+ puts 'No servers matched'
10
+ exit
11
+ elsif hosts.length == 1
12
+ set :shell_server_number, 1
13
+ else
14
+ hosts.each_with_index do |host, i|
15
+ puts "#{i + 1}) #{host} (#{host.roles.to_a.join ' '})"
16
+ end
17
+ end
18
+
19
+ i = fetch(:shell_server_number).to_i - 1
20
+ host = hosts[i]
21
+ options = host.netssh_options
22
+
23
+ cmd = ['ssh', '-t']
24
+ cmd << '-A' if options[:forward_agent]
25
+ Array(options[:keys]).each do |key|
26
+ cmd << '-i'
27
+ cmd << key
28
+ end
29
+ if options[:port]
30
+ cmd << '-p'
31
+ cmd << options[:port]
32
+ end
33
+ user_hostname = [options[:user], host.hostname].compact.join('@')
34
+ cmd << user_hostname
35
+
36
+ if host.properties.fetch(:no_release)
37
+ cmd << '$SHELL'
38
+ else
39
+ cmd << "cd #{release_path} && $SHELL"
40
+ end
41
+
42
+ puts "Executing #{cmd.join ' '}"
43
+ exec(*cmd)
44
+ end
45
+
46
+ namespace :load do
47
+ task :defaults do
48
+ set :shell_server_number, ask('server number', 1)
49
+ end
50
+ end
File without changes
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-shell
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vladimir Kochnev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-16 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.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
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: capistrano
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description:
56
+ email:
57
+ - hashtable@yandex.ru
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - capistrano-shell.gemspec
68
+ - lib/capistrano-shell.rb
69
+ - lib/capistrano/shell.rb
70
+ - lib/capistrano/tasks/shell.rake
71
+ homepage: https://github.com/marshall-lee/capistrano-shell
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
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.4.6
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Opens SSH shell on remote host in current release directory
95
+ test_files: []
96
+ has_rdoc: