Sha256: 7224aef8ace08ec181cb03f1048e186dd575a28a33c1826808f33ff7d9f18cb8

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

module Fourteeninch
  class Core

    def self.press_a_key
      print "Please press any key to continue..."
      begin
        system("stty raw -echo")
        STDIN.getc
      ensure
        system("stty -raw echo")
      end
    end

    def self.clear
      system("clear") || system("cls")
    end

    def self.core
      Fourteeninch.load_settings
      if Fourteeninch::Auth.auth != false
      menu = Fourteeninch::Core.do_core(0)
      while menu != -1
        menu = Fourteeninch::Core.do_core(menu)
      end
      else
        puts "You are not logged in. Run `fourteeninch login` now to access fourteeninch core."
      end
    end

    

    def self.do_core(menu = 0)
      clear
      case menu
      when 0
        return Fourteeninch::MainMenu.intro
      when 1
        return Fourteeninch::Customers.customers_menu
      when 11
        return Fourteeninch::Customers.list_customers
      when 12
        return Fourteeninch::Customers.new_customer
      when 2
        # Show invoices menu
      when 3
        #show Admin Users Menu
      when 9
        Fourteeninch::Auth.logout
        puts "Good bye..."
        return -1
      when 0
        puts "Good bye..."
        return -1
      else
        return 0
      end
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fourteeninch-0.1.0 lib/fourteeninch/core.rb