wpify 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -512,11 +512,6 @@ Capistrano::Configuration.instance(:must_exist).load do
512
512
  opts[:remote] ? capture(command) : run_locally(command)
513
513
  end
514
514
 
515
- # Return an array of remote plugins that are symlinks
516
- def remote_linked_plugins
517
- capture("find #{deploy_to}/wordpress/wp-content/plugins/ -type l").split("\n").map {|f| File.basename(f).gsub(/\s+$/, '') }
518
- end
519
-
520
515
  # Remote tasks
521
516
  namespace :remote do
522
517
  desc "Display the version of Wordpress installed on the first server"
@@ -534,6 +529,17 @@ Capistrano::Configuration.instance(:must_exist).load do
534
529
  logger.important "Local WP version: #{wp_version}"
535
530
  end
536
531
 
532
+ desc "Download the remote wp-config.php file"
533
+ task :get_remote_config do
534
+ server = find_servers(:roles => :app, :except => { :no_release => true }).first
535
+ local_config_file = "#{Dir.getwd}/wordpress/wp-config.php"
536
+ if not File.exist? local_config_file
537
+ run_locally "scp #{user}@#{server.host}:#{deploy_to}/wordpress/wp-config.php #{local_config_file}"
538
+ else
539
+ logger.important "A local wp-config.php file already exists. Please remove it first."
540
+ end
541
+ end
542
+
537
543
  desc "Download the wordpress version installed on the server"
538
544
  task :download_wp do
539
545
  if(wp_version = get_version(:remote => true))
@@ -561,36 +567,43 @@ Capistrano::Configuration.instance(:must_exist).load do
561
567
 
562
568
  desc "Rsync remote plugins that aren't tracked in revision control"
563
569
  task :sync_untracked_plugins do
570
+ get_remote_tracked = capture "ls -1A #{current_path}/wordpress/wp-content/plugins"
571
+ tracked = get_remote_tracked.split("\n")
572
+ exclude_string = String.new
573
+ tracked.each do |t|
574
+ t.strip!
575
+ exclude_string << " --exclude '#{t}'"
576
+ end
564
577
  server = find_servers(:roles => :app, :except => { :no_release => true }).first
565
- logger.info "Syncing non-linked plugins from #{server.host}"
566
- run_locally("rsync -avz --no-links #{user}@#{server.host}:#{deploy_to}/wordpress/wp-content/plugins/ #{Dir.getwd}/wordpress/wp-content/plugins/")
578
+ command = "rsync -avz#{exclude_string} #{user}@#{server.host}:#{deploy_to}/wordpress/wp-content/plugins/ #{Dir.getwd}/wordpress/wp-content/plugins/"
579
+ run_locally command
567
580
  end
568
581
 
569
582
  desc <<-DESC
570
583
  Install wordpress locally based on the remote version. \
571
- Sync untracked plugins from the remote servers to the local \
572
- server. Sync uploads from the remote server to the local \
573
- server.
584
+ Sync untracked plugins from the remote servers to the local machine \
585
+ server. Sync uploads from the remote server to the local machine.
574
586
  DESC
575
587
  task :bootstrap do
576
588
  # This tasks is a collector for various other tasks
577
589
  install_wp
578
590
  sync_untracked_plugins
579
- sync_uploads
591
+ get_uploads
592
+ get_remote_config
580
593
  end
581
594
  end
582
595
 
583
596
  # Tasks that perform local and remote operations
584
- desc "Pull and pushes wp-content/uploads files (2-way operation)"
585
- task :sync_uploads do
586
- servers = find_servers(:roles => :app, :except => { :no_release => true })
587
- logger.info "Syncing uploads from #{servers.first.host}"
588
- run_locally("rsync -avz --update #{user}@#{servers.first.host}:#{deploy_to}/wordpress/wp-content/uploads/ #{Dir.getwd}/wordpress/wp-content/uploads/")
589
- # Push files to each remote server
590
- servers.each do |server|
591
- logger.info "Pushing files to #{server.host}"
592
- run_locally("rsync -avz --update #{Dir.getwd}/wordpress/wp-content/uploads/ #{user}@#{server.host}:#{deploy_to}/wordpress/wp-content/uploads/")
593
- end
594
- end
597
+ # desc "Pull and pushes wp-content/uploads files (2-way operation)"
598
+ # task :sync_uploads do
599
+ # servers = find_servers(:roles => :app, :except => { :no_release => true })
600
+ # logger.info "Syncing uploads from #{servers.first.host}"
601
+ # run_locally("rsync -avz --update #{user}@#{servers.first.host}:#{deploy_to}/wordpress/wp-content/uploads/ #{Dir.getwd}/wordpress/wp-content/uploads/")
602
+ # # Push files to each remote server
603
+ # servers.each do |server|
604
+ # logger.info "Pushing files to #{server.host}"
605
+ # run_locally("rsync -avz --update #{Dir.getwd}/wordpress/wp-content/uploads/ #{user}@#{server.host}:#{deploy_to}/wordpress/wp-content/uploads/")
606
+ # end
607
+ # end
595
608
  end
596
609
  end
@@ -1,3 +1,3 @@
1
1
  module Wpify
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wpify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-09 00:00:00.000000000 Z
12
+ date: 2012-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70214813382080 !ruby/object:Gem::Requirement
16
+ requirement: &70224234034800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70214813382080
24
+ version_requirements: *70224234034800
25
25
  description: Wordpress deploy tools, including a capistrano recipe. This project is
26
26
  still in early development
27
27
  email: