heel 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,46 @@
1
+ # Hi there!
2
+
3
+ I see you are interested in contributing. That is wonderful. I love
4
+ contributions.
5
+
6
+ I guarantee that there are bugs in this software. And I guarantee that there is
7
+ a feature you want that is not in here yet. As such, any and all bugs reports
8
+ are gratefully accepted, bugfixes even more so. Helping out with bugs is the
9
+ easiest way to contribute.
10
+
11
+
12
+ ## The Quick Version
13
+
14
+ * Have a [GitHub Account][].
15
+ * Search the [GitHub Issues][] and see if your issue already present. If so
16
+ add your comments, :thumbsup:, etc.
17
+ * Issue not there? Not a problem, open up a [new issue][].
18
+ * **Bug reports** please be as detailed as possible. Include:
19
+ * full ruby engine and version: `ruby -e 'puts RUBY_DESCRIPTION'`
20
+ * operating system and version
21
+ * version of heel `ruby -rubygems -e "require 'heel'; puts Heel::VERSION"`
22
+ * as much detail about the bug as possible so I can replicate it. Feel free
23
+ to link in a [gist][]
24
+ * **New Feature**
25
+ * What the new feature should do.
26
+ * What benefit the new feature brings to the project.
27
+ * Fork the [repo][].
28
+ * Create a new branch for your issue: `git checkout -b issue/my-issue`
29
+ * Lovingly craft your contribution:
30
+ * `rake develop` to get started, or if you prefer bundler `rake develop:using_bundler && bundle`.
31
+ * `rake test` to run tests
32
+ * Make sure that `rake test` passes. It's important, I said it twice.
33
+ * Add yourself to the contributors section below.
34
+ * Submit your [pull request][].
35
+
36
+ # Contributors
37
+
38
+ * [Jeremy Hinegardner][https://github.com/copiousfreetime]
39
+ * [Kevin Barnes][https://github.com/vinbarnes]
40
+
41
+ [GitHub Account]: https://github.com/signup/free "GitHub Signup"
42
+ [GitHub Issues]: https://github.com/copiousfreetime/heel/issues "Heel Issues"
43
+ [new issue]: https://github.com/copiousfreetime/heel/issues/new "New Heel Issue"
44
+ [gist]: https://gist.github.com/ "New Gist"
45
+ [repo]: https://github.com/copiousfreetime/heel "Heel Repo"
46
+ [pull request]: https://help.github.com/articles/using-pull-requests "Using Pull Requests"
@@ -1,4 +1,17 @@
1
1
  = Changelog
2
+ == Version 3.0.0 - 2013-02-06
3
+
4
+ * Switch to using puma for the webserver
5
+ * Switch to using simplecov for coverage testing
6
+ * Update all gem dependencies
7
+ * Update to fixme project template
8
+ * Convert to minitest
9
+
10
+ == Version 2.1.0 - 2011-03-17
11
+
12
+ * Update to Launchy 1.0.0
13
+ * Update to Thin 1.2.8
14
+
2
15
  == Version 2.0.0 - 2009-06-24
3
16
 
4
17
  * Change highlighting mode default to 'off' instead of 'on'
data/Manifest.txt ADDED
@@ -0,0 +1,45 @@
1
+ CONTRIBUTING.md
2
+ HISTORY.rdoc
3
+ LICENSE
4
+ Manifest.txt
5
+ README.rdoc
6
+ Rakefile
7
+ TODO
8
+ bin/heel
9
+ data/css/coderay-alpha.css
10
+ data/css/coderay-cycnus.css
11
+ data/css/coderay-murphy.css
12
+ data/css/error.css
13
+ data/css/listing.css
14
+ data/error.rhtml
15
+ data/famfamfam/icons/application.png
16
+ data/famfamfam/icons/compress.png
17
+ data/famfamfam/icons/error.png
18
+ data/famfamfam/icons/folder.png
19
+ data/famfamfam/icons/html.png
20
+ data/famfamfam/icons/page_excel.png
21
+ data/famfamfam/icons/page_white.png
22
+ data/famfamfam/icons/page_white_acrobat.png
23
+ data/famfamfam/icons/page_white_code.png
24
+ data/famfamfam/icons/page_white_powerpoint.png
25
+ data/famfamfam/icons/page_white_text.png
26
+ data/famfamfam/icons/picture.png
27
+ data/famfamfam/icons/xhtml.png
28
+ data/famfamfam/readme.html
29
+ data/famfamfam/readme.txt
30
+ data/listing.rhtml
31
+ lib/heel.rb
32
+ lib/heel/configuration.rb
33
+ lib/heel/directory_indexer.rb
34
+ lib/heel/error_response.rb
35
+ lib/heel/mime_map.rb
36
+ lib/heel/rackapp.rb
37
+ lib/heel/request.rb
38
+ lib/heel/server.rb
39
+ spec/configuration_spec.rb
40
+ spec/directory_indexer_spec.rb
41
+ spec/rackapp_spec.rb
42
+ spec/server_spec.rb
43
+ spec/spec_helper.rb
44
+ tasks/default.rake
45
+ tasks/this.rb
@@ -16,8 +16,7 @@ Heel is built using {Rack}[http://rack.rubyforge.org] and
16
16
  {Thin}[http://code.macournoyer.com/thin/]
17
17
 
18
18
  % heel
19
- >> Thin web server (v1.0.0 codename That's What She Said)
20
- >> Threaded mode OFF
19
+ >> Thin web server (v1.2.8 codename Black Keys)
21
20
  >> Maximum connections set to 1024
22
21
  >> Listening on 0.0.0.0:4331, CTRL+C to stop
23
22
  Launching your browser...
@@ -87,7 +86,7 @@ Or run it in the background
87
86
 
88
87
  == BSD LICENSE:
89
88
 
90
- Copyright (c) 2007-2009, Jeremy Hinegardner
89
+ Copyright (c) 2007 - 2013, Jeremy Hinegardner
91
90
 
92
91
  All rights reserved.
93
92
 
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # vim: syntax=ruby
2
+ load 'tasks/this.rb'
3
+
4
+ This.name = "heel"
5
+ This.author = "Jeremy Hinegardner"
6
+ This.email = "jeremy@copiousfreetime.org"
7
+ This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
8
+
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' )
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' )
18
+ end
19
+
20
+ load 'tasks/default.rake'
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ - See why jruby is not working correctly
2
+ - Add HEAD support
data/bin/heel CHANGED
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  #--
4
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
4
+ # Copyright (c) 2007 - 2013 Jeremy Hinegardner
5
5
  # All rights reserved. Licensed under the BSD license. See LICENSE for details
6
6
  #++
7
7
 
8
- $: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
9
-
10
8
  require 'rubygems'
11
9
  require 'heel'
12
10
 
@@ -0,0 +1,120 @@
1
+ .CodeRay {
2
+ background-color: hsl(0,0%,95%);
3
+ border: 1px solid silver;
4
+ color: black;
5
+ }
6
+ .CodeRay pre {
7
+ margin: 0px;
8
+ }
9
+
10
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
11
+
12
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; }
13
+ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
14
+
15
+ .CodeRay .line-numbers {
16
+ background-color: hsl(180,65%,90%);
17
+ color: gray;
18
+ text-align: right;
19
+ -webkit-user-select: none;
20
+ -moz-user-select: none;
21
+ user-select: none;
22
+ }
23
+ .CodeRay .line-numbers a {
24
+ background-color: hsl(180,65%,90%) !important;
25
+ color: gray !important;
26
+ text-decoration: none !important;
27
+ }
28
+ .CodeRay .line-numbers a:target { color: blue !important; }
29
+ .CodeRay .line-numbers .highlighted { color: red !important; }
30
+ .CodeRay .line-numbers .highlighted a { color: red !important; }
31
+ .CodeRay span.line-numbers { padding: 0px 4px; }
32
+ .CodeRay .line { display: block; float: left; width: 100%; }
33
+ .CodeRay .code { width: 100%; }
34
+
35
+ .CodeRay .debug { color: white !important; background: blue !important; }
36
+
37
+ .CodeRay .annotation { color:#007 }
38
+ .CodeRay .attribute-name { color:#b48 }
39
+ .CodeRay .attribute-value { color:#700 }
40
+ .CodeRay .binary { color:#509 }
41
+ .CodeRay .char .content { color:#D20 }
42
+ .CodeRay .char .delimiter { color:#710 }
43
+ .CodeRay .char { color:#D20 }
44
+ .CodeRay .class { color:#B06; font-weight:bold }
45
+ .CodeRay .class-variable { color:#369 }
46
+ .CodeRay .color { color:#0A0 }
47
+ .CodeRay .comment { color:#777 }
48
+ .CodeRay .comment .char { color:#444 }
49
+ .CodeRay .comment .delimiter { color:#444 }
50
+ .CodeRay .complex { color:#A08 }
51
+ .CodeRay .constant { color:#036; font-weight:bold }
52
+ .CodeRay .decorator { color:#B0B }
53
+ .CodeRay .definition { color:#099; font-weight:bold }
54
+ .CodeRay .delimiter { color:black }
55
+ .CodeRay .directive { color:#088; font-weight:bold }
56
+ .CodeRay .doc { color:#970 }
57
+ .CodeRay .doc-string { color:#D42; font-weight:bold }
58
+ .CodeRay .doctype { color:#34b }
59
+ .CodeRay .entity { color:#800; font-weight:bold }
60
+ .CodeRay .error { color:#F00; background-color:#FAA }
61
+ .CodeRay .escape { color:#666 }
62
+ .CodeRay .exception { color:#C00; font-weight:bold }
63
+ .CodeRay .float { color:#60E }
64
+ .CodeRay .function { color:#06B; font-weight:bold }
65
+ .CodeRay .global-variable { color:#d70 }
66
+ .CodeRay .hex { color:#02b }
67
+ .CodeRay .imaginary { color:#f00 }
68
+ .CodeRay .include { color:#B44; font-weight:bold }
69
+ .CodeRay .inline { background-color: hsla(0,0%,0%,0.07); color: black }
70
+ .CodeRay .inline-delimiter { font-weight: bold; color: #666 }
71
+ .CodeRay .instance-variable { color:#33B }
72
+ .CodeRay .integer { color:#00D }
73
+ .CodeRay .key .char { color: #60f }
74
+ .CodeRay .key .delimiter { color: #404 }
75
+ .CodeRay .key { color: #606 }
76
+ .CodeRay .keyword { color:#080; font-weight:bold }
77
+ .CodeRay .label { color:#970; font-weight:bold }
78
+ .CodeRay .local-variable { color:#963 }
79
+ .CodeRay .namespace { color:#707; font-weight:bold }
80
+ .CodeRay .octal { color:#40E }
81
+ .CodeRay .operator { }
82
+ .CodeRay .predefined { color:#369; font-weight:bold }
83
+ .CodeRay .predefined-constant { color:#069 }
84
+ .CodeRay .predefined-type { color:#0a5; font-weight:bold }
85
+ .CodeRay .preprocessor { color:#579 }
86
+ .CodeRay .pseudo-class { color:#00C; font-weight:bold }
87
+ .CodeRay .regexp .content { color:#808 }
88
+ .CodeRay .regexp .delimiter { color:#404 }
89
+ .CodeRay .regexp .modifier { color:#C2C }
90
+ .CodeRay .regexp { background-color:hsla(300,100%,50%,0.06); }
91
+ .CodeRay .reserved { color:#080; font-weight:bold }
92
+ .CodeRay .shell .content { color:#2B2 }
93
+ .CodeRay .shell .delimiter { color:#161 }
94
+ .CodeRay .shell { background-color:hsla(120,100%,50%,0.06); }
95
+ .CodeRay .string .char { color: #b0b }
96
+ .CodeRay .string .content { color: #D20 }
97
+ .CodeRay .string .delimiter { color: #710 }
98
+ .CodeRay .string .modifier { color: #E40 }
99
+ .CodeRay .string { background-color:hsla(0,100%,50%,0.05); }
100
+ .CodeRay .symbol .content { color:#A60 }
101
+ .CodeRay .symbol .delimiter { color:#630 }
102
+ .CodeRay .symbol { color:#A60 }
103
+ .CodeRay .tag { color:#070 }
104
+ .CodeRay .type { color:#339; font-weight:bold }
105
+ .CodeRay .value { color: #088; }
106
+ .CodeRay .variable { color:#037 }
107
+
108
+ .CodeRay .insert { background: hsla(120,100%,50%,0.12) }
109
+ .CodeRay .delete { background: hsla(0,100%,50%,0.12) }
110
+ .CodeRay .change { color: #bbf; background: #007; }
111
+ .CodeRay .head { color: #f8f; background: #505 }
112
+ .CodeRay .head .filename { color: white; }
113
+
114
+ .CodeRay .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
115
+ .CodeRay .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
116
+
117
+ .CodeRay .insert .insert { color: #0c0; background:transparent; font-weight:bold }
118
+ .CodeRay .delete .delete { color: #c00; background:transparent; font-weight:bold }
119
+ .CodeRay .change .change { color: #88f }
120
+ .CodeRay .head .head { color: #f4f }
data/lib/heel.rb CHANGED
@@ -1,21 +1,16 @@
1
1
  #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
2
+ # Copyright (c) 2007 - 2013 Jeremy Hinegardner
3
+ # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
4
  #++
5
5
 
6
6
  module Heel
7
- # recursively descend the directory with the same name as this file and do a
8
- # require 'heel/path/to/file'
9
- #
10
- def self.require_all_libs_relative_to_me
11
- remove_parent = File.dirname(File.expand_path(__FILE__)) + File::SEPARATOR
12
- descend_dir = File.join(remove_parent,File.basename(__FILE__, ".rb"))
13
-
14
- Dir.glob("#{descend_dir}/**/*.rb").each do |rb|
15
- lib = rb.gsub(remove_parent,'')
16
- require lib
17
- end
18
- end
7
+ VERSION = '3.0.0'
19
8
  end
20
9
 
21
- Heel.require_all_libs_relative_to_me
10
+ require 'heel/configuration'
11
+ require 'heel/directory_indexer'
12
+ require 'heel/error_response'
13
+ require 'heel/mime_map'
14
+ require 'heel/rackapp'
15
+ require 'heel/request'
16
+ require 'heel/server'
@@ -1,6 +1,6 @@
1
1
  #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under BSD license. See LICENSE for details.
2
+ # Copyright (c) 2007 - 2013 Jeremy Hinegardner
3
+ # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
4
  #++
5
5
 
6
6
  module Heel
@@ -18,12 +18,10 @@ module Heel
18
18
  # File::SEPARATOR is guaranteed.
19
19
  #
20
20
  def self.root_dir
21
- unless @root_dir
22
- path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
23
- lib_index = path_parts.rindex("lib")
24
- @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
25
- end
26
- return @root_dir
21
+ path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
22
+ lib_index = path_parts.rindex("lib")
23
+ root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
24
+ return root_dir
27
25
  end
28
26
 
29
27
  # returns:: [String] The full expanded path of the +config+ directory
@@ -1,9 +1,8 @@
1
1
  #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
2
+ # Copyright (c) 2007 - 2013 Jeremy Hinegardner
3
+ # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
4
  #++
5
5
 
6
- require 'heel'
7
6
  require 'erb'
8
7
 
9
8
  module Heel
@@ -16,32 +15,33 @@ module Heel
16
15
  attr_reader :template
17
16
 
18
17
  def initialize( template_file, options )
18
+ @template = nil
19
19
  @template_file = template_file
20
20
  @options = options
21
21
  reload_template
22
22
  end
23
-
23
+
24
24
  def should_ignore?(fname)
25
25
  options[:ignore_globs].each do |glob|
26
26
  return true if ::File.fnmatch(glob,fname)
27
27
  end
28
- false
28
+ false
29
29
  end
30
-
30
+
31
31
  def mime_map
32
32
  @mime_map ||= Heel::MimeMap.new
33
33
  end
34
34
 
35
35
  def highlighting?
36
- @options[:highlighting]
36
+ @options.fetch( :highlighting, false)
37
37
  end
38
38
 
39
39
  def reload_on_template_change?
40
- @options[:reload_template_on_change]
40
+ @options.fetch( :reload_template_on_change, false )
41
41
  end
42
42
 
43
43
  def using_icons?
44
- @options[:using_icons]
44
+ @options.fetch( :using_icons, false )
45
45
  end
46
46
 
47
47
  def reload_template
@@ -1,15 +1,14 @@
1
1
  #--
2
- # Copyright (c) 2007, 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the BSD license. See LICENSE for details
2
+ # Copyright (c) 2007 - 2013 Jeremy Hinegardner
3
+ # All rights reserved. Licensed under the BSD license. See LICENSE for details
4
4
  #++
5
5
 
6
- require 'heel'
7
6
  require 'rack'
8
7
  require 'erb'
9
8
 
10
9
  module Heel
11
10
 
12
- class ErrorResponse < ::Rack::Response
11
+ class ErrorResponse
13
12
 
14
13
  attr_reader :base_uri
15
14
 
@@ -28,16 +27,18 @@ module Heel
28
27
  end
29
28
 
30
29
  def initialize(base_uri, body, status = 404, header = {})
31
- super(body, status, header)
32
- self['Content-type'] = 'text/html'
30
+ header = header.merge( "Content-Type" => 'text/html' )
31
+ @response = Rack::Response.new( body, status, header )
33
32
  @base_uri = base_uri
34
33
  end
35
34
 
36
35
  def finish
37
- message = ::Rack::Utils::HTTP_STATUS_CODES[status]
38
- homepage = ErrorResponse.homepage
39
-
40
- return [ status, header.to_hash, ErrorResponse.template.result(binding) ]
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 )
40
+ @response.write( content )
41
+ return @response.finish
41
42
  end
42
43
  end
43
44
  end