heel 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/CHANGES +15 -4
  2. data/{resources → data}/css/coderay-cycnus.css +0 -0
  3. data/{resources → data}/css/coderay-murphy.css +0 -0
  4. data/{resources → data}/css/error.css +0 -0
  5. data/{resources → data}/css/listing.css +0 -0
  6. data/{resources → data}/error.rhtml +2 -2
  7. data/{resources → data}/famfamfam/icons/application.png +0 -0
  8. data/{resources → data}/famfamfam/icons/compress.png +0 -0
  9. data/{resources → data}/famfamfam/icons/error.png +0 -0
  10. data/{resources → data}/famfamfam/icons/folder.png +0 -0
  11. data/{resources → data}/famfamfam/icons/html.png +0 -0
  12. data/{resources → data}/famfamfam/icons/page_excel.png +0 -0
  13. data/{resources → data}/famfamfam/icons/page_white.png +0 -0
  14. data/{resources → data}/famfamfam/icons/page_white_acrobat.png +0 -0
  15. data/{resources → data}/famfamfam/icons/page_white_code.png +0 -0
  16. data/{resources → data}/famfamfam/icons/page_white_powerpoint.png +0 -0
  17. data/{resources → data}/famfamfam/icons/page_white_text.png +0 -0
  18. data/{resources → data}/famfamfam/icons/picture.png +0 -0
  19. data/{resources → data}/famfamfam/icons/xhtml.png +0 -0
  20. data/{resources → data}/famfamfam/readme.html +0 -0
  21. data/{resources → data}/famfamfam/readme.txt +0 -0
  22. data/{resources → data}/listing.rhtml +1 -1
  23. data/lib/heel/dir_handler.rb +6 -6
  24. data/lib/heel/error_handler.rb +1 -1
  25. data/lib/heel/gemspec.rb +1 -1
  26. data/lib/heel/server.rb +12 -6
  27. data/lib/heel/version.rb +11 -11
  28. data/lib/heel.rb +1 -1
  29. data/spec/server_spec.rb +2 -1
  30. metadata +98 -91
data/CHANGES CHANGED
@@ -1,4 +1,15 @@
1
1
  = Changelog
2
+
3
+ == Version 0.6.0 - 2007-11-21
4
+
5
+ * Fixed bug where an exception was thrown if a 0 byte file was served.
6
+ * Changed change 'resources' directory to 'data'
7
+ * Renamed internal constants
8
+ * Changed operating URL's to avoid conflict with directories heel may be serving
9
+ ** /css -> /heel_css
10
+ ** /icons -> /heel_icons
11
+ ** /status -> /heel_status
12
+
2
13
  == Version 0.5.0 - 2007-11-19
3
14
 
4
15
  * Add in code highlighting support via coderay
