sproutit-sproutcore 1.0.20090721145280 → 1.0.20090721145281

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 20090721145280
4
- :digest: a7b4c9fd0f255164097a428ff3b8b6a640bdd389
3
+ :patch: 20090721145281
4
+ :digest: ba83b210ad765939b203da70844f9799493ef006
5
5
  :major: 1
data/bin/sc-docs ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ # ===========================================================================
4
+ # Project: Abbot - SproutCore Build Tools
5
+ # Copyright: ©2009 Apple, Inc.
6
+ # portions copyright @2006-2009 Sprout Systems, Inc.
7
+ # and contributors
8
+ # ===========================================================================
9
+
10
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib sproutcore]))
11
+
12
+ SC::Tools.invoke :docs
13
+
14
+ # EOF
@@ -2,11 +2,15 @@ function publish(symbolSet) {
2
2
  publish.conf = { // trailing slash expected for dirs
3
3
  ext: ".html",
4
4
  outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
5
- templatesDir: SYS.pwd+"../templates/jsdoc/",
5
+ templatesDir: JSDOC.opt.t || SYS.pwd+"../doc_templates/jsdoc/",
6
6
  symbolsDir: "symbols/",
7
7
  srcDir: "symbols/src/"
8
8
  };
9
-
9
+
10
+ if (!publish.conf.templatesDir.match(/\/$/)) {
11
+ publish.conf.templatesDir += '/'; // add trailing slash
12
+ }
13
+
10
14
 
11
15
  if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
12
16
  Link.prototype._makeSrcLink = function(srcFilePath) {
@@ -168,11 +168,14 @@ function publish(symbolSet) {
168
168
  publish.conf = { // trailing slash expected for dirs
169
169
  ext: ".html",
170
170
  outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
171
- templatesDir: SYS.pwd+"../templates/sproutcore/",
171
+ templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/sproutcore/",
172
172
  symbolsDir: "symbols/",
173
173
  srcDir: "symbols/src/"
174
174
  };
175
175
 
176
+ if (!publish.conf.templatesDir.match(/\/$/)) {
177
+ publish.conf.templatesDir += '/'; // add trailing slash
178
+ }
176
179
 
177
180
  if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
178
181
  Link.prototype._makeSrcLink = function(srcFilePath) {
@@ -226,13 +229,22 @@ function publish(symbolSet) {
226
229
  publish.classesIndex = classesTemplate.process(classes);
227
230
 
228
231
  try {
229
- var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
232
+ var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"classes-json.tmpl");
230
233
  }
231
234
  catch(e) { print(e.message); quit(); }
232
235
 
233
236
  var classesIndex = classesindexTemplate.process(classes);
234
237
  // IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
235
- IO.saveFile(publish.conf.outDir, "classes.js", classesIndex);
238
+ IO.saveFile(publish.conf.outDir, "classes.json", classesIndex);
239
+ classesindexTemplate = classesIndex = null;
240
+
241
+ try {
242
+ var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
243
+ }
244
+ catch(e) { print(e.message); quit(); }
245
+
246
+ var classesIndex = classesindexTemplate.process(classes);
247
+ IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
236
248
  classesindexTemplate = classesIndex = classes = null;
237
249
 
238
250
  try {
@@ -1,4 +1,3 @@
1
- /* @override http://localhost:4020/static/sproutcore/-docs/data/default.css */
2
1
 
3
2
  /* @group Core */
4
3
 
@@ -8,8 +7,9 @@ body.sc-doc {
8
7
  }
9
8
 
10
9
  .sc-doc {
11
- font: 64.5% Helvetica, Arial, Verdana, sans-serif;
12
- line-height: 1em ;
10
+ font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
11
+ font-size: 10px;
12
+ line-height: 1;
13
13
  }
14
14
 
15
15
  /* Set standard size on some things. */
@@ -18,8 +18,8 @@ body.sc-doc {
18
18
  .sc-doc dt,
19
19
  .sc-doc li,
20
20
  .sc-doc table {
21
- line-height: 1.3em;
22
- font-size: 1.2em ;
21
+ font-size: 12px;
22
+ line-height: 1.4;
23
23
  }
24
24
 
25
25
  hr
@@ -35,10 +35,10 @@ hr
35
35
 
36
36
  .sc-doc h2 {
37
37
  padding: 0;
38
- padding-bottom: 4px;
39
- border-bottom: 1px #555 solid;
38
+ padding-bottom: 3px;
39
+ border-bottom: 1px #aaa solid;
40
40
  text-transform: capitalize;
41
- margin: 1.5em 0 0;
41
+ margin: 2em 0 0.5em;
42
42
  font-size: 2.2em;
43
43
  }
44
44
 
@@ -61,7 +61,7 @@ hr
61
61
  margin: 1.3em 0 0.5em 0;
62
62
  }
63
63
 
64
- .sc-doc p { margin: 0.5em 0; }
64
+ .sc-doc p { margin: 1.5em 0; }
65
65
 
66
66
  .sc-doc a {
67
67
  text-decoration: none ;
@@ -81,10 +81,11 @@ hr
81
81
 
82
82
  .sc-doc dt {
83
83
  font-style: italic;
84
+ line-height: 2;
84
85
  }
85
86
 
86
87
  .sc-doc dd {
87
- margin: 0 0 1em 1em;
88
+ margin: 0 1em 1em 1em;
88
89
  }
89
90
 
90
91
  /* @end */
@@ -132,7 +133,7 @@ hr
132
133
  }
133
134
 
134
135
  .sc-doc .summary li code {
135
- font-size: 1.1em;
136
+ font-size: 1em;
136
137
  }
137
138
 
138
139
  .sc-doc .summary li .description {
@@ -141,14 +142,14 @@ hr
141
142
 
142
143
  .sc-doc .summary li:hover .description {
143
144
  display: block ;
144
- font-size: 0.86em;
145
+ font-size: 1em;
145
146
  position: absolute ;
146
147
  left: 80px;
147
148
  bottom: 2em;
148
149
  padding: 0.3em 1em ;
149
150
  background-color: #fff898;
150
151
  border: 1px solid #bbae2f;
151
- /* -webkit-box-shadow: rgba(0,0,0,0.3) 0px 2px 5px; */
152
+ -webkit-box-shadow: rgba(0,0,0,0.3) 0px 2px 5px;
152
153
  color: #4b4000;
153
154
  z-index: 100;
154
155
  }
@@ -210,3 +211,48 @@ span.sc-label
210
211
  overflow: hidden;
211
212
  width: 50px;
212
213
  }
214
+
215
+ /* @group Index */
216
+
217
+ #index {
218
+ padding-bottom: 2em;
219
+ }
220
+
221
+ #index > div {
222
+ clear: both;
223
+ position: relative;
224
+ font-size: 12px;
225
+ padding: 10px;
226
+ padding-left: 220px;
227
+ min-height: 14px;
228
+ border-bottom: 1px #ddd solid;
229
+ }
230
+
231
+ #index hr {
232
+ display: none;
233
+ }
234
+
235
+ #index h2 {
236
+ font-size: 14px;
237
+ border: none;
238
+ position: absolute;
239
+ left: 0;
240
+ top: 50%;
241
+ height: 14px;
242
+ margin: 0;
243
+ margin-top: -7px;
244
+ width: 200px;
245
+ text-align: right;
246
+ }
247
+
248
+ #index h2 a {
249
+ padding: 2px;
250
+ }
251
+
252
+ #index h2 a:hover {
253
+ background-color: blue;
254
+ color: white;
255
+ }
256
+
257
+ /* @end */
258
+
@@ -13,7 +13,8 @@
13
13
  <html xmlns="http://www.w3.org/1999/xhtml">
