Sha256: 3c84de127a89ab8e52f72e37605216986afab25a66b74961a87d5741ad149607

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

require 'notifyor'
require 'active_support/dependencies'

module Notifyor
  class CLI
    def boot_system
      require './config/application'
      ActiveSupport::Dependencies.require_dependency 'notifyor'
      ::Rails.application.require_environment!
      ::Rails.application.eager_load!
    end

    def parse
      OptionParser.new do |opts|
        opts.banner = 'Usage: notify_me [options]'

        opts.on('-v', '--version',
                'Show the current version of this gem') do
          puts "Notifyor Version: #{::Notifyor::VERSION}"; exit
        end

        opts.on('--ssh-host host', 'Provide the host address to your deployment/remote server') do |host|
          ::Notifyor.configuration.ssh_host = host
        end

        opts.on('--ssh-password password', 'Provide the ssh password for the deployment/remote server') do |password|
          ::Notifyor.configuration.ssh_password = password
        end

        opts.on('--ssh-port port', 'Provide the ssh port for the deployment/remote server') do |port|
          ::Notifyor.configuration.ssh_port = port
        end

        opts.on('--ssh-user user', 'Provide the ssh user for the deployment/remote server') do |user|
          ::Notifyor.configuration.ssh_user = user
        end
      end.parse!
    end

    def check_notifications
      loop do
        ::Notifyor.configuration.notifyor_models.each do |model|
          connection = Notifyor::Remote::Connection.new
          connection.growl_message(model.tableize)
        end
        sleep 5
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notifyor-0.4.3 lib/notifyor/cli.rb
notifyor-0.4.2 lib/notifyor/cli.rb
notifyor-0.4.1 lib/notifyor/cli.rb
notifyor-0.4.0 lib/notifyor/cli.rb
notifyor-0.3.2 lib/notifyor/cli.rb