chester 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/chester.gemspec +2 -2
- data/lib/chester/templates/chester.coffee +33 -28
- data/lib/chester/templates/controller.coffee.erb +1 -2
- data/lib/chester/templates/helper.coffee.erb +5 -2
- data/lib/chester/templates/model.coffee.erb +4 -2
- data/lib/chester/templates/view.coffee.erb +1 -2
- data/readme.md +52 -9
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.1
|
data/chester.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chester}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom Wilson", "Andrew Kennedy", "Nick Bucciarelli"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-16}
|
13
13
|
s.default_executable = %q{chester}
|
14
14
|
s.description = %q{This project use coffeescript and MVC to create an awesome framework for the Titanium system!}
|
15
15
|
s.email = %q{tom@jackhq.com}
|
@@ -1,44 +1,49 @@
|
|
1
|
+
# Chester Framework
|
2
|
+
# 0.3.0
|
3
|
+
#
|
4
|
+
# Classes:
|
5
|
+
#
|
6
|
+
# Base
|
7
|
+
# Application extends Base
|
8
|
+
# Controller extends Base
|
9
|
+
# View extends Base
|
10
|
+
|
11
|
+
|
1
12
|
class Base
|
2
|
-
|
13
|
+
constructor: (name) ->
|
14
|
+
@name: name
|
3
15
|
children: []
|
16
|
+
names: []
|
4
17
|
find: (name) ->
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
break
|
9
|
-
result
|
18
|
+
@children[@names.indexOf(name)]
|
19
|
+
_: (name) ->
|
20
|
+
@find(name)
|
10
21
|
|
11
22
|
add: (child) ->
|
12
|
-
|
13
|
-
|
23
|
+
child.parent: this
|
24
|
+
@children[@children.length]: child
|
25
|
+
@names[@names.length]: child.name
|
14
26
|
|
15
27
|
class Application extends Base
|
16
|
-
version: "0.
|
28
|
+
version: "0.3.0"
|
17
29
|
run: (options) ->
|
18
|
-
|
30
|
+
@find(options.controller)[options.action ?= '_index'](options.params ?= {} )
|
19
31
|
|
20
|
-
|
21
|
-
|
22
32
|
class Controller extends Base
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
class View extends Base
|
27
|
-
name: "View"
|
28
|
-
data: ->
|
29
|
-
result = {}
|
30
|
-
for child in this.children
|
31
|
-
result[child.name] = child.value
|
32
|
-
result
|
33
|
-
|
33
|
+
|
34
|
+
class View extends Base
|
34
35
|
render: ->
|
35
36
|
print "Not Implemented"
|
36
37
|
|
37
|
-
Chester
|
38
|
-
Chester.
|
39
|
-
Chester.
|
40
|
-
|
41
|
-
Chester.
|
38
|
+
Chester: new Base()
|
39
|
+
Chester.View: View
|
40
|
+
Chester.Controller: Controller
|
41
|
+
|
42
|
+
Chester.add(new Application('app'))
|
43
|
+
Chester._('app').Models: new Base('Models')
|
44
|
+
Chester._('app').Helpers: new Base('Helpers')
|
42
45
|
|
43
46
|
|
47
|
+
root: exports ? this
|
48
|
+
root.Chester: Chester
|
44
49
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class <%= name %>Controller extends Chester.Controller
|
2
|
-
name: '<%= name %>Controller'
|
3
2
|
_index: (params) ->
|
4
3
|
#TODO INDEX VIEW
|
5
4
|
|
@@ -11,4 +10,4 @@ class <%= name %>Controller extends Chester.Controller
|
|
11
10
|
|
12
11
|
|
13
12
|
# Register Controller to application
|
14
|
-
Chester.
|
13
|
+
Chester._('app').add(new <%= name %>Controller('<%= name %>Controller'))
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class <%= name %>
|
2
|
-
|
2
|
+
constructor: (name) ->
|
3
|
+
@name: name
|
4
|
+
|
3
5
|
_all: ->
|
4
6
|
# Get All Records
|
5
7
|
_find_by_id: (id) ->
|
@@ -9,4 +11,4 @@ class <%= name %>
|
|
9
11
|
|
10
12
|
# Insert your code here
|
11
13
|
|
12
|
-
Chester.
|
14
|
+
Chester._('app').Models.add(new <%= name %>('<%= name %>'))
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class <%= name %><%= action.capitalize %> extends Chester.View
|
2
|
-
name: "<%= action %>"
|
3
2
|
render: (options) ->
|
4
3
|
# TODO: add your presentation code here.
|
5
4
|
|
6
5
|
# Register view to Patients Controller
|
7
|
-
Chester.
|
6
|
+
Chester._('app')._("<%= name %>Controller").add(new <%= name %><%= action.capitalize %>('<%= action %>'))
|
data/readme.md
CHANGED
@@ -4,6 +4,32 @@ A MVC framework for Titanium Developer.
|
|
4
4
|
|
5
5
|
The purpose of this framework is to organize your Titanium Developer projects in a Model-View-Controller (MVC) pattern.
|
6
6
|
|
7
|
+
# Status
|
8
|
+
|
9
|
+
Current Version: 0.3.0
|
10
|
+
|
11
|
+
## API is locked
|
12
|
+
|
13
|
+
From this point on we will not be changing the API to move to stability. There were some changes between 0.2 and 0.3. From this point on there will not be any more api changes, so if your app works with 0.3 it should work with all later versions.
|
14
|
+
|
15
|
+
## Changes
|
16
|
+
|
17
|
+
* Multiple App Support
|
18
|
+
|
19
|
+
Extended the Chester namespace from Base, this will enable the developer to add multiple applications to the Chester namespace and run routes between the apps.
|
20
|
+
|
21
|
+
* Created an alias of '_' underscore for find, which will make the lines more readable. ex:
|
22
|
+
|
23
|
+
Chester._('app').run(...)
|
24
|
+
|
25
|
+
instead of
|
26
|
+
|
27
|
+
Chester.find('app').run(...)
|
28
|
+
|
29
|
+
* Created a names array on the base class to make it easier to find children objects
|
30
|
+
|
31
|
+
* Updated generators with new changes
|
32
|
+
|
7
33
|
# Why
|
8
34
|
|
9
35
|
Titanium Developer is an awesome JavaScript SDK for building mobile applications, but there are no conventions on how to organize your code. We build web applications using Ruby on Rails, and being able to organize our iPad applications using the same patterns will enable us to process and maintain our software projects more effectively.
|
@@ -81,10 +107,9 @@ These generators will make the following objects:
|
|
81
107
|
<pre>
|
82
108
|
<code>
|
83
109
|
class Person
|
84
|
-
name: 'Person'
|
85
110
|
# Insert your code here
|
86
111
|
|
87
|
-
Chester.
|
112
|
+
Chester._('app').Models.add(new Person('Person'))
|
88
113
|
</code>
|
89
114
|
</pre>
|
90
115
|
|
@@ -96,10 +121,9 @@ Just a quick run down on what is going on here: in order for chester to know you
|
|
96
121
|
<pre>
|
97
122
|
<code>
|
98
123
|
class PeopleController extends Chester.Controller
|
99
|
-
name: 'PeopleController'
|
100
124
|
|
101
125
|
# Register Controller to application
|
102
|
-
Chester.
|
126
|
+
Chester._('app').add(new PeopleController('PeopleController'))
|
103
127
|
|
104
128
|
</code>
|
105
129
|
</pre>
|
@@ -113,12 +137,11 @@ Just like with the model, the controller needs to have an attribute called name.
|
|
113
137
|
<pre>
|
114
138
|
<code>
|
115
139
|
class PeopleIndex extends Chester.View
|
116
|
-
|
117
|
-
render: ->
|
140
|
+
render: (params) ->
|
118
141
|
# TODO: add your presentation code here.
|
119
142
|
|
120
143
|
# Register view to Patients Controller
|
121
|
-
Chester.
|
144
|
+
Chester._('app')._("PeopleController").add(new PeopleIndex("index"))
|
122
145
|
|
123
146
|
</code>
|
124
147
|
</pre>
|
@@ -127,8 +150,6 @@ Chester.Application.find("PeopleController").add(new PeopleIndex())
|
|
127
150
|
|
128
151
|
<pre>
|
129
152
|
<code>
|
130
|
-
var Chester = {};
|
131
|
-
|
132
153
|
// Include MVC Framework
|
133
154
|
Ti.include('chester.js');
|
134
155
|
|
@@ -143,6 +164,28 @@ Ti.include('views/peoples/index.js');
|
|
143
164
|
</code>
|
144
165
|
</pre>
|
145
166
|
|
167
|
+
# Roadmap
|
168
|
+
|
169
|
+
## 0.3.0
|
170
|
+
|
171
|
+
* Simple Example and locked API
|
172
|
+
|
173
|
+
## 0.4.0
|
174
|
+
|
175
|
+
* Full Test Suite
|
176
|
+
|
177
|
+
## 0.5.0
|
178
|
+
|
179
|
+
* Complete Web Site Documentation
|
180
|
+
|
181
|
+
## 0.6.0
|
182
|
+
|
183
|
+
* Complete working JQuery Example
|
184
|
+
* Complete working Titanium Example
|
185
|
+
|
186
|
+
## 0.7.0
|
187
|
+
|
188
|
+
* Add a plugin module
|
146
189
|
|
147
190
|
# Framework
|
148
191
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Wilson
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-05-
|
14
|
+
date: 2010-05-16 00:00:00 -04:00
|
15
15
|
default_executable: chester
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|