Class: WordpressDeploy::Cli::Utility
- Inherits:
-
Thor
- Object
- Thor
- WordpressDeploy::Cli::Utility
- Includes:
- Thor::Actions
- Defined in:
- lib/wordpress_deploy/cli/utility.rb
Instance Method Summary collapse
- #backup(environment) ⇒ Object
- #config(environment) ⇒ Object
- #deploy(from, to) ⇒ Object
- #mirror(from, to) ⇒ Object
- #transmit(environment) ⇒ Object
Instance Method Details
#backup(environment) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/wordpress_deploy/cli/utility.rb', line 119 def backup(environment) # Set Logger into verbose mode (if the user requested it) Logger.verbose = [:verbose] # Set environment options Config. # Load ALL the available environments WordpressDeploy::Environments.load # Get the Environment the user requested env = WordpressDeploy::Environments.find environment.to_sym # Backup the database to the sql_dir env.database.save! rescue => err Logger.error Errors::Cli::Utility::Error.wrap(err) # Exit with an error exit(1) end |
#config(environment) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wordpress_deploy/cli/utility.rb', line 17 def config(environment) # Set Logger into verbose mode (if the user requested it) Logger.verbose = [:verbose] # Set environment options Config. # Load ALL the available environments WordpressDeploy::Environments.load # Get the Environment the user requested env = WordpressDeploy::Environments.find environment.to_sym # Save the configuration file env.save_wp_config rescue => err Logger.error Errors::Cli::Utility::Error.wrap(err) # Exit with an error exit(1) end |
#deploy(from, to) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/wordpress_deploy/cli/utility.rb', line 51 def deploy(from, to) # Set Logger into verbose mode (if the user requested it) Logger.verbose = [:verbose] # Set environment options Config. # Load ALL the available environments WordpressDeploy::Environments.load # Get the Environment the user requested from = WordpressDeploy::Environments.find from.to_sym to = WordpressDeploy::Environments.find to.to_sym # Save the correct configuration file to.save_wp_config # Send the files in wp_dir to.transfer.transmit! # Save the to database locally from.database.save! # Send the database from => to from.database.send!(to) # Now migrate the database from => to from.database.migrate!(to) rescue => err Logger.error Errors::Cli::Utility::Error.wrap(err) # Exit with an error exit(1) end |
#mirror(from, to) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/wordpress_deploy/cli/utility.rb', line 88 def mirror(from, to) # Set Logger into verbose mode (if the user requested it) Logger.verbose = [:verbose] # Set environment options Config. # Load ALL the available environments WordpressDeploy::Environments.load # Get the Environment the user requested from = WordpressDeploy::Environments.find from.to_sym to = WordpressDeploy::Environments.find to.to_sym # Save the to database locally from.database.save! # Send the database to => from from.database.send!(to) # Now migrate the database to => from from.database.migrate!(to) rescue => err Logger.error Errors::Cli::Utility::Error.wrap(err) # Exit with an error exit(1) end |
#transmit(environment) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/wordpress_deploy/cli/utility.rb', line 143 def transmit(environment) # Set Logger into verbose mode (if the user requested it) Logger.verbose = [:verbose] # Set environment options Config. # Load ALL the available environments WordpressDeploy::Environments.load # Get the Environment the user requested env = WordpressDeploy::Environments.find environment.to_sym # Save the configuration file env.save_wp_config # Send the files in wp_dir env.transfer.transmit! rescue => err Logger.error Errors::Cli::Utility::Error.wrap(err) # Exit with an error exit(1) end |