diff --git a/.gitignore b/.gitignore index 5fcc507..102c661 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ pom.xml lib classes *~ +.lein-deps-sum diff --git a/Procfile b/Procfile index 09a6c19..92abe1c 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: lein run +web: java -Djava.security.policy=example.policy $JVM_OPTS -cp target/tryclojure-standalone.jar clojure.main -m tryclojure.server $PORT diff --git a/README.md b/README.md index 67d773e..65cfeb7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ TryClojure is a online Clojure REPL written using Noir and Chris Done's jquery console (you're awesome, Chris). +[](http://travis-ci.org/Raynes/tryclojure) + ## Usage http://tryclj.com -If you want to run it, refer to https://github.com/Raynes/tryclojure/wiki/Running-Tryclojure +To run it locally, use `lein ring server`. ## Credits diff --git a/project.clj b/project.clj index 7ae763e..44808a1 100644 --- a/project.clj +++ b/project.clj @@ -1,10 +1,13 @@ (defproject tryclojure "0.1.0-SNAPSHOT" :description "A simple web-based Clojure REPL for trying out Clojure without having to install it." :dependencies [[org.clojure/clojure "1.4.0"] - [noir "1.3.0-beta10"] - [commons-lang/commons-lang "2.5"] - [clojail "1.0.1"]] - :jvm-opts ["-Djava.security.policy=example.policy""-Xmx80M"] - :main tryclojure.server) - - + [lib-noir "0.8.1"] + [compojure "1.1.6"] + [ring-server "0.3.1"] + [commons-lang/commons-lang "2.5"] + [clojail "1.0.6"]] + :jvm-opts ["-Djava.security.policy=example.policy" "-Xmx80M"] + :min-lein-version "2.0.0" + :uberjar-name "tryclojure-standalone.jar" + :plugins [[lein-ring "0.8.10"]] + :ring {:handler tryclojure.server/app :port 8801}) diff --git a/resources/public/css/gh-fork-ribbon.css b/resources/public/css/gh-fork-ribbon.css new file mode 100644 index 0000000..6fe4efb --- /dev/null +++ b/resources/public/css/gh-fork-ribbon.css @@ -0,0 +1,82 @@ +/* From https://github.com/simonwhitaker/github-fork-ribbon-css */ + +/* Left will inherit from right (so we don't need to duplicate code */ +.github-fork-ribbon { + /* The right and left lasses determine the side we attach our banner to */ + position: absolute; + + /* Add a bit of padding to give some substance outside the "stitching" */ + padding: 2px 0; + + /* Set the base colour */ + background-color: #5881d8; + + /* Set a gradient: transparent black at the top to almost-transparent black at the bottom */ + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.00)), to(rgba(0, 0, 0, 0.15))); + background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); + background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); + background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); + background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); + background-image: linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#000000', EndColorStr='#000000'); + + /* Add a drop shadow */ + -webkit-box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.5); + box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.5); +} +.github-fork-ribbon a { + /* Set the font */ + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: 700; + color: white; + + /* Set the text properties */ + text-decoration: none; + text-shadow: 0 -1px rgba(0,0,0,0.5); + text-align: center; + + /* Set the geometry. If you fiddle with these you'll also need to tweak the top and right values in #github-fork-ribbon. */ + width: 200px; + line-height: 20px; + + /* Set the layout properties */ + display: inline-block; + padding: 2px 0; + + /* Add "stitching" effect */ + border-width: 1px 0; + border-style: dotted; + border-color: rgba(255,255,255,0.7); +} + +.github-fork-ribbon-wrapper { + width: 150px; + height: 150px; + position: absolute; + overflow: hidden; + top: 0; +} + +.github-fork-ribbon-wrapper.right { + right: 0; +} + +.github-fork-ribbon-wrapper.right .github-fork-ribbon { + top: 42px; + right: -43px; + + /* Rotate the banner 45 degrees */ + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); +} + +@media (max-width: 619px) { + + .github-fork-ribbon { + zoom: 0.6; + } + +} diff --git a/resources/public/css/tryclojure.css b/resources/public/css/tryclojure.css index 58801f8..e5145d8 100644 --- a/resources/public/css/tryclojure.css +++ b/resources/public/css/tryclojure.css @@ -1,137 +1,134 @@ body { - background: #fff; - text-align: center; + background: #F7F7F7; + text-align: center; + font-family: Helvetica, sans-serif; + color: #6C7B89; } #wrapper { - text-align: left; - width: 620px; - margin: 0 auto; - border-radius: 5px; - border: 5px solid #eee; + text-align: left; + width: 620px; + margin: 0 auto; } #header { - background: #fff; - margin-top: 24px; - margin: 10px; + margin: 20px 0px 20px 190px; } #header h1 { - height: 72px; - line-height: 72px; - background: url(/resources/public/clojure-logo.png) no-repeat; - margin: 0; - padding: 0; - padding-left: 75px; - font-family: Arial, sans-serif; - font-weight: normal; - font-size: 48px; + height: 72px; + line-height: 72px; + background: url(../clojure-logo.png) no-repeat; + padding: 0px 0px 0px 80px; + font-weight: normal; + font-size: 36px; } #header h1 span.logo-try { - color: #63b132; - display:inline; + color: #63b132; + display:inline; } #header h1 span.logo-clojure { - color: #5881d8; - display:inline + color: #2B4A8B; + display:inline +} + +#container { + margin-bottom: 40px; } #console { - height: 220px; - background: #eee; - margin: 10px; - border-radius: 5px; - -moz-border-radius: 5px; - border: 1px solid #aaa; + height: 220px; + padding: 10px; + background: #FFFFFF; + font-family: monospace; + font-size: 14px; + color: #6C7B89; + margin-bottom: 10px; +} + +#console textarea { + /* Use a largish font to ensure iOS doesn't zoom in on focus */ + font-size: 2em; } -#console div.jquery-console-inner { - width:580px; - height:200px; - margin: 10px 10px; - overflow:auto; - text-align:left; +#console div.jquery-console-inner { + width:580px; + height:200px; + margin: 10px 10px; + overflow:auto; + text-align:left; } + #console div.jquery-console-message-value { - color:#0066FF; - font-family:monospace; - padding:0.1em; + color:#63b132; } + #console div.jquery-console-prompt-box { - color:#444; font-family:monospace; + color: #6C7B89; } + #console div.jquery-console-focus span.jquery-console-cursor { - background:#333; color:#eee; font-weight:bold; + background:#6C7B89; + color: #FFFFFF; } + #console div.jquery-console-message-error { - color:#ef0505; font-family:sans-serif; font-weight:bold; - padding:0.1em; + color:#FD713B; } + #console div.jquery-console-message-success { - color:#187718; font-family:monospace; - padding:0.1em; -} -#console span.jquery-console-prompt-label { - font-weight:bold; + color:#63b132; } -.bottom { - background-color: white; color: #333; -} -.bottom a,a:visited { - color: #111; -} -table.bottom { - width: 100%; border: 1px solid black; +#console span.jquery-console-prompt-label { + font-weight:bold; } #buttons { - background: transparent; - text-align: center; - margin-top: 10px; -} -#buttons a { -/* color: #4881d8;*/ - color: #3D5B99; - padding: .3em 1em; - margin-right: .7em; - font-family: Helvetica, sans-serif; - font-size: 16px; - font-weight: bold; - background: #90b4fe; - border-radius: 5px; - -moz-border-radius: 5px; + background: transparent; + text-align: center; + margin-bottom: 10px; } + +#buttons a { + display: inline-block; + color: #2B4A8B; + padding: 2px 2px; + border-bottom: 2px solid #2B4A8B; + text-transform: uppercase; + margin: 10px; + font-family: Helvetica, sans-serif; + font-size: 16px; + transition: all 100ms; +} + #buttons a.last { - margin-right: 0; + margin-right: 0; } + #buttons a:hover { - color: #5881d8; - cursor: pointer; + cursor: pointer; } -#changer { - margin: 10px; - padding: 0.25em 0.5em 0.25em 0.5em; - background: #EAF2F5; - border-radius: 5px; - -moz-border-radius: 5px; - border: 1px solid #BEDCE7; +#changer { + line-height: 1.3em; + padding: 20px; + background: #D6DADD; + margin-bottom: 10px; } -#changer h3 { - color: #555; +#changer p { + margin: 0.6em; } -#changer p { - background: transparent; - line-height: 1.3em; - font-family: Arial, serif; - font-size: 16px; - color: #555; +#changer a { + color: #2B4A8B; +} + +#changer a:visited { + color: #60749E; } #changer code { @@ -142,25 +139,34 @@ table.bottom { padding: 0.1em 0.25em 0.1em 0.25em; } -div#tuttext { +#changer ul { + margin: 0px; + padding: 0px; + list-style: none; +} + +#tuttext { } -div.continue { - width: 100%; - text-align: center; - padding-top: 0.5em; +.continue { + width: 100%; + text-align: center; + padding-top: 0.5em; } -div.footer { - text-align: center; +.footer { + text-align: center; } /* Coderay alpha style */ +code { + display: inline-block; +} + .code { - border-radius: 2px; - -moz-border-radius: 1px; - color: #000; + color: #000; } + .code pre { margin: 0px; } span.code { white-space: pre; border: 0px; padding: 2px; } @@ -177,37 +183,51 @@ table.code td { padding: 2px 4px; vertical-align: top; } /* keywords */ #changer .code span.r { - color: #0000ff; - font-weight: bold; + color: #0000ff; + font-weight: bold; } /* symbols */ #changer .code span.sy { - color: #318495; + color: #318495; } /* strings */ #changer .code span.s { - color: #008800; + color: #008800; } /* paren */ #changer .code span.of { - color: #222; - font-weight: bold; + color: #222; + font-weight: bold; } /* comment */ #changer .code span.c { - color: #ccc; + color: #ccc; } /* operator */ #changer .code span.cl { - + } /* number */ #changer .code span.i { - color: #ff0000; + color: #ff0000; +} + +@media (max-width: 619px) { + + #wrapper { + width: 100%; + } + #header { + margin: 20px auto; + } + #console div.jquery-console-inner { + width: auto; + } + } diff --git a/resources/public/javascript/jquery-console/README b/resources/public/javascript/jquery-console/README index 245420f..c5d2de3 100644 --- a/resources/public/javascript/jquery-console/README +++ b/resources/public/javascript/jquery-console/README @@ -1,6 +1,6 @@ INTRODUCTION -See demo.html. Or here: http://chrisdone.com/jquery-console/demo.html +See demo.html. Or here: http://chrisdone.com/jquery-console/ Options available: @@ -18,6 +18,10 @@ Options available: promptLabel string Prompt string like 'JavaScript> '. + cols integer the number of cols, this value is only + used by the command completion to format + the list of results. + commandValidate function When user hits return, validate whether to trigger commandHandle and re-prompt. @@ -30,6 +34,10 @@ Options available: to report a result of the command asynchronously. + commandComplete function Handle the command completion when the + tab key is pressed. It returns a list + of string completion suffixes. + animateScroll bool Whether to animate the scroll to top. Currently disabled. @@ -39,6 +47,9 @@ Options available: cancelHandle function Handle a user-signaled interrupt. + fadeOnReset bool Whether to trigger a fade in/out when + the console is reset. Defaults to true. + LICENSE Copyright 2010 Chris Done, Simon David Pratt. All rights reserved. @@ -68,5 +79,3 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - diff --git a/resources/public/javascript/jquery-console/demo.html b/resources/public/javascript/jquery-console/demo.html index 370ca73..7f85186 100644 --- a/resources/public/javascript/jquery-console/demo.html +++ b/resources/public/javascript/jquery-console/demo.html @@ -102,6 +102,33 @@ }, promptHistory:true }); + /* Fifth console */ + var console5 = $('
'); + $('body').append(console5); + var controller5 = console5.console({ + promptLabel: 'Complete> ', + commandHandle:function(line){ + if (line) { + return [{msg:"you typed " + line,className:"jquery-console-message-value"}]; + } else { + var m = "type a color among (" + this.colors.join(", ") + ")"; + return [{msg:m,className:"jquery-console-message-value"}]; + } + }, + colors: ["red","blue","green","black","yellow","white","grey"], + cols: 40, + completeHandle:function(prefix){ + var colors = this.colors; + var ret = []; + for (var i=0;i