machinegun 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 856399b20281b02dfdf915aa0e7537487dac6a18
4
- data.tar.gz: c196777356c7ec754e7f5fad536b439009da4247
3
+ metadata.gz: 6b524811b2c23d4a050e5473d1b53ae1777dd2a6
4
+ data.tar.gz: d616bd518cc62ab1ba3055bebca11ee5833b9fef
5
5
  SHA512:
6
- metadata.gz: c629db595d80ac0fcb5a6587a1b004c868e3d0906332af9436cd1dce52fc2249cd20021784ff55eb440eb734acb554f185fe9fb86f4fa173af0a77e2e0414edd
7
- data.tar.gz: 9679baee95dc8cfd4b4f54cb531e04b62954f6d207c88b40f0a9a5cabd285423cfbe300344ecdd6b41cee3678d1dbecc0db01b11510a3ac6caeb3a368589e15d
6
+ metadata.gz: 169fcc2a682b66388a492a614b3b0b58e96e0c7ce203e601faefe2a61d3da0e57d38e03c7e319fa2aca4b7d15b9f5a0ed223fa17ab67c28f6ace8e41c8aec646
7
+ data.tar.gz: 03b2e046e1e056728d91f2f7628d8dba0e1f6488de8655b6327aaaf52a6de803931cdc6add7810e87b4fea2704f6fdd9a87deea1f78ee86056d8fd06a074b190
data/README.md CHANGED
@@ -1,3 +1,23 @@
1
1
  # machinegun
2
2
 
