wordmove 0.0.6 → 0.0.7
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 +1 -0
- data/Gemfile.lock +1 -1
- data/README.mdown +13 -1
- data/lib/wordmove/hosts/remote_host.rb +13 -10
- data/lib/wordmove/version.rb +1 -1
- data/spec/fixtures/Movefile +3 -2
- data/spec/remote_host_spec.rb +52 -27
- metadata +25 -34
- data/README +0 -0
- data/spec/fixtures/Movefile.no_password +0 -24
- data/spec/fixtures/Movefile.no_port +0 -25
- data/spec/fixtures/Movefile.port +0 -26
- data/spec/fixtures/Movefile.with_password +0 -25
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.mdown
CHANGED
@@ -56,11 +56,23 @@ remote:
|
|
56
56
|
port: 2202 # optional
|
57
57
|
```
|
58
58
|
|
59
|
-
##
|
59
|
+
## Requirements
|
60
60
|
* Wordmove requires an SSH connection to the remote host;
|
61
61
|
* Wordmove requires `mysqldump` and `mysql` to be present in the remote host and executable by the SSH user;
|
62
62
|
* Wordmove requires `rsync` to be present and executable in your machine;
|
63
63
|
|
64
|
+
## About SSH authentication
|
65
|
+
|
66
|
+
### If you have your local SSH public key already installed on the remote machine.. (recommended)
|
67
|
+
Just drop the `remote.ssh.password` file on your `Movefile`.
|
68
|
+
|
69
|
+
### 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):
|
71
|
+
|
72
|
+
```
|
73
|
+
sudo brew install https://raw.github.com/gist/1513663/3e98bf9e03feb7e31eeddcd08f89ca86163a376d/sshpass.rb
|
74
|
+
```
|
75
|
+
|
64
76
|
## License
|
65
77
|
|
66
78
|
(The MIT License)
|
@@ -36,11 +36,15 @@ module Wordmove
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def download_dir(source_dir, destination_dir)
|
39
|
-
|
39
|
+
destination_dir = "#{options.ssh.host}:#{destination_dir}"
|
40
|
+
destination_dir = "#{options.ssh.username}@#{destination_dir}" if options.ssh.username
|
41
|
+
rsync "#{source_dir}/", destination_dir
|
40
42
|
end
|
41
43
|
|
42
44
|
def upload_dir(source_dir, destination_dir)
|
43
|
-
|
45
|
+
source_dir = "#{options.ssh.host}:#{source_dir}/"
|
46
|
+
source_dir = "#{options.ssh.username}@#{source_dir}" if options.ssh.username
|
47
|
+
rsync source_dir, destination_dir
|
44
48
|
end
|
45
49
|
|
46
50
|
def run(*args)
|
@@ -59,26 +63,25 @@ module Wordmove
|
|
59
63
|
|
60
64
|
arguments = [ "-azLK" ]
|
61
65
|
|
62
|
-
|
63
|
-
|
66
|
+
if options.ssh && (options.ssh.port || options.ssh.password)
|
67
|
+
|
68
|
+
remote_shell_arguments = [ "ssh" ]
|
64
69
|
|
65
70
|
if options.ssh.port
|
66
|
-
|
71
|
+
remote_shell_arguments << [ "-p", options.ssh.port ]
|
67
72
|
end
|
68
73
|
|
69
74
|
if options.ssh.password
|
70
|
-
|
71
|
-
password_file.write(options.ssh.password)
|
72
|
-
password_file.close
|
73
|
-
arguments << "--password-file=#{password_file.path}"
|
75
|
+
remote_shell_arguments = [ "sshpass", "-p", options.ssh.password ] + remote_shell_arguments
|
74
76
|
end
|
77
|
+
|
78
|
+
arguments << [ "-e", remote_shell_arguments.join(" ") ]
|
75
79
|
end
|
76
80
|
|
77
81
|
arguments << [ "--exclude-from=#{exclude_file.path}", "--delete", source_dir, destination_dir ]
|
78
82
|
arguments.flatten!
|
79
83
|
locally_run "rsync", *arguments
|
80
84
|
|
81
|
-
password_file.unlink if password_file
|
82
85
|
exclude_file.unlink
|
83
86
|
end
|
84
87
|
|
data/lib/wordmove/version.rb
CHANGED
data/spec/fixtures/Movefile
CHANGED
data/spec/remote_host_spec.rb
CHANGED
@@ -2,36 +2,61 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Wordmove::RemoteHost do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@logger.level = Logger::INFO
|
9
|
-
@config.remote[:logger] = @logger
|
10
|
-
@host = Wordmove::RemoteHost.new( @config.remote )
|
11
|
-
@host.stub!(:locally_run).and_return( 1 )
|
12
|
-
end
|
5
|
+
let!(:config) {
|
6
|
+
Hashie::Mash.new(YAML::load(File.open(File.join( File.dirname(__FILE__), "fixtures", "Movefile"))))
|
7
|
+
}
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
let(:host) {
|
10
|
+
logger = Wordmove::Logger.new
|
11
|
+
logger.level = Logger::INFO
|
12
|
+
config.remote[:logger] = @logger
|
13
|
+
host = Wordmove::RemoteHost.new( config.remote )
|
14
|
+
host.stub!(:locally_run).and_return( 1 )
|
15
|
+
host
|
16
|
+
}
|
19
17
|
|
20
|
-
|
21
|
-
load_config( File.join( File.dirname(__FILE__), "fixtures", "Movefile.no_port" ) )
|
22
|
-
@host.should_receive(:locally_run).with("rsync", "-azLK", anything(), anything(), "--delete", "username@host:foobar/", "barfoo" )
|
23
|
-
@host.upload_dir("foobar", "barfoo" )
|
24
|
-
end
|
18
|
+
context ".upload_dir" do
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
20
|
+
it "should use config ports, username and password properly" do
|
21
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", "-e", "sshpass -p password ssh -p 30000", anything(), "--delete", "username@host:foobar/", "barfoo" )
|
22
|
+
host.upload_dir( "foobar", "barfoo" )
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should skip port if missing" do
|
26
|
+
config.remote!.ssh!.port = nil
|
27
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", "-e", "sshpass -p password ssh", anything(), "--delete", "username@host:foobar/", "barfoo" )
|
28
|
+
host.upload_dir( "foobar", "barfoo" )
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should skip username if missing" do
|
32
|
+
config.remote!.ssh!.username = nil
|
33
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", "-e", "sshpass -p password ssh -p 30000", anything(), "--delete", "host:foobar/", "barfoo" )
|
34
|
+
host.upload_dir( "foobar", "barfoo" )
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when password is missing" do
|
38
|
+
|
39
|
+
before { config.remote!.ssh!.password = nil }
|
40
|
+
|
41
|
+
it "should use config ports and username properly" do
|
42
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", "-e", "ssh -p 30000", anything(), "--delete", "username@host:foobar/", "barfoo" )
|
43
|
+
host.upload_dir( "foobar", "barfoo" )
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should skip port if missing" do
|
47
|
+
config.remote!.ssh!.port = nil
|
48
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", anything(), "--delete", "username@host:foobar/", "barfoo" )
|
49
|
+
host.upload_dir( "foobar", "barfoo" )
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should skip username if missing" do
|
53
|
+
config.remote!.ssh!.username = nil
|
54
|
+
host.should_receive(:locally_run).with("rsync", "-azLK", "-e", "ssh -p 30000", anything(), "--delete", "host:foobar/", "barfoo" )
|
55
|
+
host.upload_dir( "foobar", "barfoo" )
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
31
59
|
|
32
|
-
it "should have a password file when using passwords" do
|
33
|
-
load_config( File.join( File.dirname(__FILE__), "fixtures", "Movefile.with_password" ) )
|
34
|
-
@host.should_receive(:locally_run).with("rsync", "-azLK", /--password-file.*/, anything(), "--delete", "username@host:foobar/", "barfoo" )
|
35
|
-
@host.upload_dir("foobar", "barfoo" )
|
36
60
|
end
|
61
|
+
|
37
62
|
end
|
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.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colored
|
16
|
-
requirement: &
|
16
|
+
requirement: &70270250096520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70270250096520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: escape
|
27
|
-
requirement: &
|
27
|
+
requirement: &70270250095520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70270250095520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70270250095020 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70270250095020
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: net-ssh
|
49
|
-
requirement: &
|
49
|
+
requirement: &70270250094540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70270250094540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: net-scp
|
60
|
-
requirement: &
|
60
|
+
requirement: &70270250093960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70270250093960
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: thor
|
71
|
-
requirement: &
|
71
|
+
requirement: &70270250093360 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70270250093360
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: activesupport
|
82
|
-
requirement: &
|
82
|
+
requirement: &70270250092400 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 3.0.0
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70270250092400
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: i18n
|
93
|
-
requirement: &
|
93
|
+
requirement: &70270250091700 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70270250091700
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: hashie
|
104
|
-
requirement: &
|
104
|
+
requirement: &70270250091120 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70270250091120
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec
|
115
|
-
requirement: &
|
115
|
+
requirement: &70270250090580 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70270250090580
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: cucumber
|
126
|
-
requirement: &
|
126
|
+
requirement: &70270250089940 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70270250089940
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: aruba
|
137
|
-
requirement: &
|
137
|
+
requirement: &70270250089340 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70270250089340
|
146
146
|
description: Capistrano for Wordpress
|
147
147
|
email:
|
148
148
|
- stefano.verna@welaika.com
|
@@ -154,7 +154,6 @@ files:
|
|
154
154
|
- .gitignore
|
155
155
|
- Gemfile
|
156
156
|
- Gemfile.lock
|
157
|
-
- README
|
158
157
|
- README.mdown
|
159
158
|
- Rakefile
|
160
159
|
- bin/wordmove
|
@@ -175,10 +174,6 @@ files:
|
|
175
174
|
- pkg/wordmove-0.0.1.gem
|
176
175
|
- pkg/wordmove-0.0.2.gem
|
177
176
|
- spec/fixtures/Movefile
|
178
|
-
- spec/fixtures/Movefile.no_password
|
179
|
-
- spec/fixtures/Movefile.no_port
|
180
|
-
- spec/fixtures/Movefile.port
|
181
|
-
- spec/fixtures/Movefile.with_password
|
182
177
|
- spec/remote_host_spec.rb
|
183
178
|
- spec/spec_helper.rb
|
184
179
|
- wordmove.gemspec
|
@@ -213,9 +208,5 @@ test_files:
|
|
213
208
|
- features/step_definitions/aruba_ext_steps.rb
|
214
209
|
- features/support/setup.rb
|
215
210
|
- spec/fixtures/Movefile
|
216
|
-
- spec/fixtures/Movefile.no_password
|
217
|
-
- spec/fixtures/Movefile.no_port
|
218
|
-
- spec/fixtures/Movefile.port
|
219
|
-
- spec/fixtures/Movefile.with_password
|
220
211
|
- spec/remote_host_spec.rb
|
221
212
|
- spec/spec_helper.rb
|
data/README
DELETED
File without changes
|
@@ -1,24 +0,0 @@
|
|
1
|
-
local:
|
2
|
-
vhost: "http://vhost.local"
|
3
|
-
wordpress_path: "~/dev/sites/your_site"
|
4
|
-
database:
|
5
|
-
name: "database_name"
|
6
|
-
username: "username"
|
7
|
-
password: "password"
|
8
|
-
host: "host"
|
9
|
-
remote:
|
10
|
-
vhost: "http://remote.com"
|
11
|
-
wordpress_path: "/var/www/your_site"
|
12
|
-
exclude:
|
13
|
-
- .git
|
14
|
-
- .DS_Store
|
15
|
-
- .sass-cache
|
16
|
-
- Movefile
|
17
|
-
database:
|
18
|
-
name: "database_name"
|
19
|
-
username: "username"
|
20
|
-
password: "password"
|
21
|
-
host: "host"
|
22
|
-
ssh:
|
23
|
-
username: "username"
|
24
|
-
host: "host"
|
@@ -1,25 +0,0 @@
|
|
1
|
-
local:
|
2
|
-
vhost: "http://vhost.local"
|
3
|
-
wordpress_path: "~/dev/sites/your_site"
|
4
|
-
database:
|
5
|
-
name: "database_name"
|
6
|
-
username: "username"
|
7
|
-
password: "password"
|
8
|
-
host: "host"
|
9
|
-
remote:
|
10
|
-
vhost: "http://remote.com"
|
11
|
-
wordpress_path: "/var/www/your_site"
|
12
|
-
exclude:
|
13
|
-
- .git
|
14
|
-
- .DS_Store
|
15
|
-
- .sass-cache
|
16
|
-
- Movefile
|
17
|
-
database:
|
18
|
-
name: "database_name"
|
19
|
-
username: "username"
|
20
|
-
password: "password"
|
21
|
-
host: "host"
|
22
|
-
ssh:
|
23
|
-
username: "username"
|
24
|
-
password: "password" # Password is optional, will use public keys if available.
|
25
|
-
host: "host"
|
data/spec/fixtures/Movefile.port
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
local:
|
2
|
-
vhost: "http://vhost.local"
|
3
|
-
wordpress_path: "~/dev/sites/your_site"
|
4
|
-
database:
|
5
|
-
name: "database_name"
|
6
|
-
username: "username"
|
7
|
-
password: "password"
|
8
|
-
host: "host"
|
9
|
-
remote:
|
10
|
-
vhost: "http://remote.com"
|
11
|
-
wordpress_path: "/var/www/your_site"
|
12
|
-
exclude:
|
13
|
-
- .git
|
14
|
-
- .DS_Store
|
15
|
-
- .sass-cache
|
16
|
-
- Movefile
|
17
|
-
database:
|
18
|
-
name: "database_name"
|
19
|
-
username: "username"
|
20
|
-
password: "password"
|
21
|
-
host: "host"
|
22
|
-
ssh:
|
23
|
-
username: "username"
|
24
|
-
password: "password" # Password is optional, will use public keys if available.
|
25
|
-
host: "host"
|
26
|
-
port: 30000
|
@@ -1,25 +0,0 @@
|
|
1
|
-
local:
|
2
|
-
vhost: "http://vhost.local"
|
3
|
-
wordpress_path: "~/dev/sites/your_site"
|
4
|
-
database:
|
5
|
-
name: "database_name"
|
6
|
-
username: "username"
|
7
|
-
password: "password"
|
8
|
-
host: "host"
|
9
|
-
remote:
|
10
|
-
vhost: "http://remote.com"
|
11
|
-
wordpress_path: "/var/www/your_site"
|
12
|
-
exclude:
|
13
|
-
- .git
|
14
|
-
- .DS_Store
|
15
|
-
- .sass-cache
|
16
|
-
- Movefile
|
17
|
-
database:
|
18
|
-
name: "database_name"
|
19
|
-
username: "username"
|
20
|
-
password: "password"
|
21
|
-
host: "host"
|
22
|
-
ssh:
|
23
|
-
username: "username"
|
24
|
-
password: "hithere"
|
25
|
-
host: "host"
|