dynamicmatic 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -61,8 +61,10 @@ StaticMatic is configured using `src/configuration.rb`.
61
61
  Sinatra is configured using the `set` method.
62
62
  In other words, configuration happens as usual.
63
63
 
64
- DynamicMatic itself is configured in the Sinatra manner, with `set`.
65
- Currently it only has one option:
64
+ ## Preview
66
65
 
67
- * `compile_on_start`: Whether to compile the StaticMatic site
68
- when the Sinatra app is started.
66
+ When you run your app in development mode,
67
+ your static pages are actually generated dynamically on each request,
68
+ just like with `staticmatic preview`.
69
+ Once you're in production, though,
70
+ they're all served swiftly from the `site` folder.
data/Rakefile CHANGED
@@ -11,8 +11,8 @@ DESCRIPTION
11
11
  gemspec.email = "nex342@gmail.com"
12
12
  gemspec.homepage = "http://github.com/nex3/dynamicmatic"
13
13
  gemspec.authors = ["Nathan Weizenbaum"]
14
- #gemspec.add_dependency 'sinatra', '>= 0.10.1'
15
- #gemspec.add_dependency 'staticmatic', '>= 0.10.1'
14
+ gemspec.add_dependency 'sinatra', '>= 0.10.1'
15
+ gemspec.add_dependency 'staticmatic', '>= 0.10.7'
16
16
  gemspec.has_rdoc = false
17
17
  end
18
18
  Jeweler::GemcutterTasks.new
@@ -1,4 +1,5 @@
1
1
  ---
2
+ :minor: 1
3
+ :patch: 0
4
+ :build:
2
5
  :major: 0
3
- :minor: 0
4
- :patch: 3
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dynamicmatic}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Weizenbaum"]
12
- s.date = %q{2009-11-11}
12
+ s.date = %q{2009-11-23}
13
13
  s.description = %q{DynamicMatic is a tiny Sinatra extension that integrates Sinatra with StaticMatic.
14
14
  It allows most of your site to be static
15
15
  while having a few dynamic pages that can use the StaticMatic layouts and partials.
@@ -25,8 +25,10 @@ while having a few dynamic pages that can use the StaticMatic layouts and partia
25
25
  "Rakefile",
26
26
  "VERSION.yml",
27
27
  "dynamicmatic.gemspec",
28
- "lib/sinatra/dynamicmatic.rb"
28
+ "lib/sinatra/dynamicmatic.rb",
29
+ "lib/sinatra/dynamicmatic/middleware.rb"
29
30
  ]
31
+ s.has_rdoc = false
30
32
  s.homepage = %q{http://github.com/nex3/dynamicmatic}
31
33
  s.rdoc_options = ["--charset=UTF-8"]
32
34
  s.require_paths = ["lib"]
@@ -38,8 +40,15 @@ while having a few dynamic pages that can use the StaticMatic layouts and partia
38
40
  s.specification_version = 3
39
41
 
40
42
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
43
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.10.1"])
44
+ s.add_runtime_dependency(%q<staticmatic>, [">= 0.10.7"])
41
45
  else
46
+ s.add_dependency(%q<sinatra>, [">= 0.10.1"])
47
+ s.add_dependency(%q<staticmatic>, [">= 0.10.7"])
42
48
  end
43
49
  else
50
+ s.add_dependency(%q<sinatra>, [">= 0.10.1"])
51
+ s.add_dependency(%q<staticmatic>, [">= 0.10.7"])
44
52
  end
45
53
  end
54
+
@@ -1,5 +1,6 @@
1
1
  require 'sinatra/base'
2
2
  require 'staticmatic'
3
+ require File.dirname(__FILE__) + '/dynamicmatic/middleware'
3
4
 
4
5
  module Sinatra
5
6
  module DynamicMatic
@@ -7,6 +8,10 @@ module Sinatra
7
8
  app.set :lock, true
8
9
  app.set :public, Proc.new {app.root && File.join(app.root, 'site')}
9
10
 
11
+ # If we're in development, don't serve the StaticMatic files statically.
12
+ # Instead, render them dynamically, as with `staticmatic preview`.
13
+ app.use Middleware if app.environment == :development
14
+
10
15
  configuration = StaticMatic::Configuration.new
11
16
 
12
17
  config_file = "#{app.root}/src/configuration.rb"
@@ -0,0 +1,14 @@
1
+ module Sinatra
2
+ module DynamicMatic
3
+ class Middleware
4
+ def initialize(app)
5
+ @app = app
6
+ @server = StaticMatic::Server.new(app.send(:staticmatic), @app)
7
+ end
8
+
9
+ def call(env)
10
+ @server.call(env)
11
+ end
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamicmatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-11 00:00:00 -05:00
12
+ date: 2009-11-23 00:00:00 -08:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.10.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: staticmatic
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.7
34
+ version:
16
35
  description: |
17
36
  DynamicMatic is a tiny Sinatra extension that integrates Sinatra with StaticMatic.
18
37
  It allows most of your site to be static
@@ -33,7 +52,8 @@ files:
33
52
  - VERSION.yml
34
53
  - dynamicmatic.gemspec
35
54
  - lib/sinatra/dynamicmatic.rb
36
- has_rdoc: true
55
+ - lib/sinatra/dynamicmatic/middleware.rb
56
+ has_rdoc: false
37
57
  homepage: http://github.com/nex3/dynamicmatic
38
58
  licenses: []
39
59