heel 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTBjMTliZGUxNDc1MDgwMWUwNjE2NzNmN2E3ODMxNjc3MmQzYTYzOQ==
4
+ ZDA5YmUzNmVkNjQ5YWZjMzMyMmQ1ZTNiZjMxN2YxMzRhNzZiMzM4MA==
5
5
  data.tar.gz: !binary |-
6
- YjIwMjA5ZjU5MWY2YWQzZmNhNzYzOTVhZjY0YjE1ODBiOTQyMTgxMg==
6
+ ZTkzM2M2MTMxN2MxZGI0ZDFiNGRiZWMyOTQ1YjRiYWE4ZGI1MGM4MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmEwMDIwNWJlNDIyMGM4MDIwYjllNTI1MTMxNjc1ZWJjMjkxYjM0OGJlM2Fm
10
- NjhmOTkxYzZlMTg2MWE2YzMxZWI3YmExMWFkMjI0ZjFlYjRhNjczZDM2YmVi
11
- NGJjYzQzNGNkOGY1YzkwMDQ2ZDk3OGEzMmRjODM0ODFmOWRhOWI=
9
+ OGU2MGU3ZjczYzhkZjExODYzOWMwMTQ5MGIxYTM1Y2Y2NTdiOWUxZGM4ODlj
10
+ YzE0ZjcwN2FlNGQ4OGIzYWJkN2I3M2U2NGNkZTc2MzZjMDZjNzFmZmQ0YWFl
11
+ ZGU5ODg4NGZkZjQ5YjRjMWQ2ZWQ3NTIxMTI5NmU2MGZiMDBiNzU=
12
12
  data.tar.gz: !binary |-
