chester 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/chester.gemspec +12 -9
- data/lib/chester/commands/generate.rb +4 -2
- data/lib/chester/templates/chester.coffee +4 -2
- data/lib/chester/templates/controller.coffee.erb +9 -0
- data/lib/chester/templates/helper.coffee.erb +5 -0
- data/lib/chester/templates/model.coffee.erb +7 -0
- data/lib/chester/templates/view.coffee.erb +1 -1
- data/lib/chester.rb +1 -0
- data/readme.md +20 -1
- data/spec/base.rb +23 -0
- data/spec/commands/brew_spec.rb +20 -0
- data/spec/commands/generate_spec.rb +33 -0
- data/spec/commands/install_spec.rb +20 -0
- metadata +11 -8
- data/spec/chester_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -9
- data/views/patient/index.coffee +0 -7
- data/views/patient/new.coffee +0 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
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.2.0"
|
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-12}
|
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}
|
@@ -34,14 +34,15 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/chester/helpers.rb",
|
35
35
|
"lib/chester/templates/chester.coffee",
|
36
36
|
"lib/chester/templates/controller.coffee.erb",
|
37
|
+
"lib/chester/templates/helper.coffee.erb",
|
37
38
|
"lib/chester/templates/model.coffee.erb",
|
38
39
|
"lib/chester/templates/view.coffee.erb",
|
39
40
|
"readme.md",
|
40
|
-
"spec/
|
41
|
-
"spec/
|
42
|
-
"spec/
|
43
|
-
"
|
44
|
-
"
|
41
|
+
"spec/base.rb",
|
42
|
+
"spec/commands/brew_spec.rb",
|
43
|
+
"spec/commands/generate_spec.rb",
|
44
|
+
"spec/commands/install_spec.rb",
|
45
|
+
"spec/spec.opts"
|
45
46
|
]
|
46
47
|
s.homepage = %q{http://github.com/twilson63/chester}
|
47
48
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -49,8 +50,10 @@ Gem::Specification.new do |s|
|
|
49
50
|
s.rubygems_version = %q{1.3.5}
|
50
51
|
s.summary = %q{MVC for Titanium Developer}
|
51
52
|
s.test_files = [
|
52
|
-
"spec/
|
53
|
-
"spec/
|
53
|
+
"spec/base.rb",
|
54
|
+
"spec/commands/brew_spec.rb",
|
55
|
+
"spec/commands/generate_spec.rb",
|
56
|
+
"spec/commands/install_spec.rb"
|
54
57
|
]
|
55
58
|
|
56
59
|
if s.respond_to? :specification_version then
|
@@ -4,8 +4,8 @@ module Chester::Command
|
|
4
4
|
class Generate < Base
|
5
5
|
def index
|
6
6
|
if args.length < 2
|
7
|
-
display 'Please enter [controller|model|view] [name]'
|
8
|
-
elsif args.first =~ /^(controller|model|view)$/
|
7
|
+
display 'Please enter [controller|model|view|helper] [name]'
|
8
|
+
elsif args.first =~ /^(controller|model|view|helper)$/
|
9
9
|
create_folder args.first + 's'
|
10
10
|
name = args[1].capitalize
|
11
11
|
action = args[2] || 'index'
|
@@ -33,6 +33,8 @@ module Chester::Command
|
|
33
33
|
elsif file_type == 'view'
|
34
34
|
FileUtils.mkdir_p result
|
35
35
|
result += "/#{action}.coffee"
|
36
|
+
elsif file_type == 'helper'
|
37
|
+
result += "_#{args.first}.coffee"
|
36
38
|
else
|
37
39
|
result += ".coffee"
|
38
40
|
end
|
@@ -13,9 +13,9 @@ class Base
|
|
13
13
|
|
14
14
|
|
15
15
|
class Application extends Base
|
16
|
-
version: "0.0
|
16
|
+
version: "0.2.0"
|
17
17
|
run: (options) ->
|
18
|
-
this.find(options.controller)[options.action ?= '
|
18
|
+
this.find(options.controller)[options.action ?= '_index'](options.params ?= {} )
|
19
19
|
|
20
20
|
|
21
21
|
|
@@ -38,5 +38,7 @@ Chester.View = View;
|
|
38
38
|
Chester.Controller = Controller;
|
39
39
|
Chester.Application = new Application();
|
40
40
|
Chester.Application.Models = new Base();
|
41
|
+
Chester.Application.Helpers = new Base();
|
42
|
+
|
41
43
|
|
42
44
|
|
@@ -1,5 +1,14 @@
|
|
1
1
|
class <%= name %>Controller extends Chester.Controller
|
2
2
|
name: '<%= name %>Controller'
|
3
|
+
_index: (params) ->
|
4
|
+
#TODO INDEX VIEW
|
5
|
+
|
6
|
+
_new: (params) ->
|
7
|
+
#TODO NEW VIEW
|
8
|
+
|
9
|
+
_create: (params) ->
|
10
|
+
#TODO NEW VIEW
|
11
|
+
|
3
12
|
|
4
13
|
# Register Controller to application
|
5
14
|
Chester.Application.add(new <%= name %>Controller())
|
@@ -1,5 +1,12 @@
|
|
1
1
|
class <%= name %>
|
2
2
|
name: '<%= name %>'
|
3
|
+
_all: ->
|
4
|
+
# Get All Records
|
5
|
+
_find_by_id: (id) ->
|
6
|
+
# Get model record by id
|
7
|
+
_create: (<%= name.downcase %>) ->
|
8
|
+
# create Record
|
9
|
+
|
3
10
|
# Insert your code here
|
4
11
|
|
5
12
|
Chester.Application.Models.add(new <%= name %>())
|
data/lib/chester.rb
CHANGED
data/readme.md
CHANGED
@@ -8,6 +8,16 @@ The purpose of this framework is to organize your Titanium Developer projects in
|
|
8
8
|
|
9
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
|
+
## Update
|
12
|
+
|
13
|
+
Added Helper generator, also changed the convention of the controller actions and model methods to start with an underscore. This will allow us to use new and create without worrying about javascript conflicts.
|
14
|
+
|
15
|
+
## TODO
|
16
|
+
|
17
|
+
* Finish Generator Test Coverage
|
18
|
+
* enhance brew command to create one javascript file
|
19
|
+
* Add testing library. Suggestions?
|
20
|
+
|
11
21
|
# Requirements
|
12
22
|
|
13
23
|
* node.js
|
@@ -19,8 +29,16 @@ Titanium Developer is an awesome JavaScript SDK for building mobile applications
|
|
19
29
|
<code>
|
20
30
|
gem install chester
|
21
31
|
</code>
|
22
|
-
</pre>
|
32
|
+
</pre>
|
33
|
+
|
34
|
+
# Test
|
23
35
|
|
36
|
+
<pre>
|
37
|
+
<code>
|
38
|
+
rake spec
|
39
|
+
</code>
|
40
|
+
</pre>
|
41
|
+
|
24
42
|
# Add to any Titanium Developer Project
|
25
43
|
|
26
44
|
Just run chester install, and it will create the chester.coffee file in your Resources folder.
|
@@ -51,6 +69,7 @@ cd ./Resources
|
|
51
69
|
chester generate model person
|
52
70
|
chester generate controller people
|
53
71
|
chester generate view people index
|
72
|
+
chester generate helper people
|
54
73
|
</code>
|
55
74
|
</pre>
|
56
75
|
|
data/spec/base.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/../lib/chester'
|
6
|
+
require 'command'
|
7
|
+
require 'commands/base'
|
8
|
+
Dir["#{File.dirname(__FILE__)}/../lib/chester/commands/*"].each { |c| require c }
|
9
|
+
|
10
|
+
def prepare_command(klass)
|
11
|
+
command = klass.new(['--app', 'myapp'])
|
12
|
+
# command.stub!(:args).and_return([])
|
13
|
+
# command.stub!(:display)
|
14
|
+
# command.stub!(:heroku).and_return(mock('heroku client', :host => 'heroku.com'))
|
15
|
+
# command.stub!(:extract_app).and_return('myapp')
|
16
|
+
command
|
17
|
+
end
|
18
|
+
|
19
|
+
module SandboxHelper
|
20
|
+
def bash(cmd)
|
21
|
+
FileUtils.cd(@sandbox) { |d| return `#{cmd}` }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../base'
|
2
|
+
|
3
|
+
module Chester::Command
|
4
|
+
|
5
|
+
describe Brew do
|
6
|
+
before do
|
7
|
+
@brew = prepare_command(Brew)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should compile all of the coffee scripts" do
|
11
|
+
@brew.should_receive(:display).exactly(3).times
|
12
|
+
Dir.stub!(:glob).and_return(['test.coffee'])
|
13
|
+
@brew.should_receive(:system)
|
14
|
+
@brew.index
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../base'
|
2
|
+
|
3
|
+
module Chester::Command
|
4
|
+
|
5
|
+
describe Generate do
|
6
|
+
before do
|
7
|
+
@generate = prepare_command(Generate)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return not valid" do
|
11
|
+
@generate.should_receive(:display).with("--app not valid command")
|
12
|
+
@generate.index
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return controller|model|view arguments" do
|
16
|
+
#@generate.should_receive(:display).with("Please enter [controller|model|view] [name]")
|
17
|
+
@generate = Generate.new([])
|
18
|
+
@generate.index
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return controller|model|view arguments" do
|
22
|
+
#@generate.should_receive(:display).with("Please enter [controller|model|view] [name]")
|
23
|
+
# @generate = Generate.new(['model','person'])
|
24
|
+
# @generate.stub!(:create_foler).and_return(true)
|
25
|
+
#
|
26
|
+
# @generate.index
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../base'
|
2
|
+
|
3
|
+
module Chester::Command
|
4
|
+
|
5
|
+
describe Install do
|
6
|
+
before do
|
7
|
+
@install = prepare_command(Install)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should create chester.coffee" do
|
11
|
+
FileUtils.stub!(:cp).and_return(true)
|
12
|
+
@install.should_receive(:display).with('installed chester.coffee in to the working directory....')
|
13
|
+
|
14
|
+
@install.index
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
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.2.0
|
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-12 00:00:00 -04:00
|
15
15
|
default_executable: chester
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -69,14 +69,15 @@ files:
|
|
69
69
|
- lib/chester/helpers.rb
|
70
70
|
- lib/chester/templates/chester.coffee
|
71
71
|
- lib/chester/templates/controller.coffee.erb
|
72
|
+
- lib/chester/templates/helper.coffee.erb
|
72
73
|
- lib/chester/templates/model.coffee.erb
|
73
74
|
- lib/chester/templates/view.coffee.erb
|
74
75
|
- readme.md
|
75
|
-
- spec/
|
76
|
+
- spec/base.rb
|
77
|
+
- spec/commands/brew_spec.rb
|
78
|
+
- spec/commands/generate_spec.rb
|
79
|
+
- spec/commands/install_spec.rb
|
76
80
|
- spec/spec.opts
|
77
|
-
- spec/spec_helper.rb
|
78
|
-
- views/patient/index.coffee
|
79
|
-
- views/patient/new.coffee
|
80
81
|
has_rdoc: true
|
81
82
|
homepage: http://github.com/twilson63/chester
|
82
83
|
licenses: []
|
@@ -106,5 +107,7 @@ signing_key:
|
|
106
107
|
specification_version: 3
|
107
108
|
summary: MVC for Titanium Developer
|
108
109
|
test_files:
|
109
|
-
- spec/
|
110
|
-
- spec/
|
110
|
+
- spec/base.rb
|
111
|
+
- spec/commands/brew_spec.rb
|
112
|
+
- spec/commands/generate_spec.rb
|
113
|
+
- spec/commands/install_spec.rb
|
data/spec/chester_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
data/views/patient/index.coffee
DELETED