chester 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/chester.gemspec +6 -3
- data/lib/chester/commands/generate.rb +2 -2
- data/readme.md +49 -16
- metadata +14 -2
data/Rakefile
CHANGED
@@ -9,9 +9,10 @@ begin
|
|
9
9
|
gem.description = %Q{This project use coffeescript and MVC to create an awesome framework for the Titanium system!}
|
10
10
|
gem.email = "tom@jackhq.com"
|
11
11
|
gem.homepage = "http://github.com/twilson63/chester"
|
12
|
-
gem.authors = ["Tom Wilson"]
|
12
|
+
gem.authors = ["Tom Wilson", "Andrew Kennedy", "Nick Bucciarelli" ]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
14
|
gem.add_dependency "erubis", ">= 2.6.5"
|
15
|
+
gem.add_dependency "activesupport", ">= 2.3.5"
|
15
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
17
|
end
|
17
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
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.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tom Wilson"]
|
12
|
-
s.date = %q{2010-05-
|
11
|
+
s.authors = ["Tom Wilson", "Andrew Kennedy", "Nick Bucciarelli"]
|
12
|
+
s.date = %q{2010-05-09}
|
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}
|
@@ -60,13 +60,16 @@ Gem::Specification.new do |s|
|
|
60
60
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
61
61
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
62
62
|
s.add_runtime_dependency(%q<erubis>, [">= 2.6.5"])
|
63
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
|
63
64
|
else
|
64
65
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
65
66
|
s.add_dependency(%q<erubis>, [">= 2.6.5"])
|
67
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
66
68
|
end
|
67
69
|
else
|
68
70
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
69
71
|
s.add_dependency(%q<erubis>, [">= 2.6.5"])
|
72
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
@@ -31,8 +31,8 @@ module Chester::Command
|
|
31
31
|
if file_type == 'controller'
|
32
32
|
result += "_#{args.first}.coffee"
|
33
33
|
elsif file_type == 'view'
|
34
|
-
FileUtils.mkdir_p result
|
35
|
-
result += "
|
34
|
+
FileUtils.mkdir_p result
|
35
|
+
result += "/#{action}.coffee"
|
36
36
|
else
|
37
37
|
result += ".coffee"
|
38
38
|
end
|
data/readme.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
A MVC framework for Titanium Developer.
|
4
4
|
|
5
|
-
The purpose of this framework is to organize your Titanium Developer projects in a
|
5
|
+
The purpose of this framework is to organize your Titanium Developer projects in a Model-View-Controller (MVC) pattern.
|
6
6
|
|
7
7
|
# Why
|
8
8
|
|
9
|
-
Titanium Developer is an awesome
|
9
|
+
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.
|
10
10
|
|
11
11
|
# Requirements
|
12
12
|
|
@@ -27,12 +27,15 @@ Just run chester install, and it will create the chester.coffee file in your Res
|
|
27
27
|
|
28
28
|
<pre>
|
29
29
|
<code>
|
30
|
-
|
30
|
+
cd ./Resources
|
31
|
+
chester install
|
31
32
|
</code>
|
32
33
|
</pre>
|
33
34
|
|
34
35
|
# Easy to compile the coffee files to javascript
|
35
36
|
|
37
|
+
This command compiles your coffee script into JavaScript.
|
38
|
+
|
36
39
|
<pre>
|
37
40
|
<code>
|
38
41
|
cd ./Resources
|
@@ -40,8 +43,7 @@ chester brew
|
|
40
43
|
</code>
|
41
44
|
</pre>
|
42
45
|
|
43
|
-
|
44
|
-
# Easy to generate models|views|controllers
|
46
|
+
# Easy to generate models | views | controllers
|
45
47
|
|
46
48
|
<pre>
|
47
49
|
<code>
|
@@ -67,8 +69,7 @@ Chester.Application.Models.add(new Person())
|
|
67
69
|
</code>
|
68
70
|
</pre>
|
69
71
|
|
70
|
-
Just a quick run down on what is going on here
|
71
|
-
|
72
|
+
Just a quick run down on what is going on here: in order for chester to know your model, you MUST have an attribute called name. This attribute (name) will register the model to the application object. Chester will then be able to find your model whenever you request it.
|
72
73
|
|
73
74
|
- controllers
|
74
75
|
- people.coffee
|
@@ -84,7 +85,7 @@ Chester.Application.add(new PeopleController())
|
|
84
85
|
</code>
|
85
86
|
</pre>
|
86
87
|
|
87
|
-
|
88
|
+
Just like with the model, the controller needs to have an attribute called name. That is the actual name used for Chester to recognize the controller.
|
88
89
|
|
89
90
|
- views
|
90
91
|
- people
|
@@ -103,38 +104,70 @@ Chester.Application.find("PeopleController").add(new PeopleIndex())
|
|
103
104
|
</code>
|
104
105
|
</pre>
|
105
106
|
|
107
|
+
# Include the framework | models | views | controllers in app.js
|
108
|
+
|
109
|
+
<pre>
|
110
|
+
<code>
|
111
|
+
var Chester = {};
|
112
|
+
|
113
|
+
// Include MVC Framework
|
114
|
+
Ti.include('chester.js');
|
115
|
+
|
116
|
+
// Register Controllers
|
117
|
+
Ti.include('controllers/people_controller.js');
|
118
|
+
|
119
|
+
// Register Models
|
120
|
+
Ti.include('models/person.js');
|
121
|
+
|
122
|
+
// Register Views
|
123
|
+
Ti.include('views/peoples/index.js');
|
124
|
+
</code>
|
125
|
+
</pre>
|
126
|
+
|
106
127
|
|
107
128
|
# Framework
|
108
129
|
|
109
|
-
The object hierarchy is very straight forward.
|
130
|
+
The object hierarchy is very straight forward. Chester has a base object which has an add method and a find method.
|
131
|
+
|
132
|
+
- base object
|
133
|
+
- has a collection called children
|
134
|
+
|
135
|
+
- Methods:
|
136
|
+
- add : adds an object to the children array
|
137
|
+
- find : locates and returns the object based on the name attribute
|
110
138
|
|
111
139
|
## Base
|
112
140
|
|
113
|
-
This is the core class definition that all other classes
|
141
|
+
This is the core class definition that all other classes inherit.
|
114
142
|
|
115
143
|
## Application
|
116
144
|
|
117
|
-
This objects children are controllers
|
145
|
+
This objects children are controllers. With the add method you can add new controllers to this object. With the find method you can locate the controller by the name of the controller.
|
146
|
+
|
147
|
+
####Add and Find Example:
|
148
|
+
- Chester.Application.find("PeopleController").add(new PeopleIndex())
|
149
|
+
|
150
|
+
There is another array of objects attached to this class called models. These are basic classes that can added to the Models array.
|
118
151
|
|
119
152
|
## Controller
|
120
153
|
|
121
|
-
This
|
154
|
+
This object's children are views. These are not the same as views in Titanium. These are simple JavaScript classes that are used to contain the user interface code to manage your mobile application.
|
122
155
|
|
123
156
|
## View
|
124
157
|
|
125
|
-
This will be the most confusing class
|
158
|
+
This will be the most confusing class because the UI objects in Titanium are user views. The Chester views are more like code containers that help isolate your user interface code from your business logic and domain logic.
|
126
159
|
|
127
160
|
## Application.run
|
128
161
|
|
129
|
-
This is the main routing method that makes the whole application work.
|
162
|
+
This is the main routing method that makes the whole application work. It takes the following parameters as a JavaScript object.
|
130
163
|
|
131
164
|
* Controller: string,
|
132
165
|
* Action: string,
|
133
166
|
* Params: object
|
134
167
|
|
135
|
-
This method simply finds the controller and executes the action method on the controller
|
168
|
+
This method simply finds the controller and executes the action method on the controller, passing the params object as the parameter.
|
136
169
|
|
137
|
-
Chester is built using coffee
|
170
|
+
Chester is built using coffee because it is much easier to maintain. But, you don't need to use coffeescript to use Chester! You can use JavaScript just fine.
|
138
171
|
|
139
172
|
# Get Involved
|
140
173
|
|
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Wilson
|
8
|
+
- Andrew Kennedy
|
9
|
+
- Nick Bucciarelli
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
13
|
|
12
|
-
date: 2010-05-
|
14
|
+
date: 2010-05-09 00:00:00 -04:00
|
13
15
|
default_executable: chester
|
14
16
|
dependencies:
|
15
17
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +34,16 @@ dependencies:
|
|
32
34
|
- !ruby/object:Gem::Version
|
33
35
|
version: 2.6.5
|
34
36
|
version:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activesupport
|
39
|
+
type: :runtime
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.3.5
|
46
|
+
version:
|
35
47
|
description: This project use coffeescript and MVC to create an awesome framework for the Titanium system!
|
36
48
|
email: tom@jackhq.com
|
37
49
|
executables:
|