Module: Spring

Defined in:
lib/spring/json.rb,
lib/spring/env.rb,
lib/spring/sid.rb,
lib/spring/json.rb,
lib/spring/test.rb,
lib/spring/client.rb,
lib/spring/errors.rb,
lib/spring/server.rb,
lib/spring/server.rb,
lib/spring/version.rb,
lib/spring/watcher.rb,
lib/spring/commands.rb,
lib/spring/client/run.rb,
lib/spring/application.rb,
lib/spring/client/help.rb,
lib/spring/client/stop.rb,
lib/spring/client/rails.rb,
lib/spring/client/status.rb,
lib/spring/commands/rake.rb,
lib/spring/configuration.rb,
lib/spring/client/binstub.rb,
lib/spring/client/command.rb,
lib/spring/client/version.rb,
lib/spring/commands/rails.rb,
lib/spring/command_wrapper.rb,
lib/spring/watcher/polling.rb,
lib/spring/test/application.rb,
lib/spring/watcher/abstract.rb,
lib/spring/test/watcher_test.rb,
lib/spring/test/rails_version.rb,
lib/spring/application_manager.rb,
lib/spring/test/acceptance_test.rb,
lib/spring/process_title_updater.rb,
lib/spring/test/application_generator.rb

Overview

Defined Under Namespace

Modules: Client, Commands, JSON, OkJson, SID, Test, Watcher Classes: Application, ApplicationManager, ClientError, CommandNotFound, CommandWrapper, Env, MissingApplication, ProcessTitleUpdater, Server, UnknownProject

Constant Summary collapse

IGNORE_SIGNALS =
%w(INT QUIT)
STOP_TIMEOUT =

seconds

2
ORIGINAL_ENV =
ENV.to_hash
VERSION =
"1.3.6"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.application_rootObject

Returns the value of attribute application_root.



5
6
7
# File 'lib/spring/configuration.rb', line 5

def application_root
  @application_root
end

.commandsObject (readonly)

Returns the value of attribute commands.



8
9
10
# File 'lib/spring/commands.rb', line 8

def commands
  @commands
end

.watch_intervalObject

Returns the value of attribute watch_interval.



6
7
8
# File 'lib/spring/watcher.rb', line 6

def watch_interval
  @watch_interval
end

.watch_methodObject

Returns the value of attribute watch_method.



8
9
10
# File 'lib/spring/watcher.rb', line 8

def watch_method
  @watch_method
end

.watcherObject



23
24
25
# File 'lib/spring/watcher.rb', line 23

def self.watcher
  @watcher ||= watch_method.new(Spring.application_root_path, watch_interval)
end

Class Method Details

.after_fork(&block) ⇒ Object



15
16
17
# File 'lib/spring/configuration.rb', line 15

def after_fork(&block)
  after_fork_callbacks << block
end

.after_fork_callbacksObject



11
12
13
# File 'lib/spring/configuration.rb', line 11

def after_fork_callbacks
  @after_fork_callbacks ||= []
end

.application_root_pathObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/spring/configuration.rb', line 23

def application_root_path
  @application_root_path ||= begin
    if application_root
      path = Pathname.new(File.expand_path(application_root))
    else
      path = project_root_path
    end

    raise MissingApplication.new(path) unless path.join("config/application.rb").exist?
    path
  end
end

.command(name) ⇒ Object



19
20
21
# File 'lib/spring/commands.rb', line 19

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

.command?(name) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/spring/commands.rb', line 15

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

.gemfileObject



7
8
9
# File 'lib/spring/configuration.rb', line 7

def gemfile
  ENV['BUNDLE_GEMFILE'] || "Gemfile"
end

.project_root_pathObject



36
37
38
# File 'lib/spring/configuration.rb', line 36

def project_root_path
  @project_root_path ||= find_project_root(Pathname.new(File.expand_path(Dir.pwd)))
end

.register_command(name, command = nil) ⇒ Object



11
12
13
# File 'lib/spring/commands.rb', line 11

def self.register_command(name, command = nil)
  commands[name] = CommandWrapper.new(name, command)
end

.verify_environmentObject



19
20
21
# File 'lib/spring/configuration.rb', line 19

def verify_environment
  application_root_path
end

.watch(*items) ⇒ Object



27
28
29
# File 'lib/spring/watcher.rb', line 27

def self.watch(*items)
  watcher.add *items
end