Sha256: 3d033b4d54c047be8b9f98be55714a8676626074e571cc62ad94882721767595

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

require "spring/watcher"

module Spring
  @commands = {}

  class << self
    attr_reader :commands
  end

  def self.register_command(name, klass)
    commands[name] = klass
  end

  def self.command?(name)
    commands.include? name
  end

  def self.command(name)
    commands.fetch name
  end

  require "spring/commands/rails"
  require "spring/commands/rake"

  # Load custom commands, if any.
  # needs to be at the end to allow modification of existing commands.
  config = File.expand_path("~/.spring.rb")
  require config if File.exist?(config)

  # If the config/spring.rb contains requires for commands from other gems,
  # then we need to be under bundler.
  require "bundler/setup"

  Gem::Specification.map(&:name).grep(/^spring-commands-/).each do |command|
    require command
  end

  config = File.expand_path("./config/spring.rb")
  require config if File.exist?(config)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spring-1.0.0 lib/spring/commands.rb
spring-0.9.2 lib/spring/commands.rb
spring-0.9.1 lib/spring/commands.rb