Sha256: c41b81db24ab237e5964c1f61038d457f8cc04e217b6d6674f9850eb406fa505

Contents?: true

Size: 753 Bytes

Versions: 5

Compression:

Stored size: 753 Bytes

Contents

module Evergreen
  #Translates the arguments passed in from the command line
  class Cli
    def self.execute(argv)
      new.execute(argv)
    end

    def execute(argv)
      command = argv.shift
      Evergreen.root = File.expand_path(argv.shift || '.', Dir.pwd)

      # detect Rails apps
      if File.exist?(File.join(Evergreen.root, 'config/environment.rb'))
        require File.join(Evergreen.root, 'config/environment.rb')
        require 'evergreen/rails' if defined?(Rails)
      end

      case command
      when "serve"
        Evergreen::Server.new.serve
        return true
      when "run"
        return Evergreen::Runner.new.run
      else
        puts "no such command '#{command}'"
        return false
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
evergreen-1.3.0 lib/evergreen/cli.rb
evergreen-1.2.0 lib/evergreen/cli.rb
evergreen-1.1.3 lib/evergreen/cli.rb
evergreen-1.1.2 lib/evergreen/cli.rb
evergreen-1.1.0 lib/evergreen/cli.rb