Class: Wordmove::Deployer::Base
- Inherits:
-
Object
- Object
- Wordmove::Deployer::Base
- Defined in:
- lib/wordmove/deployer/base.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #exclude_dir_contents(path) ⇒ Object
-
#initialize(environment, options = {}) ⇒ Base
constructor
A new instance of Base.
- #pull_db ⇒ Object
- #pull_wordpress ⇒ Object
- #push_db ⇒ Object
- #push_wordpress ⇒ Object
- #remote_get_directory(directory) ⇒ Object
- #remote_put_directory(directory) ⇒ Object
Constructor Details
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
13 14 15 |
# File 'lib/wordmove/deployer/base.rb', line 13 def environment @environment end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/wordmove/deployer/base.rb', line 12 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/wordmove/deployer/base.rb', line 11 def @options end |
Class Method Details
.deployer_for(cli_options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/wordmove/deployer/base.rb', line 15 def self.deployer_for() = fetch_movefile([:config]) available_enviroments = .keys.map(&:to_sym) - [ :local ] .merge!() recursive_symbolize_keys!() if available_enviroments.size > 1 && [:environment].nil? raise "You need to specify an environment with --environment parameter" end environment = ([:environment] || available_enviroments.first).to_sym if [environment][:ftp] require 'wordmove/deployer/ftp' FTP.new(environment, ) elsif [environment][:ssh] require 'wordmove/deployer/ssh' SSH.new(environment, ) else raise Thor::Error, "No valid adapter found." end end |
.fetch_movefile(path) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/wordmove/deployer/base.rb', line 38 def self.fetch_movefile(path) path ||= "Movefile" unless File.exists?(path) raise Thor::Error, "Could not find a valid Movefile" end YAML::load(File.open(path)) end |
Instance Method Details
#exclude_dir_contents(path) ⇒ Object
80 81 82 |
# File 'lib/wordmove/deployer/base.rb', line 80 def exclude_dir_contents(path) "#{path}/*" end |
#pull_db ⇒ Object
57 58 59 |
# File 'lib/wordmove/deployer/base.rb', line 57 def pull_db logger.task "Pulling Database" end |
#pull_wordpress ⇒ Object
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/wordmove/deployer/base.rb', line 95 def pull_wordpress logger.task "Pulling wordpress core" local_path = [:wordpress_path] remote_path = [:wordpress_path] exclude_wp_content = exclude_dir_contents(remote_wp_content_dir.relative_path) exclude_paths = paths_to_exclude.push(exclude_wp_content) remote_get_directory(remote_path, local_path, exclude_paths) end |
#push_db ⇒ Object
53 54 55 |
# File 'lib/wordmove/deployer/base.rb', line 53 def push_db; logger.task "Pushing Database" end |
#push_wordpress ⇒ Object
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/wordmove/deployer/base.rb', line 84 def push_wordpress logger.task "Pushing wordpress core" local_path = [:wordpress_path] remote_path = [:wordpress_path] exclude_wp_content = exclude_dir_contents(local_wp_content_dir.relative_path) exclude_paths = paths_to_exclude.push(exclude_wp_content) remote_put_directory(local_path, remote_path, exclude_paths) end |
#remote_get_directory(directory) ⇒ Object
61 |
# File 'lib/wordmove/deployer/base.rb', line 61 def remote_get_directory(directory); end |
#remote_put_directory(directory) ⇒ Object
62 |
# File 'lib/wordmove/deployer/base.rb', line 62 def remote_put_directory(directory); end |