-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfile.plugins.html
109 lines (87 loc) · 4.34 KB
/
file.plugins.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no'>
<meta name='apple-touch-fullscreen' content='yes'>
<meta name='apple-mobile-web-app-capable' content='yes'>
<meta name='apple-mobile-web-app-status-bar-style' content='rgba(228,228,228,1.0)'>
<title>File: Plugins — Puma master</title>
<link rel='stylesheet' type='text/css' href='../css/y_fonts.css' />
<link rel='stylesheet' type='text/css' href='../css/highlight.github.css' />
<link rel='stylesheet' type='text/css' href='../css/y_style.css' />
<link rel='stylesheet' type='text/css' href='../css/y_list.css' />
<link rel='stylesheet' type='text/css' href='../css/y_color.css' />
<script type='text/javascript'>
var pathId = "plugins",
relpath = '';
var t2Info = {
CSEP: '.',
ISEP: '#',
NSEP: '::'
};
</script>
<script type='text/javascript' charset='utf-8' src='../js/highlight.pack.js'></script>
<script type='text/javascript' charset='utf-8' src='../js/y_app.js'></script>
</head>
<body>
<svg id='y_wait' class viewBox='0 0 90 90'></svg>
<div id='settings' class='hidden'></div>
<div id='y_list' class='d h'>
<header id='list_header'></header>
<nav id= 'list_nav' class='y_nav l_nav'>
<ul id='list_items'></ul>
</nav>
</div>
<div id='y_toc' class='f h'>
<header id='toc_header'></header>
<nav id= 'toc_nav' class='y_nav t_nav'>
<ol id='toc_items'></ol>
</nav>
</div>
<div id='y_main' tabindex='-1'>
<header id='y_header'>
<div id='y_menu'>
<a id='home_no_xhr' href='/'>Home</a> »
<a href='.'>Puma master</a> »
<a href='_index.html'>Index</a> »
<span class='title'><a id='t2_doc_top' href='#'>File: Plugins ▲</a></span>
</div>
<a id='list_href' href="class_list.html"></a>
<div id='y_measure_em' class='y_measure'></div>
<div id='y_measure_vh' class='y_measure'></div>
<span id='y_measure_50pre' class='y_measure'><code>123456789_123456789_123456789_123456789_123456789_</code></span>
</header>
<div id='content' class='file'>
<h2>Plugins</h2>
<p><a href="Puma.html" title="Puma (module)"><code>Puma</code></a> 3.0 added support for plugins that can augment configuration and service
operations.</p>
<p>There are two canonical plugins to aid in the development of new plugins:</p>
<ul>
<li><a href="https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb">tmp_restart</a>:
Restarts the server if the file <code>tmp/restart.txt</code> is touched</li>
<li><a href="https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb">heroku</a>:
Packages up the default configuration used by Puma on Heroku (being sunset
with the release of Puma 5.0)</li>
</ul>
<p>Plugins are activated in a <a href="Puma.html" title="Puma (module)"><code>Puma</code></a> configuration file (such as <code>config/puma.rb'</code>)
by adding <code>plugin "name"</code>, such as <code>plugin "heroku"</code>.</p>
<p>Plugins are activated based on path requirements so, activating the <code>heroku</code>
plugin is much like <code>require "puma/plugin/heroku"</code>. This allows gems to provide
multiple plugins (as well as unrelated gems to provide <a href="Puma.html" title="Puma (module)"><code>Puma</code></a> plugins).</p>
<p>The <code>tmp_restart</code> plugin comes with <a href="Puma.html" title="Puma (module)"><code>Puma</code></a>, so it is always available.</p>
<p>To use the <code>heroku</code> plugin, add <code>puma-heroku</code> to your Gemfile or install it.</p>
<h3>API</h3>
<h2>Server-wide hooks</h2>
<p>Plugins can use a couple of hooks at the server level: <code>start</code> and <code>config</code>.</p>
<p><code>start</code> runs when the server has started and allows the plugin to initiate other
functionality to augment <a href="Puma.html" title="Puma (module)"><code>Puma</code></a>.</p>
<p><code>config</code> runs when the server is being configured and receives a <a href="Puma/DSL.html" title="Puma::DSL (class)"><code>DSL</code></a>
object that is useful for additional configuration.</p>
<p>Public methods in <a href="../lib/puma/plugin.rb"><a href="Puma/Plugin.html" title="Puma::Plugin (class)"><code>Plugin</code></a></a> are treated as a
public API for plugins.</p>
<div id='footer'></div>
</div> <!-- content -->
</div> <!-- y_main -->
</body>
</html>