14
14
  <head>
15
15
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
16
- <meta http-equiv="X-UA-Compatible" content="IE=8" />
16
+ <meta http-equiv="X-UA-Compatible" content="IE=8" />
17
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
17
18
  <% # Set the 'title' in your config to alter this setting %>
18
19
  <title><%= title %></title>
19
20
  <% #
@@ -27,7 +27,7 @@ module SC
27
27
  #
28
28
  # When you load a project, here is what happens:
29
29
  #
30
- # 1. Kocate and load Buildfiles, if any are found
30
+ # 1. Locate and load Buildfiles, if any are found
31
31
  # 2. Run project_type:target:find for all targets defined for the project.
32
32
  # this will locate and define the targets for the project
33
33
  # 3. If you request a build of a particular resource, a manifest will be
@@ -264,7 +264,4 @@ module SC
264
264
 
265
265
  end
266
266
 
267
- end
268
-
269
-
270
-
267
+ end
@@ -172,7 +172,7 @@ module SC
172
172
  t
173
173
  end
174
174
  ret = ret.compact.uniq
175
-
175
+
176
176
  @required_targets[key] = ret
177
177
  return ret
178
178
  end
@@ -397,6 +397,110 @@ module SC
397
397
  # None found
398
398
  return nil
399
399
  end
