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.
-
#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) ⇒ Wpcli
constructor
A new instance of Wpcli.
Constructor Details
#initialize(source_config, dest_config, config_key) ⇒ Wpcli
Returns a new instance of Wpcli.
7 8 9 10 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 7 def initialize(source_config, dest_config, config_key) @from = source_config[config_key] @to = dest_config[config_key] 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 |
#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
12 13 14 15 16 17 18 |
# File 'lib/wordmove/sql_adapter/wpcli.rb', line 12 def command unless system('which wp > /dev/null 2>&1') raise UnmetPeerDependencyError, "WP-CLI is not installed or not in your $PATH" end "wp search-replace #{from} #{to} --quiet --skip-columns=guid --all-tables" end |