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 ⇒ Object
- #remote_put_directory ⇒ Object
Constructor Details
#initialize(environment, options = {}) ⇒ Base
Returns a new instance of Base.
38 39 40 41 42 43 44 |
# File 'lib/wordmove/deployer/base.rb', line 38 def initialize(environment, = {}) @environment = environment.to_sym @options = movefile_secrets = Wordmove::Movefile.new([:config]).secrets @logger = self.class.logger(movefile_secrets) end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
6 7 8 |
# File 'lib/wordmove/deployer/base.rb', line 6 def environment @environment end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/wordmove/deployer/base.rb', line 5 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/wordmove/deployer/base.rb', line 4 def @options end |
Class Method Details
.current_dir ⇒ Object
29 30 31 |
# File 'lib/wordmove/deployer/base.rb', line 29 def current_dir '.' end |
.deployer_for(cli_options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wordmove/deployer/base.rb', line 9 def deployer_for() movefile = Wordmove::Movefile.new([:config]) movefile.load_dotenv() = movefile.fetch.merge! environment = movefile.environment() return FTP.new(environment, ) if [environment][:ftp] if [environment][:ssh] && [:global][:sql_adapter] == 'wpcli' return Ssh::WpcliSqlAdapter.new(environment, ) end if [environment][:ssh] && [:global][:sql_adapter] == 'default' return Ssh::DefaultSqlAdapter.new(environment, ) end raise NoAdapterFound, "No valid adapter found." end |
Instance Method Details
#exclude_dir_contents(path) ⇒ Object
58 59 60 |
# File 'lib/wordmove/deployer/base.rb', line 58 def exclude_dir_contents(path) "#{path}/*" end |
#pull_db ⇒ Object
50 51 52 |
# File 'lib/wordmove/deployer/base.rb', line 50 def pull_db logger.task "Pulling Database" end |
#pull_wordpress ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/wordmove/deployer/base.rb', line 73 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
46 47 48 |
# File 'lib/wordmove/deployer/base.rb', line 46 def push_db logger.task "Pushing Database" end |
#push_wordpress ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/wordmove/deployer/base.rb', line 62 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 ⇒ Object
54 |
# File 'lib/wordmove/deployer/base.rb', line 54 def remote_get_directory; end |
#remote_put_directory ⇒ Object
56 |
# File 'lib/wordmove/deployer/base.rb', line 56 def remote_put_directory; end |