laydown 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/README +18 -6
  2. data/Rakefile +1 -2
  3. data/VERSION +1 -1
  4. data/laydown.gemspec +57 -0
  5. data/lib/laydown.rb +5 -16
  6. metadata +7 -19
data/README CHANGED
@@ -14,23 +14,35 @@
14
14
  # ^
15
15
  # $ «« ^¨^ »» $
16
16
  # http://jostein.be
17
- # sample: '' ''
17
+ # '' ''
18
+ #
19
+ # Provides a simple Ruby DSL for defining HTML5 layouts
20
+ # for web apps. For those of us who has written basically
21
+ # the same html head 200 times and want to streamline it.
18
22
 
19
23
  require 'laydown'
20
24
 
21
25
  layout = Laydown.layout do
22
26
  title 'A man in a cave'
23
27
  description 'A man is sitting in a cave. What will he do?'
24
- keywords 'man, cave', @keywords
25
- favicon 'maninacave.png'
28
+ keywords 'man, cave, mystery', @keywords
29
+ favicon '/maninacave.png'
26
30
  css '/maninacave/style.css'
27
31
  css @css
28
32
  js '/maninacave/site.js'
29
33
  js @js
30
34
 
31
- body "<h1>A man in\na cave</h1>"
35
+ body @body || '<p>Empty</p>'
32
36
  end
33
37
 
34
- @css = 'somesheet.css'
35
38
 
36
- puts Layout.render(self) # => beautiful html5
39
+ @css = 'somesheet.css'
40
+ @body = '<h1>A man in a cave</h1>'
41
+
42
+ puts layout.render(self) # => beautiful html5
43
+
44
+ # Note the binding passed to render (in this case self)
45
+ # -- its instance variables are made accessible to the
46
+ # layout block.
47
+
48
+
data/Rakefile CHANGED
@@ -6,12 +6,11 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "laydown"
8
8
  gem.summary = %Q{Pure Ruby HTML5 layout DSL for microframeworks.}
9
- gem.description = %Q{Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those of us who has written basically the same html head 200 times and feels like stripping.}
9
+ gem.description = %Q{Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those of us who has written basically the same html head 200 times and feels like minimalism.}
10
10
  gem.email = "post@jostein.be"
11
11
  gem.homepage = "http://github.com/jbe/laydown"
12
12
  gem.authors = ["jbe"]
13
13
  gem.add_dependency "instant_dsl", ">= 0"
14
- gem.add_dependency "markaby", ">= 0"
15
14
  gem.add_development_dependency "tenjin", ">= 0"
16
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/laydown.gemspec ADDED
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{laydown}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["jbe"]
12
+ s.date = %q{2010-12-09}
13
+ s.description = %q{Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those of us who has written basically the same html head 200 times and feels like minimalism.}
14
+ s.email = %q{post@jostein.be}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "laydown.gemspec",
27
+ "lib/laydown.rb",
28
+ "lib/templates/default_layout.rb",
29
+ "templates/default_layout.tenjin.html",
30
+ "test/rough.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/jbe/laydown}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.7}
36
+ s.summary = %q{Pure Ruby HTML5 layout DSL for microframeworks.}
37
+ s.test_files = [
38
+ "test/rough.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<instant_dsl>, [">= 0"])
47
+ s.add_development_dependency(%q<tenjin>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<instant_dsl>, [">= 0"])
50
+ s.add_dependency(%q<tenjin>, [">= 0"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<instant_dsl>, [">= 0"])
54
+ s.add_dependency(%q<tenjin>, [">= 0"])
55
+ end
56
+ end
57
+
data/lib/laydown.rb CHANGED
@@ -28,30 +28,19 @@ module Laydown
28
28
  class Template
29
29
  def initialize(&conf)
30
30
  @conf = conf
31
+ @tpath = File.expand_path('../templates/default_layout.rb', __FILE__)
32
+ @template = IO.read(@tpath)
31
33
  end
32
34
 
33
35
  def render(source_scope=::Laydown::NoScope.new)
34
- dsl_scope = ::Laydown::DSL.new
35
- copy_instance_variables(source_scope, dsl_scope)
36
+ dsl_scope = ::Laydown::DSL.new(source_scope)
37
+
36
38
  dsl_scope.send :instance_eval, &@conf
37
39
 
38
40
  scope = ::Laydown::TemplateScope.new(dsl_scope.dsl_values)
39
-
40
- tpath = File.expand_path('../templates/default_layout.rb', __FILE__)
41
- template = IO.read(tpath)
42
-
43
- scope.send :instance_eval, template, tpath
41
+ scope.send :instance_eval, @template, @tpath
44
42
  end
45
43
 
46
- private
47
- def copy_instance_variables(a, b, destr=false)
48
- a.instance_variables.each do |name|
49
- if !b.instance_variable_defined?(name) or destr
50
- b.instance_variable_set(name, a.instance_variable_get(name))
51
- end
52
- end
53
- end
54
-
55
44
  end
56
45
 
57
46
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - jbe
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-08 00:00:00 +01:00
17
+ date: 2010-12-09 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -30,23 +30,10 @@ dependencies:
30
30
  version: "0"
31
31
  type: :runtime
32
32
  version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: markaby
35
- prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
44
- type: :runtime
45
- version_requirements: *id002
46
33
  - !ruby/object:Gem::Dependency
47
34
  name: tenjin
48
35
  prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ requirement: &id002 !ruby/object:Gem::Requirement
50
37
  none: false
51
38
  requirements:
52
39
  - - ">="
@@ -55,8 +42,8 @@ dependencies:
55
42
  - 0
56
43
  version: "0"
57
44
  type: :development
58
- version_requirements: *id003
59
- description: Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those of us who has written basically the same html head 200 times and feels like stripping.
45
+ version_requirements: *id002
46
+ description: Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those of us who has written basically the same html head 200 times and feels like minimalism.
60
47
  email: post@jostein.be
61
48
  executables: []
62
49
 
@@ -72,6 +59,7 @@ files:
72
59
  - README
73
60
  - Rakefile
74
61
  - VERSION
62
+ - laydown.gemspec
75
63
  - lib/laydown.rb
76
64
  - lib/templates/default_layout.rb
77
65
  - templates/default_layout.tenjin.html