sinatra-effigy 0.0.2 → 0.0.3

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.
Files changed (5) hide show
  1. data/README.md +13 -4
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/sinatra-effigy.gemspec +87 -2
  5. metadata +88 -2
data/README.md CHANGED
@@ -1,7 +1,14 @@
1
1
  Sinatra Effigy
2
2
  ==============
3
3
 
4
- An Effigy extension for Sinatra. HTML in .html files. Ruby in .rb files.
4
+ An Effigy extension for Sinatra.
5
+
6
+ Why?
7
+ ----
8
+
9
+ * HTML should be in .html files. Ruby should be in .rb files.
10
+ * Effigy follows the jQuery API - just replace $() with f().
11
+ * Effigy has 100% test coverage and 0 Reek smells.
5
12
 
6
13
  Usage
7
14
  -----
@@ -32,10 +39,12 @@ Create your template (fresh from a designer?) at /templates/job.html:
32
39
  <h2><a href="http://example.com">thoughtbot</a></h2>
33
40
  <h3>Boston or New York</h3>
34
41
 
35
- <p>Graphic design, typography, CSS, HTML.</p>
42
+ <div id="description">
43
+ <p>Graphic design, typography, CSS, HTML.</p>
44
+ </div>
36
45
 
37
46
  <h3>Apply</h3>
38
- <p>Please contact jobs@example.com</p>
47
+ <p>Please contact <span id="apply-at">jobs@example.com</span>.</p>
39
48
  </body>
40
49
  </html>
41
50
 
@@ -61,7 +70,7 @@ Create a view at /views/job.rb that responds to #transform:
61
70
  Conventions
62
71
  -----------
63
72
 
64
- Assumes matching files at views/*.rb and templates/*.html.
73
+ Assumes matching Ruby files at views/ and HTML files at templates/.
65
74
 
66
75
  Use a string if you need directories:
67
76
 
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 = "HTML in .html files. Ruby in .rb files."
6
+ gem.description = File.read('README.md')
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.2
1
+ 0.0.3
@@ -5,12 +5,97 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra-effigy}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
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{HTML in .html files. Ruby in .rb files.}
13
+ s.description = %q{Sinatra Effigy
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
+ }
14
99
  s.email = %q{dcroak@thoughtbot.com}
15
100
  s.extra_rdoc_files = [
16
101
  "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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -22,7 +22,93 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- description: HTML in .html files. Ruby in .rb files.
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
+
26
112
  email: dcroak@thoughtbot.com
27
113
  executables: []
28
114