heel 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,4 +1,15 @@
1
1
  = Changelog
2
+ == Version 1.0.2 - 2008-12-03
3
+
4
+ * Fix FileType namespace issue (thanks defunkt) and new version of coderay
5
+ * various task maintenance
6
+ * updated version dependencies
7
+
8
+ == Version 1.0.1 - 2008-04-24
9
+
10
+ * Fix performance issue in serving large files
11
+ * Fix performance issue in checking for coderay file type when coderay would not be used.
12
+
2
13
  == Version 1.0.0 - 2008-04-20
3
14
 
4
15
  * Convert Heel to a Rack and Thin application
data/README CHANGED
@@ -3,8 +3,9 @@
3
3
  * Homepage[http://copiousfreetime.rubyforge.org/heel/]
4
4
  * {Rubyforge Project}[http://rubyforge.org/projects/copiousfreetime/]
5
5
  * email jeremy at hinegardner dot org
6
+ * git clone git://github.com/copiousfreetime/heel.git
6
7
 
7
- == DESCRIPTION:
8
+ == DESCRIPTION
8
9
 
9
10
  Heel is a small static web server for use when you need a quick web server for a
10
11
  directory. Once the server is running, heel will use
@@ -15,7 +16,7 @@ Heel is built using {Rack}[http://rack.rubyforge.org] and
15
16
  {Thin}[http://code.macournoyer.com/thin/]
16
17
 
17
18
  % heel
18
- >> Thin web server (v0.8.1 codename Rebel Porpoise)
19
+ >> Thin web server (v1.0.0 codename That's What She Said)
19
20
  >> Threaded mode OFF
20
21
  >> Maximum connections set to 1024
21
22
  >> Listening on 0.0.0.0:4331, CTRL+C to stop
data/gemspec.rb CHANGED
@@ -18,10 +18,10 @@ Heel::GEM_SPEC = Gem::Specification.new do |spec|
18
18
  pkg = Configuration.for('packaging')
19
19
  spec.files = pkg.files.all
20
20
  spec.executables = pkg.files.bin.collect { |b| File.basename(b) }
21
- spec.add_dependency("thin", ">= 0.7.0")
22
- spec.add_dependency("mime-types", ">= 1.15")
23
- spec.add_dependency("launchy", ">= 0.3.1")
24
- spec.add_dependency("coderay", ">= 0.7.4.215")
21
+ spec.add_dependency("thin", "~> 1.0.0")
22
+ spec.add_dependency("mime-types", "~> 1.15")
23
+ spec.add_dependency("launchy", "~> 0.3.2")
24
+ spec.add_dependency("coderay", "~> 0.8.260")
25
25
 
26
26
  if rdoc = Configuration.for_if_exist?('rdoc') then
27
27
  spec.has_rdoc = true
data/lib/heel/rackapp.rb CHANGED
@@ -8,6 +8,7 @@ require 'rack'
8
8
  require 'rack/utils'
9
9
  require 'coderay'
10
10
  require 'coderay/helpers/file_type'
11
+ require 'time'
11
12
 
12
13
  module Heel
13
14
  class RackApp
@@ -85,37 +86,53 @@ module Heel
85
86
  # html file.
86
87
  #
87
88
  def file_response(req)
88
- code_ray_type = ::FileType[req.request_path, true]
89
- response = ::Rack::Response.new
89
+ response = ::Rack::Response.new
90
+
90
91
  response['Last-Modified'] = req.stat.mtime.rfc822
91
92
 
92
- if highlighting? and req.highlighting? and code_ray_type and (code_ray_type != :html) then
93
- body = <<-EOM
94
- <html>
95
- <head>
96
- <title>#{req.path_info}</title>
97
- <!-- CodeRay syntax highlighting CSS -->
98
- <link rel="stylesheet" href="/heel_css/coderay-cycnus.css" type="text/css" />
99
- </head>
100
- <body>
101
- <div class="CodeRay">
102
- <pre>
103
- #{CodeRay.scan_file(req.request_path,:auto).html({:line_numbers => :inline})}
104
- </pre>
105
- </div>
106
- </body>
107
- </html>
108
- EOM
109
- response['Content-Type'] = 'text/html'
110
- response['Content-Length'] = body.length.to_s
111
- response.body << body
112
- else
113
- file_type = mime_map.mime_type_of(req.request_path)
114
- response['Content-Type'] = file_type.to_s
115
- response['Content-Length'] = req.stat.size.to_s
116
- response.body = File.open(req.request_path)
93
+ if highlighting? and req.highlighting? then
94
+ # only do a coderay type check if we are going to use coderay in the
95
+ # response
96
+ code_ray_type = CodeRay::FileType[req.request_path, true]
97
+ if code_ray_type and (code_ray_type != :html) then
98
+ body = <<-EOM
99
+ <html>
100
+ <head>
101
+ <title>#{req.path_info}</title>
102
+ <!-- CodeRay syntax highlighting CSS -->
103
+ <link rel="stylesheet" href="/heel_css/coderay-cycnus.css" type="text/css" />
104
+ </head>
105
+ <body>
106
+ <div class="CodeRay">
107
+ <pre>
108
+ #{CodeRay.scan_file(req.request_path,:auto).html({:line_numbers => :inline})}
109
+ </pre>
110
+ </div>
111
+ </body>
112
+ </html>
113
+ EOM
114
+ response['Content-Type'] = 'text/html'
115
+ response['Content-Length'] = body.length.to_s
116
+ response.body << body
117
+ return response.finish
118
+ end
117
119
  end
118
- return response.finish
120
+
121
+ # fall through to a default file return
122
+ #
123
+
124
+ file_type = mime_map.mime_type_of(req.request_path)
125
+ response['Content-Type'] = file_type.to_s
126
+ response['Content-Length'] = req.stat.size.to_s
127
+
128
+ return response.finish do
129
+ File.open(req.request_path) do |f|
130
+ while p = f.read(8192)
131
+ response.write p
132
+ end
133
+ end
134
+ end
135
+
119
136
  end
120
137
 
121
138
  # interface to rack, env is a hash
data/lib/heel/version.rb CHANGED
@@ -7,7 +7,7 @@ module Heel
7
7
  module Version
8
8
  MAJOR = 1
9
9
  MINOR = 0
10
- BUILD = 0
10
+ BUILD = 2
11
11
 
12
12
  def to_a
13
13
  [MAJOR, MINOR, BUILD]
data/tasks/config.rb CHANGED
@@ -44,14 +44,14 @@ Configuration.for('packaging') {
44
44
  formats {
45
45
  tgz true
46
46
  zip true
47
- gem Configuration::Table.has_key?('gem')
47
+ rubygem Configuration::Table.has_key?('rubygem')
48
48
  }
49
49
  }
50
50
 
51
51
  #-----------------------------------------------------------------------
52
52
  # Gem packaging
53
53
  #-----------------------------------------------------------------------
54
- Configuration.for("gem") {
54
+ Configuration.for("rubygem") {
55
55
  spec "gemspec.rb"
56
56
  Configuration.for('packaging').files.all << spec
57
57
  }
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
- #++
5
-
6
1
  require 'tasks/config'
7
2
 
8
3
  #-------------------------------------------------------------------------------
@@ -23,7 +18,7 @@ if pkg_config = Configuration.for_if_exist?("packaging") then
23
18
 
24
19
  desc "Install as a gem"
25
20
  task :install => [:clobber, :package] do
26
- sh "sudo gem install -y pkg/#{Heel::GEM_SPEC.full_name}.gem"
21
+ sh "sudo gem install --local pkg/#{Heel::GEM_SPEC.full_name}.gem"
27
22
  end
28
23
 
29
24
  desc "Uninstall gem"
data/tasks/rspec.rb CHANGED
@@ -25,6 +25,7 @@ if spec_config = Configuration.for_if_exist?('test') then
25
25
 
26
26
  if rcov_config = Configuration.for_if_exist?('rcov') then
27
27
  r.rcov = true
28
+ r.spec_opts = %w(--format specdoc --color)
28
29
  r.rcov_dir = rcov_config.output_dir
29
30
  r.rcov_opts = rcov_config.rcov_opts
30
31
  end
data/tasks/rubyforge.rb CHANGED
@@ -19,21 +19,29 @@ if rf_conf = Configuration.for_if_exist?('rubyforge') then
19
19
 
20
20
  rubyforge = ::RubyForge.new
21
21
 
22
+ config = {}
23
+ config["release_notes"] = proj_conf.description
24
+ config["release_changes"] = Utils.release_notes_from( proj_conf.history )[Heel::VERSION]
25
+ config["Preformatted"] = true
26
+
27
+ rubyforge.configure config
28
+
22
29
  # make sure this release doesn't already exist
23
30
  releases = rubyforge.autoconfig['release_ids']
24
31
  if releases.has_key?(proj_conf.name) and releases[proj_conf.name][Heel::VERSION] then
25
32
  abort("Release #{Heel::VERSION} already exists! Unable to release.")
26
33
  end
27
34
 
28
- config = rubyforge.userconfig
29
- config["release_notes"] = proj_conf.description
30
- config["release_changes"] = Utils.release_notes_from(proj_conf.history)[Heel::VERSION]
31
- config["Prefomatted"] = true
32
35
 
33
36
  puts "Uploading to rubyforge..."
34
37
  files = FileList[File.join("pkg","#{proj_conf.name}-#{Heel::VERSION}*.*")].to_a
38
+ files.each do |f|
39
+ puts " * #{f}"
40
+ end
41
+
35
42
  rubyforge.login
36
43
  rubyforge.add_release(rf_conf.project, proj_conf.name, Heel::VERSION, *files)
44
+
37
45
  puts "done."
38
46
  end
39
47
  end
@@ -41,10 +49,17 @@ if rf_conf = Configuration.for_if_exist?('rubyforge') then
41
49
  namespace :announce do
42
50
  desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
43
51
  task :rubyforge do
44
- subject, title, body, urls = announcement
52
+ info = Utils.announcement
53
+
54
+ puts "Subject : #{info['subject']}"
55
+ msg = "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}"
56
+ puts msg
57
+
58
+
45
59
  rubyforge = RubyForge.new
60
+ rubyforge.configure
46
61
  rubyforge.login
47
- rubyforge.post_news(rf_conf.project, subject, "#{title}\n\n#{urls}\n\n#{body}")
62
+ rubyforge.post_news( rf_conf.project, info[:subject], msg )
48
63
  puts "Posted to rubyforge"
49
64
  end
50
65
 
data/tasks/utils.rb CHANGED
@@ -59,7 +59,7 @@ module Utils
59
59
  #
60
60
  def release_notes_from(history_file)
61
61
  releases = {}
62
- File.read(history_file).split(/^(?==)/).each do |section|
62
+ File.read(history_file).split(/^(?=== Version)/).each do |section|
63
63
  lines = section.split("\n")
64
64
  md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
65
65
  next unless md
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
@@ -9,46 +9,50 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-21 00:00:00 -06:00
12
+ date: 2008-12-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thin
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
- - - ">="
21
+ - - ~>
21
22
  - !ruby/object:Gem::Version
22
- version: 0.7.0
23
+ version: 1.0.0
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: mime-types
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
29
- - - ">="
31
+ - - ~>
30
32
  - !ruby/object:Gem::Version
31
33
  version: "1.15"
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
36
  name: launchy
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ">="
41
+ - - ~>
39
42
  - !ruby/object:Gem::Version
40
- version: 0.3.1
43
+ version: 0.3.2
41
44
  version:
42
45
  - !ruby/object:Gem::Dependency
43
46
  name: coderay
47
+ type: :runtime
44
48
  version_requirement:
45
49
  version_requirements: !ruby/object:Gem::Requirement
46
50
  requirements:
47
- - - ">="
51
+ - - ~>
48
52
  - !ruby/object:Gem::Version
49
- version: 0.7.4.215
53
+ version: 0.8.260
50
54
  version:
51
- description: Heel is a small static web server for use when you need a quick web server for a directory. Once the server is running, heel will use {launchy}[http://copiousfreetime.rubyforge.org/launchy/] to open your browser at the URL of your document root. Heel is built using {Rack}[http://rack.rubyforge.org] and {Thin}[http://code.macournoyer.com/thin/] % heel >> Thin web server (v0.8.1 codename Rebel Porpoise) >> Threaded mode OFF >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4331, CTRL+C to stop Launching your browser... Or run it in the background % heel --daemonize Created /Users/jeremy/.heel heel's PID (/Users/jeremy/.heel/heel.pid) and log file (/Users/jeremy/.heel/heel.log) are stored here Launching your browser at http://0.0.0.0:4331/ % heel --kill Sending TERM to process 3304 Done.
55
+ description: Heel is a small static web server for use when you need a quick web server for a directory. Once the server is running, heel will use {launchy}[http://copiousfreetime.rubyforge.org/launchy/] to open your browser at the URL of your document root. Heel is built using {Rack}[http://rack.rubyforge.org] and {Thin}[http://code.macournoyer.com/thin/] % heel >> Thin web server (v1.0.0 codename That's What She Said) >> Threaded mode OFF >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4331, CTRL+C to stop Launching your browser... Or run it in the background % heel --daemonize Created /Users/jeremy/.heel heel's PID (/Users/jeremy/.heel/heel.pid) and log file (/Users/jeremy/.heel/heel.log) are stored here Launching your browser at http://0.0.0.0:4331/ % heel --kill Sending TERM to process 3304 Done.
52
56
  email: jeremy at hinegardner dot org
53
57
  executables:
54
58
  - heel
@@ -145,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
149
  requirements: []
146
150
 
147
151
  rubyforge_project: copiousfreetime
148
- rubygems_version: 0.9.5
152
+ rubygems_version: 1.3.1
149
153
  signing_key:
150
154
  specification_version: 2
151
155
  summary: Heel is a small static web server for use when you need a quick web server for a directory