Sha256: 12917ed2f974c160cabd4516ee089e30192e847f6bd12419554e14596c1a5742

Contents?: true

Size: 1.84 KB

Versions: 60

Compression:

Stored size: 1.84 KB

Contents

module Nutella

  class NutellaCLI
    
    NUTELLA_LOGO = "                   _       _ _
                  | |     | | |
       _ __  _   _| |_ ___| | | __ _
      |  _ \\| | | | __/ _ \\ | |/ _  |
      | | | | |_| | ||  __/ | | (_| |
      |_| |_|\\__,_|\\__\\___|_|_|\\__,_|
      "
    
    # Nutella entry point. Every time the "nutella" command is invoked this is
    # the method that gets called.
    # It reads the command line parameters and it invokes the right sub-command
    def self.run
      # Read parameters
      args = ARGV.dup
      args.shift

      # Check that the command is not empty, if so, simply print the nutella logo
      command = ARGV.first
      if command == nil
        print_nutella_logo
        exit 0
      end

      # If nutella is not ready to be used (i.e. nobody has invoked the "nutella checkup" command yet),
      # append warning/reminder message
      if Nutella.config['ready'].nil? && command!='checkup'
        console.warn 'Looks like this is a fresh installation of nutella. Please run \'nutella checkup\' to check all dependencies are installed.'
      end

      # Execute the appropriate command
      Nutella.execute_command command, args
      exit 0
    end


    # Print nutella logo
    def self.print_nutella_logo
      console.info(NUTELLA_LOGO)
      nutella_version = File.open("#{Nutella::NUTELLA_HOME}VERSION", 'rb').read
      console.info("Welcome to nutella version #{nutella_version}! For a complete lists of available commands type 'nutella help'\n")
      # If nutella is not ready to be used (i.e. nobody has invoked the "nutella checkup" command yet),
      # append warning/reminder message
      if  Nutella.config['ready'].nil?
        console.warn 'Looks like this is a fresh installation of nutella. Please run \'nutella checkup\' to check all dependencies are installed.'
      end
    end
  end

end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
nutella_framework-0.9.2 lib/core/nutella_cli.rb
nutella_framework-0.9.1 lib/core/nutella_cli.rb
nutella_framework-0.9.0 lib/core/nutella_cli.rb
nutella_framework-0.8.0 lib/core/nutella_cli.rb
nutella_framework-0.7.3 lib/core/nutella_cli.rb
nutella_framework-0.7.2 lib/core/nutella_cli.rb
nutella_framework-0.7.1 lib/core/nutella_cli.rb
nutella_framework-0.7.0 lib/core/nutella_cli.rb
nutella_framework-0.6.21 lib/core/nutella_cli.rb
nutella_framework-0.6.20 lib/core/nutella_cli.rb
nutella_framework-0.6.19 lib/core/nutella_cli.rb
nutella_framework-0.6.18 lib/core/nutella_cli.rb
nutella_framework-0.6.17 lib/core/nutella_cli.rb
nutella_framework-0.6.16 lib/core/nutella_cli.rb
nutella_framework-0.6.15 lib/core/nutella_cli.rb
nutella_framework-0.6.13 lib/core/nutella_cli.rb
nutella_framework-0.6.12 lib/core/nutella_cli.rb
nutella_framework-0.6.11 lib/core/nutella_cli.rb
nutella_framework-0.6.10 lib/core/nutella_cli.rb
nutella_framework-0.6.9 lib/core/nutella_cli.rb