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 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
 
@@ -22,16 +22,18 @@ module Wordmove
22
22
  end
23
23
 
24
24
  def replace_vhost!
25
- replace_field!(:vhost)
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
- replace_field!(:wordpress_path)
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!(field_sym)
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)
@@ -1,3 +1,3 @@
1
1
  module Wordmove
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -42,31 +42,42 @@ describe Wordmove::SqlMover do
42
42
  end
43
43
  end
44
44
 
45
- context ".replace_vhost!" do
46
- it "should replace source vhost with dest vhost" do
47
- sql_mover.should_receive(:replace_field!).with(:vhost).and_return(true)
48
- sql_mover.replace_vhost!
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
- context ".replace_wordpress_path!" do
53
- it "should replace source path with dest path" do
54
- sql_mover.should_receive(:replace_field!).with(:wordpress_path).and_return(true)
55
- sql_mover.replace_wordpress_path!
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!(:field)
80
+ sql_mover.replace_field!("DUMP", "FUNK")
70
81
  end
71
82
  end
72
83
 
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: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: