public
Description: Remote multi-server automation tool
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
Search Repo:
Add an explicit dependency on net-ssh and net-sftp < 1.99.0
jamis (author)
Mon Apr 28 09:46:13 -0700 2008
commit  c746803b22c1117a76f79013b38fc0da15f1b2b4
tree    1a5b8f22a8ac15d23859e5fa025cb8c01a70746e
parent  54cee940d2834f406d960d30193b8e442f55126a
...
1
 
 
 
2
3
4
 
5
6
7
...
 
1
2
3
4
5
6
7
8
9
10
0
@@ -1,7 +1,10 @@
0
-*SVN*
0
+*unreleased*
0
+
0
+* Add an explicit dependency on Net::SSH and Net::SFTP versions less than 1.99.0 so that cap1 can coexist with net-ssh v2 [Jamis Buck]
0
 
0
 * Don't send no-auth-cache if no auth credentials are given [Jonathan Younger]
0
 
0
+
0
 *1.4.1* (February 24, 2007)
0
 
0
 * Use the no-auth-cache option with subversion so that username/password tokens do not get cached by capistrano usage [Jonathan Younger]
...
20
21
22
23
24
 
 
25
26
27
...
20
21
22
 
 
23
24
25
26
27
0
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
0
 
0
   s.add_dependency 'rake', ">= 0.7.0"
0
 
0
- s.add_dependency 'net-ssh', ">= #{Capistrano::Version::SSH_REQUIRED.join(".")}"
0
- s.add_dependency 'net-sftp', ">= #{Capistrano::Version::SFTP_REQUIRED.join(".")}"
0
+ s.add_dependency 'net-ssh', ">= #{Capistrano::Version::MINIMUM_SSH_REQUIRED.join(".")}", "< #{Capistrano::Version::MAXIMUM_SSH_REQUIRED.join('.')}"
0
+ s.add_dependency 'net-sftp', ">= #{Capistrano::Version::MINIMUM_SFTP_REQUIRED.join(".")}", "< #{Capistrano::Version::MINIMUM_SSH_REQUIRED.join('.')}"
0
 
0
   s.author = "Jamis Buck"
0
   s.email = "jamis@37signals.com"
...
 
 
 
 
 
 
1
2
3
...
5
6
7
8
9
 
 
10
11
12
...
1
2
3
4
5
6
7
8
9
...
11
12
13
 
 
14
15
16
17
18
0
@@ -1,3 +1,9 @@
0
+begin
0
+ require 'rubygems'
0
+ gem 'net-ssh', '< 1.99.0'
0
+rescue LoadError, NameError
0
+end
0
+
0
 require 'net/ssh'
0
 
0
 module Capistrano
0
@@ -5,8 +11,8 @@ module Capistrano
0
     require 'capistrano/version'
0
     require 'net/ssh/version'
0
     ssh_version = [Net::SSH::Version::MAJOR, Net::SSH::Version::MINOR, Net::SSH::Version::TINY]
0
- if !Version.check(Version::SSH_REQUIRED, ssh_version)
0
- raise "You have Net::SSH #{ssh_version.join(".")}, but you need at least #{Version::SSH_REQUIRED.join(".")}"
0
+ if !Version.check(ssh_version, Version::MINIMUM_SSH_REQUIRED, Version::MAXIMUM_SSH_REQUIRED)
0
+ raise "You have Net::SSH #{ssh_version.join(".")}, but you need a version between #{Version::MINIMUM_SSH_REQUIRED.join(".")}...#{Version::MAXIMUM_SSH_REQUIRED.join(".")}"
0
     end
0
   end
0
 
...
1
2
 
 
 
 
 
 
 
3
4
 
5
6
7
8
 
 
9
10
11
...
1
2
3
4
5
6
7
8
9
10
11
12
13
 
 
 
14
15
16
17
18
0
@@ -1,11 +1,18 @@
0
 begin
0
   require 'capistrano/version'
0
+
0
+ begin
0
+ require 'rubygems'
0
+ gem 'net-sftp', '< 1.99.0'
0
+ rescue LoadError, NameError
0
+ end
0
+
0
   require 'net/sftp'
0
   require 'net/sftp/version'
0
+
0
   sftp_version = [Net::SFTP::Version::MAJOR, Net::SFTP::Version::MINOR, Net::SFTP::Version::TINY]
0
- required_version = [1,1,0]
0
- if !Capistrano::Version.check(required_version, sftp_version)
0
- warn "You have Net::SFTP #{sftp_version.join(".")}, but you need at least #{required_version.join(".")}. Net::SFTP will not be used."
0
+ if !Capistrano::Version.check(sftp_version, Capistrano::Version::MINIMUM_SFTP_REQUIRED, Capistrano::Version::MAXIMUM_SFTP_REQUIRED)
0
+ warn "You have Net::SFTP #{sftp_version.join(".")}, but you need between #{Capistrano::Version::MINIMUM_SFTP_REQUIRED.join('.')}...#{Capistrano::Version::MAXIMUM_SFTP_REQUIRED.join('.')}. Net::SFTP will not be used."
0
     Capistrano::SFTP = false
0
   else
0
     Capistrano::SFTP = true
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
 
 
 
 
 
 
 
 
19
20
21
22
23
 
24
25
26
27
28
 
 
 
 
 
29
30
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4
5
6
7
8
9
10
11
12
13
14
15
 
16
17
18
19
 
 
20
21
22
23
24
25
26
0
@@ -1,30 +1,26 @@
0
 module Capistrano
0
   module Version #:nodoc:
0
- # A method for comparing versions of required modules. It expects two
0
- # arrays as parameters, and returns true if the first is no more than the
0
- # second.
0
- def self.check(expected, actual) #:nodoc:
0
- good = false
0
- if actual[0] > expected[0]
0
- good = true
0
- elsif actual[0] == expected[0]
0
- if actual[1] > expected[1]
0
- good = true
0
- elsif actual[1] == expected[1] && actual[2] >= expected[2]
0
- good = true
0
- end
0
- end
0
-
0
- good
0
+ # A method for comparing versions of required modules. It expects
0
+ # arrays as parameters, and returns true if the first is no less than the
0
+ # second, and strictly less than the third.
0
+ def self.check(actual, minimum, maximum) #:nodoc:
0
+ actual = actual[0] * 1_000_000 + actual[1] * 1_000 + actual[2]
0
+ minimum = minimum[0] * 1_000_000 + minimum[1] * 1_000 + minimum[2]
0
+ maximum = maximum[0] * 1_000_000 + maximum[1] * 1_000 + maximum[2]
0
+
0
+ return actual >= minimum && actual < maximum
0
     end
0
 
0
     MAJOR = 1
0
     MINOR = 4
0
- TINY = 1
0
+ TINY = 2
0
 
0
     STRING = [MAJOR, MINOR, TINY].join(".")
0
     
0
- SSH_REQUIRED = [1,0,10]
0
- SFTP_REQUIRED = [1,1,0]
0
+ MINIMUM_SSH_REQUIRED = [1,0,10]
0
+ MAXIMUM_SSH_REQUIRED = [1,99,0]
0
+
0
+ MINIMUM_SFTP_REQUIRED = [1,1,0]
0
+ MAXIMUM_SFTP_REQUIRED = [1,99,0]
0
   end
0
 end

Comments

  • frahugo Tue Jun 17 04:15:01 -0700 2008

    It would be really cool to have this branch merged into the master, cause since 2.3 I can’t use Capistrano with some of my old installations (net-ssh version is too high and breaks 1.3.1 compatibility).