13
- ZGEyYmQ2NTk1YzgyZmY2MWZlN2U4OTY2OTNjYzQ5YWQ5ZWZjNGQ4MmY4ODQw
14
- ZTFmMjI2OTczNDNkNjlhNWE3ZDVlZmUyYTNiYTU4NzRkNWFiMjk0NWE0ZDIx
15
- MDczNTAyMjQ0YjJmY2I4ZTBkYjkxNzBjYzM4MGU4YzZjMDg3YTg=
13
+ ZGYyMjk4NDhjOTRkYzUzODc0Nzg0MjgxNjFiYzk3ZTJhNTFhMzMxMmExMDdk
14
+ Y2NlNDdlZDkyZDk5NGE4NjRiYzNmYjdiZDI2ZGYyOGRmOWNlZWZlZGUwNWY3
15
+ Nzg5OWI0MTNiZTk5MmE3ZjljNTdmZTFmMmJjODFlZWExMDdiMjI=
data/HISTORY.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # Changelog
2
+ ## Version 3.1.0 - 2013-07-07
3
+ * Update dependencies
4
+ * Switch to template contributed by brianflanagan [#8]
5
+ * Add support for multiple independent heel servers [#9]
6
+
2
7
  ## Version 3.0.2 - 2013-03-13
3
8
 
4
9
  * Fix generated pages to say they are utf-8 [#4]
@@ -9,7 +9,7 @@ data/css/coderay-alpha.css
9
9
  data/css/coderay-cycnus.css
10
10
  data/css/coderay-murphy.css
11
11
  data/css/error.css
12
- data/css/listing.css
12
+ data/css/index.css
13
13
  data/error.rhtml
14
14
  data/famfamfam/icons/application.png
15
15
  data/famfamfam/icons/compress.png
@@ -35,10 +35,12 @@ lib/heel/mime_map.rb
35
35
  lib/heel/rackapp.rb
36
36
  lib/heel/request.rb
37
37
  lib/heel/server.rb
38
+ lib/heel/template_vars.rb
38
39
  spec/configuration_spec.rb
39
40
  spec/directory_indexer_spec.rb
40
41
  spec/rackapp_spec.rb
41
42
  spec/server_spec.rb
42
43
  spec/spec_helper.rb
44
+ spec/template_vars_spec.rb
43
45
  tasks/default.rake
44
46
  tasks/this.rb
data/README.md CHANGED
@@ -62,7 +62,7 @@ Or run it in the background
62
62
  ### For running:
63
63
 
64
64
  * [coderay](http://coderay.rubychan.de/)
65
- * [launchy](http://copiousfreetime.rubyforge.org/launchy/) >= 0.1.1
65
+ * [launchy](http://github.com/copiousfreetime/launchy/) >= 0.1.1
66
66
  * [mime-types](http://mime-types.rubyforge.org/)
67
67
  * [puma](http://puma.io)
68
68
 
@@ -79,7 +79,7 @@ Or run it in the background
79
79
  ## CREDITS:
80
80
 
81
81
  * [puma](http://puma.io)
82
- * [Rack](http://rack.rubyforge.org/)
82
+ * [Rack](http://rack.github.io/)
83
83
  * http://www.famfamfam.com/ for amazing icons
84
84
 
85
85
  ## BSD LICENSE:
data/Rakefile CHANGED
@@ -7,14 +7,14 @@ This.email = "jeremy@copiousfreetime.org"
7
7
  This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
8
8
 
9
9
  This.ruby_gemspec do |spec|
10
- spec.add_runtime_dependency( 'puma' , '~> 1.0' )
11
- spec.add_runtime_dependency( 'mime-types', '~> 1.19' )
12
- spec.add_runtime_dependency( 'launchy' , '~> 2.2' )
13
- spec.add_runtime_dependency( 'coderay' , '~> 1.0.7' )
10
+ spec.add_runtime_dependency( 'puma' , '~> 2.0' )
11
+ spec.add_runtime_dependency( 'mime-types', '~> 1.23')
12
+ spec.add_runtime_dependency( 'launchy' , '~> 2.3' )
13
+ spec.add_runtime_dependency( 'coderay' , '~> 1.0' )
14
14
 
15
- spec.add_development_dependency( 'rake' , '~> 10.0.3')
16
- spec.add_development_dependency( 'minitest' , '~> 4.5.0' )
17
- spec.add_development_dependency( 'rdoc' , '~> 3.12' )
15
+ spec.add_development_dependency( 'rake' , '~> 10.1')
16
+ spec.add_development_dependency( 'minitest' , '~> 5.0' )
17
+ spec.add_development_dependency( 'rdoc' , '~> 4.0' )
18
18
 
19
19
  spec.license = "BSD"
20
20
  end
data/bin/heel CHANGED
@@ -5,7 +5,6 @@
5
5
  # All rights reserved. Licensed under the BSD license. See LICENSE for details
6
6
  #++
7
7
 
8
- require 'rubygems'
9
8
  require 'heel'
10
9
 
11
10
  Heel::Server.new(ARGV).run
@@ -1,38 +1,79 @@
1
- body { font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #e0e0e0;}
2
- div.wrap {
3
- background: transparent;
4
- text-align: left;
5
- width: 400px;
6
- margin-top: 100px;
7
- margin-left: auto;
8
- margin-right: auto;
9
- }
10
- div.box {
11
- border-left: 1px solid #333;
12
- border-right: 1px solid #333;
13
- background: #FFF;
14
- display: block;
15
- }
16
- img { padding-right: 20px;}
17
- h1 { display: inline; font-weight: bold; }
18
- h2 { display: inline; font-weight: bold; padding-left: 25px;text-align: center;}
19
- div.header { font-size: x-large; }
20
- div.content { font-size: x-large; border: 0; padding: 10px 25px 10px 25px;}
21
- div.footer { text-align: right; width: 400px; }
1
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-size: 100%;
5
+ vertical-align: baseline;
6
+ border: 0;
7
+ outline: 0;
8
+ background: transparent;
9
+ -webkit-font-smoothing: optimizeLegibility; }
22
10
 
23
- .curved { background: transparent;}
24
- .curved .c1, .curved .c2, .curved .c3, .curved .c4 {
25
- display: block;
26
- overflow: hidden;
27
- height: 1px;
28
- font-size: 1px;
29
- }
30
- .curved .c2, .curved .c3, .curved .c4 {
31
- background: #fff;
32
- border-left: 1px solid #000;
33
- border-right: 1px solid #000;
34
- }
35
- .c1 { margin: 0 5px 0 5px; background: #000; }
36
- .c2 { margin: 0 3px 0 3px; border-left: 2px solid #000; border-right: 2px solid #000; }
37
- .c3 { margin: 0 2px 0 2px; }
38
- .c4 { margin: 0 1px 0 1px; }
11
+ blockquote, q {
12
+ quotes: none; }
13
+
14
+ :focus {
15
+ outline: 0; }
16
+
17
+ table {
18
+ border-collapse: collapse;
19
+ border-spacing: 0; }
20
+
21
+ ul, ol {
22
+ list-style: none; }
23
+
24
+ cite {
25
+ font-style: normal; }
26
+
27
+ * {
28
+ -moz-box-sizing: border-box;
29
+ -webkit-box-sizing: border-box;
30
+ -ms-box-sizing: border-box;
31
+ box-sizing: border-box;
32
+ *behavior: url(image-path("boxsizing.htc")); }
33
+
34
+ body {
35
+ background: #e7c9ae;
36
+ color: #47423b;
37
+ font-family: "Open Sans", sans-serif;
38
+ font-size: 14px;
39
+ line-height: 19.6px;
40
+ padding: 14px; }
41
+ body a, body a:link, body a:visited {
42
+ color: #3b619b;
43
+ text-decoration: none; }
44
+ body a:hover, body a:link:hover, body a:visited:hover {
45
+ color: #4d79bc; }
46
+ body > [role='wrapper'] {
47
+ background: white;
48
+ -webkit-border-radius: 3px;
49
+ -moz-border-radius: 3px;
50
+ border-radius: 3px;
51
+ -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
52
+ -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
53
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
54
+ width: 100%;
55
+ max-width: 360px;
56
+ margin: 0 auto; }
57
+ body > [role='wrapper'] > header, body > [role='wrapper'] > footer {
58
+ padding: 7px; }
59
+ body > [role='wrapper'] > header {
60
+ background: #df5256;
61
+ color: white;
62
+ -webkit-border-top-left-radius: 3px;
63
+ -webkit-border-top-right-radius: 3px;
64
+ -moz-border-radius-topleft: 3px;
65
+ -moz-border-radius-topright: 3px;
66
+ border-top-left-radius: 3px;
67
+ border-top-right-radius: 3px; }
68
+ body > [role='wrapper'] > footer p {
69
+ font-size: 11.2px;
70
+ line-height: 14.56px;
71
+ text-align: right; }
72
+ body > [role='wrapper'] > [role='content'] {
73
+ background: #f9f9f9;
74
+ -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
75
+ -moz-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
76
+ box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1); }
77
+ body > [role='wrapper'] > [role='content'] > [role='message'] {
78
+ padding: 28px 14px;
79
+ text-align: center; }
@@ -0,0 +1,77 @@
1
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-size: 100%;
5
+ vertical-align: baseline;
6
+ border: 0;
7
+ outline: 0;
8
+ background: transparent;
9
+ -webkit-font-smoothing: optimizeLegibility; }
10
+
11
+ blockquote, q {
12
+ quotes: none; }
13
+
14
+ :focus {
15
+ outline: 0; }
16
+
17
+ table {
18
+ border-collapse: collapse;
19
+ border-spacing: 0; }
20
+
21
+ ul, ol {
22
+ list-style: none; }
23
+
24
+ cite {
25
+ font-style: normal; }
26
+
27
+ * {
28
+ -moz-box-sizing: border-box;
29
+ -webkit-box-sizing: border-box;
30
+ -ms-box-sizing: border-box;
31
+ box-sizing: border-box;
32
+ *behavior: url(image-path("boxsizing.htc")); }
33
+
34
+ body {
35
+ background: #e7c9ae;
36
+ color: #47423b;
37
+ font-family: "Open Sans", sans-serif;
38
+ font-size: 14px;
39
+ line-height: 19.6px;
40
+ padding: 14px; }
41
+ body a, body a:link, body a:visited {
42
+ color: #3b619b;
43
+ text-decoration: none; }
44
+ body a:hover, body a:link:hover, body a:visited:hover {
45
+ color: #4d79bc; }
46
+ body > [role='wrapper'] {
47
+ background: white;
48
+ -webkit-border-radius: 3px;
49
+ -moz-border-radius: 3px;
50
+ border-radius: 3px;
51
+ -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
52
+ -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
53
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.125);
54
+ width: 100%;
55
+ max-width: 960px;
56
+ margin: 0 auto; }
57
+ body > [role='wrapper'] > header, body > [role='wrapper'] > footer {
58
+ padding: 7px; }
59
+ body > [role='wrapper'] > footer p {
60
+ font-size: 11.2px;
61
+ line-height: 14.56px;
62
+ text-align: right; }
63
+ body > [role='wrapper'] > [role='content'] {
64
+ background: #f9f9f9;
65
+ -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
66
+ -moz-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
67
+ box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1); }
68
+ body > [role='wrapper'] > [role='content'] > table {
69
+ width: 100%; }
70
+ body > [role='wrapper'] > [role='content'] > table thead {
71
+ border-bottom: 2px solid #f3f3f3; }
72
+ body > [role='wrapper'] > [role='content'] > table th, body > [role='wrapper'] > [role='content'] > table td {
73
+ text-align: left;
74
+ padding: 3.5px 7px;
75
+ color: #71695e; }
76
+ body > [role='wrapper'] > [role='content'] > table tr:nth-child(even) {
77
+ background: whitesmoke; }
@@ -1,29 +1,27 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>Error <%= status %> </title>
5
- <meta charset="utf-8">
6
- <link rel="stylesheet" href="/heel_css/error.css" type="text/css" />
4
+ <title>Error <%= status %></title>
5
+ <meta charset='utf-8'>
6
+ <link href='/heel_css/error.css' rel='stylesheet' type='text/css'>
7
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
8
+ <!--[if IE]>
9
+ <script src='//html5shiv.googlecode.com/svn/trunk/html5.js'></script>
10
+ <![endif]-->
7
11
  </head>
8
12
  <body>
9
- <div class="wrap">
10
- <div class="header">
11
- Requested URL: <%= base_uri %>
12
- </div>
13
- <div class="curved">
14
- <b class="c1"></b><b class="c2"></b><b class="c3"></b><b class="c4"></b>
15
- <div class="box">
16
- <div class="content">
17
- <img src="/heel_icons/error.png" alt=""/><h1>Error <%= status %></h1>
18
- <br />
19
- <h2><%= message %></h2>
20
- </div>
21
- </div>
22
- <b class="c4"></b><b class="c3"></b><b class="c2"></b><b class="c1"></b>
23
- </div>
24
- <div class="footer">
25
- <a href="<%= homepage %>">heel</a>/v<%= ::Heel::VERSION %>
13
+ <div role='wrapper'>
14
+ <header>
15
+ <h1>Requested URL: <%= base_uri %></h1>
16
+ </header>
17
+ <div role='content'>
18
+ <article role='message'><p><%= message %></p></article>
26
19
  </div>
20
+ <footer>
21
+ <p>
22
+ <a href="http://github.com/copiousfreetime/heel/">heel</a> v<%= Heel::VERSION %>
23
+ </p>
24
+ </footer>
27
25
  </div>
28
26
  </body>
29
27
  </html>
@@ -1,42 +1,56 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang='en'>
3
3
  <head>
4
4
  <title>Index of <%= base_uri %></title>
5
- <meta charset="utf-8">
6
- <link rel="stylesheet" href="/heel_css/listing.css" type="text/css" />
5
+ <meta charset='utf-8'>
6
+ <link href='/heel_css/index.css' rel='stylesheet' type='text/css'>
7
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
8
+ <!--[if IE]>
9
+ <script src='//html5shiv.googlecode.com/svn/trunk/html5.js'></script>
10
+ <![endif]-->
7
11
  </head>
8
12
  <body>
9
- <div class="header">
10
- <h1>Index of <%= base_uri %></h1>
11
- </div>
12
- <div class="content">
13
- <table>
14
- <caption>Directory Listing</caption>
15
- <thead>
16
- <tr><th class="n">File Name</th><th class="l" >Last Modified Timestamp</th><th class="m">File Size</th><th class="t">File Type</th></tr>
17
- </thead>
18
- <tbody>
19
- <% entries.each_with_index do |entry,i| %>
20
- <tr<%= i % 2 > 0 ? ' class="odd" ' : '' %>>
21
- <td>
22
- <% if entry.icon_url then %>
23
- <img src="<%= entry.icon_url %>" width="16" height="16" alt="icon for type <%= entry.content_type %>" />
24
- <% end %>
25
- <a href="<%= "#{base_uri.chomp('/')}/#{entry.link}" %>"><%= entry.name %></a>
26
- <% if highlighting? and entry.content_type != 'Directory' then %>
27
- (<a href="<%= "#{base_uri.chomp('/')}/#{entry.link}?highlighting=false" %>">download</a>)
28
- <% end %>
29
- </td>
30
- <td><%= entry.last_modified %></td>
31
- <td class="<%= entry.content_type == "Directory" ? 'c' : 'n' %>" ><%= entry.size %></td>
32
- <td><%= entry.content_type %></td>
33
- </tr>
34
- <% end %>
35
- </tbody>
36
- </table>
37
- </div>
38
- <div class="footer">
39
- <a href="http://copiousfreetime.rubyforge.org/heel/">heel</a>/v<%= Heel::VERSION %>
13
+ <div role='wrapper'>
14
+ <header>
15
+ <h1>Index of <%= base_uri %></h1>
16
+ </header>
17
+ <div role='content'>
18
+ <table>
19
+ <thead>
20
+ <tr>
21
+ <th>Name</th>
22
+ <th>Last Modified</th>
23
+ <th>Size</th>
24
+ <th>Type</th>
25
+ </tr>
26
+ </thead>
27
+ <tbody>
28
+ <% entries.each do |entry| %>
29
+ <tr>
30
+ <td>
31
+ <a href="<%= "#{base_uri.chomp('/')}/#{entry.link}" %>">
32
+ <% if entry.icon_url then %>
33
+ <img src="<%= entry.icon_url %>" width="16" height="16" alt="icon for type <%= entry.content_type %>" />
34
+ <% end %>
35
+ <%= entry.name %>
36
+ </a>
37
+ <% if highlighting? and entry.content_type != 'Directory' then %>
38
+ (<a href="<%= "#{base_uri.chomp('/')}/#{entry.link}?highlighting=false" %>">download</a>)
39
+ <% end %>
40
+ </td>
41
+ <td><%= entry.last_modified %></td>
42
+ <td class="<%= entry.content_type == "Directory" ? 'c' : 'n' %>" ><%= entry.size %></td>
43
+ <td><%= entry.content_type %></td>
44
+ </tr>
45
+ <% end %>
46
+ </tbody>
47
+ </table>
48
+ </div>
49
+ <footer>
50
+ <p>
51
+ <a href="<%= homepage %>">heel</a> v<%= Heel::VERSION %>
52
+ </p>
53
+ </footer>
40
54
  </div>
41
55
  </body>
42
56
  </html>
@@ -4,7 +4,7 @@
4
4
  #++
5
5
 
6
6
  module Heel
7
- VERSION = '3.0.2'
7
+ VERSION = '3.1.0'
8
8
  end
9
9
 
10
10
  require 'heel/configuration'
@@ -14,3 +14,4 @@ require 'heel/mime_map'
14
14
  require 'heel/rackapp'
15
15
  require 'heel/request'
16
16
  require 'heel/server'
17
+ require 'heel/template_vars'
@@ -56,8 +56,7 @@ module Heel
56
56
  #
57
57
  def index_page_for(req)
58
58
  reload_template if reload_on_template_change?
59
- dir = req.request_path
60
- base_uri = req.path_info
59
+ dir = req.request_path
61
60
  entries = []
62
61
  Dir.entries(dir).each do |entry|
63
62
  next if should_ignore?(entry)
@@ -88,8 +87,11 @@ module Heel
88
87
  entries << entry_data
89
88
  end
90
89
 
91
- entries = entries.sort_by { |e| e.link }
92
- return template.result(binding)
90
+ template_vars = TemplateVars.new( :base_uri => req.path_info )
91
+ template_vars.entries = entries.sort_by { |e| e.link }
92
+ template_vars.homepage = Heel::Configuration::HOMEPAGE
93
+
94
+ return template.result( template_vars.binding_for_template )
93
95
  end
94
96
 
95
97
  # essentially this is strfbytes from facets
@@ -33,10 +33,12 @@ module Heel
33
33
  end
34
34
 
35
35
  def finish
36
- status = @response.status # for the template
37
- message = ::Rack::Utils::HTTP_STATUS_CODES[status] # for the template
38
- homepage = ErrorResponse.homepage # for the template
39
- content = ErrorResponse.template.result( binding )
36
+ template_vars = TemplateVars.new( :status => @response.status,
37
+ :message => Rack::Utils::HTTP_STATUS_CODES[@response.status],
38
+ :base_uri => base_uri,
39
+ :homepage => ErrorResponse.homepage )
40
+
41
+ content = ErrorResponse.template.result( template_vars.binding_for_template )
40
42
  @response.write( content )
41
43
  return @response.finish
42
44
  end
@@ -27,10 +27,6 @@ module Heel
27
27
  (ENV["HOMEPATH"] && "#{ENV["HOMEDRIVE"]}#{ENV["HOMEPATH"]}") ||
28
28
  "/"
29
29
  end
30
-
31
- def kill_existing_proc
32
- Heel::Server.new.kill_existing_proc
33
- end
34
30
  end
35
31
 
36
32
  def initialize(argv = [])
@@ -71,11 +67,11 @@ module Heel
71
67
  end
72
68
 
73
69
  def pid_file
74
- File.join(default_directory,"heel.pid")
70
+ File.join(default_directory,"heel.#{options.port}.pid")
75
71
  end
76
72
 
77
73
  def log_file
78
- File.join(default_directory,"heel.log")
74
+ File.join(default_directory,"heel.#{options.port}.log")
79
75
  end
80
76
 
81
77
  def win?
@@ -182,7 +178,7 @@ module Heel
182
178
  @stdout.puts "Unable to kill process with pid #{pid}. No permissions to kill process."
183
179
  end
184
180
  else
185
- @stdout.puts "No pid file exists, no process to kill"
181
+ @stdout.puts "No pid file exists for server running on port #{options.port}, no process to kill"
186
182
  end
187
183
  @stdout.puts "Done."
188
184
  exit 0
@@ -200,10 +196,10 @@ module Heel
200
196
 
201
197
  # make sure that if we are daemonizing the process is not running
202
198
  def ensure_not_running
203
- if options.daemonize and File.exist?(pid_file) then
199
+ if File.exist?(pid_file) then
204
200
  @stdout.puts "ERROR: PID File #{pid_file} already exists. Heel may already be running."
205
201
  @stdout.puts "ERROR: Check the Log file #{log_file}"
206
- @stdout.puts "ERROR: Heel will not start until the .pid file is cleared (`heel --kill' to clean it up)."
202
+ @stdout.puts "ERROR: Heel will not start until the .pid file is cleared (`heel --kill --port #{options.port}' to clean it up)."
207
203
  exit 1
208
204
  end
209
205
  end
@@ -269,8 +265,8 @@ module Heel
269
265
  # run the heel server with the current options.
270
266
  def run
271
267
 
272
- error_version_help_kill
273
268
  merge_options
269
+ error_version_help_kill
274
270
  setup_heel_dir
275
271
  ensure_not_running
276
272
 
@@ -0,0 +1,8 @@
1
+ require 'ostruct'
2
+ module Heel
3
+ class TemplateVars < OpenStruct
4
+ def binding_for_template()
5
+ return binding()
6
+ end
7
+ end
8
+ end
@@ -118,4 +118,16 @@ describe Heel::Server do
118
118
  @stdout.string.must_match( /Sending TERM to process -42/m )
119
119
  end
120
120
  end
121
+
122
+ it "records the port of the server process in the pid filename" do
123
+ server = Heel::Server.new( %w[ --port 4222 ] )
124
+ server.merge_options
125
+ File.basename( server.pid_file ).must_equal( "heel.4222.pid" )
126
+ end
127
+
128
+ it "records the port of the server process in the log filename" do
129
+ server = Heel::Server.new( %w[ --port 4222 ] )
130
+ server.merge_options
131
+ File.basename( server.log_file ).must_equal( "heel.4222.log" )
132
+ end
121
133
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+ require 'pathname'
3
+
4
+ describe Heel::TemplateVars do
5
+ before do
6
+ @template = ERB.new( "<%= foo %> && <%= bar %>" )
7
+ end
8
+
9
+ it "exposes all its data members in a binding" do
10
+ t = Heel::TemplateVars.new( :foo => 'foo', :bar => 'bar' )
11
+ s = @template.result( t.binding_for_template )
12
+ s.must_equal( "foo && bar")
13
+ end
14
+
15
+ it "data members may be added after instantiation" do
16
+ t = Heel::TemplateVars.new
17
+ t.foo = 'foo'
18
+ t.bar = 'bar'
19
+ s = @template.result( t.binding_for_template )
20
+ s.must_equal( "foo && bar")
21
+ end
22
+ end
@@ -115,7 +115,7 @@ else
115
115
  end
116
116
 
117
117
  #------------------------------------------------------------------------------
118
- # Manifest - We want an explicit list of thos files that are to be packaged in
118
+ # Manifest - We want an explicit list of those files that are to be packaged in
119
119
  # the gem. Most of this is from Hoe.
120
120
  #------------------------------------------------------------------------------
121
121
  namespace 'manifest' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-13 00:00:00.000000000 Z
11
+ date: 2013-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puma
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mime-types
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.19'
33
+ version: '1.23'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.19'
40
+ version: '1.23'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: launchy
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '2.2'
47
+ version: '2.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '2.2'
54
+ version: '2.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coderay
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.7
61
+ version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.7
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 10.0.3
75
+ version: '10.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: 10.0.3
82
+ version: '10.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 4.5.0
89
+ version: '5.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 4.5.0
96
+ version: '5.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rdoc
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: '3.12'
103
+ version: '4.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: '3.12'
110
+ version: '4.0'
111
111
  description: ! 'Heel is a small static web server for use when you need a quick web
112
112
  server for a directory. Once the server is running, heel will use (http://rubygems.org/gems/launchy/)
113
113
  to open your browser at the URL of your document root. Heel is built using (http://rack.github.com)
@@ -138,7 +138,7 @@ files:
138
138
  - data/css/coderay-cycnus.css
139
139
  - data/css/coderay-murphy.css
140
140
  - data/css/error.css
141
- - data/css/listing.css
141
+ - data/css/index.css
142
142
  - data/error.rhtml
143
143
  - data/famfamfam/icons/application.png
144
144
  - data/famfamfam/icons/compress.png
@@ -164,11 +164,13 @@ files:
164
164
  - lib/heel/rackapp.rb
165
165
  - lib/heel/request.rb
166
166
  - lib/heel/server.rb
167
+ - lib/heel/template_vars.rb
167
168
  - spec/configuration_spec.rb
168
169
  - spec/directory_indexer_spec.rb
169
170
  - spec/rackapp_spec.rb
170
171
  - spec/server_spec.rb
171
172
  - spec/spec_helper.rb
173
+ - spec/template_vars_spec.rb
172
174
  - tasks/default.rake
173
175
  - tasks/this.rb
174
176
  homepage: http://github.com/copiousfreetime/heel
@@ -207,3 +209,4 @@ test_files:
207
209
  - spec/rackapp_spec.rb
208
210
  - spec/server_spec.rb
209
211
  - spec/spec_helper.rb
212
+ - spec/template_vars_spec.rb
@@ -1,29 +0,0 @@
1
- a, a:active { text-decoration: none; color: blue;}
2
- a:visited { color: purple;}
3
- a:hover, a:focus { text-decoration: underline; color: red;}
4
- body { font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #eee; }
5
- .c { text-align: center; }
6
- table { border-collapse: collapse; border-spacing: 0px; width: 100%;}
7
- tr { background-color: #ccf;}
8
- tr:hover { background-color: #faa;}
9
- td, th {
10
- border-bottom: 1px solid #ccc;
11
- padding: 0em .3em 0em .3em ;
12
- color: #666;
13
- text-align: left;
14
- vertical-align: middle;
15
- }
16
- thead th {
17
- border-top: 2px solid #666;
18
- border-bottom: 2px solid #666;
19
- font-weight: bold;
20
- background: #aaa;
21
- color: #fff;
22
- text-transform: uppercase;
23
- }
24
- tr.odd { background-color: #cfc; color: #333;}
25
- tr.odd:hover { background-color: #faa; color: #333;}
26
- td.n { text-align: right; padding-right: 2em;}
27
- div.header { }
28
- div.content { background: #FFF; width: 100%;}
29
- div.footer { border-top: 2px solid #333; text-align: right;}