wordmove 0.0.8 → 0.1.0.alpha

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.
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordmove
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
5
- prerelease:
4
+ version: 0.1.0.alpha
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Stefano Verna
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: escape
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: rake
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -60,23 +44,7 @@ dependencies:
60
44
  - !ruby/object:Gem::Version
61
45
  version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
- name: net-ssh
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: net-scp
47
+ name: thor
80
48
  requirement: !ruby/object:Gem::Requirement
81
49
  none: false
82
50
  requirements:
@@ -92,7 +60,7 @@ dependencies:
92
60
  - !ruby/object:Gem::Version
93
61
  version: '0'
94
62
  - !ruby/object:Gem::Dependency
95
- name: thor
63
+ name: activesupport
96
64
  requirement: !ruby/object:Gem::Requirement
97
65
  none: false
98
66
  requirements:
@@ -107,22 +75,6 @@ dependencies:
107
75
  - - ! '>='
108
76
  - !ruby/object:Gem::Version
109
77
  version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: activesupport
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ~>
116
- - !ruby/object:Gem::Version
117
- version: 3.0.0
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ~>
124
- - !ruby/object:Gem::Version
125
- version: 3.0.0
126
78
  - !ruby/object:Gem::Dependency
127
79
  name: i18n
128
80
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +92,7 @@ dependencies:
140
92
  - !ruby/object:Gem::Version
141
93
  version: '0'
142
94
  - !ruby/object:Gem::Dependency
143
- name: hashie
95
+ name: photocopier
144
96
  requirement: !ruby/object:Gem::Requirement
145
97
  none: false
146
98
  requirements:
@@ -223,8 +175,12 @@ files:
223
175
  - features/step_definitions/aruba_ext_steps.rb
224
176
  - features/support/setup.rb
225
177
  - lib/wordmove.rb
178
+ - lib/wordmove/assets/dump.php.erb
179
+ - lib/wordmove/assets/import.php.erb
226
180
  - lib/wordmove/cli.rb
227
- - lib/wordmove/deployer.rb
181
+ - lib/wordmove/deployer/base.rb
182
+ - lib/wordmove/deployer/ftp.rb
183
+ - lib/wordmove/deployer/ssh.rb
228
184
  - lib/wordmove/generators/Movefile
229
185
  - lib/wordmove/generators/movefile.rb
230
186
  - lib/wordmove/hosts/local_host.rb
@@ -252,9 +208,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
208
  required_rubygems_version: !ruby/object:Gem::Requirement
253
209
  none: false
254
210
  requirements:
255
- - - ! '>='
211
+ - - ! '>'
256
212
  - !ruby/object:Gem::Version
257
- version: '0'
213
+ version: 1.3.1
258
214
  requirements: []
259
215
  rubyforge_project:
260
216
  rubygems_version: 1.8.23
