tdreyno-staticmatic 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/bin/sm-build +19 -2
  2. data/bin/sm-init +2 -2
  3. data/bin/sm-server +12 -2
  4. data/lib/builder.rb +46 -0
  5. data/lib/generator.rb +27 -0
  6. data/lib/merb/init.rb +31 -0
  7. data/lib/merb/router.rb +3 -0
  8. data/lib/merb/site.rb +41 -0
  9. data/lib/{templates → template}/helpers/site_helper.rb +3 -1
  10. data/lib/{templates/layouts → template/layout}/site.html.haml +1 -1
  11. data/lib/{templates → template}/pages/index.html.haml +0 -0
  12. data/lib/{templates/stylesheets/site.css.sass → template/stylesheets/sass/site.sass} +0 -0
  13. data/spec/builder_spec.rb +31 -16
  14. data/spec/fixtures/sample/helpers/speech_helper.rb +5 -3
  15. data/spec/fixtures/sample/{layouts → pages/layout}/site.html.erb +0 -0
  16. data/spec/fixtures/sample/{layouts → pages/layout}/specified_layout.html.erb +0 -0
  17. data/spec/fixtures/sample/pages/partial_test.html.erb +1 -1
  18. data/spec/fixtures/sample/stylesheets/{site.css.sass → sass/site.sass} +0 -0
  19. metadata +27 -76
  20. data/lib/staticmatic/actionpack_support/mime.rb +0 -5
  21. data/lib/staticmatic/actionpack_support/remove_controller_caching.rb +0 -7
  22. data/lib/staticmatic/actionpack_support/remove_partial_benchmark.rb +0 -6
  23. data/lib/staticmatic/autoload.rb +0 -18
  24. data/lib/staticmatic/base.rb +0 -77
  25. data/lib/staticmatic/builder/dotnet.rb +0 -44
  26. data/lib/staticmatic/builder/html.rb +0 -23
  27. data/lib/staticmatic/builder.rb +0 -86
  28. data/lib/staticmatic/config.rb +0 -41
  29. data/lib/staticmatic/deprecation.rb +0 -26
  30. data/lib/staticmatic/generator.rb +0 -28
  31. data/lib/staticmatic/helpers/asset_tag_helper.rb +0 -11
  32. data/lib/staticmatic/helpers/page_helper.rb +0 -9
  33. data/lib/staticmatic/helpers/url_helper.rb +0 -19
  34. data/lib/staticmatic/previewer.rb +0 -54
  35. data/lib/staticmatic/template.rb +0 -97
  36. data/lib/staticmatic/template_handlers/haml.rb +0 -15
  37. data/lib/staticmatic/template_handlers/liquid.rb +0 -9
  38. data/lib/staticmatic/template_handlers/markdown.rb +0 -9
  39. data/lib/staticmatic/template_handlers/sass.rb +0 -9
  40. data/lib/staticmatic/template_handlers/textile.rb +0 -9
  41. data/lib/staticmatic/templates/rescues/default_error.html.erb +0 -2
  42. data/lib/staticmatic/templates/rescues/template_error.html.erb +0 -19
  43. data/lib/staticmatic.rb +0 -32
  44. data/spec/action_view_helpers_spec.rb +0 -12
  45. data/spec/asset_helpers_spec.rb +0 -24
  46. data/spec/base_spec.rb +0 -54
  47. data/spec/config_spec.rb +0 -31
  48. data/spec/deprecation_spec.rb +0 -18
  49. data/spec/fixtures/sample/build/haml_test.html +0 -11
  50. data/spec/fixtures/sample/build/hello_world.html +0 -9
  51. data/spec/fixtures/sample/build/index.html +0 -9
  52. data/spec/fixtures/sample/build/page_with_error.html +0 -61
  53. data/spec/fixtures/sample/build/services/index.html +0 -9
  54. data/spec/fixtures/sample/build/services/web_development.html +0 -9
  55. data/spec/fixtures/sample/build/stylesheets/site.css +0 -3
  56. data/spec/fixtures/sample/pages/liquid_test.html.liquid +0 -3
  57. data/spec/fixtures/sample/pages/markdown_test.html.markdown +0 -3
  58. data/spec/fixtures/sample/pages/page_with_error.html.haml +0 -3
  59. data/spec/fixtures/sample/pages/textile_test.html.textile +0 -3
  60. data/spec/layouts_spec.rb +0 -28
  61. data/spec/rendering_spec.rb +0 -62
