Class: DevDNSd::Application
- Inherits:
-
RExec::Daemon::Base
- Object
- RExec::Daemon::Base
- DevDNSd::Application
- Includes:
- DevDNSd::ApplicationMethods::Aliases, DevDNSd::ApplicationMethods::Server, DevDNSd::ApplicationMethods::System, Lazier::I18n
- Defined in:
- lib/devdnsd/application.rb
Overview
The main DevDNSd application.
Constant Summary
- ANY_REQUEST =
Class for ANY DNS request.
Resolv::DNS::Resource::IN::ANY
- ANY_CLASSES =
List of classes handled in case of DNS request with resource class ANY.
[Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::ANY, Resolv::DNS::Resource::IN::CNAME, Resolv::DNS::Resource::IN::HINFO, Resolv::DNS::Resource::IN::MINFO, Resolv::DNS::Resource::IN::MX, Resolv::DNS::Resource::IN::NS, Resolv::DNS::Resource::IN::PTR, Resolv::DNS::Resource::IN::SOA, Resolv::DNS::Resource::IN::TXT]
Instance Attribute Summary (collapse)
-
- (Bovem::Command) command
readonly
The Bovem command.
-
- (Configuration) config
readonly
The Configuration of this application.
-
- (Symbol|nil) locale
readonly
The current application locale.
-
- (Bovem::Logger) logger
The logger for this application.
Class Method Summary (collapse)
-
+ (Object) check_ruby_implementation
Check if the current implementation supports DevDNSd.
-
+ (Application) instance(command = nil, locale = nil, force = false)
Returns a unique (singleton) instance of the application.
-
+ (Object) quit
Stops the application.
-
+ (Object) run
Runs the application in foreground.
Instance Method Summary (collapse)
-
- (Logger) get_logger
Gets the current logger of the application.
-
- (Application) initialize(command, locale)
constructor
Creates a new application.
-
- (NilClass) on_start
This method is called when the server starts.
-
- (NilClass) on_stop
This method is called when the server stop.
Methods included from DevDNSd::ApplicationMethods::Server
#perform_server, #process_rule, #process_rule_in_classes
Methods included from DevDNSd::ApplicationMethods::Aliases
#compute_addresses, #is_ipv4?, #is_ipv6?, #manage_address, #manage_aliases
Methods included from DevDNSd::ApplicationMethods::System
#action_add, #action_install, #action_remove, #action_restart, #action_start, #action_status, #action_stop, #action_uninstall, #dns_update, #execute_command, #is_osx?, #launch_agent_path, #resolver_path
Constructor Details
- (Application) initialize(command, locale)
Creates a new application.
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/devdnsd/application.rb', line 672 def initialize(command, locale) i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale @locale = locale @command = command = @command.application..reject {|_, v| v.nil? } # Setup logger create_logger() # Open configuration read_configuration() self end |
Instance Attribute Details
- (Bovem::Command) command (readonly)
Returns The Bovem command.
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/devdnsd/application.rb', line 651 class Application < RExec::Daemon::Base # Class for ANY DNS request. ANY_REQUEST = Resolv::DNS::Resource::IN::ANY # List of classes handled in case of DNS request with resource class ANY. ANY_CLASSES = [Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::ANY, Resolv::DNS::Resource::IN::CNAME, Resolv::DNS::Resource::IN::HINFO, Resolv::DNS::Resource::IN::MINFO, Resolv::DNS::Resource::IN::MX, Resolv::DNS::Resource::IN::NS, Resolv::DNS::Resource::IN::PTR, Resolv::DNS::Resource::IN::SOA, Resolv::DNS::Resource::IN::TXT] include Lazier::I18n include DevDNSd::ApplicationMethods::System include DevDNSd::ApplicationMethods::Aliases include DevDNSd::ApplicationMethods::Server attr_reader :config attr_reader :command attr_accessor :logger attr_reader :locale # Creates a new application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. def initialize(command, locale) i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale @locale = locale @command = command = @command.application..reject {|_, v| v.nil? } # Setup logger create_logger() # Open configuration read_configuration() self end # Gets the current logger of the application. # # @return [Logger] The current logger of the application. def get_logger @logger ||= Bovem::Logger.create(@config.foreground ? $stdout : @config.log_file, @config.log_level, @log_formatter) end # This method is called when the server starts. By default is a no-op. # # @return [NilClass] `nil`. def on_start end # This method is called when the server stop. # # @return [NilClass] `nil`. def on_stop end # Returns a unique (singleton) instance of the application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. # @param force [Boolean] If to force recreation of the instance. # @return [Application] The unique (singleton) instance of the application. def self.instance(command = nil, locale = nil, force = false) @instance = nil if force @instance ||= DevDNSd::Application.new(command, locale) if command @instance end # Runs the application in foreground. # # @see #perform_server def self.run instance.perform_server end # Stops the application. def self.quit begin EM.add_timer(0.1) { ::EM.stop } rescue end end # Check if the current implementation supports DevDNSd. def self.check_ruby_implementation if defined?(JRuby) then Kernel.puts(Lazier::Localizer.new(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")).i18n.no_jruby) Kernel.exit(0) end end private # Creates a logger. # # @param options [Hash] The configuration to use. def create_logger() warn_failure = false orig_file = file = Bovem::Logger.get_real_file(["log_file"]) || Bovem::Logger.default_file if file.is_a?(String) then file = File.absolute_path(File.(file)) begin FileUtils.mkdir_p(File.dirname(file)) @logger = Bovem::Logger.create(file, Logger::INFO) rescue ["log_file"] = "STDOUT" file = $stdout warn_failure = true end end @logger = Bovem::Logger.create(file, Logger::INFO) @logger.warn(replace_markers(i18n.logging_failed(orig_file))) if @logger && warn_failure @logger end # Reads configuration. # # @param options [Hash] The configuration to read. def read_configuration() path = ::File.absolute_path(File.(["configuration"])) begin @config = DevDNSd::Configuration.new(path, , @logger) ensure_directory_for(@config.log_file) if @config.log_file.is_a?(String) ensure_directory_for(@config.pid_file) @logger = nil @logger = get_logger rescue Bovem::Errors::InvalidConfiguration => e log_failed_configuration(path, e) raise ::SystemExit end end # Creates a folder for a file. # # @param path [String] The path of the file. def ensure_directory_for(path) begin FileUtils.mkdir_p(File.dirname(path)) rescue @logger.warn(replace_markers(i18n.invalid_directory(File.dirname(path)))) raise ::SystemExit end end # Logs a failed configuration # # @param path [String] The path of the invalid file. # @param exception [Exception] The occurred exception. def log_failed_configuration(path, exception) logger = Bovem::Logger.create($stderr) logger.fatal(exception.) logger.warn(replace_markers(i18n.application_create_config(path))) end end |
- (Configuration) config (readonly)
Returns The Configuration of this application.
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/devdnsd/application.rb', line 651 class Application < RExec::Daemon::Base # Class for ANY DNS request. ANY_REQUEST = Resolv::DNS::Resource::IN::ANY # List of classes handled in case of DNS request with resource class ANY. ANY_CLASSES = [Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::ANY, Resolv::DNS::Resource::IN::CNAME, Resolv::DNS::Resource::IN::HINFO, Resolv::DNS::Resource::IN::MINFO, Resolv::DNS::Resource::IN::MX, Resolv::DNS::Resource::IN::NS, Resolv::DNS::Resource::IN::PTR, Resolv::DNS::Resource::IN::SOA, Resolv::DNS::Resource::IN::TXT] include Lazier::I18n include DevDNSd::ApplicationMethods::System include DevDNSd::ApplicationMethods::Aliases include DevDNSd::ApplicationMethods::Server attr_reader :config attr_reader :command attr_accessor :logger attr_reader :locale # Creates a new application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. def initialize(command, locale) i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale @locale = locale @command = command = @command.application..reject {|_, v| v.nil? } # Setup logger create_logger() # Open configuration read_configuration() self end # Gets the current logger of the application. # # @return [Logger] The current logger of the application. def get_logger @logger ||= Bovem::Logger.create(@config.foreground ? $stdout : @config.log_file, @config.log_level, @log_formatter) end # This method is called when the server starts. By default is a no-op. # # @return [NilClass] `nil`. def on_start end # This method is called when the server stop. # # @return [NilClass] `nil`. def on_stop end # Returns a unique (singleton) instance of the application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. # @param force [Boolean] If to force recreation of the instance. # @return [Application] The unique (singleton) instance of the application. def self.instance(command = nil, locale = nil, force = false) @instance = nil if force @instance ||= DevDNSd::Application.new(command, locale) if command @instance end # Runs the application in foreground. # # @see #perform_server def self.run instance.perform_server end # Stops the application. def self.quit begin EM.add_timer(0.1) { ::EM.stop } rescue end end # Check if the current implementation supports DevDNSd. def self.check_ruby_implementation if defined?(JRuby) then Kernel.puts(Lazier::Localizer.new(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")).i18n.no_jruby) Kernel.exit(0) end end private # Creates a logger. # # @param options [Hash] The configuration to use. def create_logger() warn_failure = false orig_file = file = Bovem::Logger.get_real_file(["log_file"]) || Bovem::Logger.default_file if file.is_a?(String) then file = File.absolute_path(File.(file)) begin FileUtils.mkdir_p(File.dirname(file)) @logger = Bovem::Logger.create(file, Logger::INFO) rescue ["log_file"] = "STDOUT" file = $stdout warn_failure = true end end @logger = Bovem::Logger.create(file, Logger::INFO) @logger.warn(replace_markers(i18n.logging_failed(orig_file))) if @logger && warn_failure @logger end # Reads configuration. # # @param options [Hash] The configuration to read. def read_configuration() path = ::File.absolute_path(File.(["configuration"])) begin @config = DevDNSd::Configuration.new(path, , @logger) ensure_directory_for(@config.log_file) if @config.log_file.is_a?(String) ensure_directory_for(@config.pid_file) @logger = nil @logger = get_logger rescue Bovem::Errors::InvalidConfiguration => e log_failed_configuration(path, e) raise ::SystemExit end end # Creates a folder for a file. # # @param path [String] The path of the file. def ensure_directory_for(path) begin FileUtils.mkdir_p(File.dirname(path)) rescue @logger.warn(replace_markers(i18n.invalid_directory(File.dirname(path)))) raise ::SystemExit end end # Logs a failed configuration # # @param path [String] The path of the invalid file. # @param exception [Exception] The occurred exception. def log_failed_configuration(path, exception) logger = Bovem::Logger.create($stderr) logger.fatal(exception.) logger.warn(replace_markers(i18n.application_create_config(path))) end end |
- (Symbol|nil) locale (readonly)
Returns The current application locale.
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/devdnsd/application.rb', line 651 class Application < RExec::Daemon::Base # Class for ANY DNS request. ANY_REQUEST = Resolv::DNS::Resource::IN::ANY # List of classes handled in case of DNS request with resource class ANY. ANY_CLASSES = [Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::ANY, Resolv::DNS::Resource::IN::CNAME, Resolv::DNS::Resource::IN::HINFO, Resolv::DNS::Resource::IN::MINFO, Resolv::DNS::Resource::IN::MX, Resolv::DNS::Resource::IN::NS, Resolv::DNS::Resource::IN::PTR, Resolv::DNS::Resource::IN::SOA, Resolv::DNS::Resource::IN::TXT] include Lazier::I18n include DevDNSd::ApplicationMethods::System include DevDNSd::ApplicationMethods::Aliases include DevDNSd::ApplicationMethods::Server attr_reader :config attr_reader :command attr_accessor :logger attr_reader :locale # Creates a new application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. def initialize(command, locale) i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale @locale = locale @command = command = @command.application..reject {|_, v| v.nil? } # Setup logger create_logger() # Open configuration read_configuration() self end # Gets the current logger of the application. # # @return [Logger] The current logger of the application. def get_logger @logger ||= Bovem::Logger.create(@config.foreground ? $stdout : @config.log_file, @config.log_level, @log_formatter) end # This method is called when the server starts. By default is a no-op. # # @return [NilClass] `nil`. def on_start end # This method is called when the server stop. # # @return [NilClass] `nil`. def on_stop end # Returns a unique (singleton) instance of the application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. # @param force [Boolean] If to force recreation of the instance. # @return [Application] The unique (singleton) instance of the application. def self.instance(command = nil, locale = nil, force = false) @instance = nil if force @instance ||= DevDNSd::Application.new(command, locale) if command @instance end # Runs the application in foreground. # # @see #perform_server def self.run instance.perform_server end # Stops the application. def self.quit begin EM.add_timer(0.1) { ::EM.stop } rescue end end # Check if the current implementation supports DevDNSd. def self.check_ruby_implementation if defined?(JRuby) then Kernel.puts(Lazier::Localizer.new(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")).i18n.no_jruby) Kernel.exit(0) end end private # Creates a logger. # # @param options [Hash] The configuration to use. def create_logger() warn_failure = false orig_file = file = Bovem::Logger.get_real_file(["log_file"]) || Bovem::Logger.default_file if file.is_a?(String) then file = File.absolute_path(File.(file)) begin FileUtils.mkdir_p(File.dirname(file)) @logger = Bovem::Logger.create(file, Logger::INFO) rescue ["log_file"] = "STDOUT" file = $stdout warn_failure = true end end @logger = Bovem::Logger.create(file, Logger::INFO) @logger.warn(replace_markers(i18n.logging_failed(orig_file))) if @logger && warn_failure @logger end # Reads configuration. # # @param options [Hash] The configuration to read. def read_configuration() path = ::File.absolute_path(File.(["configuration"])) begin @config = DevDNSd::Configuration.new(path, , @logger) ensure_directory_for(@config.log_file) if @config.log_file.is_a?(String) ensure_directory_for(@config.pid_file) @logger = nil @logger = get_logger rescue Bovem::Errors::InvalidConfiguration => e log_failed_configuration(path, e) raise ::SystemExit end end # Creates a folder for a file. # # @param path [String] The path of the file. def ensure_directory_for(path) begin FileUtils.mkdir_p(File.dirname(path)) rescue @logger.warn(replace_markers(i18n.invalid_directory(File.dirname(path)))) raise ::SystemExit end end # Logs a failed configuration # # @param path [String] The path of the invalid file. # @param exception [Exception] The occurred exception. def log_failed_configuration(path, exception) logger = Bovem::Logger.create($stderr) logger.fatal(exception.) logger.warn(replace_markers(i18n.application_create_config(path))) end end |
- (Bovem::Logger) logger
Returns The logger for this application.
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/devdnsd/application.rb', line 651 class Application < RExec::Daemon::Base # Class for ANY DNS request. ANY_REQUEST = Resolv::DNS::Resource::IN::ANY # List of classes handled in case of DNS request with resource class ANY. ANY_CLASSES = [Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::ANY, Resolv::DNS::Resource::IN::CNAME, Resolv::DNS::Resource::IN::HINFO, Resolv::DNS::Resource::IN::MINFO, Resolv::DNS::Resource::IN::MX, Resolv::DNS::Resource::IN::NS, Resolv::DNS::Resource::IN::PTR, Resolv::DNS::Resource::IN::SOA, Resolv::DNS::Resource::IN::TXT] include Lazier::I18n include DevDNSd::ApplicationMethods::System include DevDNSd::ApplicationMethods::Aliases include DevDNSd::ApplicationMethods::Server attr_reader :config attr_reader :command attr_accessor :logger attr_reader :locale # Creates a new application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. def initialize(command, locale) i18n_setup(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale @locale = locale @command = command = @command.application..reject {|_, v| v.nil? } # Setup logger create_logger() # Open configuration read_configuration() self end # Gets the current logger of the application. # # @return [Logger] The current logger of the application. def get_logger @logger ||= Bovem::Logger.create(@config.foreground ? $stdout : @config.log_file, @config.log_level, @log_formatter) end # This method is called when the server starts. By default is a no-op. # # @return [NilClass] `nil`. def on_start end # This method is called when the server stop. # # @return [NilClass] `nil`. def on_stop end # Returns a unique (singleton) instance of the application. # # @param command [Bovem::Command] The current Bovem command. # @param locale [Symbol] The locale to use for the application. # @param force [Boolean] If to force recreation of the instance. # @return [Application] The unique (singleton) instance of the application. def self.instance(command = nil, locale = nil, force = false) @instance = nil if force @instance ||= DevDNSd::Application.new(command, locale) if command @instance end # Runs the application in foreground. # # @see #perform_server def self.run instance.perform_server end # Stops the application. def self.quit begin EM.add_timer(0.1) { ::EM.stop } rescue end end # Check if the current implementation supports DevDNSd. def self.check_ruby_implementation if defined?(JRuby) then Kernel.puts(Lazier::Localizer.new(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")).i18n.no_jruby) Kernel.exit(0) end end private # Creates a logger. # # @param options [Hash] The configuration to use. def create_logger() warn_failure = false orig_file = file = Bovem::Logger.get_real_file(["log_file"]) || Bovem::Logger.default_file if file.is_a?(String) then file = File.absolute_path(File.(file)) begin FileUtils.mkdir_p(File.dirname(file)) @logger = Bovem::Logger.create(file, Logger::INFO) rescue ["log_file"] = "STDOUT" file = $stdout warn_failure = true end end @logger = Bovem::Logger.create(file, Logger::INFO) @logger.warn(replace_markers(i18n.logging_failed(orig_file))) if @logger && warn_failure @logger end # Reads configuration. # # @param options [Hash] The configuration to read. def read_configuration() path = ::File.absolute_path(File.(["configuration"])) begin @config = DevDNSd::Configuration.new(path, , @logger) ensure_directory_for(@config.log_file) if @config.log_file.is_a?(String) ensure_directory_for(@config.pid_file) @logger = nil @logger = get_logger rescue Bovem::Errors::InvalidConfiguration => e log_failed_configuration(path, e) raise ::SystemExit end end # Creates a folder for a file. # # @param path [String] The path of the file. def ensure_directory_for(path) begin FileUtils.mkdir_p(File.dirname(path)) rescue @logger.warn(replace_markers(i18n.invalid_directory(File.dirname(path)))) raise ::SystemExit end end # Logs a failed configuration # # @param path [String] The path of the invalid file. # @param exception [Exception] The occurred exception. def log_failed_configuration(path, exception) logger = Bovem::Logger.create($stderr) logger.fatal(exception.) logger.warn(replace_markers(i18n.application_create_config(path))) end end |
Class Method Details
+ (Object) check_ruby_implementation
Check if the current implementation supports DevDNSd.
736 737 738 739 740 741 |
# File 'lib/devdnsd/application.rb', line 736 def self.check_ruby_implementation if defined?(JRuby) then Kernel.puts(Lazier::Localizer.new(:devdnsd, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")).i18n.no_jruby) Kernel.exit(0) end end |
+ (Application) instance(command = nil, locale = nil, force = false)
Returns a unique (singleton) instance of the application.
714 715 716 717 718 |
# File 'lib/devdnsd/application.rb', line 714 def self.instance(command = nil, locale = nil, force = false) @instance = nil if force @instance ||= DevDNSd::Application.new(command, locale) if command @instance end |
+ (Object) quit
Stops the application.
728 729 730 731 732 733 |
# File 'lib/devdnsd/application.rb', line 728 def self.quit begin EM.add_timer(0.1) { ::EM.stop } rescue end end |
+ (Object) run
Runs the application in foreground.
723 724 725 |
# File 'lib/devdnsd/application.rb', line 723 def self.run instance.perform_server end |
Instance Method Details
- (Logger) get_logger
Gets the current logger of the application.
692 693 694 |
# File 'lib/devdnsd/application.rb', line 692 def get_logger @logger ||= Bovem::Logger.create(@config.foreground ? $stdout : @config.log_file, @config.log_level, @log_formatter) end |
- (NilClass) on_start
This method is called when the server starts. By default is a no-op.
699 700 |
# File 'lib/devdnsd/application.rb', line 699 def on_start end |
- (NilClass) on_stop
This method is called when the server stop.
705 706 |
# File 'lib/devdnsd/application.rb', line 705 def on_stop end |