closure Package
closure Package
-
class tic.development.closure.ClosureTemplatesDirectoryWatcher(compmgr, init=None, cls=<class 'tic.development.closure.ClosureTemplatesDirectoryWatcher'>)[source]
Bases: tic.core.Component
-
changed(list)[source]
@see IDirectoryWatcher.changed
-
created(list)[source]
@see IDirectoryWatcher.created
-
deleted(list)[source]
@see IDirectoryWatcher.deleted
-
generated_path = '/Users/selkhateeb/Development/Projects/tic/src/generated/client/templates/'
-
class tic.development.closure.CompileClosureApplication(compmgr, init=None, cls=<class 'tic.development.closure.CompileClosureApplication'>)[source]
Bases: tic.core.Component
-
run(build_path)[source]
-
class tic.development.closure.CompileSoyTemplates(compmgr, init=None, cls=<class 'tic.development.closure.CompileSoyTemplates'>)[source]
Bases: tic.core.Component
-
run(build_path)[source]
-
class tic.development.closure.GenerateIndexPage(compmgr, init=None, cls=<class 'tic.development.closure.GenerateIndexPage'>)[source]
Bases: tic.core.Component
-
run(build_path)[source]
-
class tic.development.closure.GenerateSharedJavascriptClasses(compmgr, init=<function __init__ at 0x1041ca140>, cls=<class 'tic.development.closure.GenerateSharedJavascriptClasses'>)[source]
Bases: tic.core.Component
-
changed(changed_files)[source]
changed_files: list of paths to changed files
-
created(created_files)[source]
created_files: list of paths to newly created files
-
deleted(deleted_files)[source]
deleted_files: list of paths to removed files
TODO: This is the tricky one.. we need to delete the generated closure
class files.
Implementation Idea: since this is a singleton class we can keep the
state in a variable and use it to clean up ..
-
run(build_path=None)[source]
-
tic.development.closure.calculate_deps(js_entrypoint_file_path)[source]
TODO Documentation
-
tic.development.closure.calculate_test_deps(js_test_file_path)[source]
Calculates the dependancy files for the test
-
tic.development.closure.compile_closure_files()[source]
Compiles the javascript files
-
tic.development.closure.compile_soy_templates(templates=None)[source]
Compiles the soy files
TODO: cannot do this in appengine dev server since os.popen is not defined
so a better approach would be to run a deamon that that monitors the file
system and generates all needed stuff JIT
-
tic.development.closure.copy_required_js_files()[source]
Documentation
-
tic.development.closure.prepare_generated_directory()[source]
Documentation
closurebuilder Module
Utility for Closure Library dependency calculation.
ClosureBuilder scans source files to build dependency info. From the
dependencies, the script can produce a deps.js file, a manifest in dependency
order, a concatenated script, or compiled output from the Closure Compiler.
Paths to files can be expressed as individual arguments to the tool (intended
for use with find and xargs). As a convenience, –root can be used to specify
all JS files below a directory.
usage: %prog [options] [file1.js file2.js ...]
-
tic.development.closure.closurebuilder.main()[source]
console Module
-
class tic.development.closure.console.ClosureCommand(compmgr, init=None, cls=<class 'tic.development.closure.console.ClosureCommand'>)[source]
Bases: tic.core.Component
-
get_admin_commands()[source]
Returns a list of commands to execute
@see tic.development.admin.api.IAdminCommandProvider
-
run(build_path=None)[source]
Runs the closure templates compiler
depstree Module
Class to represent a full Closure Library dependency tree.
Offers a queryable tree of dependencies of a given set of sources. The tree
will also do logical validation to prevent duplicate provides and circular
dependencies.
-
exception tic.development.closure.depstree.BaseDepsTreeError[source]
Bases: exceptions.Exception
Base DepsTree error.
-
exception tic.development.closure.depstree.CircularDependencyError(dependency_list)[source]
Bases: tic.development.closure.depstree.BaseDepsTreeError
Raised when a dependency cycle is encountered.
-
class tic.development.closure.depstree.DepsTree(sources)[source]
Bases: object
Represents the set of dependencies between source files.
-
GetDependencies(required_namespaces)[source]
Get source dependencies, in order, for the given namespaces.
- Args:
- required_namespaces: A string (for one) or list (for one or more) of
- namespaces.
- Returns:
- A list of source objects that provide those namespaces and all
requirements, in dependency order.
- Raises:
- NamespaceNotFoundError: A namespace is requested but doesn’t exist.
CircularDependencyError: A cycle is detected in the dependency tree.
-
exception tic.development.closure.depstree.MultipleProvideError(namespace, sources)[source]
Bases: tic.development.closure.depstree.BaseDepsTreeError
Raised when a namespace is provided more than once.
-
exception tic.development.closure.depstree.NamespaceNotFoundError(namespace, source=None)[source]
Bases: tic.development.closure.depstree.BaseDepsTreeError
Raised when a namespace is requested but not provided.
depstree_test Module
Unit test for depstree.
-
class tic.development.closure.depstree_test.DepsTreeTestCase(methodName='runTest')[source]
Bases: unittest.case.TestCase
Unit test for DepsTree. Tests several common situations and errors.
-
AssertValidDependencies(deps_list)[source]
Validates a dependency list.
Asserts that a dependency list is valid: For every source in the list,
ensure that every require is provided by a source earlier in the list.
- Args:
- deps_list: A list of sources that should be in dependency order.
-
testCircularDependency()[source]
-
testDepsForMissingNamespace()[source]
-
testMultipleRequires()[source]
-
testRequiresUndefinedNamespace()[source]
-
testSimpleDepsTree()[source]
-
class tic.development.closure.depstree_test.MockSource(provides, requires)[source]
Bases: object
Mock Source file.
depswriter Module
Generates out a Closure deps.js file given a list of JavaScript sources.
Paths can be specified as arguments or (more commonly) specifying trees
with the flags (call with –help for descriptions).
Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
-
tic.development.closure.depswriter.MakeDepsFile(source_map)[source]
Make a generated deps file.
- Args:
- source_map: A dict map of the source path to source.Source object.
- Returns:
- str, A generated deps file source.
-
tic.development.closure.depswriter.main()[source]
CLI frontend to MakeDepsFile.
jscompiler Module
Utility to use the Closure Compiler CLI from Python.
-
tic.development.closure.jscompiler.Compile(compiler_jar_path, source_paths, flags=None)[source]
Prepares command-line call to Closure Compiler.
- Args:
- compiler_jar_path: Path to the Closure compiler .jar file.
source_paths: Source paths to build, in order.
flags: A list of additional flags to pass on to Closure Compiler.
- Returns:
- The compiled source, as a string, or None if compilation failed.
source Module
Scans a source JS file for its provided and required namespaces.
Simple class to scan a JavaScript file and express its dependencies.
-
class tic.development.closure.source.CssSource(source)[source]
Bases: object
Scans a Css file for the special @tic.provideCss at-rule
-
getProvideCssRule()[source]
-
tic.development.closure.source.GetFileContents(path)[source]
Get a file’s contents as a string.
- Args:
- path: str, Path to file.
- Returns:
- str, Contents of file.
- Raises:
- IOError: An error occurred opening or reading the file.
-
class tic.development.closure.source.Source(source)[source]
Bases: object
Scans a JavaScript source for its provided and required namespaces.
-
GetSource()[source]
Get the source as a string.
source_test Module
Unit test for source.
-
class tic.development.closure.source_test.SourceTestCase(methodName='runTest')[source]
Bases: unittest.case.TestCase
Unit test for source. Tests the parser on a known source input.
-
testSourceScan()[source]
treescan Module
Shared utility functions for scanning directory trees.
-
tic.development.closure.treescan.ScanTree(root, path_filter=None, ignore_hidden=True)[source]
Scans a directory tree for files.
- Args:
root: str, Path to a root directory.
path_filter: A regular expression fileter. If set, only paths matching
the path_filter are returned.
- ignore_hidden: If True, do not follow or return hidden directories or files
- (those starting with a ‘.’ character).
- Yields:
- A string path to files, relative to cwd.
-
tic.development.closure.treescan.ScanTreeForJsFiles(root)[source]
Scans a directory tree for JavaScript files.
- Args:
- root: str, Path to a root directory.
- Returns:
- An iterable of paths to JS files, relative to cwd.