wordmove 1.0.2 → 1.0.3
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/README.mdown +8 -0
- data/lib/wordmove/sql_mover.rb +7 -5
- data/lib/wordmove/version.rb +1 -1
- data/spec/sql_mover_spec.rb +27 -16
- metadata +1 -1
data/README.mdown
CHANGED
@@ -67,6 +67,7 @@ remote:
|
|
67
67
|
host: "host"
|
68
68
|
port: 2202 # optional
|
69
69
|
```
|
70
|
+
|
70
71
|
### If you have your local SSH public key already installed on the remote machine.. (recommended)
|
71
72
|
Just not use the `remote.ssh.password` field on your `Movefile`. Easy peasy.
|
72
73
|
|
@@ -80,6 +81,13 @@ too much about security though: the script is deleted just after the usage,
|
|
80
81
|
and can only be executed by `wordmove`, as each time it requires a pre-shared
|
81
82
|
one-time-password to be run.
|
82
83
|
|
84
|
+
### If you want to specify both relative and absolute wordpress path (FTP paths anyone?)
|
85
|
+
Just add to the YAML config a `wordpress_absolute_path` field specifying the absolute path,
|
86
|
+
while using the usual `wordpress_path` for the relative one.
|
87
|
+
|
88
|
+
### If you want to specify a passive FTP connection
|
89
|
+
Add to the YAML config a `passive` flag set to `true`.
|
90
|
+
|
83
91
|
* The dump script is the [`MYSQL-dump` PHP package](https://github.com/dg/MySQL-dump) by David Grudl;
|
84
92
|
* The import script used is the [BigDump](http://www.ozerov.de/bigdump/) library;
|
85
93
|
|
data/lib/wordmove/sql_mover.rb
CHANGED
@@ -22,16 +22,18 @@ module Wordmove
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def replace_vhost!
|
25
|
-
|
25
|
+
source_vhost = source_config[:vhost]
|
26
|
+
dest_vhost = dest_config[:vhost]
|
27
|
+
replace_field!(source_vhost, dest_vhost)
|
26
28
|
end
|
27
29
|
|
28
30
|
def replace_wordpress_path!
|
29
|
-
|
31
|
+
source_path = source_config[:wordpress_absolute_path] || source_config[:wordpress_path]
|
32
|
+
dest_path = dest_config[:wordpress_absolute_path] || dest_config[:wordpress_path]
|
33
|
+
replace_field!(source_path, dest_path)
|
30
34
|
end
|
31
35
|
|
32
|
-
def replace_field!(
|
33
|
-
source_field = source_config[field_sym]
|
34
|
-
dest_field = dest_config[field_sym]
|
36
|
+
def replace_field!(source_field, dest_field)
|
35
37
|
if source_field && dest_field
|
36
38
|
serialized_replace!(source_field, dest_field)
|
37
39
|
simple_replace!(source_field, dest_field)
|
data/lib/wordmove/version.rb
CHANGED
data/spec/sql_mover_spec.rb
CHANGED
@@ -42,31 +42,42 @@ describe Wordmove::SqlMover do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
describe "replace single fields" do
|
46
|
+
context ".replace_vhost!" do
|
47
|
+
let(:source_config) do { :vhost => "DUMP" } end
|
48
|
+
let(:dest_config) do { :vhost => "FUNK" } end
|
49
|
+
|
50
|
+
it "should replace source vhost with dest vhost" do
|
51
|
+
sql_mover.should_receive(:replace_field!).with("DUMP", "FUNK").and_return(true)
|
52
|
+
sql_mover.replace_vhost!
|
53
|
+
end
|
49
54
|
end
|
50
|
-
end
|
51
55
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
context ".replace_wordpress_path!" do
|
57
|
+
let(:source_config) do { :wordpress_path => "DUMP" } end
|
58
|
+
let(:dest_config) do { :wordpress_path => "FUNK" } end
|
59
|
+
|
60
|
+
it "should replace source vhost with dest wordpress paths" do
|
61
|
+
sql_mover.should_receive(:replace_field!).with("DUMP", "FUNK").and_return(true)
|
62
|
+
sql_mover.replace_wordpress_path!
|
63
|
+
end
|
64
|
+
|
65
|
+
context "given an absolute path" do
|
66
|
+
let(:source_config) do { :wordpress_absolute_path => "ABSOLUTE_DUMP", :wordpress_path => "DUMP" } end
|
67
|
+
|
68
|
+
it "should replace the absolute path instead" do
|
69
|
+
sql_mover.should_receive(:replace_field!).with("ABSOLUTE_DUMP", "FUNK").and_return(true)
|
70
|
+
sql_mover.replace_wordpress_path!
|
71
|
+
end
|
72
|
+
end
|
56
73
|
end
|
57
74
|
end
|
58
75
|
|
59
76
|
context ".replace_field!" do
|
60
|
-
let(:source_config) { stub("config") }
|
61
|
-
let(:dest_config) { stub("config") }
|
62
|
-
|
63
77
|
it "should replace source vhost with dest vhost" do
|
64
|
-
source_config.stub(:[]).with(:field).and_return("DUMP")
|
65
|
-
dest_config.stub(:[]).with(:field).and_return("FUNK")
|
66
|
-
|
67
78
|
sql_mover.should_receive(:serialized_replace!).ordered.with("DUMP", "FUNK").and_return(true)
|
68
79
|
sql_mover.should_receive(:simple_replace!).ordered.with("DUMP", "FUNK").and_return(true)
|
69
|
-
sql_mover.replace_field!(
|
80
|
+
sql_mover.replace_field!("DUMP", "FUNK")
|
70
81
|
end
|
71
82
|
end
|
72
83
|
|