Module: Spring

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

Overview

Defined Under Namespace

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

Constant Summary collapse

STOP_TIMEOUT =

seconds

2
ORIGINAL_ENV =
ENV.to_hash
VERSION =
"1.4.3"
IGNORE_SIGNALS =
%w(INT QUIT)

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-jruby/configuration.rb', line 5

def application_root
  @application_root
end

.commandsObject (readonly)

Returns the value of attribute commands.



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

def commands
  @commands
end

.watch_intervalObject

Returns the value of attribute watch_interval.



6
7
8
# File 'lib/spring-jruby/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-jruby/watcher.rb', line 8

def watch_method
  @watch_method
end

.watcherObject



23
24
25
# File 'lib/spring-jruby/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-jruby/configuration.rb', line 15

def after_fork(&block)
  after_fork_callbacks << block
end

.after_fork_callbacksObject



11
12
13
# File 'lib/spring-jruby/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-jruby/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-jruby/commands.rb', line 19

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

.command?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.fork?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/spring-jruby/platform.rb', line 2

def self.fork?
  Process.respond_to?(:fork)
end

.gemfileObject



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

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

.jruby?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/spring-jruby/platform.rb', line 6

def self.jruby?
  RUBY_PLATFORM == "java"
end

.pool_min_free_workersObject



40
41
42
# File 'lib/spring-jruby/configuration.rb', line 40

def pool_min_free_workers
  2
end

.pool_spawn_parallelObject



44
45
46
# File 'lib/spring-jruby/configuration.rb', line 44

def pool_spawn_parallel
  true
end

.project_root_pathObject



36
37
38
# File 'lib/spring-jruby/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-jruby/commands.rb', line 11

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

.ruby_binObject



10
11
12
13
14
15
16
# File 'lib/spring-jruby/platform.rb', line 10

def self.ruby_bin
  if RUBY_PLATFORM == "java"
    "jruby"
  else
    "ruby"
  end
end

.verify_environmentObject



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

def verify_environment
  application_root_path
end

.watch(*items) ⇒ Object



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

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