data/bin/sm-build CHANGED
@@ -1,4 +1,21 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'staticmatic')
4
- StaticMatic::Builder.run_cli(Dir.pwd, 'sm-build', 1, %w(build --force).concat(ARGV))
3
+ require 'rubygems'
4
+ require 'merb-core'
5
+
6
+ # Setup Default Options
7
+ ARGV.push *['--pid', "/var/tmp/staticmatic.%s.pid"]
8
+ ARGV.push *['--init-file', File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'init.rb')]
9
+
10
+ # Start Merb
11
+ Merb.start
12
+
13
+ class MerbProxy
14
+ include Merb::Test::RequestHelper
15
+ end
16
+
17
+ Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass]
18
+ Sass::Plugin.update_stylesheets
19
+
20
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'builder')
21
+ Generators.run_cli(Dir.pwd, 'sm-build', 1, %w(build --force).concat(ARGV))
data/bin/sm-init CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'staticmatic')
4
- StaticMatic::Generator.run_cli(Dir.pwd, 'sm-init', 1, %w(setup).concat(ARGV))
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'generator')
4
+ Generators.run_cli(Dir.pwd, 'sm-init', 1, %w(setup).concat(ARGV))
data/bin/sm-server CHANGED
@@ -1,4 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'staticmatic')
4
- StaticMatic::Previewer.start(Dir.pwd)
3
+ # Require Merb
4
+ require 'rubygems'
5
+ require 'merb-core'
6
+
7
+ # Setup Default Options
8
+ ARGV.push *['--adapter', "mongrel"]
9
+ ARGV.push *['--pid', "/var/tmp/staticmatic.%s.pid"]
10
+ ARGV.push *['--init-file', File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'init.rb')]
11
+
12
+ # Start Merb
13
+ puts "Welcome to StaticMatic"
14
+ Merb.start
data/lib/builder.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'templater'
3
+
4
+ module Generators
5
+ extend Templater::Manifold
6
+ desc "Build a staticmatic site"
7
+
8
+ class Builder < Templater::Generator
9
+ # Define source and desintation
10
+ def self.source_root; Dir.pwd; end
11
+ def destination_root; File.join(Dir.pwd, 'build'); end
12
+
13
+ # Override template to ask staticmatic for the correct extension to output
14
+ def self.template(name, *args, &block)
15
+ return if args.first.include?('/layout/')
16
+ return if File.basename(args.first)[0,1] == '_'
17
+
18
+ if (args[0] === args[1])
19
+ args[1] = args[0].gsub(File.extname(args.first), '').gsub('pages/', '')
20
+ end
21
+
22
+ super(name, *args, &block)
23
+ end
24
+
25
+ def self.file(name, *args, &block)
26
+ return if args.first.include?('/sass/')
27
+ args[1] = args[0].gsub('pages/', '') if (args[0] === args[1])
28
+ super(name, *args, &block)
29
+ end
30
+
31
+ glob! "images", [] # No templates
32
+ glob! "javascripts", [] # No templates
33
+ glob! "stylesheets", [] # No templates (Sass is pregenerated)
34
+ glob! "pages", %w(haml erb)
35
+ end
36
+
37
+ add :build, Builder
38
+ end
39
+
40
+ # Monkey-patch to use a dynamic renderer, not just ERb
41
+ class Templater::Actions::Template
42
+ def render
43
+ request_path = destination.gsub(File.join(Dir.pwd, 'build'), "")
44
+ ::MerbProxy.new.get(request_path).body
45
+ end
46
+ end
data/lib/generator.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'templater'
3
+
4
+ module Generators
5
+ extend Templater::Manifold
6
+ desc "Generator for streamlining staticmatic"
7
+
8
+ class NewSite < Templater::Generator
9
+ desc "Creates a new staticmatic scaffold."
10
+ first_argument :location, :required => true, :desc => "Project location"
11
+
12
+ def destination_root
13
+ File.expand_path(location)
14
+ end
15
+
16
+ def self.source_root
17
+ File.join(File.dirname(__FILE__), 'template')
18
+ end
19
+
20
+ glob!
21
+ empty_directory :build, "build"
22
+ empty_directory :javascripts, "javascripts"
23
+ empty_directory :images, "images"
24
+ end
25
+
26
+ add :setup, NewSite
27
+ end
data/lib/merb/init.rb ADDED
@@ -0,0 +1,31 @@
1
+ dependency 'merb-assets', ">=1.0.0"
2
+ dependency 'merb-helpers', ">=1.0.0"
3
+ dependency 'merb-haml', ">=1.0.0"
4
+
5
+ Merb::Config.use do |c|
6
+ c[:name] = 'sm-server'
7
+ c[:exception_details] = true
8
+
9
+ # Append random numbers to assets in dev mode, but not build mode
10
+ c[:reload_templates] = (Merb::Config[:adapter] == 'mongrel')
11
+
12
+ c[:reload_classes] = true
13
+ c[:reload_time] = 0.5
14
+ c[:ignore_tampered_cookies] = true
15
+ c[:log_auto_flush ] = true
16
+ c[:log_level] = :error
17
+ c[:log_stream] = STDOUT
18
+ c[:log_file] = nil
19
+ end
20
+
21
+ Merb.push_path(:controller, File.dirname(__FILE__))
22
+ Merb.push_path(:router, File.dirname(__FILE__), "router.rb")
23
+ Merb.push_path(:public, Merb.root, nil)
24
+ Merb.push_path(:stylesheet, Merb.root / "stylesheets", nil)
25
+ Merb.push_path(:javascript, Merb.root / "javascripts", nil)
26
+ Merb.push_path(:image, Merb.root / "images", nil)
27
+ Merb.push_path(:view, Merb.root)
28
+ Merb.push_path(:helper, Merb.root / "helpers")
29
+
30
+ Merb::Plugins.config[:sass][:css_location] = Merb.dir_for(:stylesheet)
31
+ Merb::Plugins.config[:sass][:template_location] = Merb.dir_for(:stylesheet) / "sass"
@@ -0,0 +1,3 @@
1
+ Merb::Router.prepare do
2
+ match(/(.*)/).to(:controller => 'site', :action => 'index')
3
+ end
data/lib/merb/site.rb ADDED
@@ -0,0 +1,41 @@
1
+ # Intercept all requests
2
+ class Site < ::Merb::Controller
3
+ def index
4
+ render :template => File.join("pages", current_page)
5
+ end
6
+
7
+ override! :partial
8
+ def partial(template, opts={})
9
+ super(File.join("pages", template.to_s), opts)
10
+ end
11
+
12
+ override! :asset_path
13
+ def asset_path(*args)
14
+ relative_path(super)
15
+ end
16
+
17
+ override! :image_tag
18
+ def image_tag(img, opts={})
19
+ super(img, opts.merge(:path => relative_path('/images/')))
20
+ end
21
+
22
+ override! :link_to
23
+ def link_to(name, url='', opts={})
24
+ absolute_path = (opts[:href] || url)
25
+ absolute_path = "/" + absolute_path if absolute_path.length > 0
26
+ super(name, url, opts.merge(:href => relative_path(absolute_path)))
27
+ end
28
+
29
+ protected
30
+ def current_page
31
+ path = request.uri
32
+ path << "index.html" if path[path.length-1,1] == '/'
33
+ path[1..request.uri.length]
34
+ end
35
+
36
+ private
37
+ def relative_path(absolute_path)
38
+ depth = current_page.split('/').length - 1
39
+ absolute_path.gsub(/^\//, "../" * depth)
40
+ end
41
+ end
@@ -1,5 +1,7 @@
1
1
  # Add helpers to use in your templates here
2
2
  #
3
3
  # For best results, create seperate helpers for different reponsibilities
4
- module SiteHelper
4
+ module Merb
5
+ module SiteHelper
6
+ end
5
7
  end
@@ -3,4 +3,4 @@
3
3
  %title StaticMatic!
4
4
 
5
5
  %body
6
- = yield
6
+ = catch_content :for_layout
File without changes
data/spec/builder_spec.rb CHANGED
@@ -1,29 +1,44 @@
1
- require File.join(File.dirname(__FILE__), "..", "lib", "staticmatic")
1
+ require 'fileutils'
2
2
 
3
- describe StaticMatic::Builder do
4
- before :each do
5
- @root_dir = File.expand_path(File.join(File.dirname(__FILE__), "fixtures", "builder-test"))
6
- @init_cmd = File.expand_path(File.join(File.dirname(__FILE__), "..", "bin", "sm-init"))
7
- @build_cmd = File.expand_path(File.join(File.dirname(__FILE__), "..", "bin", "sm-build"))
8
-
9
- `cd #{File.dirname(@root_dir)} && #{@init_cmd} #{File.basename(@root_dir)}`
3
+ describe "Builder" do
4
+ def project_file(*parts)
5
+ File.expand_path(File.join(File.dirname(__FILE__), "..", *parts))
6
+ end
7
+
8
+ before :all do
9
+ @root_dir = project_file("spec", "fixtures", "sample")
10
+ end
11
+
12
+ before :each do
13
+ build_cmd = project_file("bin", "sm-build")
14
+ `cd #{@root_dir} && #{build_cmd}`
10
15
  end
11
16
 
12
17
  after :each do
13
- FileUtils.rm_rf(@root_dir)
18
+ FileUtils.rm_rf(File.join(@root_dir, "build"))
14
19
  end
15
20
 
16
21
  it "should build normal files" do
17
- `cd #{@root_dir} && #{@build_cmd}`
18
- File.exists?("#{@root_dir}/build/index.html").should_not be_false
22
+ File.exists?("#{@root_dir}/build/index.html").should be_true
23
+ end
24
+
25
+ it "should build static files" do
26
+ File.exists?("#{@root_dir}/build/static.html").should be_true
27
+ end
28
+
29
+ it "should build subdirectory files" do
30
+ File.exists?("#{@root_dir}/build/services/index.html").should be_true
31
+ end
32
+
33
+ it "should build sass files" do
34
+ File.exists?("#{@root_dir}/build/stylesheets/site.css").should be_true
35
+ end
36
+
37
+ it "should build static css files" do
38
+ File.exists?("#{@root_dir}/build/stylesheets/static.css").should be_true
19
39
  end
20
40
 
21
41
  it "should not build partial files" do
22
- File.open("#{@root_dir}/pages/_partial.html.erb", "w") do |f|
23
- f.puts "Test"
24
- end
25
-
26
- `cd #{@root_dir} && #{@build_cmd}`
27
42
  File.exists?("#{@root_dir}/build/_partial.html").should be_false
28
43
  end
29
44
  end
@@ -1,5 +1,7 @@
1
- module SpeechHelper
2
- def say(text)
3
- "You said: #{text}"
1
+ module Merb
2
+ module SpeechHelper
3
+ def say(text)
4
+ "You said: #{text}"
5
+ end
4
6
  end
5
7
  end
@@ -1 +1 @@
1
- <%= render(:partial => "pages/form") %>
1
+ <%= partial "./form" %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdreyno-staticmatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Bartholomew
@@ -10,62 +10,44 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-05 00:00:00 -08:00
13
+ date: 2008-12-18 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: mongrel
17
+ name: templater
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 0.5.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: rubyzip
26
+ name: merb-core
27
27
  version_requirement:
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: "0"
32
+ version: 1.0.0
33
33
  version:
34
34
  - !ruby/object:Gem::Dependency
35
- name: templater
35
+ name: merb-haml
36
36
  version_requirement:
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.3.5
41
+ version: 1.0.0
42
42
  version:
43
43
  - !ruby/object:Gem::Dependency
44
- name: haml
44
+ name: merb-assets
45
45
  version_requirement:
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 2.0.1
51
- version:
52
- - !ruby/object:Gem::Dependency
53
- name: actionpack
54
- version_requirement:
55
- version_requirements: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "="
58
- - !ruby/object:Gem::Version
59
- version: 2.1.2
60
- version:
61
- - !ruby/object:Gem::Dependency
62
- name: activesupport
63
- version_requirement:
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "="
67
- - !ruby/object:Gem::Version
68
- version: 2.1.2
50
+ version: 1.0.0
69
51
  version:
70
52
  description:
71
53
  email: tdreyno@gmail.com
@@ -82,42 +64,17 @@ files:
82
64
  - bin/sm-init
83
65
  - bin/sm-build
84
66
  - bin/sm-server
85
- - lib/staticmatic.rb
86
- - lib/staticmatic/autoload.rb
87
- - lib/staticmatic/base.rb
88
- - lib/staticmatic/builder.rb
89
- - lib/staticmatic/builder/html.rb
90
- - lib/staticmatic/builder/dotnet.rb
91
- - lib/staticmatic/config.rb
92
- - lib/staticmatic/deprecation.rb
93
- - lib/staticmatic/generator.rb
94
- - lib/staticmatic/previewer.rb
95
- - lib/staticmatic/template.rb
96
- - lib/staticmatic/actionpack_support/mime.rb
97
- - lib/staticmatic/actionpack_support/remove_partial_benchmark.rb
98
- - lib/staticmatic/actionpack_support/remove_controller_caching.rb
99
- - lib/staticmatic/helpers/asset_tag_helper.rb
100
- - lib/staticmatic/helpers/page_helper.rb
101
- - lib/staticmatic/helpers/url_helper.rb
102
- - lib/staticmatic/template_handlers/haml.rb
103
- - lib/staticmatic/template_handlers/liquid.rb
104
- - lib/staticmatic/template_handlers/markdown.rb
105
- - lib/staticmatic/template_handlers/sass.rb
106
- - lib/staticmatic/template_handlers/textile.rb
107
- - lib/staticmatic/templates/rescues/default_error.html.erb
108
- - lib/staticmatic/templates/rescues/template_error.html.erb
109
- - lib/templates/helpers/site_helper.rb
110
- - lib/templates/layouts/site.html.haml
111
- - lib/templates/pages/index.html.haml
112
- - lib/templates/stylesheets/site.css.sass
113
- - spec/action_view_helpers_spec.rb
114
- - spec/asset_helpers_spec.rb
67
+ - lib/builder.rb
68
+ - lib/generator.rb
69
+ - lib/merb/init.rb
70
+ - lib/merb/router.rb
71
+ - lib/merb/site.rb
72
+ - lib/template/helpers/site_helper.rb
73
+ - lib/template/layout/site.html.haml
74
+ - lib/template/pages/index.html.haml
75
+ - lib/template/stylesheets/sass/site.sass
115
76
  - spec/base_spec.rb
116
77
  - spec/builder_spec.rb
117
- - spec/config_spec.rb
118
- - spec/deprecation_spec.rb
119
- - spec/layouts_spec.rb
120
- - spec/rendering_spec.rb
121
78
  - spec/fixtures/sample/build/haml_test.html
122
79
  - spec/fixtures/sample/build/hello_world.html
123
80
  - spec/fixtures/sample/build/index.html
@@ -126,8 +83,8 @@ files:
126
83
  - spec/fixtures/sample/build/services/web_development.html
127
84
  - spec/fixtures/sample/build/stylesheets/site.css
128
85
  - spec/fixtures/sample/helpers/speech_helper.rb
129
- - spec/fixtures/sample/layouts/site.html.erb
130
- - spec/fixtures/sample/layouts/specified_layout.html.erb
86
+ - spec/fixtures/sample/pages/layout/site.html.erb
87
+ - spec/fixtures/sample/pages/layout/specified_layout.html.erb
131
88
  - spec/fixtures/sample/pages/_form.html.erb
132
89
  - spec/fixtures/sample/pages/haml_test.html.haml
133
90
  - spec/fixtures/sample/pages/hello_world.html.erb
@@ -135,13 +92,13 @@ files:
135
92
  - spec/fixtures/sample/pages/partial_test.html.erb
136
93
  - spec/fixtures/sample/pages/liquid_test.html.liquid
137
94
  - spec/fixtures/sample/pages/markdown_test.html.markdown
138
- - spec/fixtures/sample/pages/page_with_error.html.haml
95
+ - spec/fixtures/sample/pages/page_with_error.html.nothaml
139
96
  - spec/fixtures/sample/pages/specify_layout.html.erb
140
97
  - spec/fixtures/sample/pages/static.html
141
98
  - spec/fixtures/sample/pages/textile_test.html.textile
142
99
  - spec/fixtures/sample/pages/services/index.html.erb
143
100
  - spec/fixtures/sample/pages/services/web_development.html.erb
144
- - spec/fixtures/sample/stylesheets/site.css.sass
101
+ - spec/fixtures/sample/stylesheets/sass/site.sass
145
102
  has_rdoc: false
146
103
  homepage: http://github.com/tdreyno/staticmatic
147
104
  post_install_message:
@@ -169,14 +126,8 @@ signing_key:
169
126
  specification_version: 2
170
127
  summary: Static sites, the Rails Way
171
128
  test_files:
172
- - spec/action_view_helpers_spec.rb
173
- - spec/asset_helpers_spec.rb
174
129
  - spec/base_spec.rb
175
130
  - spec/builder_spec.rb
176
- - spec/config_spec.rb
177
- - spec/deprecation_spec.rb
178
- - spec/layouts_spec.rb
179
- - spec/rendering_spec.rb
180
131
  - spec/fixtures/sample/build/haml_test.html
181
132
  - spec/fixtures/sample/build/hello_world.html
182
133
  - spec/fixtures/sample/build/index.html
@@ -185,8 +136,8 @@ test_files:
185
136
  - spec/fixtures/sample/build/services/web_development.html
186
137
  - spec/fixtures/sample/build/stylesheets/site.css
187
138
  - spec/fixtures/sample/helpers/speech_helper.rb
188
- - spec/fixtures/sample/layouts/site.html.erb
189
- - spec/fixtures/sample/layouts/specified_layout.html.erb
139
+ - spec/fixtures/sample/pages/layout/site.html.erb
140
+ - spec/fixtures/sample/pages/layout/specified_layout.html.erb
190
141
  - spec/fixtures/sample/pages/_form.html.erb
191
142
  - spec/fixtures/sample/pages/haml_test.html.haml
192
143
  - spec/fixtures/sample/pages/hello_world.html.erb
@@ -194,10 +145,10 @@ test_files:
194
145
  - spec/fixtures/sample/pages/partial_test.html.erb
195
146
  - spec/fixtures/sample/pages/liquid_test.html.liquid
196
147
  - spec/fixtures/sample/pages/markdown_test.html.markdown
197
- - spec/fixtures/sample/pages/page_with_error.html.haml
148
+ - spec/fixtures/sample/pages/page_with_error.html.nothaml
198
149
  - spec/fixtures/sample/pages/specify_layout.html.erb
199
150
  - spec/fixtures/sample/pages/static.html
200
151
  - spec/fixtures/sample/pages/textile_test.html.textile
201
152
  - spec/fixtures/sample/pages/services/index.html.erb
202
153
  - spec/fixtures/sample/pages/services/web_development.html.erb
203
- - spec/fixtures/sample/stylesheets/site.css.sass
154
+ - spec/fixtures/sample/stylesheets/sass/site.sass
@@ -1,5 +0,0 @@
1
- module Mime
2
- CSS = "text/css"
3
- HTML = "text/html"
4
- JS = "text/javascript"
5
- end
@@ -1,7 +0,0 @@
1
- module ActionController
2
- class Base
3
- def self.perform_caching
4
- false
5
- end
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- # Remove ActionController::Base.benchmark call
2
- class ActionView::PartialTemplate
3
- def render
4
- @handler.render(self)
5
- end
6
- end
@@ -1,18 +0,0 @@
1
- module StaticMatic
2
- autoload :Base, File.join(File.dirname(__FILE__), 'base')
3
- autoload :Template, File.join(File.dirname(__FILE__), 'template')
4
- autoload :Config, File.join(File.dirname(__FILE__), 'config')
5
- autoload :Builder, File.join(File.dirname(__FILE__), 'builder')
6
- autoload :Generator, File.join(File.dirname(__FILE__), 'generator')
7
- autoload :Deprecation, File.join(File.dirname(__FILE__), 'deprecation')
8
- autoload :Previewer, File.join(File.dirname(__FILE__), 'previewer')
9
-
10
- module Helpers
11
- autoload :AssetTagHelper, File.join(File.dirname(__FILE__), 'helpers', 'asset_tag_helper')
12
- autoload :PageHelper, File.join(File.dirname(__FILE__), 'helpers', 'page_helper')
13
- autoload :UrlHelper, File.join(File.dirname(__FILE__), 'helpers', 'url_helper')
14
- end
15
-
16
- module TemplateHandlers
17
- end
18
- end
@@ -1,77 +0,0 @@
1
- module StaticMatic
2
- class Base
3
- include StaticMatic::Deprecation
4
-
5
- attr_accessor :logger, :root_dir, :build_dir, :extentions, :guard
6
-
7
- def initialize(root_dir)
8
- @root_dir = root_dir
9
- @build_dir = File.join(@root_dir, "build")
10
- @guard = Mutex.new
11
-
12
- # Setup logger
13
- @logger = Logger.new(STDERR)
14
- @logger.level = Logger::INFO
15
-
16
- # User config
17
- StaticMatic::Config.setup
18
- config_file = File.join(@root_dir, "config.rb")
19
- require config_file if File.exists? config_file
20
-
21
- @extentions = ActionView::Template.template_handler_extensions.map { |ext| ext.to_s }
22
- end
23
-
24
- def helpers
25
- Dir[File.join(@root_dir, 'helpers', '**', '*_helper.rb')]
26
- end
27
-
28
- def layouts
29
- @layouts ||= Dir[File.join(@root_dir, "layouts", "*")].select do |path|
30
- !File.directory?(path)
31
- end.map do |path|
32
- File.basename(path)
33
- end
34
- end
35
-
36
- def template(filename)
37
- filename = full_template_path(filename)
38
- @templates ||= {}
39
- @templates[filename] ||= Template.new(filename, self)
40
- end
41
-
42
- def pages
43
- @pages ||= Dir[File.join(@root_dir, "pages", "**/*")].select do |path|
44
- !File.directory?(path) && File.basename(path) !~ /^_/
45
- end.map do |path|
46
- path.gsub("#{@root_dir}/", "")
47
- end.partition do |relative_path|
48
- can_render?(relative_path)
49
- end
50
- end
51
-
52
- # Aliases
53
- def dynamic_pages; pages.first; end
54
- def static_pages; pages.last; end
55
-
56
- # Delegate to Template class
57
- def render(filename); template(filename).render; end
58
- def rendered_ext(filename); template(filename).rendered_ext; end
59
- def can_render?(filename)
60
- return false if filename =~ /images\/|javascripts\//
61
- template(filename).can_render?
62
- end
63
-
64
- protected
65
- # Full path to a template, relative to src/
66
- def full_template_path(template)
67
- template = template.gsub("#{@root_dir}/", '')
68
- directory = template.match(/^(\/)?(layouts|stylesheets|pages)/) ? "" : "pages"
69
- template = File.join(directory, template) unless directory.empty?
70
-
71
- path = File.join(File.expand_path(@root_dir), template)
72
- template = File.join(template, "index") if File.directory? path
73
-
74
- template
75
- end
76
- end
77
- end