400
+
401
+ ######################################################
402
+ # BUILD DOCS METHODS
403
+ #
404
+
405
+ # Creates all of the documentation for the target.
406
+ #
407
+ # === Options
408
+ #
409
+ # :build_root:: the root path to place built documentation
410
+ # :language:: the language to build. defaults to preferred lang
411
+ # :required:: include required targets. defaults to true
412
+ def build_docs!(opts ={})
413
+
414
+ build_root = opts[:build_root] || nil
415
+ language = opts[:language] || self.config.preferred_language || :en
416
+ logger = opts[:logger] || SC.logger
417
+ template_name = opts[:template] || 'jsdoc'
418
+ use_required = opts[:required]
419
+ use_required = true if use_required.nil?
420
+
421
+ # collect targets to build
422
+ doc_targets = [self]
423
+ doc_targets += self.expand_required_targets if use_required
424
+
425
+ # convert targets to manifests so we can get alll files
426
+ doc_manifests = doc_targets.map do |target|
427
+ target.manifest_for(:language => language)
428
+ end
429
+
430
+ # Collect all source entries, in the order they should be loaded
431
+ file_list = []
432
+ doc_manifests.each do |manifest|
433
+ entry = manifest.build!.entry_for('javascript.js')
434
+ next if entry.nil?
435
+
436
+ # loop over entries, collecting their source entries until we get
437
+ # back to the original source files. Since we expand these entries
438
+ # in their proper load order this should give us something suitable
439
+ # to hand to jsdoc.
440
+ entries = entry.ordered_entries || entry.source_entries
441
+ while entries && entries.size>0
442
+ new_entries = []
443
+ entries.each do |cur_entry|
444
+ sources = cur_entry.ordered_entries || cur_entry.source_entries
445
+ if sources
446
+ new_entries += sources
447
+ elsif entry.filename =~ /\.js$/
448
+ file_list << cur_entry.source_path
449
+ end
450
+ end
451
+ entries = new_entries
452
+ end
453
+ end
454
+
455
+ file_list = file_list.uniq # remove duplicates
456
+
457
+ logger.info "Building #{target_name} docs at #{build_root}"
458
+ FileUtils.mkdir_p(build_root)
459
+
460
+ # Prepare jsdoc opts
461
+ jsdoc_root = SC::PATH / 'vendor' / 'jsdoc'
462
+ jar_path = jsdoc_root / 'jsrun.jar'
463
+ runjs_path = jsdoc_root / 'app' / 'run.js'
464
+
465
+ # look for a directory matching the template name
466
+ cur_project = self.project
467
+ has_template = false
468
+ while cur_project
469
+ template_path = cur_project.project_root / 'doc_templates' / template_name
470
+ has_template = File.directory?(template_path)
471
+ cur_project = has_template ? nil : cur_project.parent_project
472
+ end
473
+
474
+ if !has_template
475
+ cur_project = self.project
476
+ has_template = false
477
+ while cur_project
478
+ template_path = cur_project.project_root / template_name
479
+ has_template = File.directory?(template_path)
480
+ cur_project = has_template ? nil : cur_project.parent_project
481
+ end
482
+ end
483
+ throw("could not find template named #{template_name}") if !has_template
484
+
485
+ # wrap files in quotes...
486
+ # Note: using -server gives an approx. 25% speed boost over -client
487
+ # (the default)
488
+ js_doc_cmd = %(java -server -Djsdoc.dir="#{jsdoc_root}" -jar "#{jar_path}" "#{runjs_path}" -t="#{template_path}" -d="#{build_root}" "#{ file_list * '" "' }" -v)
489
+
490
+ logger.info "File Manifest:\r\n"
491
+ file_list.each { |file_path| logger.info(file_path) }
492
+
493
+ puts "Generating docs for #{self.target_name}\r\nPlease be patient this could take awhile..."
494
+
495
+ # use pipe so that we can immediately log output as it happens
496
+ IO.popen(js_doc_cmd) do |pipe|
497
+ while line = pipe.gets
498
+ logger.info line.sub(/\n$/,'')
499
+ end
500
+ end
501
+
502
+ puts "Finished."
503
+ end
400
504
 
