wordmove 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +9 -7
- data/lib/wordmove/generators/Movefile +8 -2
- data/lib/wordmove/hosts/local_host.rb +0 -4
- data/lib/wordmove/hosts/remote_host.rb +60 -14
- data/lib/wordmove/version.rb +1 -1
- data/spec/fixtures/Movefile +1 -0
- metadata +87 -27
data/README.mdown
CHANGED
@@ -55,24 +55,26 @@ remote:
|
|
55
55
|
host: "host"
|
56
56
|
port: 2202 # optional
|
57
57
|
```
|
58
|
-
|
59
|
-
## Requirements
|
60
|
-
* Wordmove requires an SSH connection to the remote host;
|
61
|
-
* Wordmove requires `mysqldump` and `mysql` to be present in the remote host and executable by the SSH user;
|
62
|
-
* Wordmove requires `rsync` to be present and executable in your machine;
|
63
|
-
|
64
58
|
## About SSH authentication
|
65
59
|
|
66
60
|
### If you have your local SSH public key already installed on the remote machine.. (recommended)
|
67
61
|
Just drop the `remote.ssh.password` file on your `Movefile`.
|
68
62
|
|
69
63
|
### Else..
|
70
|
-
You need to have `sshpass` on your machine. On Linux, install it with your standard package manager. On Mac, you can have it via [`brew`](https://github.com/mxcl/homebrew):
|
64
|
+
You need to have [`sshpass`](http://sourceforge.net/projects/sshpass/) on your machine. On Linux, install it with your standard package manager. On Mac, you can have it via [`brew`](https://github.com/mxcl/homebrew):
|
71
65
|
|
72
66
|
```
|
73
67
|
sudo brew install https://raw.github.com/gist/1513663/3e98bf9e03feb7e31eeddcd08f89ca86163a376d/sshpass.rb
|
74
68
|
```
|
75
69
|
|
70
|
+
**Please note that on Ubuntu 11.10 `sshpass` is at version 1.04, which has a [bug](https://bugs.launchpad.net/ubuntu/+source/sshpass/+bug/774882) that prevents it from working. Install version 1.03 or 1.05.**
|
71
|
+
|
72
|
+
## Requirements
|
73
|
+
* Wordmove requires an SSH connection to the remote host;
|
74
|
+
* Wordmove requires `mysqldump` and `mysql` to be present in the remote host and executable by the SSH user;
|
75
|
+
* Wordmove requires `rsync` to be present and executable in your machine;
|
76
|
+
* As said above, you may also need `sshpass` on your machine;
|
77
|
+
|
76
78
|
## License
|
77
79
|
|
78
80
|
(The MIT License)
|
@@ -20,7 +20,13 @@ remote:
|
|
20
20
|
password: "password"
|
21
21
|
host: "host"
|
22
22
|
ssh:
|
23
|
-
username: "username"
|
24
|
-
password: "password" # Password is optional, will use public keys if available.
|
25
23
|
host: "host"
|
24
|
+
username: "username"
|
25
|
+
password: "password" # password is optional, will use public keys if available.
|
26
26
|
# port: 22 # Port is optional
|
27
|
+
#
|
28
|
+
# gateway:
|
29
|
+
# host: "host"
|
30
|
+
# username: "username"
|
31
|
+
# password: "password" # password is optional, will use public keys if available.
|
32
|
+
|
@@ -10,10 +10,6 @@ module Wordmove
|
|
10
10
|
def initialize(options = {})
|
11
11
|
@options = Hashie::Mash.new(options)
|
12
12
|
@logger = @options[:logger]
|
13
|
-
@ssh_extras = {}
|
14
|
-
[ :port, :password ].each do |p|
|
15
|
-
@ssh_extras.merge!( { p => @options.ssh[p] } ) if @options.ssh and @options.ssh[p]
|
16
|
-
end
|
17
13
|
end
|
18
14
|
|
19
15
|
def run(*args)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'net/ssh'
|
2
2
|
require 'net/scp'
|
3
|
+
require 'net/ssh/gateway'
|
3
4
|
|
4
5
|
module Wordmove
|
5
6
|
class RemoteHost < LocalHost
|
@@ -13,37 +14,67 @@ module Wordmove
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def session
|
16
|
-
|
17
|
-
|
17
|
+
if options.ssh.nil?
|
18
|
+
raise Thor::Error, "No SSH credentials provided on Movefile!"
|
19
|
+
end
|
20
|
+
|
21
|
+
ssh_extras = {}
|
22
|
+
[ :port, :password ].each do |p|
|
23
|
+
ssh_extras.merge!( { p => options.ssh[p] } ) if options.ssh[p]
|
24
|
+
end
|
25
|
+
|
26
|
+
if options.ssh.gateway.nil?
|
27
|
+
logger.verbose "Connecting to #{options.ssh.host}..." unless @session.present?
|
28
|
+
@session ||= Net::SSH.start(options.ssh.host, options.ssh.username, ssh_extras)
|
29
|
+
else
|
30
|
+
logger.verbose "Connecting to #{options.ssh.host} through the gateway..." unless @session.present?
|
31
|
+
@session ||= gateway.ssh(options.ssh.host, options.ssh.username, ssh_extras)
|
32
|
+
end
|
33
|
+
|
34
|
+
@session
|
35
|
+
end
|
36
|
+
|
37
|
+
def gateway
|
38
|
+
if options.ssh.gateway.nil?
|
39
|
+
raise Thor::Error, "No SSH credentials provided on Movefile!"
|
40
|
+
end
|
41
|
+
|
42
|
+
ssh_extras = {}
|
43
|
+
[ :port, :password ].each do |p|
|
44
|
+
ssh_extras.merge!( { p => options.ssh.gateway[p] } ) if options.ssh.gateway[p]
|
45
|
+
end
|
46
|
+
|
47
|
+
logger.verbose "Connecting to #{options.ssh.gateway.host}..." unless @gateway.present?
|
48
|
+
@gateway ||= Net::SSH::Gateway.new(options.ssh.gateway.host, options.ssh.gateway.username, ssh_extras )
|
49
|
+
|
50
|
+
@gateway
|
18
51
|
end
|
19
52
|
|
20
53
|
def close
|
21
54
|
session.close
|
55
|
+
if options.ssh.gateway.present?
|
56
|
+
gateway.close(session.transport.port)
|
57
|
+
end
|
22
58
|
end
|
23
59
|
|
24
60
|
def upload_file(source_file, destination_file)
|
25
61
|
logger.verbose "Copying remote #{source_file} to #{destination_file}..."
|
26
|
-
|
27
|
-
ssh.scp.download! source_file, destination_file
|
28
|
-
end
|
62
|
+
session.scp.download! source_file, destination_file
|
29
63
|
end
|
30
64
|
|
31
65
|
def download_file(source_file, destination_file)
|
32
66
|
logger.verbose "Copying local #{source_file} to #{destination_file}..."
|
33
|
-
|
34
|
-
ssh.scp.upload! source_file, destination_file
|
35
|
-
end
|
67
|
+
session.scp.upload! source_file, destination_file
|
36
68
|
end
|
37
69
|
|
38
70
|
def download_dir(source_dir, destination_dir)
|
39
|
-
destination_dir = "
|
71
|
+
destination_dir = ":#{destination_dir}"
|
40
72
|
destination_dir = "#{options.ssh.username}@#{destination_dir}" if options.ssh.username
|
41
73
|
rsync "#{source_dir}/", destination_dir
|
42
74
|
end
|
43
75
|
|
44
76
|
def upload_dir(source_dir, destination_dir)
|
45
|
-
source_dir = "
|
46
|
-
source_dir = "#{options.ssh.username}@#{source_dir}" if options.ssh.username
|
77
|
+
source_dir = ":#{source_dir}/"
|
47
78
|
rsync source_dir, destination_dir
|
48
79
|
end
|
49
80
|
|
@@ -61,11 +92,22 @@ module Wordmove
|
|
61
92
|
exclude_file.write(options.exclude.join("\n"))
|
62
93
|
exclude_file.close
|
63
94
|
|
64
|
-
arguments = [ "-
|
95
|
+
arguments = [ "-azLKO" ]
|
96
|
+
|
97
|
+
if options.ssh && (options.ssh.port || options.ssh.password || options.ssh.gateway)
|
65
98
|
|
66
|
-
|
99
|
+
remote_shell_arguments = []
|
67
100
|
|
68
|
-
|
101
|
+
if options.ssh.gateway
|
102
|
+
host = options.ssh.gateway.host
|
103
|
+
host = "#{options.ssh.gateway.username}@#{host}" if options.ssh.gateway.username
|
104
|
+
remote_shell_arguments << [ "ssh", host ]
|
105
|
+
if options.ssh.gateway.port
|
106
|
+
remote_shell_arguments << [ "-p", options.ssh.gateway.port ]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
remote_shell_arguments << [ "ssh" ]
|
69
111
|
|
70
112
|
if options.ssh.port
|
71
113
|
remote_shell_arguments << [ "-p", options.ssh.port ]
|
@@ -75,6 +117,10 @@ module Wordmove
|
|
75
117
|
remote_shell_arguments = [ "sshpass", "-p", options.ssh.password ] + remote_shell_arguments
|
76
118
|
end
|
77
119
|
|
120
|
+
host = options.ssh.host
|
121
|
+
host = "#{options.ssh.username}@#{host}" if options.ssh.username
|
122
|
+
remote_shell_arguments << host
|
123
|
+
|
78
124
|
arguments << [ "-e", remote_shell_arguments.join(" ") ]
|
79
125
|
end
|
80
126
|
|
data/lib/wordmove/version.rb
CHANGED
data/spec/fixtures/Movefile
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordmove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colored
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: escape
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: net-ssh
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: net-scp
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: thor
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :runtime
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: activesupport
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 3.0.0
|
88
118
|
type: :runtime
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 3.0.0
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: i18n
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,10 +133,15 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :runtime
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
- !ruby/object:Gem::Dependency
|
103
143
|
name: hashie
|
104
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
105
145
|
none: false
|
106
146
|
requirements:
|
107
147
|
- - ! '>='
|
@@ -109,10 +149,15 @@ dependencies:
|
|
109
149
|
version: '0'
|
110
150
|
type: :runtime
|
111
151
|
prerelease: false
|
112
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
113
158
|
- !ruby/object:Gem::Dependency
|
114
159
|
name: rspec
|
115
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
116
161
|
none: false
|
117
162
|
requirements:
|
118
163
|
- - ! '>='
|
@@ -120,10 +165,15 @@ dependencies:
|
|
120
165
|
version: '0'
|
121
166
|
type: :development
|
122
167
|
prerelease: false
|
123
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
124
174
|
- !ruby/object:Gem::Dependency
|
125
175
|
name: cucumber
|
126
|
-
requirement:
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
127
177
|
none: false
|
128
178
|
requirements:
|
129
179
|
- - ! '>='
|
@@ -131,10 +181,15 @@ dependencies:
|
|
131
181
|
version: '0'
|
132
182
|
type: :development
|
133
183
|
prerelease: false
|
134
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
135
190
|
- !ruby/object:Gem::Dependency
|
136
191
|
name: aruba
|
137
|
-
requirement:
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
138
193
|
none: false
|
139
194
|
requirements:
|
140
195
|
- - ! '>='
|
@@ -142,7 +197,12 @@ dependencies:
|
|
142
197
|
version: '0'
|
143
198
|
type: :development
|
144
199
|
prerelease: false
|
145
|
-
version_requirements:
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
146
206
|
description: Capistrano for Wordpress
|
147
207
|
email:
|
148
208
|
- stefano.verna@welaika.com
|
@@ -197,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
257
|
version: '0'
|
198
258
|
requirements: []
|
199
259
|
rubyforge_project:
|
200
|
-
rubygems_version: 1.8.
|
260
|
+
rubygems_version: 1.8.23
|
201
261
|
signing_key:
|
202
262
|
specification_version: 3
|
203
263
|
summary: Capistrano for Wordpress
|