sproutcore 0.9.11 → 0.9.12
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.
- data/History.txt +98 -73
- data/Manifest.txt +2 -1
- data/README.txt +1 -1
- data/Rakefile +8 -8
- data/app_generators/sproutcore/USAGE +2 -3
- data/app_generators/sproutcore/sproutcore_generator.rb +12 -12
- data/app_generators/sproutcore/templates/README +26 -23
- data/app_generators/sproutcore/templates/{sc-config.rb → sc-config} +32 -17
- data/bin/sc-build +17 -17
- data/bin/sc-server +1 -1
- data/bin/sproutcore +3 -3
- data/clients/sc_test_runner/english.lproj/no_tests.rhtml +0 -1
- data/config/hoe.rb +9 -9
- data/config/requirements.rb +1 -1
- data/frameworks/sproutcore/HISTORY +14 -0
- data/frameworks/sproutcore/core.js +1 -1
- data/frameworks/sproutcore/english.lproj/theme.css +1 -0
- data/frameworks/sproutcore/foundation/binding.js +2 -2
- data/frameworks/sproutcore/foundation/timer.js +55 -22
- data/frameworks/sproutcore/lib/index.rhtml +2 -3
- data/frameworks/sproutcore/models/record.js +204 -63
- data/frameworks/sproutcore/tests/models/model.rhtml +360 -0
- data/frameworks/sproutcore/views/button/button.js +22 -1
- data/frameworks/sproutcore/views/collection/collection.js +6 -2
- data/frameworks/sproutcore/views/collection/list.js +1 -0
- data/frameworks/sproutcore/views/collection/source_list.js +1 -0
- data/frameworks/sproutcore/views/field/text_field.js +11 -2
- data/frameworks/sproutcore/views/inline_text_field.js +3 -2
- data/frameworks/sproutcore/views/menu_item.js +1 -0
- data/frameworks/sproutcore/views/pagination.js +1 -0
- data/frameworks/sproutcore/views/view.js +4 -1
- data/lib/sproutcore/build_tools/html_builder.rb +36 -36
- data/lib/sproutcore/build_tools/resource_builder.rb +55 -54
- data/lib/sproutcore/build_tools.rb +12 -12
- data/lib/sproutcore/bundle.rb +162 -164
- data/lib/sproutcore/bundle_manifest.rb +154 -107
- data/lib/sproutcore/generator_helper.rb +23 -23
- data/lib/sproutcore/helpers/capture_helper.rb +10 -10
- data/lib/sproutcore/helpers/static_helper.rb +39 -26
- data/lib/sproutcore/helpers/tag_helper.rb +10 -10
- data/lib/sproutcore/helpers/text_helper.rb +36 -36
- data/lib/sproutcore/helpers.rb +1 -1
- data/lib/sproutcore/jsdoc.rb +10 -10
- data/lib/sproutcore/jsmin.rb +14 -14
- data/lib/sproutcore/library.rb +135 -87
- data/lib/sproutcore/merb/bundle_controller.rb +77 -54
- data/lib/sproutcore/merb/router.rb +19 -12
- data/lib/sproutcore/merb.rb +1 -1
- data/lib/sproutcore/version.rb +1 -1
- data/lib/sproutcore/view_helpers.rb +121 -121
- data/lib/sproutcore.rb +5 -7
- data/sc-config.rb +6 -0
- data/sc_generators/client/README +1 -1
- data/sc_generators/client/USAGE +1 -2
- data/sc_generators/client/client_generator.rb +6 -6
- data/sc_generators/client/templates/core.js +2 -2
- data/sc_generators/client/templates/english.lproj/body.css +79 -81
- data/sc_generators/client/templates/english.lproj/strings.js +1 -2
- data/sc_generators/client/templates/main.js +6 -8
- data/sc_generators/controller/USAGE +1 -2
- data/sc_generators/controller/controller_generator.rb +7 -7
- data/sc_generators/controller/templates/controller.js +3 -3
- data/sc_generators/controller/templates/test.rhtml +1 -1
- data/sc_generators/framework/README +1 -2
- data/sc_generators/framework/USAGE +2 -3
- data/sc_generators/framework/framework_generator.rb +5 -5
- data/sc_generators/framework/templates/core.js +3 -3
- data/sc_generators/framework/templates/english.lproj/strings.js +1 -2
- data/sc_generators/language/USAGE +1 -2
- data/sc_generators/language/language_generator.rb +6 -6
- data/sc_generators/language/templates/strings.js +1 -2
- data/sc_generators/model/USAGE +1 -2
- data/sc_generators/model/model_generator.rb +7 -7
- data/sc_generators/model/templates/fixture.js +26 -26
- data/sc_generators/model/templates/model.js +5 -5
- data/sc_generators/model/templates/test.rhtml +2 -2
- data/sc_generators/test/USAGE +1 -2
- data/sc_generators/test/templates/test.rhtml +2 -2
- data/sc_generators/test/test_generator.rb +6 -6
- data/sc_generators/view/USAGE +1 -2
- data/sc_generators/view/templates/test.rhtml +2 -2
- data/sc_generators/view/templates/view.js +3 -3
- data/sc_generators/view/view_generator.rb +7 -7
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/sproutcore_spec.rb +3 -3
- data/tasks/deployment.rake +4 -4
- metadata +4 -3
data/sc-config.rb
CHANGED
data/sc_generators/client/README
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Your new SproutCore client application has been created. To access your application, just start sc-server and visit your client name in the web browser.
|
|
2
2
|
|
|
3
|
-
If you want to change the deployment settings for your application edit the sc-config
|
|
3
|
+
If you want to change the deployment settings for your application edit the sc-config file to get started.
|
data/sc_generators/client/USAGE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
client - Generates a new SproutCore client
|
|
2
2
|
|
|
3
|
-
USAGE:
|
|
3
|
+
USAGE:
|
|
4
4
|
|
|
5
5
|
sc-gen client client_name
|
|
6
6
|
|
|
@@ -9,4 +9,3 @@ DISCUSSION:
|
|
|
9
9
|
This generator will create a new SproutCore-based JavaScript application. After the generator completes, you will be able to begin work immediately.
|
|
10
10
|
|
|
11
11
|
The code created by this generator will appear in a /clients directory. To add models, views, and controllers, you can use the additional generators model, controller, and view.
|
|
12
|
-
|
|
@@ -3,11 +3,11 @@ require 'sproutcore/generator_helper'
|
|
|
3
3
|
class ClientGenerator < RubiGen::Base
|
|
4
4
|
|
|
5
5
|
include SproutCore::GeneratorHelper
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
default_options :author => nil
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_reader :name
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def initialize(runtime_args, runtime_options = {})
|
|
12
12
|
super
|
|
13
13
|
usage if args.empty?
|
|
@@ -36,10 +36,10 @@ EOS
|
|
|
36
36
|
def add_options!(opts)
|
|
37
37
|
opts.on('-l', "--library=LIBRARY_ROOT", String, "Specify an alternate library root other than current working directory", "Default: working directory") { |options[:library_root] | }
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
def extract_options
|
|
41
41
|
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
42
42
|
@destination_root = File.expand_path(options[:library_root]) unless options[:library_root].nil?
|
|
43
43
|
end
|
|
44
|
-
|
|
45
|
-
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// your model objects are defined in to the prefix array.
|
|
9
9
|
server: SC.Server.create({ prefix: ['<%= class_name %>'] }),
|
|
10
10
|
|
|
11
|
-
// When you are in development mode, this array will be populated with
|
|
11
|
+
// When you are in development mode, this array will be populated with
|
|
12
12
|
// any fixtures you create for testing and loaded automatically in your
|
|
13
13
|
// main method. When in production, this will be an empty array.
|
|
14
14
|
FIXTURES: []
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
}) ;
|
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
/* Default CSS for welcome page. Delete this styling and replace it with your own. */
|
|
2
2
|
|
|
3
3
|
.sc-welcome {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
position: absolute ;
|
|
5
|
+
top: 0px;
|
|
6
|
+
left: 0px;
|
|
7
|
+
right: 0px;
|
|
8
|
+
bottom: 0px;
|
|
9
|
+
background-color: white ;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.sc-welcome img.logo {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
position: absolute ;
|
|
14
|
+
bottom: 80px;
|
|
15
|
+
left: 50%;
|
|
16
|
+
margin-left: -20px;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/* @group Message */
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
21
|
.sc-welcome .message {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
max-width: 800px;
|
|
23
|
+
margin-left: auto ;
|
|
24
|
+
margin-right: auto;
|
|
25
|
+
margin-top: 100px;
|
|
26
|
+
position: relative;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
.sc-welcome h1 {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
border: none ;
|
|
31
|
+
padding: 0;
|
|
32
|
+
margin: 0;
|
|
33
|
+
letter-spacing: -3px;
|
|
34
|
+
font: normal 6.4em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
.sc-welcome h3 {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
margin: 8px 12px;
|
|
39
|
+
padding: 0;
|
|
40
|
+
font: 1.5em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
|
|
41
|
+
color: #808080;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
/* @end */
|
|
@@ -48,28 +46,28 @@
|
|
|
48
46
|
/* @group Sticky Note */
|
|
49
47
|
|
|
50
48
|
.sc-welcome .sticky-note {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
position: absolute ;
|
|
50
|
+
right: 0;
|
|
51
|
+
top: -70px;
|
|
52
|
+
width: 320px;
|
|
53
|
+
height: 300px;
|
|
54
|
+
padding: 60px;
|
|
55
|
+
padding-right: 20px;
|
|
56
|
+
background: static_url('sticky-note') no-repeat center center;
|
|
57
|
+
font: 1.3em "Comic Sans MS", "Comic Sans", Arial, Helvetica, Geneva, sans-serif;
|
|
58
|
+
color: #5f4700;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
.sc-welcome .sticky-note p {
|
|
64
|
-
|
|
62
|
+
font-weight: bold ;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
.sc-welcome .sticky-note ul {
|
|
68
|
-
|
|
66
|
+
padding: 0 10px ;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
.sc-welcome .sticky-note li {
|
|
72
|
-
|
|
70
|
+
margin: 8px 0 ;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
/* @end */
|
|
@@ -77,72 +75,72 @@
|
|
|
77
75
|
/* @group For Tutorial */
|
|
78
76
|
|
|
79
77
|
body {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
position: absolute ;
|
|
79
|
+
left: 0;
|
|
80
|
+
right: 0;
|
|
81
|
+
top: 0;
|
|
82
|
+
bottom: 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
margin: 0;
|
|
85
|
+
overflow: hidden ;
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
.workspace .sidebar {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
position: absolute;
|
|
90
|
+
left: 0;
|
|
91
|
+
top: 0;
|
|
92
|
+
width: 200px;
|
|
93
|
+
bottom: 0;
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
.workspace .sidebar .master_list {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
position: absolute;
|
|
98
|
+
left: 0;
|
|
99
|
+
top: 0;
|
|
100
|
+
right: 0;
|
|
101
|
+
bottom: 0;
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
.workspace .sc-split-divider-view {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
position: absolute;
|
|
106
|
+
left: 200px;
|
|
107
|
+
top: 0;
|
|
108
|
+
bottom: 0;
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
.workspace .detail_view {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: 205px;
|
|
114
|
+
right: 0;
|
|
115
|
+
top: 0;
|
|
116
|
+
bottom: 0;
|
|
117
|
+
border: none ;
|
|
118
|
+
background-color: #aaa;
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
.workspace .detail_view .card-detail {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
margin-left: auto;
|
|
123
|
+
margin-right: auto;
|
|
124
|
+
top: 100px;
|
|
125
|
+
position: relative;
|
|
126
|
+
border: 4px #888 solid;
|
|
127
|
+
background: #f0f0f0;
|
|
128
|
+
padding-top: 10px;
|
|
129
|
+
padding-bottom: 10px;
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
.workspace .detail_view .card-detail td {
|
|
135
|
-
|
|
133
|
+
padding: 0 10px;
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
.workspace .detail_view .card-detail .buttons {
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
text-align: right;
|
|
138
|
+
padding-top: 10px;
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
.workspace .detail_view .card-detail input {
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
font-size: 14px;
|
|
143
|
+
width: 300px;
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
/* @end */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// <%= class_name %> English Strings
|
|
3
3
|
// ==========================================================================
|
|
4
4
|
|
|
5
|
-
// Place strings you want to localize here. In your app, use the key and
|
|
5
|
+
// Place strings you want to localize here. In your app, use the key and
|
|
6
6
|
// localize it using "key string".loc(). HINT: For your key names, use the
|
|
7
7
|
// english string with an underscore in front. This way you can still see
|
|
8
8
|
// how your UI will look and you'll notice right away when something needs a
|
|
@@ -11,4 +11,3 @@
|
|
|
11
11
|
Object.extend(String.English,{
|
|
12
12
|
// "_String Key": "Localized String"
|
|
13
13
|
}) ;
|
|
14
|
-
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// <%= class_name %>
|
|
3
3
|
// ==========================================================================
|
|
4
4
|
|
|
5
|
-
// This is the function that will start your app running. The default
|
|
5
|
+
// This is the function that will start your app running. The default
|
|
6
6
|
// implementation will load any fixtures you have created then instantiate
|
|
7
7
|
// your controllers and awake the elements on your page.
|
|
8
8
|
//
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// See comments for some pointers on what to do next.
|
|
11
11
|
//
|
|
12
12
|
function main() {
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
// Step 1: Load Your Model Data
|
|
15
15
|
// The default code here will load the fixtures you have defined.
|
|
16
16
|
// Comment out the preload line and add something to refresh from the server
|
|
@@ -19,19 +19,17 @@ function main() {
|
|
|
19
19
|
|
|
20
20
|
// TODO: refresh() any collections you have created to get their records.
|
|
21
21
|
// ex: <%= class_name %>.contacts.refresh() ;
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
// Step 2: Instantiate Your Views
|
|
24
24
|
// The default code just activates all the views you have on the page. If
|
|
25
25
|
// your app gets any level of complexity, you should just get the views you
|
|
26
26
|
// need to show the app in the first place, to speed things up.
|
|
27
27
|
SC.page.awake() ;
|
|
28
28
|
|
|
29
|
-
// Step 3. Set the content property on your primary controller.
|
|
29
|
+
// Step 3. Set the content property on your primary controller.
|
|
30
30
|
// This will make your app come alive!
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
// TODO: Set the content property on your primary controller
|
|
33
33
|
// ex: <%= class_name %>.contactsController.set('content',<%= class_name %>.contacts);
|
|
34
|
-
|
|
35
|
-
} ;
|
|
36
|
-
|
|
37
34
|
|
|
35
|
+
} ;
|
|
@@ -3,7 +3,7 @@ sc_controller - Create a new controller object in your SproutCore client.
|
|
|
3
3
|
USAGE:
|
|
4
4
|
|
|
5
5
|
./script/generate controller client_name/controller_name [CLASS]
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
DISCUSSION:
|
|
8
8
|
|
|
9
9
|
This generator will create a new SproutCore object in your client for us as a controller. You should pass as the first parameter your client directory name/the controller you want to create. For example:
|
|
@@ -13,4 +13,3 @@ This generator will create a new SproutCore object in your client for us as a co
|
|
|
13
13
|
defines a new object called Todos.taskController in the file clients/todos/controllers/task.js.
|
|
14
14
|
|
|
15
15
|
This generator creates objects that inherit from SC.Object. You can override this by passing a classname as the second parameter. You can also use the specialize sc_object_controller and sc_collection_controller generators to create those specific types of controllers.
|
|
16
|
-
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'sproutcore/generator_helper'
|
|
2
2
|
|
|
3
3
|
class ControllerGenerator < RubiGen::Base
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
include SproutCore::GeneratorHelper
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
default_options :author => nil
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_reader :name, :client_location
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def initialize(runtime_args, runtime_options = {})
|
|
12
12
|
super
|
|
13
13
|
usage if args.empty?
|
|
@@ -21,7 +21,7 @@ class ControllerGenerator < RubiGen::Base
|
|
|
21
21
|
fp = client_file_path('controllers','js','controller')
|
|
22
22
|
build_client_directories(m, fp)
|
|
23
23
|
m.template 'controller.js', fp
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
fp = client_file_path('tests/controllers', 'rhtml')
|
|
26
26
|
build_client_directories(m, fp)
|
|
27
27
|
m.template 'test.rhtml', fp
|
|
@@ -40,7 +40,7 @@ EOS
|
|
|
40
40
|
def add_options!(opts)
|
|
41
41
|
opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
|
|
42
42
|
end
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
def extract_options
|
|
45
45
|
@client_location = options[:loc]
|
|
46
46
|
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
@@ -48,4 +48,4 @@ EOS
|
|
|
48
48
|
# raw instance variable value.
|
|
49
49
|
# @author = options[:author]
|
|
50
50
|
end
|
|
51
|
-
end
|
|
51
|
+
end
|
|
@@ -9,13 +9,13 @@ require('core');
|
|
|
9
9
|
(Document Your View Here)
|
|
10
10
|
|
|
11
11
|
@extends <%= base_class_name 'SC.Object' %>
|
|
12
|
-
@author
|
|
12
|
+
@author AuthorName
|
|
13
13
|
@version 0.1
|
|
14
14
|
@static
|
|
15
15
|
*/
|
|
16
16
|
<%= controller_instance_name %> = <%= base_class_name 'SC.Object' %>.create(
|
|
17
17
|
/** @scope <%= controller_instance_name %> */ {
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
// TODO: Add your own code here.
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
}) ;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
Your new framework has been created. To include it in your clients, be sure to edit your
|
|
1
|
+
Your new framework has been created. To include it in your clients, be sure to edit your sc-config file, adding someting like this:
|
|
2
2
|
|
|
3
3
|
all:
|
|
4
4
|
requires: [<%= name %>]
|
|
5
5
|
|
|
6
6
|
Then restart your sc-server and you should be ready to go.
|
|
7
|
-
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
framework - Generates a new SproutCore framework
|
|
2
2
|
|
|
3
|
-
USAGE:
|
|
3
|
+
USAGE:
|
|
4
4
|
|
|
5
5
|
./script/generate framework framework_name
|
|
6
6
|
|
|
7
7
|
DISCUSSION:
|
|
8
8
|
|
|
9
|
-
This generator will create a new SproutCore-based JavaScript framework for use by other SproutCore clients. After the generator completes, you will need to add it as a requirement to your
|
|
9
|
+
This generator will create a new SproutCore-based JavaScript framework for use by other SproutCore clients. After the generator completes, you will need to add it as a requirement to your sc-config.
|
|
10
10
|
|
|
11
11
|
The code created by this generator will appear in a /frameworks directory. To add models, views, and controllers, you can use the additional generators model, controller, object_controller, collection_controller, and view.
|
|
12
|
-
|
|
@@ -3,11 +3,11 @@ require 'sproutcore/generator_helper'
|
|
|
3
3
|
class FrameworkGenerator < RubiGen::Base
|
|
4
4
|
|
|
5
5
|
include SproutCore::GeneratorHelper
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
default_options :author => nil
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_reader :name
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def initialize(runtime_args, runtime_options = {})
|
|
12
12
|
super
|
|
13
13
|
usage if args.empty?
|
|
@@ -43,11 +43,11 @@ EOS
|
|
|
43
43
|
# "Default: none") { |options[:author]| }
|
|
44
44
|
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
def extract_options
|
|
48
48
|
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
49
49
|
# Templates can access these value via the attr_reader-generated methods, but not the
|
|
50
50
|
# raw instance variable value.
|
|
51
51
|
# @author = options[:author]
|
|
52
52
|
end
|
|
53
|
-
end
|
|
53
|
+
end
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
// ==========================================================================
|
|
4
4
|
|
|
5
5
|
<%= class_name %> = SC.Object.create({
|
|
6
|
-
|
|
7
|
-
// When you are in development mode, this array will be populated with
|
|
6
|
+
|
|
7
|
+
// When you are in development mode, this array will be populated with
|
|
8
8
|
// any fixtures you create for testing and loaded automatically in your
|
|
9
9
|
// main method. When in production, this will be an empty array.
|
|
10
10
|
//
|
|
11
11
|
// You will use this most often when running unit tests in dev mode.
|
|
12
12
|
//
|
|
13
13
|
FIXTURES: []
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
// Add any global constants or other properties used by the entire
|
|
16
16
|
// framework:
|
|
17
17
|
// CONSTANT_NAME: 'some-value'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// <%= class_name %> English Strings
|
|
3
3
|
// ==========================================================================
|
|
4
4
|
|
|
5
|
-
// Place strings you want to localize here. In your app, use the key and
|
|
5
|
+
// Place strings you want to localize here. In your app, use the key and
|
|
6
6
|
// localize it using "key string".loc(). HINT: For your key names, use the
|
|
7
7
|
// english string with an underscore in front. This way you can still see
|
|
8
8
|
// how your UI will look and you'll notice right away when something needs a
|
|
@@ -11,4 +11,3 @@
|
|
|
11
11
|
Object.extend(String.English,{
|
|
12
12
|
// "_String Key": "Localized String"
|
|
13
13
|
}) ;
|
|
14
|
-
|
|
@@ -3,7 +3,7 @@ sc_view - Create a new view class in your SproutCore client.
|
|
|
3
3
|
USAGE:
|
|
4
4
|
|
|
5
5
|
./script/generate view client_name/view_name [CLASS]
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
DISCUSSION:
|
|
8
8
|
|
|
9
9
|
This generator will create a new SproutCore view class in your client. You should pass as the first parameter your client directory name/the view you want to create. For example:
|
|
@@ -13,4 +13,3 @@ This generator will create a new SproutCore view class in your client. You shou
|
|
|
13
13
|
defines a new class called Todos.TaskView in the file clients/todos/views/task.js.
|
|
14
14
|
|
|
15
15
|
This generator creates view that inherit from SC.View but you can override this by passing the name of the view class you want as the second argument.
|
|
16
|
-
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'sproutcore/generator_helper'
|
|
2
2
|
|
|
3
3
|
class LanguageGenerator < RubiGen::Base
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
include SproutCore::GeneratorHelper
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
default_options :author => nil
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_reader :name, :client_location
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def initialize(runtime_args, runtime_options = {})
|
|
12
12
|
super
|
|
13
13
|
usage if args.empty?
|
|
@@ -36,7 +36,7 @@ EOS
|
|
|
36
36
|
def add_options!(opts)
|
|
37
37
|
opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
def extract_options
|
|
41
41
|
@client_location = options[:loc]
|
|
42
42
|
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
@@ -44,4 +44,4 @@ EOS
|
|
|
44
44
|
# raw instance variable value.
|
|
45
45
|
# @author = options[:author]
|
|
46
46
|
end
|
|
47
|
-
end
|
|
47
|
+
end
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// <%= client_namespace %> <%= file_name.capitalize %> Strings
|
|
3
3
|
// ==========================================================================
|
|
4
4
|
|
|
5
|
-
// HINT: For your key names, use the english string with an underscore in
|
|
5
|
+
// HINT: For your key names, use the english string with an underscore in
|
|
6
6
|
// front.
|
|
7
7
|
Object.extend(String.<%= file_name.capitalize %>,{
|
|
8
8
|
// "_String Key": "Localized String"
|
|
9
9
|
}) ;
|
|
10
|
-
|
data/sc_generators/model/USAGE
CHANGED
|
@@ -3,7 +3,7 @@ model - Create a new model class in your SproutCore client.
|
|
|
3
3
|
USAGE:
|
|
4
4
|
|
|
5
5
|
./script/generate model client_name/model_name [MODEL_CLASS]
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
DISCUSSION:
|
|
8
8
|
|
|
9
9
|
This generator will create a new SproutCore model file in your client or framework. You should pass as the first parameter your client or framework directory name/the model you want to create. For example:
|
|
@@ -21,4 +21,3 @@ defines a new class called Shared.Task in the file frameworks/shared/models/task
|
|
|
21
21
|
This generator creates classes that inherit from SC.Record but you can override this by passing the name of the view class you want as the second argument.
|
|
22
22
|
|
|
23
23
|
In addition to creating a model class, this will also create a stub for you to add Fixture data. This is a convenient way to preload your application with data while you develop the client but have not yet connected to your server.
|
|
24
|
-
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'sproutcore/generator_helper'
|
|
2
2
|
|
|
3
3
|
class ModelGenerator < RubiGen::Base
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
include SproutCore::GeneratorHelper
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
default_options :author => nil
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_reader :name, :client_location
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def initialize(runtime_args, runtime_options = {})
|
|
12
12
|
super
|
|
13
13
|
usage if args.empty?
|
|
@@ -25,7 +25,7 @@ class ModelGenerator < RubiGen::Base
|
|
|
25
25
|
fp = client_file_path('fixtures','js')
|
|
26
26
|
build_client_directories(m, fp)
|
|
27
27
|
m.template 'fixture.js', fp
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
fp = client_file_path('tests/models', 'rhtml')
|
|
30
30
|
build_client_directories(m, fp)
|
|
31
31
|
m.template 'test.rhtml', fp
|
|
@@ -44,7 +44,7 @@ EOS
|
|
|
44
44
|
def add_options!(opts)
|
|
45
45
|
opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
def extract_options
|
|
49
49
|
@client_location = options[:loc]
|
|
50
50
|
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
@@ -52,4 +52,4 @@ EOS
|
|
|
52
52
|
# raw instance variable value.
|
|
53
53
|
# @author = options[:author]
|
|
54
54
|
end
|
|
55
|
-
end
|
|
55
|
+
end
|