codgen 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/.idea/codgen.iml +10 -38
- data/.idea/workspace.xml +276 -254
- data/README.md +7 -2
- data/Rakefile +8 -3
- data/codgen.gemspec +1 -1
- data/lib/codgen.rb +7 -1
- data/lib/codgen/statement.rb +15 -34
- data/lib/codgen/version.rb +1 -1
- data/test/behavior/output_spec.rb +33 -2
- data/test/data/Input-Web/CreateDatabase.sql.mustache +10 -0
- data/test/data/Input-Web/DbContextTemplate.cs.mustache +18 -0
- data/test/data/Input-Web/Map.json +36 -0
- data/test/data/Input-Web/ModelTemplate.cs.mustache +26 -0
- data/test/data/Input-Web/config.json +44 -0
- data/test/data/Input-Web/example-data.json +76 -0
- data/test/data/Input-Web/explicit_names.txt +21 -0
- data/test/data/Input-Web/hello_world.txt.mustache +1 -0
- data/test/data/Input-Web/i_can_ride_my_bike_with_no.handlebars +28 -0
- data/test/data/Input-Web/model_template.rb.mustache +8 -0
- data/test/data/Input-Web/package_test_dir/config.json +8 -0
- data/test/data/Input-Web/package_test_dir/templates/package_hello_world.txt.mustache +1 -0
- data/test/data/Input-Web/package_test_zip.zip +0 -0
- data/test/data/Input-Web/package_test_zip/config.json +8 -0
- data/test/data/Input-Web/package_test_zip/templates/package_zip_hello_world.txt.mustache +1 -0
- data/test/data/Input-Web/static_text.txt +1 -0
- data/test/data/Input/i_can_ride_my_bike_with_no.handlebars +2 -1
- data/test/data/Output-Web/CreateMyBlogDatabase.sql +17 -0
- data/test/data/Output-Web/MsMvc/MyBlog/DAL/MyBlogContext.cs +17 -0
- data/test/data/Output-Web/MsMvc/MyBlog/Models/Comment.cs +14 -0
- data/test/data/Output-Web/MsMvc/MyBlog/Models/Post.cs +17 -0
- data/test/data/Output-Web/Ruby/my_blog/Models/comment.rb +3 -0
- data/test/data/Output-Web/Ruby/my_blog/Models/post.rb +3 -0
- data/test/data/Output-Web/explicit_names.txt +21 -0
- data/test/data/Output-Web/i_can_ride_my_bike_with_no +32 -0
- data/test/data/Output-Web/package_hello_world.txt +1 -0
- data/test/data/Output-Web/package_zip_hello_world.txt +1 -0
- data/test/data/Output-Web/static_text.txt +1 -0
- data/test/data/expected_output/i_can_ride_my_bike_with_no +2 -1
- metadata +60 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello {{name}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{{ApplicationName}}
|
|
2
|
+
{{ApplicationNames}}
|
|
3
|
+
{{ApplicationName?CapCamel}}
|
|
4
|
+
{{ApplicationNames?CapCamel}}
|
|
5
|
+
{{ApplicationName?CapCamel?singular}}
|
|
6
|
+
{{ApplicationNames?CapCamel?plural}}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
{{application_name}}
|
|
10
|
+
{{application_names}}
|
|
11
|
+
{{application_name?underscored}}
|
|
12
|
+
{{application_names?underscored}}
|
|
13
|
+
{{application_name?underscored?singular}}
|
|
14
|
+
{{application_names?underscored?plural}}
|
|
15
|
+
|
|
16
|
+
{{applicationName}}
|
|
17
|
+
{{applicationNames}}
|
|
18
|
+
{{applicationName?camelCase}}
|
|
19
|
+
{{applicationNames?camelCase}}
|
|
20
|
+
{{applicationName?camelCase?singular}}
|
|
21
|
+
{{applicationNames?camelCase?plural}}
|
|
22
|
+
|
|
23
|
+
{{#each entities}}
|
|
24
|
+
{{EntityName}}
|
|
25
|
+
{{entity_name}}
|
|
26
|
+
{{entityName}}
|
|
27
|
+
{{ENTITY_NAME}}
|
|
28
|
+
{{/each}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello {{name}}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello {{name}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
foo {{bar}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Create Database MyBlog
|
|
2
|
+
|
|
3
|
+
Create Table Posts (
|
|
4
|
+
PostId UniqueIdentifier
|
|
5
|
+
, ##:!IsLastTemplateInstance?
|
|
6
|
+
PostTitle varchar(200)
|
|
7
|
+
, ##:!IsLastTemplateInstance?
|
|
8
|
+
PostText text
|
|
9
|
+
, ##:!IsLastTemplateInstance?
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
Create Table Comments (
|
|
13
|
+
CommentId UniqueIdentifier
|
|
14
|
+
, ##:!IsLastTemplateInstance?
|
|
15
|
+
CommentText text
|
|
16
|
+
, ##:!IsLastTemplateInstance?
|
|
17
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using MyBlog.Models;
|
|
2
|
+
using System.Data.Entity;
|
|
3
|
+
using System.Data.Entity.ModelConfiguration.Conventions;
|
|
4
|
+
|
|
5
|
+
namespace MyBlog.DAL
|
|
6
|
+
{
|
|
7
|
+
public class MyBlogContext : DbContext
|
|
8
|
+
{
|
|
9
|
+
public DbSet<Blog> Posts { get; set; }
|
|
10
|
+
public DbSet<Blog> Comments { get; set; }
|
|
11
|
+
|
|
12
|
+
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.ComponentModel.DataAnnotations.Schema;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
namespace MyBlog.Models
|
|
7
|
+
{
|
|
8
|
+
public class Comment
|
|
9
|
+
{
|
|
10
|
+
public Guid CommentId { get; set; }
|
|
11
|
+
public string CommentText { get; set; }
|
|
12
|
+
Post Post { get; set; }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.ComponentModel.DataAnnotations.Schema;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
namespace MyBlog.Models
|
|
7
|
+
{
|
|
8
|
+
public class Post
|
|
9
|
+
{
|
|
10
|
+
public Guid PostId { get; set; }
|
|
11
|
+
[Required]
|
|
12
|
+
[StringLength(200)]
|
|
13
|
+
public string PostTitle { get; set; }
|
|
14
|
+
public string PostText { get; set; }
|
|
15
|
+
ICollection<Comment> Comments { get; set; }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
MyBlog
|
|
2
|
+
MyBlogs
|
|
3
|
+
MyBlog
|
|
4
|
+
MyBlogs
|
|
5
|
+
MyBlog
|
|
6
|
+
MyBlogs
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
my_blog
|
|
10
|
+
my_blogs
|
|
11
|
+
my_blog
|
|
12
|
+
my_blogs
|
|
13
|
+
my_blog
|
|
14
|
+
my_blogs
|
|
15
|
+
|
|
16
|
+
myBlog
|
|
17
|
+
myBlogs
|
|
18
|
+
myBlog
|
|
19
|
+
myBlogs
|
|
20
|
+
myBlog
|
|
21
|
+
myBlogs
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Post
|
|
25
|
+
post
|
|
26
|
+
post
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Comment
|
|
30
|
+
comment
|
|
31
|
+
comment
|
|
32
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello World
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello World
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
foo {{bar}}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: codgen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Beatty
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -126,16 +126,16 @@ dependencies:
|
|
|
126
126
|
name: handlebars
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
|
-
- - '
|
|
129
|
+
- - '='
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version:
|
|
131
|
+
version: 0.6.0
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
|
-
- - '
|
|
136
|
+
- - '='
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version:
|
|
138
|
+
version: 0.6.0
|
|
139
139
|
description: Codgen is a cross language, template based, code generator, capable of
|
|
140
140
|
generating multiple applications from a common model. It uses JSON for it's model
|
|
141
141
|
and config and you can use mustache or handlebars templates or just verbatim copy.
|
|
@@ -193,6 +193,22 @@ files:
|
|
|
193
193
|
- test/behavior/basic_test.rb
|
|
194
194
|
- test/behavior/output_spec.rb
|
|
195
195
|
- test/behavior/test_utils.rb
|
|
196
|
+
- test/data/Input-Web/CreateDatabase.sql.mustache
|
|
197
|
+
- test/data/Input-Web/DbContextTemplate.cs.mustache
|
|
198
|
+
- test/data/Input-Web/Map.json
|
|
199
|
+
- test/data/Input-Web/ModelTemplate.cs.mustache
|
|
200
|
+
- test/data/Input-Web/config.json
|
|
201
|
+
- test/data/Input-Web/example-data.json
|
|
202
|
+
- test/data/Input-Web/explicit_names.txt
|
|
203
|
+
- test/data/Input-Web/hello_world.txt.mustache
|
|
204
|
+
- test/data/Input-Web/i_can_ride_my_bike_with_no.handlebars
|
|
205
|
+
- test/data/Input-Web/model_template.rb.mustache
|
|
206
|
+
- test/data/Input-Web/package_test_dir/config.json
|
|
207
|
+
- test/data/Input-Web/package_test_dir/templates/package_hello_world.txt.mustache
|
|
208
|
+
- test/data/Input-Web/package_test_zip.zip
|
|
209
|
+
- test/data/Input-Web/package_test_zip/config.json
|
|
210
|
+
- test/data/Input-Web/package_test_zip/templates/package_zip_hello_world.txt.mustache
|
|
211
|
+
- test/data/Input-Web/static_text.txt
|
|
196
212
|
- test/data/Input/CreateDatabase.sql.mustache
|
|
197
213
|
- test/data/Input/DbContextTemplate.cs.mustache
|
|
198
214
|
- test/data/Input/Map.json
|
|
@@ -207,6 +223,17 @@ files:
|
|
|
207
223
|
- test/data/Input/package_test_dir/templates/package_hello_world.txt.mustache
|
|
208
224
|
- test/data/Input/package_test_zip.zip
|
|
209
225
|
- test/data/Input/static_text.txt
|
|
226
|
+
- test/data/Output-Web/CreateMyBlogDatabase.sql
|
|
227
|
+
- test/data/Output-Web/MsMvc/MyBlog/DAL/MyBlogContext.cs
|
|
228
|
+
- test/data/Output-Web/MsMvc/MyBlog/Models/Comment.cs
|
|
229
|
+
- test/data/Output-Web/MsMvc/MyBlog/Models/Post.cs
|
|
230
|
+
- test/data/Output-Web/Ruby/my_blog/Models/comment.rb
|
|
231
|
+
- test/data/Output-Web/Ruby/my_blog/Models/post.rb
|
|
232
|
+
- test/data/Output-Web/explicit_names.txt
|
|
233
|
+
- test/data/Output-Web/i_can_ride_my_bike_with_no
|
|
234
|
+
- test/data/Output-Web/package_hello_world.txt
|
|
235
|
+
- test/data/Output-Web/package_zip_hello_world.txt
|
|
236
|
+
- test/data/Output-Web/static_text.txt
|
|
210
237
|
- test/data/expected_output/MsMvc/MyBlog/DAL/MyBlogContext.cs
|
|
211
238
|
- test/data/expected_output/MsMvc/MyBlog/Models/Comment.cs
|
|
212
239
|
- test/data/expected_output/MsMvc/MyBlog/Models/Post.cs
|
|
@@ -250,6 +277,22 @@ test_files:
|
|
|
250
277
|
- test/behavior/basic_test.rb
|
|
251
278
|
- test/behavior/output_spec.rb
|
|
252
279
|
- test/behavior/test_utils.rb
|
|
280
|
+
- test/data/Input-Web/CreateDatabase.sql.mustache
|
|
281
|
+
- test/data/Input-Web/DbContextTemplate.cs.mustache
|
|
282
|
+
- test/data/Input-Web/Map.json
|
|
283
|
+
- test/data/Input-Web/ModelTemplate.cs.mustache
|
|
284
|
+
- test/data/Input-Web/config.json
|
|
285
|
+
- test/data/Input-Web/example-data.json
|
|
286
|
+
- test/data/Input-Web/explicit_names.txt
|
|
287
|
+
- test/data/Input-Web/hello_world.txt.mustache
|
|
288
|
+
- test/data/Input-Web/i_can_ride_my_bike_with_no.handlebars
|
|
289
|
+
- test/data/Input-Web/model_template.rb.mustache
|
|
290
|
+
- test/data/Input-Web/package_test_dir/config.json
|
|
291
|
+
- test/data/Input-Web/package_test_dir/templates/package_hello_world.txt.mustache
|
|
292
|
+
- test/data/Input-Web/package_test_zip.zip
|
|
293
|
+
- test/data/Input-Web/package_test_zip/config.json
|
|
294
|
+
- test/data/Input-Web/package_test_zip/templates/package_zip_hello_world.txt.mustache
|
|
295
|
+
- test/data/Input-Web/static_text.txt
|
|
253
296
|
- test/data/Input/CreateDatabase.sql.mustache
|
|
254
297
|
- test/data/Input/DbContextTemplate.cs.mustache
|
|
255
298
|
- test/data/Input/Map.json
|
|
@@ -264,6 +307,17 @@ test_files:
|
|
|
264
307
|
- test/data/Input/package_test_dir/templates/package_hello_world.txt.mustache
|
|
265
308
|
- test/data/Input/package_test_zip.zip
|
|
266
309
|
- test/data/Input/static_text.txt
|
|
310
|
+
- test/data/Output-Web/CreateMyBlogDatabase.sql
|
|
311
|
+
- test/data/Output-Web/MsMvc/MyBlog/DAL/MyBlogContext.cs
|
|
312
|
+
- test/data/Output-Web/MsMvc/MyBlog/Models/Comment.cs
|
|
313
|
+
- test/data/Output-Web/MsMvc/MyBlog/Models/Post.cs
|
|
314
|
+
- test/data/Output-Web/Ruby/my_blog/Models/comment.rb
|
|
315
|
+
- test/data/Output-Web/Ruby/my_blog/Models/post.rb
|
|
316
|
+
- test/data/Output-Web/explicit_names.txt
|
|
317
|
+
- test/data/Output-Web/i_can_ride_my_bike_with_no
|
|
318
|
+
- test/data/Output-Web/package_hello_world.txt
|
|
319
|
+
- test/data/Output-Web/package_zip_hello_world.txt
|
|
320
|
+
- test/data/Output-Web/static_text.txt
|
|
267
321
|
- test/data/expected_output/MsMvc/MyBlog/DAL/MyBlogContext.cs
|
|
268
322
|
- test/data/expected_output/MsMvc/MyBlog/Models/Comment.cs
|
|
269
323
|
- test/data/expected_output/MsMvc/MyBlog/Models/Post.cs
|