@@ -1,149 +0,0 @@
1
- require 'active_support/core_ext'
2
- require 'hashie'
3
- require 'wordmove/hosts/local_host'
4
- require 'wordmove/hosts/remote_host'
5
- require 'wordmove/logger'
6
-
7
- module Wordmove
8
-
9
- class Deployer
10
-
11
- attr_reader :options
12
- attr_reader :logger
13
-
14
- def initialize(options = {})
15
- @options = Hashie::Mash.new(options)
16
- @logger = Logger.new
17
- @logger.level = options.verbose ? Logger::VERBOSE : Logger::INFO
18
- end
19
-
20
- def push
21
- informative_errors do
22
- unless options.skip_db
23
- logger.info "Pushing the DB..."
24
- push_db
25
- end
26
-
27
- remotely do |host|
28
- %w(uploads themes plugins).each do |step|
29
- unless options.send("skip_#{step}")
30
- logger.info "Pushing wp-content/#{step}..."
31
- host.download_dir local_wpcontent_path(step), remote_wpcontent_path(step)
32
- end
33
- end
34
- end
35
- end
36
- end
37
-
38
- def pull
39
- informative_errors do
40
- unless options.skip_db
41
- logger.info "Pulling the DB..."
42
- pull_db
43
- end
44
-
45
- remotely do |host|
46
- %w(uploads themes plugins).each do |step|
47
- unless options.send("skip_#{step}")
48
- logger.info "Pulling wp-content/#{step}..."
49
- host.upload_dir remote_wpcontent_path(step), local_wpcontent_path(step)
50
- end
51
- end
52
- end
53
- end
54
- end
55
-
56
- private
57
-
58
- def push_db
59
- local_mysql_dump_path = local_wpcontent_path("database_dump.sql")
60
- remote_mysql_dump_path = remote_wpcontent_path("database_dump.sql")
61
-
62
- locally do |host|
63
- host.run "mysqldump", "--host=#{config.local.database.host}", "--user=#{config.local.database.username}", "--password=#{config.local.database.password}", config.local.database.name, :stdout => local_mysql_dump_path
64
- File.open(local_mysql_dump_path, 'a') do |file|
65
- file.write "UPDATE wp_options SET option_value=\"#{config.remote.vhost}\" WHERE option_name=\"siteurl\" OR option_name=\"home\";\n"
66
- end
67
- end
68
-
69
- remotely do |host|
70
- host.download_file local_mysql_dump_path, remote_mysql_dump_path
71
- host.run "mysql", "--user=#{config.remote.database.username}", "--password=#{config.remote.database.password}", "--host=#{config.remote.database.host}", "--database=#{config.remote.database.name}", :stdin => remote_mysql_dump_path
72
- host.run "rm", remote_mysql_dump_path
73
- end
74
-
75
- locally do |host|
76
- host.run "rm", local_mysql_dump_path
77
- end
78
- end
79
-
80
-
81
- def pull_db
82
- local_mysql_dump_path = local_wpcontent_path("database_dump.sql")
83
- remote_mysql_dump_path = remote_wpcontent_path("database_dump.sql")
84
-
85
- remotely do |host|
86
- host.run "mysqldump", "--host=#{config.remote.database.host}", "--user=#{config.remote.database.username}", "--password=#{config.remote.database.password}", config.remote.database.name, :stdout => remote_mysql_dump_path
87
- host.upload_file remote_mysql_dump_path, local_mysql_dump_path
88
- end
89
-
90
- locally do |host|
91
- File.open(local_mysql_dump_path, 'a') do |file|
92
- file.write "UPDATE wp_options SET option_value=\"#{config.local.vhost}\" WHERE option_name=\"siteurl\" OR option_name=\"home\";\n"
93
- end
94
- host.run "mysql", "--user=#{config.local.database.username}", "--password=#{config.local.database.password}", "--host=#{config.local.database.host}", "--database=#{config.local.database.name}", :stdin => local_mysql_dump_path
95
- host.run "rm", local_mysql_dump_path
96
- end
97
-
98
- remotely do |host|
99
- host.run "rm", remote_mysql_dump_path
100
- end
101
-
102
- end
103
-
104
- def config
105
- if @config.blank?
106
- config_path = @options[:config] || "Movefile"
107
- unless File.exists? config_path
108
- raise Thor::Error, "Could not find a valid Movefile"
109
- end
110
- @config = Hashie::Mash.new(YAML::load(File.open(config_path)))
111
- end
112
- @config
113
- end
114
-
115
- def local_wpcontent_path(*args)
116
- File.join(config.local.wordpress_path, "wp-content", *args)
117
- end
118
-
119
- def remote_wpcontent_path(*args)
120
- File.join(config.remote.wordpress_path, "wp-content", *args)
121
- end
122
-
123
- def locally
124
- host = LocalHost.new(config.local.merge(:logger => @logger))
125
- yield host
126
- host.close
127
- end
128
-
129
- def remotely
130
- host = RemoteHost.new(config.remote.merge(:logger => @logger))
131
- yield host
132
- host.close
133
- end
134
-
135
- def informative_errors
136
- yield
137
- rescue Timeout::Error
138
- logger.error "Connection timed out!"
139
- puts "Timed out"
140
- rescue Errno::EHOSTUNREACH
141
- logger.error "Host unreachable!"
142
- rescue Errno::ECONNREFUSED
143
- logger.error "Connection refused!"
144
- rescue Net::SSH::AuthenticationFailed
145
- logger.error "SSH authentification failure, please double check the SSH credentials on your Movefile!"
146
- end
147
-
148
- end
149
- end