sinatra-effigy 0.0.3 → 0.0.4
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/sinatra-effigy.gemspec +2 -87
- metadata +2 -88
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'jeweler'
|
|
3
3
|
Jeweler::Tasks.new do |gem|
|
4
4
|
gem.name = "sinatra-effigy"
|
5
5
|
gem.summary = "An Effigy extenstion for Sinatra."
|
6
|
-
gem.description =
|
6
|
+
gem.description = "Ruby in .rb files. HTML in .html files."
|
7
7
|
gem.email = "dcroak@thoughtbot.com"
|
8
8
|
gem.homepage = "http://github.com/dancroak/sinatra-effigy"
|
9
9
|
gem.authors = ["Dan Croak"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/sinatra-effigy.gemspec
CHANGED
@@ -5,97 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-effigy}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Croak"]
|
12
12
|
s.date = %q{2010-01-12}
|
13
|
-
s.description = %q{
|
14
|
-
==============
|
15
|
-
|
16
|
-
An Effigy extension for Sinatra.
|
17
|
-
|
18
|
-
Why?
|
19
|
-
----
|
20
|
-
|
21
|
-
* HTML should be in .html files. Ruby should be in .rb files.
|
22
|
-
* Effigy follows the jQuery API - just replace $() with f().
|
23
|
-
* Effigy has 100% test coverage and 0 Reek smells.
|
24
|
-
|
25
|
-
Usage
|
26
|
-
-----
|
27
|
-
|
28
|
-
Install the gem:
|
29
|
-
|
30
|
-
sudo gem install sinatra-effigy
|
31
|
-
|
32
|
-
Create your Sinatra app:
|
33
|
-
|
34
|
-
require 'rubygems'
|
35
|
-
require 'sinatra'
|
36
|
-
require 'sinatra/effigy'
|
37
|
-
|
38
|
-
get '/jobs/:id' do |id|
|
39
|
-
effigy :job, Job.find(id)
|
40
|
-
end
|
41
|
-
|
42
|
-
Create your template (fresh from a designer?) at /templates/job.html:
|
43
|
-
|
44
|
-
<!DOCTYPE html>
|
45
|
-
<html>
|
46
|
-
<head>
|
47
|
-
<title>Web Designer at thoughtbot</title>
|
48
|
-
</head>
|
49
|
-
<body>
|
50
|
-
<h1>Web Designer</h1>
|
51
|
-
<h2><a href="http://example.com">thoughtbot</a></h2>
|
52
|
-
<h3>Boston or New York</h3>
|
53
|
-
|
54
|
-
<div id="description">
|
55
|
-
<p>Graphic design, typography, CSS, HTML.</p>
|
56
|
-
</div>
|
57
|
-
|
58
|
-
<h3>Apply</h3>
|
59
|
-
<p>Please contact <span id="apply-at">jobs@example.com</span>.</p>
|
60
|
-
</body>
|
61
|
-
</html>
|
62
|
-
|
63
|
-
Create a view at /views/job.rb that responds to #transform:
|
64
|
-
|
65
|
-
class JobView < Effigy::View
|
66
|
-
attr_reader :job
|
67
|
-
|
68
|
-
def initialize(*locals)
|
69
|
-
@job = locals.first
|
70
|
-
end
|
71
|
-
|
72
|
-
def transform
|
73
|
-
f('title').text("#{job.position} at #{job.company}")
|
74
|
-
f('h1').text(job.position)
|
75
|
-
f('h2 a').attr(:href => job.company_url).
|
76
|
-
text(job.company)
|
77
|
-
f('#description').html(job.description)
|
78
|
-
f('#apply-at').text(job.apply_at)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
Conventions
|
83
|
-
-----------
|
84
|
-
|
85
|
-
Assumes matching Ruby files at views/ and HTML files at templates/.
|
86
|
-
|
87
|
-
Use a string if you need directories:
|
88
|
-
|
89
|
-
get '/jobs/edit/:id' do |id|
|
90
|
-
effigy 'jobs/edit', Job.find(id)
|
91
|
-
end
|
92
|
-
|
93
|
-
Resources
|
94
|
-
---------
|
95
|
-
|
96
|
-
* [Effigy](http://github.com/jferris/effigy)
|
97
|
-
* [Sinatra](http://sinatrarb.com)
|
98
|
-
}
|
13
|
+
s.description = %q{Ruby in .rb files. HTML in .html files.}
|
99
14
|
s.email = %q{dcroak@thoughtbot.com}
|
100
15
|
s.extra_rdoc_files = [
|
101
16
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-effigy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
@@ -22,93 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
description:
|
26
|
-
Sinatra Effigy
|
27
|
-
==============
|
28
|
-
|
29
|
-
An Effigy extension for Sinatra.
|
30
|
-
|
31
|
-
Why?
|
32
|
-
----
|
33
|
-
|
34
|
-
* HTML should be in .html files. Ruby should be in .rb files.
|
35
|
-
* Effigy follows the jQuery API - just replace $() with f().
|
36
|
-
* Effigy has 100% test coverage and 0 Reek smells.
|
37
|
-
|
38
|
-
Usage
|
39
|
-
-----
|
40
|
-
|
41
|
-
Install the gem:
|
42
|
-
|
43
|
-
sudo gem install sinatra-effigy
|
44
|
-
|
45
|
-
Create your Sinatra app:
|
46
|
-
|
47
|
-
require 'rubygems'
|
48
|
-
require 'sinatra'
|
49
|
-
require 'sinatra/effigy'
|
50
|
-
|
51
|
-
get '/jobs/:id' do |id|
|
52
|
-
effigy :job, Job.find(id)
|
53
|
-
end
|
54
|
-
|
55
|
-
Create your template (fresh from a designer?) at /templates/job.html:
|
56
|
-
|
57
|
-
<!DOCTYPE html>
|
58
|
-
<html>
|
59
|
-
<head>
|
60
|
-
<title>Web Designer at thoughtbot</title>
|
61
|
-
</head>
|
62
|
-
<body>
|
63
|
-
<h1>Web Designer</h1>
|
64
|
-
<h2><a href="http://example.com">thoughtbot</a></h2>
|
65
|
-
<h3>Boston or New York</h3>
|
66
|
-
|
67
|
-
<div id="description">
|
68
|
-
<p>Graphic design, typography, CSS, HTML.</p>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<h3>Apply</h3>
|
72
|
-
<p>Please contact <span id="apply-at">jobs@example.com</span>.</p>
|
73
|
-
</body>
|
74
|
-
</html>
|
75
|
-
|
76
|
-
Create a view at /views/job.rb that responds to #transform:
|
77
|
-
|
78
|
-
class JobView < Effigy::View
|
79
|
-
attr_reader :job
|
80
|
-
|
81
|
-
def initialize(*locals)
|
82
|
-
@job = locals.first
|
83
|
-
end
|
84
|
-
|
85
|
-
def transform
|
86
|
-
f('title').text("#{job.position} at #{job.company}")
|
87
|
-
f('h1').text(job.position)
|
88
|
-
f('h2 a').attr(:href => job.company_url).
|
89
|
-
text(job.company)
|
90
|
-
f('#description').html(job.description)
|
91
|
-
f('#apply-at').text(job.apply_at)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
Conventions
|
96
|
-
-----------
|
97
|
-
|
98
|
-
Assumes matching Ruby files at views/ and HTML files at templates/.
|
99
|
-
|
100
|
-
Use a string if you need directories:
|
101
|
-
|
102
|
-
get '/jobs/edit/:id' do |id|
|
103
|
-
effigy 'jobs/edit', Job.find(id)
|
104
|
-
end
|
105
|
-
|
106
|
-
Resources
|
107
|
-
---------
|
108
|
-
|
109
|
-
* [Effigy](http://github.com/jferris/effigy)
|
110
|
-
* [Sinatra](http://sinatrarb.com)
|
111
|
-
|
25
|
+
description: Ruby in .rb files. HTML in .html files.
|
112
26
|
email: dcroak@thoughtbot.com
|
113
27
|
executables: []
|
114
28
|
|