Class: EasyInstaller::Steps
- Inherits:
-
Object
- Object
- EasyInstaller::Steps
- Defined in:
- lib/easy_installer/steps.rb
Instance Method Summary collapse
-
#after_install ⇒ Object
Third step which evals code after successfull instalation.
-
#initialize(config, method) ⇒ Steps
constructor
A new instance of Steps.
-
#install(inputs) ⇒ Object
This is second step it evals install code with support of helper methods.
-
#return_callback(inputs) ⇒ Object
Last step which is evaled by redirecting user back to page for example to remove install directory on server.
-
#validate(inputs) ⇒ Object
First step which validates inputs data from user.
Constructor Details
#initialize(config, method) ⇒ Steps
Returns a new instance of Steps.
3 4 5 6 7 |
# File 'lib/easy_installer/steps.rb', line 3 def initialize(config, method) @config = config @method = method @config.method = method end |
Instance Method Details
#after_install ⇒ Object
Third step which evals code after successfull instalation
25 26 27 28 |
# File 'lib/easy_installer/steps.rb', line 25 def after_install install = EasyInstaller::Installer.new(@config) install.install(@config.after_install_code) end |
#install(inputs) ⇒ Object
This is second step it evals install code with support of helper methods
20 21 22 23 |
# File 'lib/easy_installer/steps.rb', line 20 def install(inputs) install = EasyInstaller::Installer.new(@config) install.install(@config.install_code(@method), inputs) end |
#return_callback(inputs) ⇒ Object
Last step which is evaled by redirecting user back to page for example to remove install directory on server
30 31 32 33 |
# File 'lib/easy_installer/steps.rb', line 30 def return_callback(inputs) install = EasyInstaller::Installer.new(@config) install.install(@config.return_callback_code, inputs) end |
#validate(inputs) ⇒ Object
First step which validates inputs data from user. In case of error it returns false and sets inputs_errors. inputs_errors is hash which looks like:
"input_name" => "error"
13 14 15 16 17 |
# File 'lib/easy_installer/steps.rb', line 13 def validate(inputs) validator = EasyInstaller::Validator.new(@config) validator.import_from_config_by_method(@method) raise validator.inputs_errors unless validator.check(inputs) end |