401
505
  end
402
506
 
@@ -0,0 +1,53 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ===========================================================================
3
+ # Project: Abbot - SproutCore Build Tools
4
+ # Copyright: ©2009 Apple, Inc.
5
+ # portions copyright @2006-2009 Sprout Systems, Inc.
6
+ # and contributors
7
+ # ===========================================================================
8
+
9
+ require File.expand_path(File.join(File.dirname(__FILE__), 'manifest'))
10
+
11
+ module SC
12
+ class Tools
13
+
14
+ desc "sc-docs [TARGET..]", "Generates JSDoc's for specified targets."
15
+ method_options(:entries => :optional,
16
+ :clean => true,
17
+ :language => :optional,
18
+ :template => :optional,
19
+ ['--include-required', '-r'] => false)
20
+ def docs(*targets)
21
+
22
+ SC.env.build_prefix = options.buildroot if options.buildroot
23
+ SC.env.clean = options.clean
24
+ SC.env.build_required = options['include-required']
25
+ SC.env.language = options.language
26
+ SC.env.template_name = options.template
27
+
28
+ # Find all the targets
29
+ targets = find_targets(*targets)
30
+ targets.each do |target|
31
+ project_root = target.project.project_root
32
+ build_root = project_root / 'tmp' / 'docs' / target.target_name.to_s
33
+
34
+ if [:framework, :app].include?(target.target_type)
35
+ if SC.env.clean
36
+ SC.logger.info "Cleaning #{build_root}"
37
+ FileUtils.rm_r(build_root) if File.directory?(build_root)
38
+ end
39
+
40
+ target.build_docs!(:build_root => build_root,
41
+ :language => SC.env.language,
42
+ :required => SC.env.build_required,
43
+ :template => SC.env.template_name,
44
+ :logger => SC.logger)
45
+ else
46
+ SC.logger.info "#{target.target_name} is not of type framework or app. Skipping."
47
+ SC.logger.info "#{target.target_name} is of type #{target.target_type}."
48
+
49
+ end # if [:framework, :app]
50
+ end # targets.each
51
+ end # def docs
52
+ end # class Tools
53
+ end # module SC
@@ -259,7 +259,7 @@ module SC
259
259
  end
260
260
 
261
261
  # Core method to process command line options and then build a manifest.
