capistrano-different-password 0.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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-different-password.gemspec
4
+ gemspec
5
+
6
+ gem 'capistrano'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 jjy
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Capistrano::Different::Password
2
+
3
+ This gem make you can use different password with capistrano.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'capistrano-different-password'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-different-password
18
+
19
+ ## Usage
20
+
21
+ #capfile
22
+
23
+ require 'capistrano-different-password'
24
+
25
+ set :user,'user'
26
+ set :password,"PasSworD"
27
+
28
+ role :admin,"127.0.0.1","127.0.0.2",["127.0.0.3","DifferentPasSwOrd"]
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,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano-different-password/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano-different-password"
8
+ gem.version = Capistrano::Different::Password::VERSION
9
+ gem.authors = ["jjyr"]
10
+ gem.email = ["jjyruby@gmail.com"]
11
+ gem.description = %q{This gem make you can use different password with capistrano.}
12
+ gem.summary = %q{This gem make you can use different password with capistrano.}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,69 @@
1
+ require "capistrano-different-password/version"
2
+
3
+ class ::Capistrano::ServerDefinition
4
+ attr_reader :password
5
+ def initialize(server, options={})
6
+ if server.is_a? Array
7
+ @password = server[1]
8
+ server = server[0]
9
+ end
10
+ @user, @host, @port = server.match(/^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/)[1,3]
11
+
12
+ @options = options.dup
13
+ user_opt, port_opt = @options.delete(:user), @options.delete(:port)
14
+
15
+ @user ||= user_opt
16
+ @port ||= port_opt
17
+
18
+ @port = @port.to_i if @port
19
+ end
20
+ end
21
+
22
+ class ::Capistrano::SSH
23
+ def self.connection_strategy(server, options={}, &block)
24
+ methods = [ %w(publickey hostbased), %w(password keyboard-interactive) ]
25
+ password_value = nil
26
+
27
+ # construct the hash of ssh options that should be passed more-or-less
28
+ # directly to Net::SSH. This will be the general ssh options, merged with
29
+ # the server-specific ssh-options.
30
+ ssh_options = (options[:ssh_options] || {}).merge(server.options[:ssh_options] || {})
31
+
32
+ # load any SSH configuration files that were specified in the SSH options. This
33
+ # will load from ~/.ssh/config and /etc/ssh_config by default (see Net::SSH
34
+ # for details). Merge the explicitly given ssh_options over the top of the info
35
+ # from the config file.
36
+ ssh_options = Net::SSH.configuration_for(server.host, ssh_options.fetch(:config, true)).merge(ssh_options)
37
+
38
+ # Once we've loaded the config, we don't need Net::SSH to do it again.
39
+ ssh_options[:config] = false
40
+
41
+ ssh_options[:verbose] = :debug if options[:verbose] && options[:verbose] > 0
42
+
43
+ user = server.user || options[:user] || ssh_options[:username] ||
44
+ ssh_options[:user] || ServerDefinition.default_user
45
+ port = server.port || options[:port] || ssh_options[:port]
46
+
47
+ # the .ssh/config file might have changed the host-name on us
48
+ host = ssh_options.fetch(:host_name, server.host)
49
+
50
+ ssh_options[:port] = port if port
51
+
52
+ # delete these, since we've determined which username to use by this point
53
+ ssh_options.delete(:username)
54
+ ssh_options.delete(:user)
55
+
56
+ begin
57
+ connection_options = ssh_options.merge(
58
+ :password => password_value,
59
+ :auth_methods => ssh_options[:auth_methods] || methods.shift
60
+ )
61
+
62
+ yield host, user, connection_options
63
+ rescue Net::SSH::AuthenticationFailed
64
+ raise if methods.empty? || ssh_options[:auth_methods]
65
+ password_value = server.password || options[:password]
66
+ retry
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,7 @@
1
+ module Capistrano
2
+ module Different
3
+ module Password
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-different-password
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - jjyr
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: This gem make you can use different password with capistrano.
15
+ email:
16
+ - jjyruby@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - capistrano-different-password.gemspec
27
+ - lib/capistrano-different-password.rb
28
+ - lib/capistrano-different-password/version.rb
29
+ homepage: ''
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.24
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: This gem make you can use different password with capistrano.
53
+ test_files: []
54
+ has_rdoc: