rid 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -4
- data/lib/rid/generators/application/application_generator.rb +1 -0
- data/lib/rid/generators/application/templates/lib/path.js +5 -0
- data/lib/rid/generators/application/templates/lib/templates/layout.mustache +1 -1
- data/lib/rid/generators/list/USAGE +4 -4
- data/lib/rid/generators/list/templates/index.mustache +4 -1
- data/lib/rid/generators/list/templates/list.js +3 -0
- data/lib/rid/generators/scaffold/scaffold_generator.rb +4 -0
- data/lib/rid/generators/show/USAGE +3 -3
- data/lib/rid/generators/show/show_generator.rb +1 -0
- data/lib/rid/generators/show/templates/form.mustache +14 -0
- data/lib/rid/generators/show/templates/show.js +20 -3
- data/lib/rid/generators/show/templates/show.mustache +3 -1
- data/lib/rid/generators/update/USAGE +8 -0
- data/lib/rid/generators/update/templates/update.js +29 -0
- data/lib/rid/generators/update/update_generator.rb +9 -0
- data/lib/rid/version.rb +1 -1
- data/rid.gemspec +7 -2
- metadata +8 -3
data/README.rdoc
CHANGED
@@ -34,11 +34,10 @@ Building standalone Couchdb applications according to correct principles affords
|
|
34
34
|
At the moment, Rid supports generating a scaffold application, pushing to a Couchdb server and pulling from a Couchdb.
|
35
35
|
Rid injects the !code and !json makros introduced by CouchApp.
|
36
36
|
|
37
|
-
The next
|
37
|
+
The very next steps are:
|
38
|
+
|
39
|
+
* add support for edit and delete
|
38
40
|
|
39
|
-
* make use of mustache.js in generators
|
40
|
-
* build a lightweight Javascript library to assist client side Javascript work
|
41
|
-
* enhance generators to build a full flavored scaffold with all CRUD operations
|
42
41
|
|
43
42
|
== I need your help!
|
44
43
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
5
5
|
<title><%= app_title %>: {{title}}</title>
|
6
|
-
<link rel="stylesheet" href="
|
6
|
+
<link rel="stylesheet" href="{{path}}/stylesheets/application.css" type="text/css" media="screen" charset="utf-8">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<h1><%= app_title %></h1>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Description:
|
2
|
-
The '
|
3
|
-
for the name you specify
|
2
|
+
The 'list' generator creates a scaffold list function
|
3
|
+
for the name and attributes you specify
|
4
4
|
|
5
5
|
Example:
|
6
|
-
rid generate
|
6
|
+
rid generate list post title body
|
7
7
|
|
8
|
-
This generates a skeletal
|
8
|
+
This generates a skeletal posts list function
|
@@ -1,5 +1,7 @@
|
|
1
|
+
<p><a href="{{path}}/_show/<%= model_name %>/">New <%= model_name.humanize %></a></p>
|
1
2
|
<table>
|
2
3
|
<tr>
|
4
|
+
<th>ID</th>
|
3
5
|
<% attributes.each do |attribute| -%>
|
4
6
|
<th><%= attribute.humanize %></th>
|
5
7
|
<% end -%>
|
@@ -7,10 +9,11 @@
|
|
7
9
|
</tr>
|
8
10
|
{{#rows}}
|
9
11
|
<tr>
|
12
|
+
<td>{{id}}</td>
|
10
13
|
<% attributes.each do |attribute| -%>
|
11
14
|
<td>{{<%= attribute %>}}</td>
|
12
15
|
<% end -%>
|
13
|
-
<td><a href="
|
16
|
+
<td><a href="{{path}}/_show/<%= model_name %>/{{id}}">Show <%= model_name.humanize %></a></td>
|
14
17
|
</tr>
|
15
18
|
{{/rows}}
|
16
19
|
</table>
|
@@ -1,12 +1,15 @@
|
|
1
1
|
function(head, req) {
|
2
|
+
// !code path.js
|
2
3
|
// !code mustache.js
|
3
4
|
// !json templates/layout.mustache
|
4
5
|
// !json templates/<%= pluralized_model_name %>/index.mustache
|
5
6
|
|
6
7
|
provides("html", function() {
|
7
8
|
var view = {
|
9
|
+
path: path(),
|
8
10
|
title: "Listing <%= pluralized_model_name.humanize %>",
|
9
11
|
body: {
|
12
|
+
path: path(),
|
10
13
|
rows: function() {
|
11
14
|
var rows = [];
|
12
15
|
var row;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Description:
|
2
2
|
The 'show' generator creates a scaffold show function
|
3
|
-
for the name you specify
|
3
|
+
for the name and attributes you specify
|
4
4
|
|
5
5
|
Example:
|
6
|
-
rid generate show post
|
6
|
+
rid generate show post title body
|
7
7
|
|
8
|
-
This generates a skeletal post show function
|
8
|
+
This generates a skeletal post show function with title and body
|
@@ -5,6 +5,7 @@ module Rid::Generators
|
|
5
5
|
def create_show_function
|
6
6
|
template "show.js", "shows/#{model_name}.js"
|
7
7
|
template "show.mustache", "lib/templates/#{pluralized_model_name}/show.mustache"
|
8
|
+
template "form.mustache", "lib/templates/#{pluralized_model_name}/form.mustache"
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p><a href="{{path}}/_list/<%= pluralized_model_name %>/<%= pluralized_model_name %>">List <%= pluralized_model_name.humanize %></a></p>
|
2
|
+
<form action="{{path}}/_update/<%= pluralized_model_name %>" method="post" accept-charset="utf-8">
|
3
|
+
<p>
|
4
|
+
<label for="id">ID</label><br/>
|
5
|
+
<input type="text" name="id" value="{{id}}" id="id" />
|
6
|
+
</p>
|
7
|
+
<% attributes.each do |attribute| -%>
|
8
|
+
<p>
|
9
|
+
<label for="<%= attribute %>"><%= attribute.humanize %></label><br/>
|
10
|
+
<input type="text" name="<%= attribute %>" value="{{<%= attribute %>}}" id="<%= attribute %>" />
|
11
|
+
</p>
|
12
|
+
<% end -%>
|
13
|
+
<p><input type="submit" value="Create <%= model_name.humanize %>"></p>
|
14
|
+
</form>
|
@@ -1,15 +1,20 @@
|
|
1
1
|
function(doc, req) {
|
2
|
+
// !code path.js
|
2
3
|
// !code mustache.js
|
3
4
|
// !json templates/layout.mustache
|
4
5
|
// !json templates/<%= pluralized_model_name %>/show.mustache
|
6
|
+
// !json templates/<%= pluralized_model_name %>/form.mustache
|
5
7
|
|
6
8
|
if(doc) {
|
7
9
|
provides("html", function() {
|
8
10
|
var view = {
|
11
|
+
path: path(),
|
9
12
|
title: "Showing <%= model_name.humanize %>",
|
10
13
|
body: {
|
11
|
-
|
12
|
-
|
14
|
+
path: path(),
|
15
|
+
<% attributes.each do |attribute| -%>
|
16
|
+
'<%= attribute %>': doc['<%= attribute %>'],
|
17
|
+
<% end -%>
|
13
18
|
id: doc._id
|
14
19
|
}
|
15
20
|
};
|
@@ -17,6 +22,18 @@ function(doc, req) {
|
|
17
22
|
return Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.show });
|
18
23
|
});
|
19
24
|
} else {
|
20
|
-
|
25
|
+
var view = {
|
26
|
+
path: path(),
|
27
|
+
title: "New <%= model_name.humanize %>",
|
28
|
+
body: {
|
29
|
+
path: path(),
|
30
|
+
<% attributes.each do |attribute| -%>
|
31
|
+
'<%= attribute %>': '',
|
32
|
+
<% end -%>
|
33
|
+
id: ''
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
return Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.form });
|
21
38
|
}
|
22
39
|
}
|
@@ -1,5 +1,7 @@
|
|
1
|
-
<p><a href="
|
1
|
+
<p><a href="{{path}}/_list/<%= pluralized_model_name %>/<%= pluralized_model_name %>">List <%= pluralized_model_name.humanize %></a></p>
|
2
2
|
<dl>
|
3
|
+
<dt>ID</dt>
|
4
|
+
<dd>{{id}}</dd>
|
3
5
|
<% attributes.each do |attribute| -%>
|
4
6
|
<dt><%= attribute.humanize %></dt>
|
5
7
|
<dd>{{<%= attribute %>}}</dd>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
function(doc, req) {
|
2
|
+
// !code path.js
|
3
|
+
// !code mustache.js
|
4
|
+
// !json templates/layout.mustache
|
5
|
+
// !json templates/<%= pluralized_model_name %>/show.mustache
|
6
|
+
|
7
|
+
if (!doc) {
|
8
|
+
var doc = {
|
9
|
+
_id: req.form.id,
|
10
|
+
type: '<%= model_name %>',
|
11
|
+
<% attributes.each do |attribute| -%>
|
12
|
+
'<%= attribute %>': req.form['<%= attribute %>'],
|
13
|
+
<% end -%>
|
14
|
+
};
|
15
|
+
var view = {
|
16
|
+
path: path(),
|
17
|
+
title: "Created Post",
|
18
|
+
body: {
|
19
|
+
path: path(),
|
20
|
+
<% attributes.each do |attribute| -%>
|
21
|
+
'<%= attribute %>': doc['<%= attribute %>'],
|
22
|
+
<% end -%>
|
23
|
+
id: doc._id
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
return [doc, Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.show })];
|
28
|
+
}
|
29
|
+
}
|
data/lib/rid/version.rb
CHANGED
data/rid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rid}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Johannes J. Schmidt"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-14}
|
13
13
|
s.default_executable = %q{rid}
|
14
14
|
s.description = %q{With Couch you can easy build a standalone CouchDB application. Couch aims to bring some of the Rails beauty to CouchDB. Currently Couch supports Rails style Generators you will love, using the same awesome Thor library used in Rails3.}
|
15
15
|
s.email = %q{schmidt@netzmerk.com}
|
@@ -48,6 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
"lib/rid/generators/application/templates/_id",
|
49
49
|
"lib/rid/generators/application/templates/gitignore",
|
50
50
|
"lib/rid/generators/application/templates/lib/mustache.js",
|
51
|
+
"lib/rid/generators/application/templates/lib/path.js",
|
51
52
|
"lib/rid/generators/application/templates/lib/templates/layout.mustache",
|
52
53
|
"lib/rid/generators/application/templates/ridrc",
|
53
54
|
"lib/rid/generators/application/templates/validate_doc_update.js",
|
@@ -61,8 +62,12 @@ Gem::Specification.new do |s|
|
|
61
62
|
"lib/rid/generators/scaffold/scaffold_generator.rb",
|
62
63
|
"lib/rid/generators/show/USAGE",
|
63
64
|
"lib/rid/generators/show/show_generator.rb",
|
65
|
+
"lib/rid/generators/show/templates/form.mustache",
|
64
66
|
"lib/rid/generators/show/templates/show.js",
|
65
67
|
"lib/rid/generators/show/templates/show.mustache",
|
68
|
+
"lib/rid/generators/update/USAGE",
|
69
|
+
"lib/rid/generators/update/templates/update.js",
|
70
|
+
"lib/rid/generators/update/update_generator.rb",
|
66
71
|
"lib/rid/generators/validation/USAGE",
|
67
72
|
"lib/rid/generators/validation/templates/validate_doc_update.js",
|
68
73
|
"lib/rid/generators/validation/validation_generator.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Johannes J. Schmidt
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-14 00:00:00 +01:00
|
18
18
|
default_executable: rid
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/rid/generators/application/templates/_id
|
128
128
|
- lib/rid/generators/application/templates/gitignore
|
129
129
|
- lib/rid/generators/application/templates/lib/mustache.js
|
130
|
+
- lib/rid/generators/application/templates/lib/path.js
|
130
131
|
- lib/rid/generators/application/templates/lib/templates/layout.mustache
|
131
132
|
- lib/rid/generators/application/templates/ridrc
|
132
133
|
- lib/rid/generators/application/templates/validate_doc_update.js
|
@@ -140,8 +141,12 @@ files:
|
|
140
141
|
- lib/rid/generators/scaffold/scaffold_generator.rb
|
141
142
|
- lib/rid/generators/show/USAGE
|
142
143
|
- lib/rid/generators/show/show_generator.rb
|
144
|
+
- lib/rid/generators/show/templates/form.mustache
|
143
145
|
- lib/rid/generators/show/templates/show.js
|
144
146
|
- lib/rid/generators/show/templates/show.mustache
|
147
|
+
- lib/rid/generators/update/USAGE
|
148
|
+
- lib/rid/generators/update/templates/update.js
|
149
|
+
- lib/rid/generators/update/update_generator.rb
|
145
150
|
- lib/rid/generators/validation/USAGE
|
146
151
|
- lib/rid/generators/validation/templates/validate_doc_update.js
|
147
152
|
- lib/rid/generators/validation/validation_generator.rb
|