Skip to content

Commit

Permalink
Updated build script to generate sequential build numbers. Tiny AMD t…
Browse files Browse the repository at this point in the history
…weak.
  • Loading branch information
Tim committed Jul 5, 2014
1 parent ae7d613 commit 04e6d12
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 31 deletions.
8 changes: 8 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/rangy_github.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions 212.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="lib/log4javascript.js"></script>
<script>
var appender = new log4javascript.PopUpAppender();
log4javascript.getRootLogger().addAppender(appender);
document.onmouseup = function() {
var sel = rangy.getSelection();
var applier = rangy.createClassApplier("test");
console.log(sel.inspect());
applier.toggleSelection();
console.log(sel.inspect());
applier.toggleSelection();
console.log(sel.inspect());
}
</script>
<!--
<script type="text/javascript" src="../rangy-1.3alpha.804/rangy-core.js"></script>
<script type="text/javascript" src="../rangy-1.3alpha.804/rangy-cssclassapplier.js"></script>
-->
<script type="text/javascript" src="src/js/core/core.js"></script>
<script type="text/javascript" src="src/js/core/dom.js"></script>
<script type="text/javascript" src="src/js/core/domrange.js"></script>
<script type="text/javascript" src="src/js/core/wrappedrange.js"></script>
<script type="text/javascript" src="src/js/core/wrappedselection.js"></script>
<script type="text/javascript" src="src/js/modules/rangy-cssclassapplier.js"></script>
</head>
<body>

<div contenteditable="true">
this is text<br/>and more stuff<br/>
</div>

</body>
</html>
36 changes: 36 additions & 0 deletions 213.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="lib/log4javascript.js"></script>
<script>
var appender = new log4javascript.PopUpAppender();
log4javascript.getRootLogger().addAppender(appender);
</script>
<script type="text/javascript" src="src/js/core/core.js"></script>
<script type="text/javascript" src="src/js/core/dom.js"></script>
<script type="text/javascript" src="src/js/core/domrange.js"></script>
<script type="text/javascript" src="src/js/core/wrappedrange.js"></script>
<script type="text/javascript" src="src/js/core/wrappedselection.js"></script>
<script type="text/javascript" src="src/js/modules/rangy-cssclassapplier.js"></script>
<script type="text/javascript" src="src/js/modules/rangy-textrange.js"></script>
</head>
<body>

<table>
<tr>
<td>
<p contenteditable="true" onclick="rangy.getSelection().expand('word')">Select the end of this</p>
</td>
</tr>
<tr>
<td>
<p contenteditable="true">
ŠŠŠŠŠŠ
</p>
</td>
</tr>
</table>

</body>
</html>
23 changes: 1 addition & 22 deletions builder/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function getVersion() {
exec("git describe", function(error, stdout, stderr) {
console.log(error, stdout, stderr);
var result = /^.*-([\d]+)-.*$/.exec( stdout.trim() );
var commitNumber = parseInt(result[1]) + 811;
var commitNumber = parseInt(result[1]);
buildVersion = buildSpec.baseVersion + "." + commitNumber;
zipDir = buildDir + "rangy-" + buildVersion + "/";
fs.mkdirSync(zipDir);
Expand All @@ -104,27 +104,6 @@ function getVersion() {
});
}

/*
function checkoutSvnRepository() {
exec("svn checkout " + buildSpec.svnUrl, { cwd: gitDir }, function(error, stdout, stderr) {
console.log("Checked out SVN repository ", stdout, stderr);
callback();
});
}
function getVersion() {
exec("svnversion", function(error, stdout, stderr) {
buildVersion = buildSpec.baseVersion + "." + stdout.trim().replace(/:/g, "_");
zipDir = buildDir + "rangy-" + buildVersion + "/";
fs.mkdirSync(zipDir);
uncompressedBuildDir = zipDir + "uncompressed/";
fs.mkdirSync(uncompressedBuildDir);
console.log("Got SVN version ", stdout, stderr);
callback();
});
}
*/

function concatCoreScripts() {
function prependJsPath(fileList) {
return fileList.map(function(filePath) {
Expand Down
24 changes: 17 additions & 7 deletions src/js/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,24 @@

/*----------------------------------------------------------------------------------------------------------------*/

// AMD, for those who like this kind of thing

// AMD support, for those who like that kind of thing.
if (amdSupported) {
// AMD. Register as an anonymous module.
global.define(function() {
api.amd = true;
return api;
});
/**
* Register Rangy as an anonymous module.
*
* According to the AMD docs (https://github.com/amdjs/amdjs-api/wiki/AMD#usage-notes-):
* "It is recommended that define calls be in the literal form of 'define(...)' in
* order to work properly with static analysis tools (like build tools).".
* See also Rangy issue #204 (https://github.com/timdown/rangy/issues/204).
*
* We therefore dutifully jump through this little hoop.
*/
(function(define) {
define(function() {
api.amd = true;
return api;
});
})(global.define);
}

// Create a "rangy" property of the global object in any case. Other Rangy modules (which use Rangy's own simple
Expand Down
3 changes: 1 addition & 2 deletions test/textranges.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html>
<html>
<head>
<title></title>
Expand Down

0 comments on commit 04e6d12

Please sign in to comment.