Module: Deployment::Methods::Helper
- Defined in:
- lib/depengine/dsl/helper.rb
Class Method Summary collapse
- .validates_not_empty(attribute, message = nil) ⇒ Object
- .validates_presence_of(attribute, message = nil) ⇒ Object
Instance Method Summary collapse
- #assert_url_response_of(options = {}) ⇒ Object
- #report_by_mail(options = {}) ⇒ Object
- #report_to_cdb(options = {}) ⇒ Object
- #samba_mount(remote_path, local_path) ⇒ Object
- #samba_umount(local_path) ⇒ Object
- #sendmail(options) ⇒ Object
- #tomcat_deploy(options = {}) ⇒ Object
Class Method Details
.validates_not_empty(attribute, message = nil) ⇒ Object
78 79 80 |
# File 'lib/depengine/dsl/helper.rb', line 78 def validates_not_empty(attribute, =nil) raise ArgumentError, || "Parameter is empty", caller if attribute.nil? end |
.validates_presence_of(attribute, message = nil) ⇒ Object
73 74 75 |
# File 'lib/depengine/dsl/helper.rb', line 73 def validates_presence_of(attribute, =nil) raise ArgumentError, || "Missing parameter", caller if attribute.nil? end |
Instance Method Details
#assert_url_response_of(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/depengine/dsl/helper.rb', line 16 def assert_url_response_of(={}) asserter = ::Asserter::Url.new asserter.check_protocol = [:check_protocol] || @cdb['check_protocol'] || "http" asserter.check_host = [:check_host] || @cdb['check_host'] asserter.check_port = [:check_port] || @cdb['check_port'] || '80' asserter.check_uri = [:check_uri] || @cdb['check_uri'] || '/' asserter.check_response_string = [:chek_response_string] || @cdb['check_response_string'] || 'html' asserter.assert_url_response_of() end |
#report_by_mail(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/depengine/dsl/helper.rb', line 34 def report_by_mail(={}) reporter = ::Reporter::Mail.new reporter.deploy_email_from = [:deploy_email_from] || @cdb['deploy_email_from'] reporter.deploy_email_to = [:deploy_email_to] || @cdb['deploy_email_to'] reporter.application_name = [:application_name] || $recipe_config[:application_name] || @cdb['application_name'] reporter.module_name = [:module_name] || $recipe_config[:module_name] || @cdb['module_name'] reporter.environment = $recipe_config['ENVIRONMENT'] reporter.version = @version.to_json reporter.worker = self reporter.send() end |
#report_to_cdb(options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/depengine/dsl/helper.rb', line 27 def report_to_cdb(={}) reporter = ::Reporter::Cdb.new reporter.version = @version.to_json reporter.worker = self reporter.set_version() end |
#samba_mount(remote_path, local_path) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/depengine/dsl/helper.rb', line 60 def samba_mount (remote_path, local_path) smb = ::Helper::Smb.new smb.remote_path = remote_path smb.local_path = local_path smb.samba_mount() end |
#samba_umount(local_path) ⇒ Object
67 68 69 70 71 |
# File 'lib/depengine/dsl/helper.rb', line 67 def samba_umount (local_path) smb = ::Helper::Smb.new smb.local_path = local_path smb.samba_umount() end |
#sendmail(options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/depengine/dsl/helper.rb', line 4 def sendmail() Helper.validates_presence_of [:from], "Mail-FROM not set" Helper.validates_presence_of [:to], "Mail-TO not set" Helper.validates_presence_of [:subject], "No mail subject set" Helper.validates_presence_of [:body], "No mail body set" Helper.validates_presence_of @cdb['smtp_host'], "SMTP host not set" helper = ::Helper::Mail.new helper.smtp_host = @cdb['smtp_host'] helper.sendmail() end |
#tomcat_deploy(options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/depengine/dsl/helper.rb', line 46 def tomcat_deploy(={}) publisher = ::Publisher::Tomcat.new publisher.servers = [:servers] || @cdb['servers'] publisher.runners = [:runners] || @cdb['runners'] || publisher.servers publisher.initd_script = [:initd_script] || @cdb['initd_script'] publisher.application_name = [:application_name] || $recipe_config[:application_name] || @cdb['application_name'] publisher.catalina_home = [:catalina_home] || @cdb['catalina_home'] publisher.tomcat_context = [:tomcat_context] || @cdb['tomcat_context'] publisher.logfilename = [:logfilename] || @cdb['logfilename'] publisher.check_host = [:check_host] || @cdb['check_host'] publisher.worker = self publisher.deploy() end |