Permalink
Browse files

refactor scripts again; more README revs

  • Loading branch information...
1 parent caec6fa commit 10a26e6a8b92a1562f35889f1a7a39c537ef2ee7 @michaelsbradleyjr michaelsbradleyjr committed May 6, 2013
Showing with 78 additions and 50 deletions.
  1. +2 −2 .npmignore
  2. +31 −23 README.md
  3. +0 −2 bin/lein_prefer
  4. +5 −5 package.json
  5. +2 −2 project.clj
  6. +7 −1 scripts/build.ps1
  7. +2 −12 scripts/build.sh
  8. +7 −0 scripts/build_clean.sh
  9. +3 −3 scripts/build_node.sh
  10. +14 −0 scripts/build_web.sh
  11. +5 −0 scripts/clean.sh
View
@@ -8,8 +8,8 @@
/checkouts
/.lein-deps-sum
.lein*
-mori-dev.js
-mori-rel.js
+mori_dev.js
+mori_rel.js
tmp.js
*.swp
.#*
View
@@ -5,19 +5,32 @@ mori
<img src="http://cloud.github.com/downloads/swannodette/mori/mori.png" alt="Mori" title="Mori"/>
-A simple bridge to ClojureScript's persistent data structures and supporting APIs for vanilla JavaScript. Pull requests welcome.
+A simple bridge to ClojureScript's persistent data structures and [supporting APIs](http://swannodette.github.io/mori/) for vanilla JavaScript. Pull requests welcome.
Getting it
----
-You can download the latest prebuilt version of Mori from the [downloads](http://github.com/swannodette/mori/downloads) tab.
-
-It's also available for Node.js via npm:
+It's available for Node.js via npm:
```shell
npm install mori
```
+The installed package contains two JavaScript files: `mori.node.js` and `mori.js`. The first is used by Node.js, the second may be used in a Web browser or other JavaScript environments in the usual way.
+
+Load `mori` in your Node.js programs as you would any other module:
+
+```javascript
+var mori = require("mori");
+```
+
+In a browser, you can load mori with a script tag, as you would any other JavaScript library:
+
+```html
+<script src="mori.js" type="text/javascript"></script>
+```
+
+
Caveats
----
@@ -26,44 +39,39 @@ Pre-pre-pre alpha. ClojureScript is constantly being improved, especially in ter
Build
----
-Make a folder in the repo folder called checkouts, clone the [ClojureScript](http://github.com/clojure/clojurescript) repo into it.
+### Prerequisites
-Install [Leiningen](http://github.com/technomancy/leiningen).
+You will first need to install the [Java](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) SDK, if it's not already installed on your system.
-Grab dependencies:
+On Windows, you will need to manually install [Leiningen](http://github.com/technomancy/leiningen). On UNIX-like systems, Leiningen will be installed within the project automatically if the `lein` executable is not found on your path, or if your version predates `2.0.0`.
+
+### Clone the repo
```shell
-lein deps
+git clone https://github.com/swannodette/mori.git
+cd mori
```
-On a UNIX-like system build with:
+### On a UNIX-like system build with
```shell
./scripts/build.sh
```
-On Windows:
+### On Windows
```shell
./scripts/build.ps1
```
-This will produce a file mori.js. You can include this like any other JavaScript library.
+### Using npm
-Note: If you are using leiningen 2, use this for your project.clj
-```clojure
-(defproject mori "0.1.0-SNAPSHOT"
- :description "Persistent Data Structures for JavaScript"
- :dependencies [[org.clojure/clojure "1.4.0"]]
- :profiles {:dev
- {:source-paths
- ["comp/clojurescript/src/clj"
- "comp/clojurescript/src/cljs"]}}
- :cljsbuild {:builds {:tmp {:source-path "src"
- :compiler {:optimizations :advanced
- :output-to "tmp.js"}}}})
+```shell
+npm run-script build
```
+The build process will generate two JavaScript files: `mori.node.js` and `mori.js`. The first is used by Node.js, the second may be used in a Web browser or other JavaScript environments in the usual way.
+
Usage
----
View
@@ -41,6 +41,4 @@ chmod +x $LEIN_PREFER
fi
-echo "lein path: "$LEIN_PREFER
-
$LEIN_PREFER $@
View
@@ -39,14 +39,14 @@
"jasmine-node": "1.7.0"
},
"scripts": {
- "build": "npm run-script build-node",
- "build-clean": "npm run-script build-node-clean",
+ "build": "./scripts/build.sh",
+ "build-clean": "./scripts/build_clean.sh",
"build-node": "./scripts/build_node.sh",
"build-node-clean": "rm -f mori.node.js && ./bin/lein_prefer cljsbuild clean && npm run-script build-node",
- "build-web": "./scripts/build.sh",
+ "build-web": "./scripts/build_web.sh",
"build-web-clean": "rm -f mori.js && ./bin/lein_prefer cljsbuild clean && npm run-script build-web",
- "clean": "rm -f mori.node.js mori.js && ./bin/lein_prefer cljsbuild clean",
- "prepublish": "rm -f mori.node.js mori.js && ./bin/lein_prefer cljsbuild clean && npm run-script build-node && npm run-script build-web",
+ "clean": "./scripts/clean.sh",
+ "prepublish": "npm run-script build-clean",
"test": "jasmine-node spec"
},
"directories": {
View
@@ -13,11 +13,11 @@
{:source-paths ["src"],
:id "dev",
:compiler
- {:output-to "mori-dev.js",
+ {:output-to "mori_dev.js",
:optimizations :whitespace}}
{:source-paths ["src"],
:id "release",
:compiler
- {:output-to "mori-rel.js",
+ {:output-to "mori_rel.js",
:optimizations :advanced
:pretty-print false}}]})
View
@@ -1,8 +1,14 @@
lein cljsbuild clean
lein cljsbuild once tmp
-ni "mori.js" -type file
+ni "mori.js" -type file -force
ac "mori.js" "(function() {"
$tmpjs = Get-Content tmp.js
ac "mori.js" $tmpjs
ac "mori.js" "}).call(this);"
rm tmp.js
+lein cljsbuild once release
+ni "mori.node.js" -type file -force
+$reljs = Get-Content mori_rel.js
+ac "mori.node.js" $reljs
+ac "mori.node.js" ";module.exports = this.mori;`n"
+rm mori_rel.js
View
@@ -1,14 +1,4 @@
#!/bin/sh
-./bin/lein_prefer deps
-./bin/lein_prefer cljsbuild once tmp
-
-echo "Finalizing mori.js"
-
-(echo "(function() {"; cat tmp.js; echo "}).call(this);") > mori.js
-
-echo "Deleting tmp.js"
-
-rm tmp.js
-
-echo "Build finished."
+./scripts/build_node.sh
+./scripts/build_web.sh
View
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+rm -f mori.node.js mori.js
+
+./bin/lein_prefer cljsbuild clean
+
+./scripts/build.sh
View
@@ -5,10 +5,10 @@
echo "Finalizing mori.node.js"
-(cat mori-rel.js; echo ";module.exports = this.mori;\n") > mori.node.js
+(cat mori_rel.js; echo ";module.exports = this.mori;\n") > mori.node.js
-echo "Deleting mori-rel.js"
+echo "Deleting mori_rel.js"
-rm mori-rel.js
+rm mori_rel.js
echo "Build finished."
View
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+./bin/lein_prefer deps
+./bin/lein_prefer cljsbuild once tmp
+
+echo "Finalizing mori.js"
+
+(echo "(function() {"; cat tmp.js; echo "}).call(this);") > mori.js
+
+echo "Deleting tmp.js"
+
+rm tmp.js
+
+echo "Build finished."
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+rm -f mori.node.js mori.js
+
+./bin/lein_prefer cljsbuild clean

0 comments on commit 10a26e6

Please sign in to comment.