Sha256: 1686dc8a7f79157a582b2defa9a98325eda21bf75567f597edf5b0c0a88ad3c2

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

module Evergreen
  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

2 entries across 2 versions & 1 rubygems

Version Path
evergreen-1.0.1 lib/evergreen/cli.rb
evergreen-1.0.0 lib/evergreen/cli.rb