puma_file_restart 0.0.1
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/lib/puma/plugin/file_restart.rb +55 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7267e489edb5d568a4b03018bef62c36febaed0f
|
4
|
+
data.tar.gz: 92b19ccc62483730480c757b875255fd7ec26a72
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce9a5258ec3872244e7b474136f63e8d98319308d2fc751445e4e027463ef00b6973d1cb974232534ce2bfe40031c4e20a26b00e18495dbd5e4f2ad457c881ef
|
7
|
+
data.tar.gz: 9997bf0170fe1b6758bc75651abe907a10ffb5ba98a9a239de5c66f0eba9fb354b4e6b8749f610b23d64d8faf4ac10b5f981bc7c8c44fb23650937fb9f7da408
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "listen"
|
2
|
+
|
3
|
+
# Restarts Puma when a file gets modified.
|
4
|
+
# Only works when RACK_ENV == "development" to prevent accidental usage.
|
5
|
+
#
|
6
|
+
# By default it restarts Puma on every file change inside the current directory,
|
7
|
+
# but can be configured through the following environment variables:
|
8
|
+
#
|
9
|
+
# - ENV["PUMA_FILE_RESTART_DIRS"]: comma-separated list of the directories
|
10
|
+
# to be monitored. Example: "./app,./tmp"
|
11
|
+
#
|
12
|
+
# - ENV["PUMA_FILE_RESTART_IGNORE"]: string representing a Ruby Regexp.
|
13
|
+
# Changes in files whose pathname match the Regexp won"t restart Puma.
|
14
|
+
# Example: '\.txt\Z' will ignore changes in any file with extension .txt
|
15
|
+
# (Notice the single quotes so you don't need to worry about escaping '\').
|
16
|
+
#
|
17
|
+
# - ENV["PUMA_FILE_RESTART_ONLY"]: string representing a Ruby Regexp.
|
18
|
+
# Changes in files whose pathname don"t match the Regexp won"t restart Puma.
|
19
|
+
# Example: '\.txt\Z' will changes in any file with extension .txt
|
20
|
+
# (Notice the single quotes so you don't need to worry about escaping '\').
|
21
|
+
|
22
|
+
Puma::Plugin.create do
|
23
|
+
def start(launcher)
|
24
|
+
return unless ENV["RACK_ENV"] == "development"
|
25
|
+
in_background do
|
26
|
+
listener = Listen.to(*dirs) { |_| launcher.restart }
|
27
|
+
listener.only(only) if only
|
28
|
+
listener.ignore(ignore) if ignore
|
29
|
+
listener.start
|
30
|
+
sleep
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def dirs
|
35
|
+
if env = ENV["PUMA_FILE_RESTART_DIRS"]
|
36
|
+
env.split(",")
|
37
|
+
else
|
38
|
+
[Dir.pwd]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def ignore
|
43
|
+
if env = ENV["PUMA_FILE_RESTART_IGNORE"]
|
44
|
+
Regexp.new(env)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def only
|
49
|
+
if env = ENV["PUMA_FILE_RESTART_ONLY"]
|
50
|
+
Regexp.new(env)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
VERSION = "0.0.1"
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puma_file_restart
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Raul Murciano
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: puma
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: listen
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: Puma plugin to restart Puma automatically when a file gets modified.
|
70
|
+
email:
|
71
|
+
- raul@murciano.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- lib/puma/plugin/file_restart.rb
|
77
|
+
homepage: https://github.com/raul/puma_file_restart
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.0.14.1
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Restarts Puma when a file gets modified.
|
101
|
+
test_files: []
|