Module: FoundryWordpressTool::Uploads

Included in:
Base
Defined in:
lib/foundry_wordpress_tool/uploads.rb

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/foundry_wordpress_tool/uploads.rb', line 3

def self.included(thor)
  thor.class_eval do
  
    method_option :delete,
      :type => :boolean,
      :lazy_default => false,
      :desc => 'Delete files locally that do not exist the remotely'
    desc "uploads_pull", "Pull wp-content/uploads from the remote"
    def uploads_pull
      load_environment_config()
      rsync_command = "rsync -avz #{'--delete' if options.delete} #{@config['username']}@#{@config['host']}:#{@config['deploy_to']}/wp-content/uploads/ wp-content/uploads/"
      run(rsync_command)
    end
  
    method_option :delete,
      :type => :boolean,
      :lazy_default => false,
      :desc => 'Delete files remotely that do not exist the locally'
    desc "uploads_push", "Push wp-content/uploads to the remote host"
    def uploads_push
      load_environment_config()
      rsync_command = "rsync -avz #{'--delete' if options.delete} wp-content/uploads/ #{@config['username']}@#{@config['host']}:#{@config['deploy_to']}/wp-content/uploads/"
      run(rsync_command)
    end
  
  end
end