wordmove-sshbump 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +64 -0
- data/README +0 -0
- data/README.mdown +73 -0
- data/Rakefile +2 -0
- data/bin/wordmove +4 -0
- data/features/generator.feature +30 -0
- data/features/pull.feature +0 -0
- data/features/push.feature +0 -0
- data/features/step_definitions/aruba_ext_steps.rb +3 -0
- data/features/support/setup.rb +2 -0
- data/lib/wordmove.rb +4 -0
- data/lib/wordmove/cli.rb +39 -0
- data/lib/wordmove/deployer.rb +149 -0
- data/lib/wordmove/generators/Movefile +26 -0
- data/lib/wordmove/generators/movefile.rb +18 -0
- data/lib/wordmove/hosts/local_host.rb +45 -0
- data/lib/wordmove/hosts/remote_host.rb +73 -0
- data/lib/wordmove/logger.rb +32 -0
- data/lib/wordmove/version.rb +3 -0
- data/pkg/wordmove-0.0.1.gem +0 -0
- data/pkg/wordmove-0.0.2.gem +0 -0
- data/spec/foodie_spec.rb +9 -0
- data/wordmove.gemspec +31 -0
- metadata +261 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
tmp/*
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wordmove (0.0.1)
|
5
|
+
activesupport (~> 3.0.0)
|
6
|
+
colored
|
7
|
+
escape
|
8
|
+
hashie
|
9
|
+
i18n
|
10
|
+
net-scp
|
11
|
+
net-ssh
|
12
|
+
rake
|
13
|
+
thor
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: http://rubygems.org/
|
17
|
+
specs:
|
18
|
+
activesupport (3.0.11)
|
19
|
+
aruba (0.4.7)
|
20
|
+
childprocess (>= 0.2.2)
|
21
|
+
cucumber (>= 1.1.1)
|
22
|
+
ffi (= 1.0.9)
|
23
|
+
rspec (>= 2.7.0)
|
24
|
+
builder (3.0.0)
|
25
|
+
childprocess (0.2.3)
|
26
|
+
ffi (~> 1.0.6)
|
27
|
+
colored (1.2)
|
28
|
+
cucumber (1.1.3)
|
29
|
+
builder (>= 2.1.2)
|
30
|
+
diff-lcs (>= 1.1.2)
|
31
|
+
gherkin (~> 2.6.7)
|
32
|
+
json (>= 1.4.6)
|
33
|
+
term-ansicolor (>= 1.0.6)
|
34
|
+
diff-lcs (1.1.3)
|
35
|
+
escape (0.0.4)
|
36
|
+
ffi (1.0.9)
|
37
|
+
gherkin (2.6.8)
|
38
|
+
json (>= 1.4.6)
|
39
|
+
hashie (1.2.0)
|
40
|
+
i18n (0.6.0)
|
41
|
+
json (1.6.2)
|
42
|
+
net-scp (1.0.4)
|
43
|
+
net-ssh (>= 1.99.1)
|
44
|
+
net-ssh (2.2.1)
|
45
|
+
rake (0.9.2.2)
|
46
|
+
rspec (2.7.0)
|
47
|
+
rspec-core (~> 2.7.0)
|
48
|
+
rspec-expectations (~> 2.7.0)
|
49
|
+
rspec-mocks (~> 2.7.0)
|
50
|
+
rspec-core (2.7.1)
|
51
|
+
rspec-expectations (2.7.0)
|
52
|
+
diff-lcs (~> 1.1.2)
|
53
|
+
rspec-mocks (2.7.0)
|
54
|
+
term-ansicolor (1.0.7)
|
55
|
+
thor (0.14.6)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
aruba
|
62
|
+
cucumber
|
63
|
+
rspec
|
64
|
+
wordmove!
|
data/README
ADDED
File without changes
|
data/README.mdown
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Wordmove
|
2
|
+
|
3
|
+
Wordmove is a nice little gem that lets you automatically mirror local Wordpress installations and DB data back and forth from your local development machine to the remote staging server.
|
4
|
+
|
5
|
+
Think of it like Capistrano for Wordpress, complete with push/pull capabilities.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
That's easy:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install wordmove
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```
|
18
|
+
> wordmove help
|
19
|
+
Tasks:
|
20
|
+
wordmove help [TASK] # Describe available tasks or one specific task
|
21
|
+
wordmove init # Generates a brand new Movefile
|
22
|
+
wordmove pull # Pulls WP data from remote host to the local machine
|
23
|
+
wordmove push # Pushes WP data from local machine to remote host
|
24
|
+
```
|
25
|
+
|
26
|
+
## Movefile
|
27
|
+
|
28
|
+
You can configure Wordmove creating a `Movefile`. That's just a YAML file with all the local and remote host infos:
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
local:
|
32
|
+
vhost: "http://vhost.local"
|
33
|
+
wordpress_path: "~/dev/sites/your_site"
|
34
|
+
database:
|
35
|
+
name: "database_name"
|
36
|
+
username: "username"
|
37
|
+
password: "password"
|
38
|
+
host: "host"
|
39
|
+
remote:
|
40
|
+
vhost: "http://remote.com"
|
41
|
+
wordpress_path: "/var/www/your_site"
|
42
|
+
exclude:
|
43
|
+
- .git
|
44
|
+
- .DS_Store
|
45
|
+
- .sass-cache
|
46
|
+
- Movefile
|
47
|
+
database:
|
48
|
+
name: "database_name"
|
49
|
+
username: "username"
|
50
|
+
password: "password"
|
51
|
+
host: "host"
|
52
|
+
ssh:
|
53
|
+
username: "username"
|
54
|
+
password: "password"
|
55
|
+
host: "host"
|
56
|
+
```
|
57
|
+
|
58
|
+
## Known problems and limitations
|
59
|
+
* Wordmove requires an SSH connection to the remote host;
|
60
|
+
* Wordmove requires `mysqldump` and `mysql` to be present in the remote host and executable by the SSH user;
|
61
|
+
* Wordmove requires `rsync` to be present and executable in your machine;
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
(The MIT License)
|
66
|
+
|
67
|
+
Copyright © 2011 weLaika
|
68
|
+
|
69
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
72
|
+
|
73
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/wordmove
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Generating Movefile
|
2
|
+
In order to configure Wordmove
|
3
|
+
As a WP developer
|
4
|
+
I want Wordmove to generate me a Wordmove skeleton file
|
5
|
+
|
6
|
+
Scenario: Wordmove creation
|
7
|
+
When I run "wordmove init"
|
8
|
+
Then the following files should exist:
|
9
|
+
| Movefile |
|
10
|
+
Then the file "Movefile" should contain:
|
11
|
+
"""
|
12
|
+
local:
|
13
|
+
vhost: "http://vhost.local"
|
14
|
+
wordpress_path: "~/dev/sites/your_site"
|
15
|
+
database:
|
16
|
+
username: "username"
|
17
|
+
password: "password"
|
18
|
+
host: "host"
|
19
|
+
remote:
|
20
|
+
vhost: "http://remote.com"
|
21
|
+
wordpress_path: "/var/www/your_site"
|
22
|
+
database:
|
23
|
+
username: "username"
|
24
|
+
password: "password"
|
25
|
+
host: "host"
|
26
|
+
ssh:
|
27
|
+
username: "username"
|
28
|
+
password: "password"
|
29
|
+
host: "host"
|
30
|
+
"""
|
File without changes
|
File without changes
|
data/lib/wordmove.rb
ADDED
data/lib/wordmove/cli.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'wordmove/generators/movefile'
|
3
|
+
require 'wordmove/deployer'
|
4
|
+
|
5
|
+
|
6
|
+
module Wordmove
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
desc "init", "Generates a brand new Movefile"
|
10
|
+
def init
|
11
|
+
Wordmove::Generators::Movefile.start
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "pull", "Pulls WP data from remote host to the local machine"
|
15
|
+
method_option :skip_db, :aliases => "-d", :type => :boolean
|
16
|
+
method_option :skip_uploads, :aliases => "-u", :type => :boolean
|
17
|
+
method_option :skip_themes, :aliases => "-t", :type => :boolean
|
18
|
+
method_option :skip_plugins, :aliases => "-p", :type => :boolean
|
19
|
+
method_option :verbose, :aliases => "-v", :type => :boolean
|
20
|
+
method_option :config, :aliases => "-c"
|
21
|
+
def pull
|
22
|
+
deployer = Wordmove::Deployer.new(options)
|
23
|
+
deployer.pull
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "push", "Pushes WP data from local machine to remote host"
|
27
|
+
method_option :skip_db, :aliases => "-d", :type => :boolean
|
28
|
+
method_option :skip_uploads, :aliases => "-u", :type => :boolean
|
29
|
+
method_option :skip_themes, :aliases => "-t", :type => :boolean
|
30
|
+
method_option :skip_plugins, :aliases => "-p", :type => :boolean
|
31
|
+
method_option :verbose, :aliases => "-v", :type => :boolean
|
32
|
+
method_option :config, :aliases => "-c"
|
33
|
+
def push
|
34
|
+
deployer = Wordmove::Deployer.new(options)
|
35
|
+
deployer.push
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,149 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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"
|
25
|
+
host: "host"
|
26
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Wordmove
|
4
|
+
module Generators
|
5
|
+
class Movefile < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.dirname(__FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_movefile
|
13
|
+
template "Movefile"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'escape'
|
2
|
+
|
3
|
+
module Wordmove
|
4
|
+
class LocalHost
|
5
|
+
|
6
|
+
attr_reader :options
|
7
|
+
attr_reader :logger
|
8
|
+
attr_reader :ssh_extras
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
@options = Hashie::Mash.new(options)
|
12
|
+
@logger = @options[:logger]
|
13
|
+
@ssh_extras = {}
|
14
|
+
[ :port, :password ].each do |p|
|
15
|
+
@ssh_extras.merge( { p => options.ssh[p] } ) if options.ssh[p]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def run(*args)
|
20
|
+
command = shell_command(*args)
|
21
|
+
logger.verbose "Executing locally #{command}"
|
22
|
+
unless system(command)
|
23
|
+
raise Thor::Error, "Error executing \"#{command}\""
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def close
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def shell_command(*args)
|
33
|
+
options = args.extract_options!
|
34
|
+
command = Escape.shell_command(args)
|
35
|
+
if options[:stdin]
|
36
|
+
command += " < #{options[:stdin]}"
|
37
|
+
end
|
38
|
+
if options[:stdout]
|
39
|
+
command += " > #{options[:stdout]}"
|
40
|
+
end
|
41
|
+
command
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
require 'net/scp'
|
3
|
+
|
4
|
+
module Wordmove
|
5
|
+
class RemoteHost < LocalHost
|
6
|
+
|
7
|
+
alias :locally_run :run
|
8
|
+
|
9
|
+
attr_reader :session
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def session
|
16
|
+
logger.verbose "Connecting to #{options.ssh.host}..." unless @session.present?
|
17
|
+
@session ||= Net::SSH.start(options.ssh.host, options.ssh.username, @ssh_options )
|
18
|
+
end
|
19
|
+
|
20
|
+
def close
|
21
|
+
session.close
|
22
|
+
end
|
23
|
+
|
24
|
+
def upload_file(source_file, destination_file)
|
25
|
+
logger.verbose "Copying remote #{source_file} to #{destination_file}..."
|
26
|
+
Net::SCP.download!(options.ssh.host, options.ssh.username, source_file, destination_file, @ssh_options )
|
27
|
+
end
|
28
|
+
|
29
|
+
def download_file(source_file, destination_file)
|
30
|
+
logger.verbose "Copying local #{source_file} to #{destination_file}..."
|
31
|
+
Net::SCP.upload!(options.ssh.host, options.ssh.username, source_file, destination_file, @ssh_options )
|
32
|
+
end
|
33
|
+
|
34
|
+
def download_dir(source_dir, destination_dir)
|
35
|
+
rsync "#{source_dir}/", "#{options.ssh.username}@#{options.ssh.host}:#{destination_dir}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def upload_dir(source_dir, destination_dir)
|
39
|
+
rsync "#{options.ssh.username}@#{options.ssh.host}:#{source_dir}/", destination_dir
|
40
|
+
end
|
41
|
+
|
42
|
+
def run(*args)
|
43
|
+
command = shell_command(*args)
|
44
|
+
logger.verbose "Executing remotely #{command}"
|
45
|
+
session.exec!(command)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def rsync(source_dir, destination_dir)
|
51
|
+
exclude_file = Tempfile.new('exclude')
|
52
|
+
exclude_file.write(options.exclude.join("\n"))
|
53
|
+
exclude_file.close
|
54
|
+
|
55
|
+
arguments = [ "-azLK" ]
|
56
|
+
|
57
|
+
if options.ssh.password
|
58
|
+
password_file = Tempfile.new('rsync_password')
|
59
|
+
password_file.write(options.ssh.password)
|
60
|
+
password_file.close
|
61
|
+
arguments << "--password-file=#{password_file.path}"
|
62
|
+
end
|
63
|
+
|
64
|
+
arguments << [ "--exclude-from=#{exclude_file.path}", "--delete", source_dir, destination_dir ]
|
65
|
+
arguments.flatten! # do we need this?
|
66
|
+
locally_run "rsync", arguments
|
67
|
+
|
68
|
+
password_file.unlink
|
69
|
+
exclude_file.unlink
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'colored'
|
2
|
+
|
3
|
+
module Wordmove
|
4
|
+
class Logger
|
5
|
+
|
6
|
+
ERROR = 0
|
7
|
+
INFO = 1
|
8
|
+
VERBOSE = 2
|
9
|
+
|
10
|
+
attr_accessor :level
|
11
|
+
|
12
|
+
def log(l, message)
|
13
|
+
colors = [ :red, :green, :cyan ]
|
14
|
+
if l <= level
|
15
|
+
puts " " * [l-1, 0].max + message.send(colors[l])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def info(message)
|
20
|
+
log INFO, message
|
21
|
+
end
|
22
|
+
|
23
|
+
def verbose(message)
|
24
|
+
log VERBOSE, message
|
25
|
+
end
|
26
|
+
|
27
|
+
def error(message)
|
28
|
+
log ERROR, message
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
Binary file
|
Binary file
|
data/spec/foodie_spec.rb
ADDED
data/wordmove.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/wordmove/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Stefano Verna"]
|
6
|
+
gem.email = ["stefano.verna@welaika.com"]
|
7
|
+
gem.description = %q{Capistrano for Wordpress}
|
8
|
+
gem.summary = %q{Capistrano for Wordpress}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "wordmove-sshbump"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Wordmove::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'colored'
|
19
|
+
gem.add_dependency 'escape'
|
20
|
+
gem.add_dependency 'rake'
|
21
|
+
gem.add_dependency 'net-ssh'
|
22
|
+
gem.add_dependency 'net-scp'
|
23
|
+
gem.add_dependency "thor"
|
24
|
+
gem.add_dependency "activesupport", "~> 3.0.0"
|
25
|
+
gem.add_dependency "i18n"
|
26
|
+
gem.add_dependency "hashie"
|
27
|
+
|
28
|
+
gem.add_development_dependency "rspec"
|
29
|
+
gem.add_development_dependency "cucumber"
|
30
|
+
gem.add_development_dependency "aruba"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wordmove-sshbump
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Stefano Verna
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-22 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: colored
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: escape
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rake
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: net-ssh
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: net-scp
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :runtime
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: thor
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
type: :runtime
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: activesupport
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ~>
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 7
|
114
|
+
segments:
|
115
|
+
- 3
|
116
|
+
- 0
|
117
|
+
- 0
|
118
|
+
version: 3.0.0
|
119
|
+
type: :runtime
|
120
|
+
version_requirements: *id007
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: i18n
|
123
|
+
prerelease: false
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
type: :runtime
|
134
|
+
version_requirements: *id008
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: hashie
|
137
|
+
prerelease: false
|
138
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
hash: 3
|
144
|
+
segments:
|
145
|
+
- 0
|
146
|
+
version: "0"
|
147
|
+
type: :runtime
|
148
|
+
version_requirements: *id009
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: rspec
|
151
|
+
prerelease: false
|
152
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
hash: 3
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
161
|
+
type: :development
|
162
|
+
version_requirements: *id010
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: cucumber
|
165
|
+
prerelease: false
|
166
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 3
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
version: "0"
|
175
|
+
type: :development
|
176
|
+
version_requirements: *id011
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: aruba
|
179
|
+
prerelease: false
|
180
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
hash: 3
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
version: "0"
|
189
|
+
type: :development
|
190
|
+
version_requirements: *id012
|
191
|
+
description: Capistrano for Wordpress
|
192
|
+
email:
|
193
|
+
- stefano.verna@welaika.com
|
194
|
+
executables:
|
195
|
+
- wordmove
|
196
|
+
extensions: []
|
197
|
+
|
198
|
+
extra_rdoc_files: []
|
199
|
+
|
200
|
+
files:
|
201
|
+
- .gitignore
|
202
|
+
- Gemfile
|
203
|
+
- Gemfile.lock
|
204
|
+
- README
|
205
|
+
- README.mdown
|
206
|
+
- Rakefile
|
207
|
+
- bin/wordmove
|
208
|
+
- features/generator.feature
|
209
|
+
- features/pull.feature
|
210
|
+
- features/push.feature
|
211
|
+
- features/step_definitions/aruba_ext_steps.rb
|
212
|
+
- features/support/setup.rb
|
213
|
+
- lib/wordmove.rb
|
214
|
+
- lib/wordmove/cli.rb
|
215
|
+
- lib/wordmove/deployer.rb
|
216
|
+
- lib/wordmove/generators/Movefile
|
217
|
+
- lib/wordmove/generators/movefile.rb
|
218
|
+
- lib/wordmove/hosts/local_host.rb
|
219
|
+
- lib/wordmove/hosts/remote_host.rb
|
220
|
+
- lib/wordmove/logger.rb
|
221
|
+
- lib/wordmove/version.rb
|
222
|
+
- pkg/wordmove-0.0.1.gem
|
223
|
+
- pkg/wordmove-0.0.2.gem
|
224
|
+
- spec/foodie_spec.rb
|
225
|
+
- wordmove.gemspec
|
226
|
+
has_rdoc: true
|
227
|
+
homepage: ""
|
228
|
+
licenses: []
|
229
|
+
|
230
|
+
post_install_message:
|
231
|
+
rdoc_options: []
|
232
|
+
|
233
|
+
require_paths:
|
234
|
+
- lib
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
|
+
none: false
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
hash: 3
|
250
|
+
segments:
|
251
|
+
- 0
|
252
|
+
version: "0"
|
253
|
+
requirements: []
|
254
|
+
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 1.6.2
|
257
|
+
signing_key:
|
258
|
+
specification_version: 3
|
259
|
+
summary: Capistrano for Wordpress
|
260
|
+
test_files: []
|
261
|
+
|