staticmatic 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/staticmatic CHANGED
@@ -1,11 +1,32 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ DEFAULT_PORT = 3000
4
+ DEFAULT_HOST = "127.0.0.1"
2
5
  require File.dirname(__FILE__) + '/../lib/staticmatic'
3
6
 
7
+ $options = {:host=>DEFAULT_HOST,:port=>DEFAULT_PORT}
8
+
9
+ optparse = OptionParser.new do |opt|
10
+ opt.banner = "Usage: #{$0} <build|setup|preview> [OPTIONS]"
11
+ opt.separator ""
12
+ opt.on "-p", "--port [PORT]", "Select the server port, defaults to #{DEFAULT_PORT}" do |port|
13
+ $options[:port] = port
14
+ end
15
+ opt.on "-h", "--host [HOST]", "Select the server host, defaults to #{DEFAULT_HOST}" do |host|
16
+ $options[:host] = host
17
+ end
18
+ opt.on_tail "-h", "--help", "Display this help message" do
19
+ puts opt
20
+ exit
21
+ end
22
+ end
23
+ optparse.parse!
24
+
4
25
  command = ARGV[0]
5
26
  directory = ARGV[1]
6
27
 
7
28
  if !command || !directory
8
- puts 'Usage: staticmatic <build|setup|preview> <directory>'
29
+ puts "Usage: #{$0} <build|setup|preview> <directory>"
9
30
  exit
10
31
  end
11
32
 
@@ -3,7 +3,7 @@ module Haml
3
3
 
4
4
  # Generates links to all stylesheets in the source directory
5
5
  def stylesheets
6
- stylesheet_dir = "#{base_dir}/src/stylesheets"
6
+ stylesheet_dir = "#{@base_dir}/src/stylesheets"
7
7
  output = ""
8
8
  Dir["#{stylesheet_dir}/**/*.sass"].each do |path|
9
9
  filename_without_extension = File.basename(path).chomp(File.extname(path))
@@ -38,7 +38,11 @@ module StaticMatic
38
38
  output = e.message
39
39
  end
40
40
  else
41
- output = "File not Found"
41
+ if @files.can_serve(path_info)
42
+ @files.process(request,response)
43
+ else
44
+ output = "File not Found"
45
+ end
42
46
  end
43
47
  out.write output
44
48
  end
@@ -55,9 +59,9 @@ module StaticMatic
55
59
  #
56
60
  # StaticMatic.start('/path/to/site/')
57
61
  #
58
- def start(base_dir, port = 3000)
59
- config = Mongrel::Configurator.new :host => "127.0.0.1" do
60
- puts "Running Preview of #{base_dir} on 127.0.0.1:#{port}"
62
+ def start(base_dir, port = $options[:port])
63
+ config = Mongrel::Configurator.new :host => $options[:host] do
64
+ puts "Running Preview of #{base_dir} on #{$options[:host]}:#{port}"
61
65
  listener :port => port do
62
66
  uri "/", :handler => Server.new(base_dir)
63
67
  end
@@ -68,4 +72,4 @@ module StaticMatic
68
72
  end
69
73
  end
70
74
  end
71
- end
75
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: staticmatic
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.1
7
- date: 2007-06-10 00:00:00 +01:00
6
+ version: 0.3.0
7
+ date: 2007-07-26 00:00:00 +01:00
8
8
  summary: Manage static sites using Haml & Sass
9
9
  require_paths:
10
10
  - lib
@@ -30,30 +30,25 @@ authors:
30
30
  - Stephen Bartholomew
31
31
  files:
32
32
  - bin
33
- - example
34
- - lib
35
- - RakeFile
36
- - README
37
- - staticmatic-0.2.0.gem
38
- - test
39
33
  - bin/staticmatic
34
+ - example
40
35
  - example/site
41
- - example/src
42
36
  - example/site/contact.html
43
37
  - example/site/images
44
38
  - example/site/index.html
45
39
  - example/site/javascripts
46
40
  - example/site/stylesheets
47
41
  - example/site/stylesheets/application.css
42
+ - example/src
48
43
  - example/src/layouts
49
- - example/src/pages
50
- - example/src/stylesheets
51
44
  - example/src/layouts/application.haml
45
+ - example/src/pages
52
46
  - example/src/pages/contact.haml
53
47
  - example/src/pages/index.haml
48
+ - example/src/stylesheets
54
49
  - example/src/stylesheets/application.sass
50
+ - lib
55
51
  - lib/staticmatic
56
- - lib/staticmatic.rb
57
52
  - lib/staticmatic/base.rb
58
53
  - lib/staticmatic/error.rb
59
54
  - lib/staticmatic/helpers.rb
@@ -62,26 +57,30 @@ files:
62
57
  - lib/staticmatic/templates/application.haml
63
58
  - lib/staticmatic/templates/application.sass
64
59
  - lib/staticmatic/templates/index.haml
60
+ - lib/staticmatic.rb
61
+ - RakeFile
62
+ - README
63
+ - test
65
64
  - test/base_test.rb
66
65
  - test/helpers_test.rb
67
66
  - test/sandbox
68
- - test/server_test.rb
69
67
  - test/sandbox/test_site
70
- - test/sandbox/tmp
71
68
  - test/sandbox/test_site/config.rb
72
69
  - test/sandbox/test_site/site
73
- - test/sandbox/test_site/src
74
70
  - test/sandbox/test_site/site/images
75
71
  - test/sandbox/test_site/site/index.html
76
72
  - test/sandbox/test_site/site/javascripts
77
73
  - test/sandbox/test_site/site/stylesheets
78
74
  - test/sandbox/test_site/site/stylesheets/application.css
75
+ - test/sandbox/test_site/src
79
76
  - test/sandbox/test_site/src/layouts
80
- - test/sandbox/test_site/src/pages
81
- - test/sandbox/test_site/src/stylesheets
82
77
  - test/sandbox/test_site/src/layouts/application.haml
78
+ - test/sandbox/test_site/src/pages
83
79
  - test/sandbox/test_site/src/pages/index.haml
80
+ - test/sandbox/test_site/src/stylesheets
84
81
  - test/sandbox/test_site/src/stylesheets/application.sass
82
+ - test/sandbox/tmp
83
+ - test/server_test.rb
85
84
  test_files:
86
85
  - test/base_test.rb
87
86
  - test/helpers_test.rb
Binary file