### Install Rake and Dependencies Source: https://github.com/aws/aws-sdk-js/blob/master/CONTRIBUTING.md Install Rake and other necessary gems using Bundler to prepare for documentation testing. ```bash bundle install ``` -------------------------------- ### Install PhantomJS for Testing Source: https://github.com/aws/aws-sdk-js/blob/master/CONTRIBUTING.md Install PhantomJS using Homebrew, a dependency for running tests locally. ```bash brew install --cask phantomjs ``` -------------------------------- ### Install Bundler for Documentation Testing Source: https://github.com/aws/aws-sdk-js/blob/master/CONTRIBUTING.md Install the Bundler gem, a prerequisite for managing Ruby dependencies when testing documentation changes. ```bash gem install bundler ``` -------------------------------- ### Installing YARD for JavaScript Dependencies Source: https://github.com/aws/aws-sdk-js/blob/master/doc-src/yard-js/README.md Installs the necessary Ruby dependencies for YARD for JavaScript using Bundler. Ensure Ruby and Bundler are installed prior to running these commands. ```sh $ git clone git://github.com/lsegal/yard-js $ cd yard-js $ bundle install ``` -------------------------------- ### Configuring Mixin Module Expression Source: https://github.com/aws/aws-sdk-js/blob/master/doc-src/yard-js/README.md Specifies the syntax for detecting modules that are mixed into a class. This example uses `mixin` to identify module mixing operations. ```javascript mixin(MyClass, SomeMixin); ``` -------------------------------- ### Configuring Class Definition Expression Source: https://github.com/aws/aws-sdk-js/blob/master/doc-src/yard-js/README.md Specifies the JavaScript syntax used to define classes, enabling YARD to correctly identify class definitions. This example uses `inherit` as the class definition expression. ```javascript inherit(SuperClass, { // class implementation constructor: function() { /* constructor function */ }, foo: function() { /* an instance method */ } }); ``` -------------------------------- ### Configuring Class Update Expression Source: https://github.com/aws/aws-sdk-js/blob/master/doc-src/yard-js/README.md Defines the syntax for updating class objects, typically used for class-level methods or properties. This example uses `update` to identify blocks of class methods. ```javascript update(MyClass, { bar: function() { /* a method only available as MyClass.bar() */ } }); ``` -------------------------------- ### Generate GUID Source: https://github.com/aws/aws-sdk-js/blob/master/test/browser/sample/console.html Generates a universally unique identifier (UUID) using a combination of random numbers. ```javascript function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); }; function guid() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } ``` -------------------------------- ### Request Lifecycle Handlers Source: https://github.com/aws/aws-sdk-js/blob/master/test/browser/sample/console.html Defines functions to handle the start and end of AWS SDK requests, updating the history and setting global variables for debugging. ```javascript function startRequest(resp) { addHistoryEntry(resp.request); resp.requestStarted = new Date().getTime(); } function endRequest(resp) { // set window properties for console debugging window.response = resp; window.data = resp.data; window.error = resp.error; window.requestCount++; // update history info try { updateHistoryEntry(resp); } catch (err) { console.log(err.message); console.log(err.stack); } } ``` -------------------------------- ### YARD Options File Configuration Source: https://github.com/aws/aws-sdk-js/blob/master/doc-src/yard-js/README.md A sample `.yardopts` file demonstrating how to configure YARD for JavaScript options, including class definition, update, and mixin expressions, as well as Markdown formatting. ```text --define-class-expr inherit --update-class-expr update --mixin-module-expr mixin ``` -------------------------------- ### Initialize AWS SDK and Load Services Source: https://github.com/aws/aws-sdk-js/blob/master/test/browser/sample/console.html Sets up event listeners for SDK requests and loads available AWS services into a selector. This is typically called on page load. ```javascript function loadServices() { $("#serviceSelector").empty(); for (var key in AWS) { if (AWS[key].serviceIdentifier) { var svcVarName = AWS[key].serviceIdentifier; try { var svc = services[svcVarName] = window[svcVarName] = new AWS[key](); var fullName = svc.api.abbreviation || svc.api.fullName; var el = $("