262
- # Shared by sc-manifest and sc-build commands.
262
+ # Shared by sc-manifest, sc-build and sc-docs commands.
263
263
  def build_manifests(*targets)
264
264
 
265
265
  requires_project! # get project
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sproutit-sproutcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20090721145280
4
+ version: 1.0.20090721145281
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sprout Systems, Inc. Apple, Inc. and contributors
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-23 00:00:00 -07:00
12
+ date: 2009-07-28 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ email: contact@sproutcore.com
67
67
  executables:
68
68
  - sc-build
69
69
  - sc-build-number
70
+ - sc-docs
70
71
  - sc-gen
71
72
  - sc-init
72
73
  - sc-manifest
@@ -86,6 +87,7 @@ files:
86
87
  - VERSION.yml
87
88
  - bin/sc-build
88
89
  - bin/sc-build-number
90
+ - bin/sc-docs
89
91
  - bin/sc-gen
90
92
  - bin/sc-init
91
93
  - bin/sc-manifest
@@ -96,6 +98,14 @@ files:
96
98
  - buildtasks/manifest.rake
97
99
  - buildtasks/render.rake
98
100
  - buildtasks/target.rake
101
+ - doc_templates/jsdoc/publish.js
102
+ - doc_templates/jsdoc/static/default.css
103
+ - doc_templates/jsdoc/static/header.html
104
+ - doc_templates/jsdoc/static/index.html
105
+ - doc_templates/sproutcore/publish.js
106
+ - doc_templates/sproutcore/static/default.css
107
+ - doc_templates/sproutcore/static/header.html
108
+ - doc_templates/sproutcore/static/index.html
99
109
  - frameworks/sproutcore/Buildfile
100
110
  - frameworks/sproutcore/HISTORY
101
111
  - frameworks/sproutcore/README
@@ -798,6 +808,7 @@ files:
798
808
  - lib/sproutcore/tools.rb
799
809
  - lib/sproutcore/tools/build.rb
800
810
  - lib/sproutcore/tools/build_number.rb
811
+ - lib/sproutcore/tools/docs.rb
801
812
  - lib/sproutcore/tools/gen.rb
802
813
  - lib/sproutcore/tools/init.rb
803
814
  - lib/sproutcore/tools/manifest.rb
@@ -918,14 +929,6 @@ files:
918
929
  - vendor/jsdoc/jsrun.jar
919
930
  - vendor/jsdoc/t/TestDoc.js
920
931
  - vendor/jsdoc/t/runner.js
921
- - vendor/jsdoc/templates/jsdoc/publish.js
922
- - vendor/jsdoc/templates/jsdoc/static/default.css
923
- - vendor/jsdoc/templates/jsdoc/static/header.html
924
- - vendor/jsdoc/templates/jsdoc/static/index.html
925
- - vendor/jsdoc/templates/sproutcore/publish.js
926
- - vendor/jsdoc/templates/sproutcore/static/default.css
927
- - vendor/jsdoc/templates/sproutcore/static/header.html
928
- - vendor/jsdoc/templates/sproutcore/static/index.html
929
932
  - vendor/jsdoc/test.js
930
933
  - vendor/jsdoc/test/addon.js
931
934
  - vendor/jsdoc/test/anon_inner.js
@@ -969,6 +972,7 @@ files:
969
972
  - vendor/yui-compressor/yuicompressor-2.4.2.jar
970
973
  has_rdoc: false
971
974
  homepage: http://www.sproutcore.com/sproutcore
975
+ licenses:
972
976
  post_install_message:
973
977
  rdoc_options:
974
978
  - --charset=UTF-8
@@ -989,7 +993,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
989
993
  requirements: []
990
994
 
991
995
  rubyforge_project: sproutcore
992
- rubygems_version: 1.2.0
996
+ rubygems_version: 1.3.5
993
997
  signing_key:
994
998
  specification_version: 3
995
999
  summary: SproutCore is a platform for building native look-and-feel applications on the web