@@ -23,25 +34,25 @@
23
34
  * fix failure to find pid file [Bug #13530]
24
35
  * remember to stop releasing software in the wee hours of the morning
25
36
 
26
- === Version 0.3.0 - 2007-08-30
37
+ == Version 0.3.0 - 2007-08-30
27
38
 
28
39
  * update with Launchy requirement 0.3.0
29
40
  * remove unneeded famfamfam icons
30
41
  * change default listening address to 127.0.0.1
31
42
  * refactored handler test, now with more coverage
32
43
 
33
- === Version 0.2.0 - 2007-08-11
44
+ == Version 0.2.0 - 2007-08-11
34
45
 
35
46
  * Initial public release
36
47
  * Added daemonizing of server
37
48
  * Added launching of browser to server URL
38
49
 
39
- === Version 0.1.0
50
+ == Version 0.1.0
40
51
 
41
52
  * rename project to 'heel'
42
53
  * gem packaging
43
54
 
44
- === Version 0.0.1 - 2007-05-03
55
+ == Version 0.0.1 - 2007-05-03
45
56
 
46
57
  * initial development release
47
58
 
File without changes
File without changes
File without changes
File without changes
@@ -3,7 +3,7 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
4
  <head>
5
5
  <title>Error <%= status %> </title>
6
- <link rel="stylesheet" href="/css/error.css" type="text/css" />
6
+ <link rel="stylesheet" href="/heel_css/error.css" type="text/css" />
7
7
  </head>
8
8
  <body>
9
9
  <div class="wrap">
@@ -14,7 +14,7 @@
14
14
  <b class="c1"></b><b class="c2"></b><b class="c3"></b><b class="c4"></b>
15
15
  <div class="box">
16
16
  <div class="content">
17
- <img src="/icons/error.png"><h1>Error <%= status %></h1>
17
+ <img src="/heel_icons/error.png"><h1>Error <%= status %></h1>
18
18
  <br />
19
19
  <h2><%= message %></h2>
20
20
  </div>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,7 +3,7 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
4
  <head>
5
5
  <title>Index of <%= base_uri %></title>
6
- <link rel="stylesheet" href="/css/listing.css" type="text/css" />
6
+ <link rel="stylesheet" href="/heel_css/listing.css" type="text/css" />
7
7
  </head>
8
8
  <body>
9
9
  <div class="header">
@@ -56,7 +56,7 @@ module Heel
56
56
  @directory_listing_allowed = options[:directory_listing_allowed] || true
57
57
  @directory_index_html = options[:directory_index_html] || "index.html"
58
58
  @using_icons = options[:using_icons] || true
59
- @icon_url = options[:icon_url] || "/icons"
59
+ @icon_url = options[:icon_url] || "/heel_icons"
60
60
  @reload_template_changes = options[:reload_template_changes] || false
61
61
  @highlighting = options[:highlighting] || false
62
62
  reload_template
@@ -100,7 +100,7 @@ module Heel
100
100
  end
101
101
 
102
102
  def reload_template
103
- fname = File.join(APP_RESOURCE_DIR,"listing.rhtml")
103
+ fname = File.join(APP_DATA_DIR,"listing.rhtml")
104
104
  fstat = File.stat(fname)
105
105
  @template_mtime ||= fstat.mtime
106
106
  if @template.nil? or fstat.mtime > @template_mtime then
@@ -130,7 +130,7 @@ module Heel
130
130
  elsif stat.file? and stat.readable? then
131
131
  if should_ignore?(File.basename(req_path)) then
132
132
  return 403
133
- elsif highlighting and not %w(false off).include? query_params['highlighting'].to_s.downcase
133
+ elsif highlighting and (stat.size > 0) and not %w(false off).include? query_params['highlighting'].to_s.downcase
134
134
  ft = ::FileType[req_path,true]
135
135
  return :highlighted_file if ft and ft != :html
136
136
  end
@@ -144,8 +144,8 @@ module Heel
144
144
  if error.kind_of?(Errno::ENOENT) then
145
145
  return 404
146
146
  end
147
- log "ERROR: Unknown, check out the stacktrace"
148
- log error
147
+ log "ERROR: Unknown, check out the backtrace"
148
+ log error.backtrace.join("\n")
149
149
  return 500
150
150
  end
151
151
  end
@@ -231,7 +231,7 @@ module Heel
231
231
  <head>
232
232
  <title>#{path}</title>
233
233
  <!-- CodeRay syntax highlighting CSS -->
234
- <link rel="stylesheet" href="/css/coderay-cycnus.css" type="text/css" />
234
+ <link rel="stylesheet" href="/heel_css/coderay-cycnus.css" type="text/css" />
235
235
  </head>
236
236
  <body>
237
237
  <div class="CodeRay">
@@ -11,7 +11,7 @@ module Heel
11
11
 
12
12
 
13
13
  def initialize(options = {})
14
- @template = ::ERB.new File.read(File.join(APP_RESOURCE_DIR,"error.rhtml"))
14
+ @template = ::ERB.new File.read(File.join(APP_DATA_DIR,"error.rhtml"))
15
15
  end
16
16
 
17
17
  def process(request,response)
data/lib/heel/gemspec.rb CHANGED
@@ -31,7 +31,7 @@ module Heel
31
31
  spec.test_files = FileList["spec/**/*.rb"]
32
32
  spec.executable = spec.name
33
33
  spec.files = spec.test_files + spec.extra_rdoc_files +
34
- FileList["lib/**/*.rb", "resources/**/*"]
34
+ FileList["lib/**/*.rb", "data/**/*"]
35
35
 
36
36
  spec.add_dependency("mongrel", ">= 1.0.1")
37
37
  spec.add_dependency("launchy", ">= 0.3.0")
data/lib/heel/server.rb CHANGED
@@ -22,6 +22,10 @@ module Heel
22
22
  (ENV["HOMEPATH"] && "#{ENV["HOMEDRIVE"]}#{ENV["HOMEPATH"]}") ||
23
23
  "/"
24
24
  end
25
+
26
+ def kill_existing_proc
27
+ Heel::Server.new.kill_existing_proc
28
+ end
25
29
  end
26
30
 
27
31
  def initialize(argv = [])
@@ -161,8 +165,10 @@ module Heel
161
165
  @stdout.puts "Sending TERM to process #{pid}"
162
166
  Process.kill("TERM", pid)
163
167
  rescue Errno::ESRCH
164
- @stdout.puts "Process does not exist. Removing stale pid file."
168
+ @stdout.puts "Unable to kill process with pid #{pid}. Process does not exist. Removing stale pid file."
165
169
  File.unlink(pid_file)
170
+ rescue Errno::EPERM
171
+ @stdout.puts "Unable to kill process with pid #{pid}. No permissions to kill process."
166
172
  end
167
173
  else
168
174
  @stdout.puts "No pid file exists, no process to kill"
@@ -217,11 +223,11 @@ module Heel
217
223
  uri "/", :handler => Heel::DirHandler.new({:document_root => c_document_root,
218
224
  :highlighting => c_highlighting })
219
225
  uri "/", :handler => Heel::ErrorHandler.new
220
- uri "/css", :handler => Heel::DirHandler.new({:document_root =>
221
- File.join(APP_RESOURCE_DIR, "css")})
222
- uri "/icons", :handler => Heel::DirHandler.new({ :document_root =>
223
- File.join(APP_RESOURCE_DIR, "famfamfam", "icons")})
224
- uri "/status", :handler => ::Mongrel::StatusHandler.new(:stats_filter => stats)
226
+ uri "/heel_css", :handler => Heel::DirHandler.new({:document_root =>
227
+ File.join(APP_DATA_DIR, "css")})
228
+ uri "/heel_icons", :handler => Heel::DirHandler.new({ :document_root =>
229
+ File.join(APP_DATA_DIR, "famfamfam", "icons")})
230
+ uri "/heel_status", :handler => ::Mongrel::StatusHandler.new(:stats_filter => stats)
225
231
  end
226
232
  rescue Errno::EADDRINUSE
227
233
  log "ERROR: Address (#{c_address}:#{c_port}) is already in use, please check running processes or run `heel --kill'"
data/lib/heel/version.rb CHANGED
@@ -1,20 +1,20 @@
1
- require 'heel'
2
-
3
1
  module Heel
4
- class Version
2
+ module Version
5
3
  MAJOR = 0
6
- MINOR = 5
4
+ MINOR = 6
7
5
  BUILD = 0
8
6
 
9
- class << self
10
- def to_a
11
- [MAJOR, MINOR, BUILD]
12
- end
7
+ def to_a
8
+ [MAJOR, MINOR, BUILD]
9
+ end
13
10
 
14
- def to_s
15
- to_a.join(".")
16
- end
11
+ def to_s
12
+ to_a.join(".")
17
13
  end
14
+ module_function :to_a
15
+ module_function :to_s
16
+
17
+ STRING = Version.to_s
18
18
  end
19
19
  VERSION = Version.to_s
20
20
  end
data/lib/heel.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Heel
2
2
  APP_ROOT_DIR = File.dirname(File.expand_path(File.join(__FILE__,".."))).freeze
3
3
  APP_LIB_DIR = File.join(APP_ROOT_DIR,"lib")
4
- APP_RESOURCE_DIR = File.join(APP_ROOT_DIR,"resources")
4
+ APP_DATA_DIR = File.join(APP_ROOT_DIR,"data")
5
5
  end
6
6
 
7
7
  require 'rubygems'
data/spec/server_spec.rb CHANGED
@@ -97,7 +97,7 @@ describe Heel::Server do
97
97
  @stdout.string.should =~ /Created/m
98
98
  end
99
99
 
100
- it "should not find a pid file" do
100
+ it "should send a signal to a pid" do
101
101
  server = Heel::Server.new(%w[--kil])
102
102
  server.set_io(@stdin,@stdout)
103
103
  server.setup_heel_dir
@@ -111,4 +111,5 @@ describe Heel::Server do
111
111
  @stdout.string.should =~ /Sending TERM to process -42/m
112
112
  end
113
113
  end
114
+
114
115
  end
metadata CHANGED
@@ -1,100 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: heel
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2007-11-19 00:00:00 -07:00
8
- summary: A mongrel based static file webserver.
9
- require_paths:
10
- - lib
11
- email: jeremy@hinegardner.org
12
- homepage: http://copiousfreetime.rubyforge.org/heel/
13
- rubyforge_project: copiousfreetime
14
- description: Heel is a mongrel based web server to quickly and easily serve up the contents of a directory as webpages. Beyond just serving up webpages heel uses an ERB template and famfamfam icons to create useful index pages. And to make things even easier it launches your browser for you so no cut and paste necessary.
15
- autorequire:
16
- default_executable: heel
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.5
24
- version:
25
- platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
4
+ version: 0.6.0
5
+ platform: ""
29
6
  authors:
30
7
  - Jeremy Hinegardner
31
- files:
32
- - spec/dir_handler_spec.rb
33
- - spec/error_handler_spec.rb
34
- - spec/server_spec.rb
35
- - spec/spec_helper.rb
36
- - CHANGES
37
- - LICENSE
38
- - README
39
- - lib/heel/dir_handler.rb
40
- - lib/heel/error_handler.rb
41
- - lib/heel/gemspec.rb
42
- - lib/heel/server.rb
43
- - lib/heel/specification.rb
44
- - lib/heel/version.rb
45
- - lib/heel.rb
46
- - resources/css
47
- - resources/css/coderay-cycnus.css
48
- - resources/css/coderay-murphy.css
49
- - resources/css/error.css
50
- - resources/css/listing.css
51
- - resources/error.rhtml
52
- - resources/famfamfam
53
- - resources/famfamfam/icons
54
- - resources/famfamfam/icons/application.png
55
- - resources/famfamfam/icons/compress.png
56
- - resources/famfamfam/icons/error.png
57
- - resources/famfamfam/icons/folder.png
58
- - resources/famfamfam/icons/html.png
59
- - resources/famfamfam/icons/page_excel.png
60
- - resources/famfamfam/icons/page_white.png
61
- - resources/famfamfam/icons/page_white_acrobat.png
62
- - resources/famfamfam/icons/page_white_code.png
63
- - resources/famfamfam/icons/page_white_powerpoint.png
64
- - resources/famfamfam/icons/page_white_text.png
65
- - resources/famfamfam/icons/picture.png
66
- - resources/famfamfam/icons/xhtml.png
67
- - resources/famfamfam/readme.html
68
- - resources/famfamfam/readme.txt
69
- - resources/listing.rhtml
70
- - bin/heel
71
- test_files:
72
- - spec/dir_handler_spec.rb
73
- - spec/error_handler_spec.rb
74
- - spec/server_spec.rb
75
- - spec/spec_helper.rb
76
- rdoc_options:
77
- - --line-numbers
78
- - --inline-source
79
- - --main
80
- - README
81
- - --title
82
- - "'heel -- A mongrel based static file webserver.'"
83
- extra_rdoc_files:
84
- - CHANGES
85
- - LICENSE
86
- - README
87
- executables:
88
- - heel
89
- extensions: []
90
-
91
- requirements: []
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
92
11
 
12
+ date: 2007-11-21 00:00:00 -07:00
13
+ default_executable: heel
93
14
  dependencies:
94
15
  - !ruby/object:Gem::Dependency
95
16
  name: mongrel
96
17
  version_requirement:
97
- version_requirements: !ruby/object:Gem::Version::Requirement
18
+ version_requirements: !ruby/object:Gem::Requirement
98
19
  requirements:
99
20
  - - ">="
100
21
  - !ruby/object:Gem::Version
@@ -103,7 +24,7 @@ dependencies:
103
24
  - !ruby/object:Gem::Dependency
104
25
  name: launchy
105
26
  version_requirement:
106
- version_requirements: !ruby/object:Gem::Version::Requirement
27
+ version_requirements: !ruby/object:Gem::Requirement
107
28
  requirements:
108
29
  - - ">="
109
30
  - !ruby/object:Gem::Version
@@ -112,7 +33,7 @@ dependencies:
112
33
  - !ruby/object:Gem::Dependency
113
34
  name: mime-types
114
35
  version_requirement:
115
- version_requirements: !ruby/object:Gem::Version::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
116
37
  requirements:
117
38
  - - ">="
118
39
  - !ruby/object:Gem::Version
@@ -121,7 +42,7 @@ dependencies:
121
42
  - !ruby/object:Gem::Dependency
122
43
  name: coderay
123
44
  version_requirement:
124
- version_requirements: !ruby/object:Gem::Version::Requirement
45
+ version_requirements: !ruby/object:Gem::Requirement
125
46
  requirements:
126
47
  - - ">="
127
48
  - !ruby/object:Gem::Version
@@ -130,9 +51,95 @@ dependencies:
130
51
  - !ruby/object:Gem::Dependency
131
52
  name: rake
132
53
  version_requirement:
133
- version_requirements: !ruby/object:Gem::Version::Requirement
54
+ version_requirements: !ruby/object:Gem::Requirement
134
55
  requirements:
135
56
  - - ">="
136
57
  - !ruby/object:Gem::Version
137
58
  version: 0.7.3
138
59
  version:
60
+ description: Heel is a mongrel based web server to quickly and easily serve up the contents of a directory as webpages. Beyond just serving up webpages heel uses an ERB template and famfamfam icons to create useful index pages. And to make things even easier it launches your browser for you so no cut and paste necessary.
61
+ email: jeremy@hinegardner.org
62
+ executables:
63
+ - heel
64
+ extensions: []
65
+
66
+ extra_rdoc_files:
67
+ - CHANGES
68
+ - LICENSE
69
+ - README
70
+ files:
71
+ - spec/dir_handler_spec.rb
72
+ - spec/error_handler_spec.rb
73
+ - spec/server_spec.rb
74
+ - spec/spec_helper.rb
75
+ - CHANGES
76
+ - LICENSE
77
+ - README
78
+ - lib/heel/dir_handler.rb
79
+ - lib/heel/error_handler.rb
80
+ - lib/heel/gemspec.rb
81
+ - lib/heel/server.rb
82
+ - lib/heel/specification.rb
83
+ - lib/heel/version.rb
84
+ - lib/heel.rb
85
+ - data/css
86
+ - data/css/coderay-cycnus.css
87
+ - data/css/coderay-murphy.css
88
+ - data/css/error.css
89
+ - data/css/listing.css
90
+ - data/error.rhtml
91
+ - data/famfamfam
92
+ - data/famfamfam/icons
93
+ - data/famfamfam/icons/application.png
94
+ - data/famfamfam/icons/compress.png
95
+ - data/famfamfam/icons/error.png
96
+ - data/famfamfam/icons/folder.png
97
+ - data/famfamfam/icons/html.png
98
+ - data/famfamfam/icons/page_excel.png
99
+ - data/famfamfam/icons/page_white.png
100
+ - data/famfamfam/icons/page_white_acrobat.png
101
+ - data/famfamfam/icons/page_white_code.png
102
+ - data/famfamfam/icons/page_white_powerpoint.png
103
+ - data/famfamfam/icons/page_white_text.png
104
+ - data/famfamfam/icons/picture.png
105
+ - data/famfamfam/icons/xhtml.png
106
+ - data/famfamfam/readme.html
107
+ - data/famfamfam/readme.txt
108
+ - data/listing.rhtml
109
+ - bin/heel
110
+ has_rdoc: true
111
+ homepage: http://copiousfreetime.rubyforge.org/heel/
112
+ post_install_message:
113
+ rdoc_options:
114
+ - --line-numbers
115
+ - --inline-source
116
+ - --main
117
+ - README
118
+ - --title
119
+ - "'heel -- A mongrel based static file webserver.'"
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 1.8.5
127
+ version:
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: "0"
133
+ version:
134
+ requirements: []
135
+
136
+ rubyforge_project: copiousfreetime
137
+ rubygems_version: 0.9.5
138
+ signing_key:
139
+ specification_version: 2
140
+ summary: A mongrel based static file webserver.
141
+ test_files:
142
+ - spec/dir_handler_spec.rb
143
+ - spec/error_handler_spec.rb
144
+ - spec/server_spec.rb
145
+ - spec/spec_helper.rb