3
- An automatic reloading webserver for Ruby.
3
+ [![Gem Version](https://badge.fury.io/rb/machinegun.svg)](https://badge.fury.io/rb/machinegun)
4
+
5
+ An automatic reloading Rack development web server for Ruby.
6
+
7
+ This gem was inspired by [shotgun](https://github.com/rtomayko/shotgun), which reloads the application on every request to ensure that the latest code is running. However, reloading on request can cause performance problems for applications that consume a lot of memory and/or generate a lot of requests. machinegun solves this problem by reloading the application when there are changes to the filesystem, instead of reloading on each request. This allows for the best of both worlds: A web server that reloads when changes to the code are made, and also performs quickly when serving requests.
8
+
9
+ ## Installation
10
+
11
+ ```text
12
+ $ gem install machinegun
13
+ ```
14
+
15
+ ## Use
16
+
17
+ The `machinegun` command replaces `rackup`. rackup's command line options should be compatible with the machinegun executable. Since machinegun is a wrapper around Rack, your project also needs a [Rack configuration file](https://github.com/rack/rack/wiki/(tutorial)-rackup-howto#config-file-syntax), typically `config.ru`.
18
+
19
+ For example, the following command will launch the web server on port 9393 and bind it to all network adapters:
20
+
21
+ ```text
22
+ $ machinegun -p 9393 -o 0.0.0.0
23
+ ```
data/bin/machinegun ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/machinegun'
4
+
5
+ MachineGun.run
@@ -0,0 +1,203 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: MachineGun
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!MachineGun.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (M)</a> &raquo;
35
+
36
+
37
+ <span class="title">MachineGun</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: MachineGun
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">MachineGun</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/machinegun.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Class Method Summary
112
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#run-class_method" title="run (class method)">+ (Object) <strong>run</strong> </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ </ul>
140
+
141
+
142
+
143
+
144
+ <div id="class_method_details" class="method_details_list">
145
+ <h2>Class Method Details</h2>
146
+
147
+
148
+ <div class="method_details first">
149
+ <h3 class="signature first" id="run-class_method">
150
+
151
+ + (<tt>Object</tt>) <strong>run</strong>
152
+
153
+
154
+
155
+
156
+
157
+ </h3><table class="source_code">
158
+ <tr>
159
+ <td>
160
+ <pre class="lines">
161
+
162
+
163
+ 6
164
+ 7
165
+ 8
166
+ 9
167
+ 10
168
+ 11
169
+ 12
170
+ 13
171
+ 14
172
+ 15</pre>
173
+ </td>
174
+ <td>
175
+ <pre class="code"><span class="info file"># File 'lib/machinegun.rb', line 6</span>
176
+
177
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span>
178
+ <span class='id identifier rubyid_pid'>pid</span> <span class='op'>=</span> <span class='id identifier rubyid_start_server'>start_server</span>
179
+
180
+ <span class='const'>FileWatcher</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>./**/*.rb</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_watch'>watch</span> <span class='kw'>do</span>
181
+ <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INT</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_pid'>pid</span>
182
+ <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_wait'>wait</span> <span class='id identifier rubyid_pid'>pid</span>
183
+
184
+ <span class='id identifier rubyid_pid'>pid</span> <span class='op'>=</span> <span class='id identifier rubyid_start_server'>start_server</span>
185
+ <span class='kw'>end</span>
186
+ <span class='kw'>end</span></pre>
187
+ </td>
188
+ </tr>
189
+ </table>
190
+ </div>
191
+
192
+ </div>
193
+
194
+ </div>
195
+
196
+ <div id="footer">
197
+ Generated on Fri Oct 23 11:08:57 2015 by
198
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
199
+ 0.8.7.6 (ruby-2.1.1).
200
+ </div>
201
+
202
+ </body>
203
+ </html>
data/doc/_index.html CHANGED
@@ -82,6 +82,19 @@
82
82
  <tr>
83
83
  <td valign='top' width="33%">
84
84
 
85
+
86
+ <ul id="alpha_M" class="alpha">
87
+ <li class="letter">M</li>
88
+ <ul>
89
+
90
+ <li>
91
+ <span class='object_link'><a href="MachineGun.html" title="MachineGun (class)">MachineGun</a></span>
92
+
93
+ </li>
94
+
95
+ </ul>
96
+ </ul>
97
+
85
98
  </td>
86
99
  </tr>
87
100
  </table>
@@ -91,7 +104,7 @@
91
104
  </div>
92
105
 
93
106
  <div id="footer">
94
- Generated on Thu Oct 22 14:06:57 2015 by
107
+ Generated on Fri Oct 23 11:08:57 2015 by
95
108
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
96
109
  0.8.7.6 (ruby-2.1.1).
97
110
  </div>
data/doc/class_list.html CHANGED
@@ -50,7 +50,7 @@
50
50
 
51
51
  <ul id="full_list" class="class">
52
52
  <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
53
-
53
+ <li><span class='object_link'><a href="MachineGun.html" title="MachineGun (class)">MachineGun</a></span> &lt; Object<small class='search_info'>Top Level Namespace</small></li>
54
54
 
55
55
  </ul>
56
56
  </div>
data/doc/file.README.html CHANGED
@@ -63,11 +63,29 @@
63
63
 
64
64
  <div id="content"><div id='filecontents'><h1>machinegun</h1>
65
65
 
66
- <p>An automatic reloading webserver for Ruby.</p>
66
+ <p><a href="https://badge.fury.io/rb/machinegun"><img src="https://badge.fury.io/rb/machinegun.svg" alt="Gem Version"></a></p>
67
+
68
+ <p>An automatic reloading Rack development web server for Ruby.</p>
69
+
70
+ <p>This gem was inspired by <a href="https://github.com/rtomayko/shotgun">shotgun</a>, which reloads the application on every request to ensure that the latest code is running. However, reloading on request can cause performance problems for applications that consume a lot of memory and/or generate a lot of requests. machinegun solves this problem by reloading the application when there are changes to the filesystem, instead of reloading on each request. This allows for the best of both worlds: A web server that reloads when changes to the code are made, and also performs quickly when serving requests.</p>
71
+
72
+ <h2>Installation</h2>
73
+
74
+ <pre class="code text"><code class="text">$ gem install machinegun
75
+ </code></pre>
76
+
77
+ <h2>Use</h2>
78
+
79
+ <p>The <code>machinegun</code> command replaces <code>rackup</code>. rackup&#39;s command line options should be compatible with the machinegun executable. Since machinegun is a wrapper around Rack, your project also needs a <a href="https://github.com/rack/rack/wiki/(tutorial)-rackup-howto#config-file-syntax">Rack configuration file</a>, typically <code>config.ru</code>.</p>
80
+
81
+ <p>For example, the following command will launch the web server on port 9393 and bind it to all network adapters:</p>
82
+
83
+ <pre class="code text"><code class="text">$ machinegun -p 9393 -o 0.0.0.0
84
+ </code></pre>
67
85
  </div></div>
68
86
 
69
87
  <div id="footer">
70
- Generated on Thu Oct 22 14:06:57 2015 by
88
+ Generated on Fri Oct 23 11:08:57 2015 by
71
89
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
72
90
  0.8.7.6 (ruby-2.1.1).
73
91
  </div>
@@ -64,7 +64,7 @@
64
64
  <div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2015 Alex McLain<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.</div></div>
65
65
 
66
66
  <div id="footer">
67
- Generated on Thu Oct 22 14:06:57 2015 by
67
+ Generated on Fri Oct 23 11:08:57 2015 by
68
68
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
69
69
  0.8.7.6 (ruby-2.1.1).
70
70
  </div>
data/doc/index.html CHANGED
@@ -63,11 +63,29 @@
63
63
 
64
64
  <div id="content"><div id='filecontents'><h1>machinegun</h1>
65
65
 
66
- <p>An automatic reloading webserver for Ruby.</p>
66
+ <p><a href="https://badge.fury.io/rb/machinegun"><img src="https://badge.fury.io/rb/machinegun.svg" alt="Gem Version"></a></p>
67
+
68
+ <p>An automatic reloading Rack development web server for Ruby.</p>
69
+
70
+ <p>This gem was inspired by <a href="https://github.com/rtomayko/shotgun">shotgun</a>, which reloads the application on every request to ensure that the latest code is running. However, reloading on request can cause performance problems for applications that consume a lot of memory and/or generate a lot of requests. machinegun solves this problem by reloading the application when there are changes to the filesystem, instead of reloading on each request. This allows for the best of both worlds: A web server that reloads when changes to the code are made, and also performs quickly when serving requests.</p>
71
+
72
+ <h2>Installation</h2>
73
+
74
+ <pre class="code text"><code class="text">$ gem install machinegun
75
+ </code></pre>
76
+
77
+ <h2>Use</h2>
78
+
79
+ <p>The <code>machinegun</code> command replaces <code>rackup</code>. rackup&#39;s command line options should be compatible with the machinegun executable. Since machinegun is a wrapper around Rack, your project also needs a <a href="https://github.com/rack/rack/wiki/(tutorial)-rackup-howto#config-file-syntax">Rack configuration file</a>, typically <code>config.ru</code>.</p>
80
+
81
+ <p>For example, the following command will launch the web server on port 9393 and bind it to all network adapters:</p>
82
+
83
+ <pre class="code text"><code class="text">$ machinegun -p 9393 -o 0.0.0.0
84
+ </code></pre>
67
85
  </div></div>
68
86
 
69
87
  <div id="footer">
70
- Generated on Thu Oct 22 14:06:57 2015 by
88
+ Generated on Fri Oct 23 11:08:57 2015 by
71
89
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
72
90
  0.8.7.6 (ruby-2.1.1).
73
91
  </div>
data/doc/method_list.html CHANGED
@@ -51,6 +51,12 @@
51
51
  <ul id="full_list" class="method">
52
52
 
53
53
 
54
+ <li class="r1 ">
55
+ <span class='object_link'><a href="MachineGun.html#run-class_method" title="MachineGun.run (method)">run</a></span>
56
+ <small>MachineGun</small>
57
+ </li>
58
+
59
+
54
60
  </ul>
55
61
  </div>
56
62
  </body>
@@ -81,6 +81,16 @@
81
81
  </dl>
82
82
  <div class="clear"></div>
83
83
 
84
+ <h2>Defined Under Namespace</h2>
85
+ <p class="children">
86
+
87
+
88
+
89
+
90
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="MachineGun.html" title="MachineGun (class)">MachineGun</a></span>
91
+
92
+
93
+ </p>
84
94
 
85
95
 
86
96
 
@@ -93,7 +103,7 @@
93
103
  </div>
94
104
 
95
105
  <div id="footer">
96
- Generated on Thu Oct 22 14:06:57 2015 by
106
+ Generated on Fri Oct 23 11:08:57 2015 by
97
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
98
108
  0.8.7.6 (ruby-2.1.1).
99
109
  </div>
data/lib/machinegun.rb CHANGED
@@ -0,0 +1,28 @@
1
+ require 'rack'
2
+ require 'filewatcher'
3
+
4
+ class MachineGun
5
+
6
+ def self.run
7
+ pid = start_server
8
+
9
+ FileWatcher.new("./**/*.rb").watch do
10
+ Process.kill "INT", pid
11
+ Process.wait pid
12
+
13
+ pid = start_server
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def self.start_server
20
+ pid = fork do
21
+ $0 = "rack"
22
+ Rack::Server.start
23
+ end
24
+
25
+ pid
26
+ end
27
+
28
+ end
metadata CHANGED
@@ -1,15 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: machinegun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McLain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.6.4
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.4
33
+ - !ruby/object:Gem::Dependency
34
+ name: filewatcher
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.5.2
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.5.2
13
47
  - !ruby/object:Gem::Dependency
14
48
  name: rake
15
49
  requirement: !ruby/object:Gem::Requirement
@@ -108,14 +142,17 @@ dependencies:
108
142
  - - ">="
109
143
  - !ruby/object:Gem::Version
110
144
  version: '0'
111
- description: An automatic reloading webserver for Ruby.
145
+ description: An automatic reloading Rack development web server for Ruby.
112
146
  email:
113
147
  - alex@alexmclain.com
114
- executables: []
148
+ executables:
149
+ - machinegun
115
150
  extensions: []
116
151
  extra_rdoc_files: []
117
152
  files:
118
153
  - README.md
154
+ - bin/machinegun
155
+ - doc/MachineGun.html
119
156
  - doc/_index.html
120
157
  - doc/class_list.html
121
158
  - doc/css/common.css
@@ -156,6 +193,6 @@ rubyforge_project:
156
193
  rubygems_version: 2.4.1
157
194
  signing_key:
158
195
  specification_version: 4
159
- summary: An automatic reloading webserver for Ruby.
196
+ summary: An automatic reloading Rack development web server for Ruby.
160
197
  test_files: []
161
198
  has_rdoc: