Skip to content

Commit

Permalink
First pass at YUIDoc conversion
Browse files Browse the repository at this point in the history
Upgraded docs for ember-metal and added a custom theme with a few
tweaks.
  • Loading branch information
wagenet committed Sep 13, 2012
1 parent d34adc2 commit 1325935
Show file tree
Hide file tree
Showing 23 changed files with 796 additions and 532 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ assets/bpm_styles.css
bin/
coverage
dist
docs
docs/build
docs/node_modules
lib/*/tests/all.js
lib/*/tests/qunit*
lib/bundler/man
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ gem "uglifier", :git => "https://github.com/lautis/uglifier.git"
group :development do
gem "rack"
gem "github_downloads", :git => "https://github.com/pangratz/github_downloads.git"
gem "ember-docs", :git => "https://github.com/emberjs/docs-generator.git"
gem "kicker"
end
9 changes: 0 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
GIT
remote: https://github.com/emberjs/docs-generator.git
revision: cfbc2a3aabc08de305224b290ad8f37f3ef5f847
specs:
ember-docs (0.1)
rack
thor

GIT
remote: https://github.com/lautis/uglifier.git
revision: 45133bfdadc8f5056cb93423d2eedad3aed936bf
Expand Down Expand Up @@ -80,7 +72,6 @@ PLATFORMS

DEPENDENCIES
colored
ember-docs!
github_downloads!
kicker
rack
Expand Down
76 changes: 2 additions & 74 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,6 @@ def upload_file(uploader, filename, description, file)
end
end

def docs_upload_task(name)
instance_eval <<-end_eval
namespace :upload do
file "tmp/#{name}" do
mkdir_p "tmp"
Dir.chdir("tmp") do
sh "git clone [email protected]:#{name}.git"
end
end
task :pull => "tmp/#{name}" do
Dir.chdir("tmp/#{name}") do
sh "git pull origin master"
end
end
task :clean => :pull do
rm_rf "tmp/#{name}/html"
end
file "tmp/#{name}/html" => ['docs:build', :clean] do
cp_r "docs", "tmp/#{name}/html"
end
task :run => "tmp/#{name}/html" do
Dir.chdir "tmp/#{name}" do
sh "git add -A html && git commit -m 'Upload generated API docs' && git push origin master"
end
end
end
desc "Upload docs to #{name}"
task :upload => 'upload:run'
end_eval
end


desc "Strip trailing whitespace for JavaScript files in packages"
task :strip_whitespace do
Expand Down Expand Up @@ -99,31 +62,6 @@ task :upload_latest => [:clean, :dist] do
upload_file(uploader, 'ember-latest.js', "Ember.js Master", "dist/ember.js")
end

namespace :docs do
def doc_args
"#{Dir.glob("packages/ember-*").join(' ')} -E #{Dir.glob("packages/ember-*/tests").join(' ')} -t docs.emberjs.com"
end

desc "Preview Ember Docs (does not auto update)"
task :preview do
require "ember_docs/cli"
EmberDocs::CLI.start("preview #{doc_args}".split(' '))
end

desc "Build Ember Docs"
task :build do
require "ember_docs/cli"
EmberDocs::CLI.start("generate #{doc_args} -o docs".split(' '))
end

docs_upload_task("ember-edge-docs")

desc "Remove Ember Docs"
task :clean do
rm_r "docs"
end
end

desc "Run tests with phantomjs"
task :test, [:suite] => :dist do |t, args|
require "colored"
Expand Down Expand Up @@ -519,21 +457,11 @@ namespace :release do
task :deploy => [:update]
end

namespace :docs do
docs_upload_task("ember-docs")

desc "Prepare docs for release"
task :prepare => []

desc "Deploy docs"
task :deploy => [:upload]
end

desc "Prepare Ember for new release"
task :prepare => [:clean, 'framework:prepare', 'starter_kit:prepare', 'examples:prepare', 'website:prepare', 'docs:prepare']
task :prepare => [:clean, 'framework:prepare', 'starter_kit:prepare', 'examples:prepare', 'website:prepare']

desc "Deploy a new Ember release"
task :deploy => ['framework:deploy', 'starter_kit:deploy', 'examples:deploy', 'website:deploy', 'docs:deploy']
task :deploy => ['framework:deploy', 'starter_kit:deploy', 'examples:deploy', 'website:deploy']

end

Expand Down
7 changes: 7 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "ember-docs",
"version": "0.0.1",
"dependencies": {
"yuidoc": "git://github.com/wagenet/yuidoc.git"
}
}
20 changes: 20 additions & 0 deletions docs/yuidoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "The Ember API",
"description": "The Ember API: a framework for building ambitious web applications",
"version": "1.0 pre",
"url": "http://emberjs.com/",
"options": {
"paths": [
"../packages/ember/lib",
"../packages/ember-debug/lib",
"../packages/ember-metal/lib",
"../packages/ember-runtime/lib",
"../packages/ember-states/lib",
"../packages/ember-views/lib",
"../packages/ember-handlebars/lib",
"../packages/ember-routing/lib",
"../packages/ember-application/lib"
],
"outdir": "./build"
}
}
138 changes: 66 additions & 72 deletions packages/ember-metal/lib/accessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ require('ember-metal/core');
require('ember-metal/platform');
require('ember-metal/utils');

/**
@module ember-metal
*/

var META_KEY = Ember.META_KEY, get, set;

var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;

/** @private */
var IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;
var IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\.\*]/;
var HAS_THIS = /^this[\.\*]/;
Expand All @@ -25,7 +28,30 @@ var FIRST_KEY = /^([^\.\*]+)/;
// Otherwise simulate accessors by looking up the property directly on the
// object.

/** @private */
/**
Gets the value of a property on an object. If the property is computed,
the function will be invoked. If the property is not defined but the
object implements the unknownProperty() method then that will be invoked.
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to retrieve a property on an object that you don't
know for sure is private. (My convention only properties beginning with
an underscore '_' are considered private.)
On all newer browsers, you only need to use this method to retrieve
properties if the property might not be defined on the object and you want
to respect the unknownProperty() handler. Otherwise you can ignore this
method.
Note that if the obj itself is null, this method will simply return
undefined.
@method get
@for Ember
@param {Object} obj The object to retrieve from.
@param {String} keyName The property key to retrieve
@return {Object} the property value or null.
*/
get = function get(obj, keyName) {
// Helpers that operate with 'this' within an #each
if (keyName === '') {
Expand Down Expand Up @@ -62,7 +88,29 @@ get = function get(obj, keyName) {
}
};

/** @private */
/**
Sets the value of a property on an object, respecting computed properties
and notifying observers and other listeners of the change. If the
property is not defined but the object implements the unknownProperty()
method then that will be invoked as well.
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to set a property on an object that you don't
know for sure is private. (My convention only properties beginning with
an underscore '_' are considered private.)
On all newer browsers, you only need to use this method to set
properties if the property might not be defined on the object and you want
to respect the unknownProperty() handler. Otherwise you can ignore this
method.
@method set
@for Ember
@param {Object} obj The object to modify.
@param {String} keyName The property key to set
@param {Object} value The value to set
@return {Object} the passed value.
*/
set = function set(obj, keyName, value, tolerant) {
if (typeof obj === 'string') {
Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
Expand Down Expand Up @@ -118,13 +166,11 @@ set = function set(obj, keyName, value, tolerant) {
return value;
};

/** @private */
function firstKey(path) {
return path.match(FIRST_KEY)[0];
}

// assumes path is already normalized
/** @private */
function normalizeTuple(target, path) {
var hasThis = HAS_THIS.test(path),
isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),
Expand All @@ -145,7 +191,6 @@ function normalizeTuple(target, path) {
return [ target, path ];
}

/** @private */
function getPath(root, path) {
var hasThis, parts, tuple, idx, len;

Expand Down Expand Up @@ -173,7 +218,6 @@ function getPath(root, path) {
return root;
}

/** @private */
function setPath(root, path, value, tolerant) {
var keyName;

Expand Down Expand Up @@ -209,13 +253,11 @@ function setPath(root, path, value, tolerant) {
paths (i.e. a path beginning with a captial letter not defined on the
target) and * separators.
@param {Object} target
The current target. May be null.
@param {String} path
A path on the target or a global property path.
@returns {Array} a temporary array with the normalized target/path pair.
@method normalizeTuple
@for Ember
@param {Object} target The current target. May be null.
@param {String} path A path on the target or a global property path.
@return {Array} a temporary array with the normalized target/path pair.
*/
Ember.normalizeTuple = function(target, path) {
return normalizeTuple(target, path);
Expand All @@ -229,66 +271,9 @@ Ember.getWithDefault = function(root, key, defaultValue) {
};


/**
@function
Gets the value of a property on an object. If the property is computed,
the function will be invoked. If the property is not defined but the
object implements the unknownProperty() method then that will be invoked.
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to retrieve a property on an object that you don't
know for sure is private. (My convention only properties beginning with
an underscore '_' are considered private.)
On all newer browsers, you only need to use this method to retrieve
properties if the property might not be defined on the object and you want
to respect the unknownProperty() handler. Otherwise you can ignore this
method.
Note that if the obj itself is null, this method will simply return
undefined.
@param {Object} obj
The object to retrieve from.
@param {String} keyName
The property key to retrieve
@returns {Object} the property value or null.
*/
Ember.get = get;
Ember.getPath = Ember.deprecateFunc('getPath is deprecated since get now supports paths', Ember.get);

/**
@function
Sets the value of a property on an object, respecting computed properties
and notifying observers and other listeners of the change. If the
property is not defined but the object implements the unknownProperty()
method then that will be invoked as well.
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to set a property on an object that you don't
know for sure is private. (My convention only properties beginning with
an underscore '_' are considered private.)
On all newer browsers, you only need to use this method to set
properties if the property might not be defined on the object and you want
to respect the unknownProperty() handler. Otherwise you can ignore this
method.
@param {Object} obj
The object to modify.
@param {String} keyName
The property key to set
@param {Object} value
The value to set
@returns {Object} the passed value.
*/
Ember.set = set;
Ember.setPath = Ember.deprecateFunc('setPath is deprecated since set now supports paths', Ember.set);

Expand All @@ -298,6 +283,12 @@ Ember.setPath = Ember.deprecateFunc('setPath is deprecated since set now support
This is primarily used when syncing bindings, which may try to update after
an object has been destroyed.
@method trySet
@for Ember
@param {Object} obj The object to modify.
@param {String} keyName The property key to set
@param {Object} value The value to set
*/
Ember.trySet = function(root, path, value) {
return set(root, path, value, true);
Expand All @@ -308,8 +299,11 @@ Ember.trySetPath = Ember.deprecateFunc('trySetPath has been renamed to trySet',
Returns true if the provided path is global (e.g., "MyApp.fooController.bar")
instead of local ("foo.bar.baz").
@method isGlobalPath
@for Ember
@private
@param {String} path
@returns Boolean
@return Boolean
*/
Ember.isGlobalPath = function(path) {
return IS_GLOBAL.test(path);
Expand Down
Loading

0 comments on commit 1325935

Please sign in to comment.