alpha-simprini-engine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ class Backbone::Model
2
+ def initialize(namespace, model, parent=nil)
3
+ @model = model
4
+ @namespace = namespace
5
+ if parent
6
+ @parent = [namespace, parent].join(".").gsub(/\.$/, '')
7
+ else
8
+ @parent = "AS.Model"
9
+ end
10
+ end
11
+
12
+ def coffee_path
13
+ "#{@namespace}.#{@model.name.demodulize}"
14
+ end
15
+
16
+ def content_fields
17
+ @model.fields.reject do |name, config|
18
+ config.options[:identity] || name.ends_with?("_ids")
19
+ end
20
+ end
21
+
22
+ def spool_boilerplate
23
+ bp = []
24
+ bp << %|module "#{@namespace}", ->|
25
+ bp << %|class #{coffee_path} extends #{@parent}|
26
+ # bp << %| AS.Heap.Classes["Packed#{@model.name}"] = this|
27
+ content_fields.each do |name, config|
28
+ bp << %| @field "#{name}"|
29
+ end
30
+ @model.relations.each do |name, config|
31
+ case config.macro
32
+ when :embeds_many, :references_many
33
+ bp << %| @has_many "#{name}"|
34
+ bp << %| model: -> #{@namespace}.#{config.class_name}|
35
+ when :embedded_in, :referenced_in
36
+ bp << %| @belongs_to "#{name}"|
37
+ end
38
+ end
39
+ bp
40
+ end
41
+
42
+
43
+ def boilerplate
44
+ bp = spool_boilerplate
45
+ bp << %||
46
+ bp << %||
47
+ bp.join("\n")
48
+ end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module AlphaSimpriniEngine
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha-simprini-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70134367082040 !ruby/object:Gem::Requirement
16
+ requirement: &70289229766680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70134367082040
24
+ version_requirements: *70289229766680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: erector
27
- requirement: &70134367080280 !ruby/object:Gem::Requirement
27
+ requirement: &70289229766080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.0.pre1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70134367080280
35
+ version_requirements: *70289229766080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: inherited_resources
38
- requirement: &70134367078800 !ruby/object:Gem::Requirement
38
+ requirement: &70289229765360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.2.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70134367078800
46
+ version_requirements: *70289229765360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sass-rails
49
- requirement: &70134367077720 !ruby/object:Gem::Requirement
49
+ requirement: &70289229764840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70134367077720
57
+ version_requirements: *70289229764840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: coffee-rails
60
- requirement: &70134367076260 !ruby/object:Gem::Requirement
60
+ requirement: &70289229764180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 3.1.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70134367076260
68
+ version_requirements: *70289229764180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: msgpack
71
- requirement: &70134367075760 !ruby/object:Gem::Requirement
71
+ requirement: &70289229763560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70134367075760
79
+ version_requirements: *70289229763560
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: compass
82
- requirement: &70134370706640 !ruby/object:Gem::Requirement
82
+ requirement: &70289229761840 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.12.alpha
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70134370706640
90
+ version_requirements: *70289229761840
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: sqlite3
93
- requirement: &70134370704360 !ruby/object:Gem::Requirement
93
+ requirement: &70289229760640 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70134370704360
101
+ version_requirements: *70289229760640
102
102
  description: Comes with some plugins configured and some coffeescript/css/assets preloaded
103
103
  for JOY
104
104
  email:
@@ -174,6 +174,7 @@ files:
174
174
  - lib/alpha_simprini/packer.rb
175
175
  - lib/alpha_simprini/page.rb
176
176
  - lib/tasks/alpha-simprini-engine_tasks.rake
177
+ - extras/backbone/model.rb
177
178
  - MIT-LICENSE
178
179
  - Rakefile
179
180
  - README.rdoc
@@ -249,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
250
  version: '0'
250
251
  segments:
251
252
  - 0
252
- hash: 1422641884723458801
253
+ hash: 2501303998048105159
253
254
  required_rubygems_version: !ruby/object:Gem::Requirement
254
255
  none: false
255
256
  requirements:
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
259
  version: '0'
259
260
  segments:
260
261
  - 0
261
- hash: 1422641884723458801
262
+ hash: 2501303998048105159
262
263
  requirements: []
263
264
  rubyforge_project:
264
265
  rubygems_version: 1.8.6