Class: Wordmove::SqlAdapter::Wpcli
- Inherits:
-
Object
- Object
- Wordmove::SqlAdapter::Wpcli
- Defined in:
- lib/wordmove/sql_adapter/wpcli.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#local_path ⇒ Object
readonly
Returns the value of attribute local_path.
-
#sql_content ⇒ Object
Returns the value of attribute sql_content.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(source_config, dest_config, config_key, local_path) ⇒ Wpcli
constructor
A new instance of Wpcli.
Constructor Details
#initialize(source_config, dest_config, config_key, local_path) ⇒ Wpcli
Returns a new instance of Wpcli.
7 8 9 10 11 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 7 def initialize(source_config, dest_config, config_key, local_path) @from = source_config[config_key] @to = dest_config[config_key] @local_path = local_path end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
5 6 7 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 5 def from @from end |
#local_path ⇒ Object (readonly)
Returns the value of attribute local_path.
5 6 7 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 5 def local_path @local_path end |
#sql_content ⇒ Object
Returns the value of attribute sql_content.
4 5 6 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 4 def sql_content @sql_content end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
5 6 7 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 5 def to @to end |
Instance Method Details
#command ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 13 def command unless wp_in_path? raise UnmetPeerDependencyError, "WP-CLI is not installed or not in your $PATH" end opts = [ "--path=#{cli_config_path}", from, to, "--quiet", "--skip-columns=guid", "--all-tables", "--allow-root" ] "wp search-replace #{opts.join(' ')}" end |