spring-jruby 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +364 -0
- data/bin/spring +49 -0
- data/lib/spring-jruby/application.rb +283 -0
- data/lib/spring-jruby/application/boot.rb +19 -0
- data/lib/spring-jruby/binstub.rb +13 -0
- data/lib/spring-jruby/boot.rb +9 -0
- data/lib/spring-jruby/client.rb +46 -0
- data/lib/spring-jruby/client/binstub.rb +188 -0
- data/lib/spring-jruby/client/command.rb +18 -0
- data/lib/spring-jruby/client/help.rb +62 -0
- data/lib/spring-jruby/client/rails.rb +34 -0
- data/lib/spring-jruby/client/run.rb +167 -0
- data/lib/spring-jruby/client/status.rb +30 -0
- data/lib/spring-jruby/client/stop.rb +22 -0
- data/lib/spring-jruby/client/version.rb +11 -0
- data/lib/spring-jruby/command_wrapper.rb +82 -0
- data/lib/spring-jruby/commands.rb +51 -0
- data/lib/spring-jruby/commands/rails.rb +112 -0
- data/lib/spring-jruby/commands/rake.rb +30 -0
- data/lib/spring-jruby/configuration.rb +60 -0
- data/lib/spring-jruby/env.rb +109 -0
- data/lib/spring-jruby/errors.rb +36 -0
- data/lib/spring-jruby/impl/application.rb +7 -0
- data/lib/spring-jruby/impl/application_manager.rb +7 -0
- data/lib/spring-jruby/impl/fork/application.rb +69 -0
- data/lib/spring-jruby/impl/fork/application_manager.rb +137 -0
- data/lib/spring-jruby/impl/fork/run.rb +47 -0
- data/lib/spring-jruby/impl/pool/application.rb +47 -0
- data/lib/spring-jruby/impl/pool/application_manager.rb +226 -0
- data/lib/spring-jruby/impl/pool/run.rb +27 -0
- data/lib/spring-jruby/impl/run.rb +7 -0
- data/lib/spring-jruby/io_helpers.rb +92 -0
- data/lib/spring-jruby/json.rb +626 -0
- data/lib/spring-jruby/platform.rb +23 -0
- data/lib/spring-jruby/process_title_updater.rb +65 -0
- data/lib/spring-jruby/server.rb +130 -0
- data/lib/spring-jruby/sid.rb +42 -0
- data/lib/spring-jruby/test.rb +18 -0
- data/lib/spring-jruby/test/acceptance_test.rb +371 -0
- data/lib/spring-jruby/test/application.rb +217 -0
- data/lib/spring-jruby/test/application_generator.rb +134 -0
- data/lib/spring-jruby/test/rails_version.rb +40 -0
- data/lib/spring-jruby/test/watcher_test.rb +167 -0
- data/lib/spring-jruby/version.rb +3 -0
- data/lib/spring-jruby/watcher.rb +30 -0
- data/lib/spring-jruby/watcher/abstract.rb +86 -0
- data/lib/spring-jruby/watcher/polling.rb +61 -0
- metadata +137 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spring-jruby/watcher/abstract"
|
2
|
+
require "spring-jruby/configuration"
|
3
|
+
|
4
|
+
module Spring
|
5
|
+
class << self
|
6
|
+
attr_accessor :watch_interval
|
7
|
+
attr_writer :watcher
|
8
|
+
attr_reader :watch_method
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.watch_method=(method)
|
12
|
+
if method.is_a?(Class)
|
13
|
+
@watch_method = method
|
14
|
+
else
|
15
|
+
require "spring-jruby/watcher/#{method}"
|
16
|
+
@watch_method = Watcher.const_get(method.to_s.gsub(/(^.|_.)/) { $1[-1].upcase })
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
self.watch_interval = 0.2
|
21
|
+
self.watch_method = :polling
|
22
|
+
|
23
|
+
def self.watcher
|
24
|
+
@watcher ||= watch_method.new(Spring.application_root_path, watch_interval)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.watch(*items)
|
28
|
+
watcher.add(*items)
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "set"
|
2
|
+
require "pathname"
|
3
|
+
require "mutex_m"
|
4
|
+
|
5
|
+
module Spring
|
6
|
+
module Watcher
|
7
|
+
# A user of a watcher can use IO.select to wait for changes:
|
8
|
+
#
|
9
|
+
# watcher = MyWatcher.new(root, latency)
|
10
|
+
# IO.select([watcher]) # watcher is running in background
|
11
|
+
# watcher.stale? # => true
|
12
|
+
class Abstract
|
13
|
+
include Mutex_m
|
14
|
+
|
15
|
+
attr_reader :files, :directories, :root, :latency
|
16
|
+
|
17
|
+
def initialize(root, latency)
|
18
|
+
super()
|
19
|
+
|
20
|
+
@root = File.realpath(root)
|
21
|
+
@latency = latency
|
22
|
+
@files = Set.new
|
23
|
+
@directories = Set.new
|
24
|
+
@stale = false
|
25
|
+
@listeners = []
|
26
|
+
end
|
27
|
+
|
28
|
+
def add(*items)
|
29
|
+
items = items.flatten.map do |item|
|
30
|
+
item = Pathname.new(item)
|
31
|
+
|
32
|
+
if item.relative?
|
33
|
+
Pathname.new("#{root}/#{item}")
|
34
|
+
else
|
35
|
+
item
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
items = items.select(&:exist?)
|
40
|
+
|
41
|
+
synchronize {
|
42
|
+
items.each do |item|
|
43
|
+
if item.directory?
|
44
|
+
directories << item.realpath.to_s
|
45
|
+
else
|
46
|
+
files << item.realpath.to_s
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
subjects_changed
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def stale?
|
55
|
+
@stale
|
56
|
+
end
|
57
|
+
|
58
|
+
def on_stale(&block)
|
59
|
+
@listeners << block
|
60
|
+
end
|
61
|
+
|
62
|
+
def mark_stale
|
63
|
+
return if stale?
|
64
|
+
@stale = true
|
65
|
+
@listeners.each(&:call)
|
66
|
+
end
|
67
|
+
|
68
|
+
def restart
|
69
|
+
stop
|
70
|
+
start
|
71
|
+
end
|
72
|
+
|
73
|
+
def start
|
74
|
+
raise NotImplementedError
|
75
|
+
end
|
76
|
+
|
77
|
+
def stop
|
78
|
+
raise NotImplementedError
|
79
|
+
end
|
80
|
+
|
81
|
+
def subjects_changed
|
82
|
+
raise NotImplementedError
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "spring-jruby/watcher"
|
2
|
+
|
3
|
+
module Spring
|
4
|
+
module Watcher
|
5
|
+
class Polling < Abstract
|
6
|
+
attr_reader :mtime
|
7
|
+
|
8
|
+
def initialize(root, latency)
|
9
|
+
super
|
10
|
+
@mtime = 0
|
11
|
+
@poller = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def check_stale
|
15
|
+
synchronize { mark_stale if mtime < compute_mtime }
|
16
|
+
end
|
17
|
+
|
18
|
+
def add(*)
|
19
|
+
check_stale if @poller
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def start
|
24
|
+
unless @poller
|
25
|
+
@poller = Thread.new {
|
26
|
+
Thread.current.abort_on_exception = true
|
27
|
+
|
28
|
+
loop do
|
29
|
+
Kernel.sleep latency
|
30
|
+
check_stale
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop
|
37
|
+
if @poller
|
38
|
+
@poller.kill
|
39
|
+
@poller = nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def subjects_changed
|
44
|
+
@mtime = compute_mtime
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def compute_mtime
|
50
|
+
expanded_files.map { |f| File.mtime(f).to_f }.max || 0
|
51
|
+
rescue Errno::ENOENT
|
52
|
+
# if a file does no longer exist, the watcher is always stale.
|
53
|
+
Float::MAX
|
54
|
+
end
|
55
|
+
|
56
|
+
def expanded_files
|
57
|
+
files + Dir["{#{directories.map { |d| "#{d}/**/*" }.join(",")}}"]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spring-jruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Leighton
|
8
|
+
- Jan Berdajs
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.0
|
20
|
+
name: activesupport
|
21
|
+
prerelease: false
|
22
|
+
type: :development
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 4.2.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
name: rake
|
35
|
+
prerelease: false
|
36
|
+
type: :development
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
name: bump
|
49
|
+
prerelease: false
|
50
|
+
type: :development
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: Preloads your application so things like console, rake and tests run faster
|
57
|
+
email:
|
58
|
+
- j@jonathanleighton.com
|
59
|
+
- mrbrdo@gmail.com
|
60
|
+
executables:
|
61
|
+
- spring
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- bin/spring
|
68
|
+
- lib/spring-jruby/application.rb
|
69
|
+
- lib/spring-jruby/application/boot.rb
|
70
|
+
- lib/spring-jruby/binstub.rb
|
71
|
+
- lib/spring-jruby/boot.rb
|
72
|
+
- lib/spring-jruby/client.rb
|
73
|
+
- lib/spring-jruby/client/binstub.rb
|
74
|
+
- lib/spring-jruby/client/command.rb
|
75
|
+
- lib/spring-jruby/client/help.rb
|
76
|
+
- lib/spring-jruby/client/rails.rb
|
77
|
+
- lib/spring-jruby/client/run.rb
|
78
|
+
- lib/spring-jruby/client/status.rb
|
79
|
+
- lib/spring-jruby/client/stop.rb
|
80
|
+
- lib/spring-jruby/client/version.rb
|
81
|
+
- lib/spring-jruby/command_wrapper.rb
|
82
|
+
- lib/spring-jruby/commands.rb
|
83
|
+
- lib/spring-jruby/commands/rails.rb
|
84
|
+
- lib/spring-jruby/commands/rake.rb
|
85
|
+
- lib/spring-jruby/configuration.rb
|
86
|
+
- lib/spring-jruby/env.rb
|
87
|
+
- lib/spring-jruby/errors.rb
|
88
|
+
- lib/spring-jruby/impl/application.rb
|
89
|
+
- lib/spring-jruby/impl/application_manager.rb
|
90
|
+
- lib/spring-jruby/impl/fork/application.rb
|
91
|
+
- lib/spring-jruby/impl/fork/application_manager.rb
|
92
|
+
- lib/spring-jruby/impl/fork/run.rb
|
93
|
+
- lib/spring-jruby/impl/pool/application.rb
|
94
|
+
- lib/spring-jruby/impl/pool/application_manager.rb
|
95
|
+
- lib/spring-jruby/impl/pool/run.rb
|
96
|
+
- lib/spring-jruby/impl/run.rb
|
97
|
+
- lib/spring-jruby/io_helpers.rb
|
98
|
+
- lib/spring-jruby/json.rb
|
99
|
+
- lib/spring-jruby/platform.rb
|
100
|
+
- lib/spring-jruby/process_title_updater.rb
|
101
|
+
- lib/spring-jruby/server.rb
|
102
|
+
- lib/spring-jruby/sid.rb
|
103
|
+
- lib/spring-jruby/test.rb
|
104
|
+
- lib/spring-jruby/test/acceptance_test.rb
|
105
|
+
- lib/spring-jruby/test/application.rb
|
106
|
+
- lib/spring-jruby/test/application_generator.rb
|
107
|
+
- lib/spring-jruby/test/rails_version.rb
|
108
|
+
- lib/spring-jruby/test/watcher_test.rb
|
109
|
+
- lib/spring-jruby/version.rb
|
110
|
+
- lib/spring-jruby/watcher.rb
|
111
|
+
- lib/spring-jruby/watcher/abstract.rb
|
112
|
+
- lib/spring-jruby/watcher/polling.rb
|
113
|
+
homepage: https://github.com/mrbrdo/spring
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.4.8
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Rails application preloader
|
137
|
+
test_files: []
|