Giter Club home page Giter Club logo

cake's Introduction


NOTE:

cake and lein have joined forces, and starting with Lein 2.0, we plan to move all Flatland projects to lein.

Read this for more info: https://groups.google.com/forum/#!topic/clojure/WnnQIZipG5E

Lein is located here: https://github.com/technomancy/leiningen

Also, if you're interested, you can join the Leiningen mailing (http://groups.google.com/group/leiningen) and join us in #leiningen on irc.freenode.com too. There is also a wiki page for brainstorming version 2.0 changes (https://github.com/technomancy/leiningen/wiki/VersionTwo).


cake is a Clojure development environment for your command line. It is a build tool, a repl, a package manager, a script launcher, and a deployment tool mixed together and baked into a single, delicious command, cake.

You can use cake with any editor, but it goes especially well with emacs, vi, and textmate. cake is cross-platform. It works on OS X, Linux and Windows. Also, unlike most other JVM-based command line tools, it is fast!

Installation

There are two ways to get Cake. If you are a user, the standalone script is easiest. If you want to help with cake development though, you should check out the develop branch of the git repository. You can always access the stable version of cake, even when running from git, by adding the -S flag to your command.

Standalone script (stable)

Make sure ~/bin/ is in your $PATH, then execute the following command:

curl http://ninjudd.com/cake-releases/cake -o ~/bin/cake && chmod +x ~/bin/cake

Git repository (development)

git clone git://github.com/flatland/cake.git

Symlink bin/cake into your $PATH.

Cake will bootstrap itself the first time it starts up.

Getting Started

Cake is compatible with most Leiningen project.clj files, so if you already have a project.clj, you're probably ready to go. Just install Cake and then type cake in your project root for a list of tasks.

If you don't yet have a project.clj file, creating one is simple. Here's an example:

(defproject jiraph "0.2.7"
  :description "Embedded graph db library for Clojure."
  :url "http://jiraph.org"
  :tasks [protobuf.tasks]
  :dependencies [[clojure "1.2.0"]
                 [clojure-contrib "1.2.0"]
                 [clojure-useful "0.2.1"]
                 [clojure-protobuf "0.3.0"]
                 [tokyocabinet "1.2.3"]])

Get a list of available commands

cake help

Get detailed help on a single command

cake help command-name

Start an interactive repl with command history and tab completion:

cake repl

Run a clojure script

cake run path/to/script.clj

Create a new project in the current directory

cake new project-name

Help

For more detailed documentation, see the wiki. For questions and help, join us in #flatland on irc or send a message to the clojure-cake google group.

Contributors

YourKit

YourKit's Java Profiler was a terrific help to us in finding classloader memory leaks when we switched Cake to use a single JVM with a separate project classloader.

YourKit is kindly supporting open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler.

cake's People

Contributors

amalloy avatar davidsantiago avatar lancepantz avatar marvinthepa avatar mtnygard avatar ninjudd avatar raynes avatar rickmode avatar rosejn avatar samaaron avatar yn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cake's Issues

Support stderr/stdout for Threads

lein repl will intermingle output from threads in the repl itself, making it easy for debugging. cake repl doesn't have this behaviour and ignores thread stderr/stdout.

doesn't works at all. readlink': Invalid argument - /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/cake-0.3.11/bin/cake

% cake
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/cake-0.3.11/bin/cake:88:in readlink': Invalid argument - /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/cake-0.3.11/bin/cake (Errno::EINVAL) from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/cake-0.3.11/bin/cake:88:inreadlink'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/cake-0.3.11/bin/cake:95
from /opt/ruby-enterprise-1.8.7-2010.02/bin/cake:19:in `load'
from /opt/ruby-enterprise-1.8.7-2010.02/bin/cake:19

Standalone REPL is borked

EDIT: after some more research I realize that cake and cake repl work but only if you are currently in a directory with a project.clj. The standalone "cake repl" no longer works and gives the following exception:

          [deps] fetching cake libraries. this may take a moment...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 (io.clj:37)
    at clojure.lang.Compiler.load(Compiler.java:5858)
    at clojure.lang.RT.loadResourceScript(RT.java:340)
    at clojure.lang.RT.loadResourceScript(RT.java:331)
    at clojure.lang.RT.load(RT.java:409)
    at clojure.lang.RT.load(RT.java:381)
    at clojure.core$load$fn__1412.invoke(core.clj:4905)
    at clojure.core$load.doInvoke(core.clj:4904)
    at clojure.lang.RestFn.invoke(RestFn.java:409)
    at clojure.core$load_one.invoke(core.clj:4729)
    at clojure.core$load_lib.doInvoke(core.clj:4766)
    at clojure.lang.RestFn.applyTo(RestFn.java:143)
    at clojure.core$apply.invoke(core.clj:542)
    at clojure.core$load_libs.doInvoke(core.clj:4800)
    at clojure.lang.RestFn.applyTo(RestFn.java:138)
    at clojure.core$apply.invoke(core.clj:544)
    at clojure.core$use.doInvoke(core.clj:4880)
    at clojure.lang.RestFn.invoke(RestFn.java:458)
    at cake.tasks.new$eval4196$loading__1295__auto____4197.invoke(new.clj:1)
    at cake.tasks.new$eval4196.invoke(new.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:5419)
    at clojure.lang.Compiler.eval(Compiler.java:5410)
    at clojure.lang.Compiler.load(Compiler.java:5852)
    at clojure.lang.RT.loadResourceScript(RT.java:340)
    at clojure.lang.RT.loadResourceScript(RT.java:331)
    at clojure.lang.RT.load(RT.java:409)
    at clojure.lang.RT.load(RT.java:381)
    at clojure.core$load$fn__1412.invoke(core.clj:4905)
    at clojure.core$load.doInvoke(core.clj:4904)
    at clojure.lang.RestFn.invoke(RestFn.java:409)
    at clojure.core$load_one.invoke(core.clj:4729)
    at clojure.core$load_lib.doInvoke(core.clj:4766)
    at clojure.lang.RestFn.applyTo(RestFn.java:143)
    at clojure.core$apply.invoke(core.clj:542)
    at clojure.core$load_libs.doInvoke(core.clj:4804)
    at clojure.lang.RestFn.applyTo(RestFn.java:138)
    at clojure.core$apply.invoke(core.clj:542)
    at clojure.core$require.doInvoke(core.clj:4869)
    at clojure.lang.RestFn.invoke(RestFn.java:409)
    at cake$start_server.invoke(cake.clj:197)
    at user$eval4127.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:5419)
    at clojure.lang.Compiler.eval(Compiler.java:5386)
    at clojure.core$eval.invoke(core.clj:2382)
    at clojure.main$eval_opt.invoke(main.clj:235)
    at clojure.main$initialize.invoke(main.clj:254)
    at clojure.main$script_opt.invoke(main.clj:270)
    at clojure.main$main.doInvoke(main.clj:354)
    at clojure.lang.RestFn.invoke(RestFn.java:437)
    at clojure.lang.Var.invoke(Var.java:373)
    at clojure.lang.AFn.applyToHelper(AFn.java:169)
    at clojure.lang.Var.applyTo(Var.java:482)
    at clojure.main.main(main.java:37)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at clojure.lang.PersistentArrayMap$Seq.first(PersistentArrayMap.java:236)
    at clojure.lang.APersistentMap.hashCode(APersistentMap.java:94)
    at clojure.lang.ASeq.hashCode(ASeq.java:69)
    at clojure.lang.ASeq.hashCode(ASeq.java:69)
    at clojure.lang.ASeq.hashCode(ASeq.java:69)
    at clojure.lang.ASeq.hashCode(ASeq.java:69)
    at clojure.lang.ASeq.hashCode(ASeq.java:69)
    at clojure.lang.Util.hash(Util.java:65)
    at clojure.lang.PersistentHashMap.containsKey(PersistentHashMap.java:123)
    at clojure.lang.Compiler.isSpecial(Compiler.java:292)
    at clojure.lang.LispReader$SyntaxQuoteReader.syntaxQuote(LispReader.java:702)
    at clojure.lang.LispReader$SyntaxQuoteReader.invoke(LispReader.java:692)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
    at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
    at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
    at clojure.lang.LispReader.read(LispReader.java:145)
    at clojure.lang.Compiler.load(Compiler.java:5849)
    ... 51 more

Unsupported escape character: \x

Running a clean install of cake:

‹ ~ › ∴ gem install cake
Successfully installed cake-0.4.15
1 gem installed
Installing ri documentation for cake-0.4.15...
Installing RDoc documentation for cake-0.4.15...
‹ ~ › ∴ cake
/Users/hinmanm/.rvm/gems/ruby-1.9.1-p378/gems/cake-0.4.15/bin/cake:731:in `chdir': No such file or directory - /Users/hinmanm/.cake (Errno::ENOENT)
        from /Users/hinmanm/.rvm/gems/ruby-1.9.1-p378/gems/cake-0.4.15/bin/cake:731:in `<top (required)>'
        from /Users/hinmanm/.rvm/gems/ruby-1.9.1-p378/bin/cake:19:in `load'
        from /Users/hinmanm/.rvm/gems/ruby-1.9.1-p378/bin/cake:19:in `<main>'
‹ ~ › ∴ mkdir .cake
‹ ~ › ∴ cake
clojure.lang.LispReader$ReaderException: java.lang.Exception: Unsupported escape character: \x
 at clojure.lang.LispReader.read (LispReader.java:180)
    clojure.core$read.invoke (core.clj:2884)
    clojure.core$read.invoke (core.clj:2882)
    clojure.core$read.invoke (core.clj:2880)
    clojure.core$read.invoke (core.clj:2878)
    cake.server$create$fn__730.invoke (server.clj:121)
    cake.contrib.server_socket$accept_fn$fn__398$fn__401.invoke (server_socket.clj:39)
    cake.contrib.server_socket$accept_fn$fn__398.invoke (server_socket.clj:38)
    clojure.lang.AFn.run (AFn.java:24)
    java.lang.Thread.run (Thread.java:637)
Caused by: java.lang.Exception: Unsupported escape character: \x
 at clojure.lang.LispReader$StringReader.invoke (LispReader.java:451)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1051)
    clojure.lang.LispReader$MapReader.invoke (LispReader.java:1006)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1051)
    clojure.lang.LispReader$MapReader.invoke (LispReader.java:1006)
    clojure.lang.LispReader.read (LispReader.java:145)
    clojure.core$read.invoke (core.clj:2884)
    clojure.core$read.invoke (core.clj:2882)
    clojure.core$read.invoke (core.clj:2880)
    clojure.core$read.invoke (core.clj:2878)
    cake.server$create$fn__730.invoke (server.clj:121)
    cake.contrib.server_socket$accept_fn$fn__398$fn__401.invoke (server_socket.clj:39)
    cake.contrib.server_socket$accept_fn$fn__398.invoke (server_socket.clj:38)
    clojure.lang.AFn.run (AFn.java:24)
    java.lang.Thread.run (Thread.java:637)
clojure.lang.LispReader$ReaderException: java.lang.Exception: Unsupported escape character: \x
 at clojure.lang.LispReader.read (LispReader.java:180)
    clojure.core$read.invoke (core.clj:2884)
    clojure.core$read.invoke (core.clj:2882)
    clojure.core$read.invoke (core.clj:2880)
    clojure.core$read.invoke (core.clj:2878)
    cake.server$create$fn__730.invoke (server.clj:121)
    cake.contrib.server_socket$accept_fn$fn__398$fn__401.invoke (server_socket.clj:39)
    cake.contrib.server_socket$accept_fn$fn__398.invoke (server_socket.clj:38)
    clojure.lang.AFn.run (AFn.java:24)
    java.lang.Thread.run (Thread.java:637)
Caused by: java.lang.Exception: Unsupported escape character: \x
 at clojure.lang.LispReader$StringReader.invoke (LispReader.java:451)

etc, etc, etc

Ruby version 1.9.1-p378

Environments for JARs

The current "f" branch provides environments which let you bundle together various values (for example, settings for release and debug versions of your software) and then specify which set of values to use when run on the command-line.

It would be wonderful to have this facility available for compiled JARs.

For example, I have a function I've written called include-js to include a javascript module in a compojure app. In debug mode, that function returns a dynamic URL that serves the raw JS file, and in release mode, that function points to a web server location with the compiled module. The environments feature lets you run the webapp from the command line in different ways, but the functionality cannot be used in the compiled war.

"#!/usr/bin/env cake" vs. "#!/usr/bin/env cake run"

If I have an executable script that looks like this in a project directory

#!/usr/bin/env cake
(println (System/getProperty "user.dir"))

I see the output as the global path. If I specify I run, I see it as the project directory. I don't suppose this can be resolved?

More advanced project templates

We want to allow for users to be able to put a 'template' project in ~/.cake/template that will be used when they run cake new.

Add cake script/run ?

It would be nice to be able to run one-off Clojure scripts with cake. It would be particularly sweet to have this command bind

cake/cwd
before loading the .clj file to be run.

Cannot add :tasks to project.clj

From IRC:

ninjudd, lancepantz: In the last commit, on line 800 and 805 of the Ruby file, you removed "lib/dev/*" from the classpath. Now, when you try to add a task by adding it to dependencies or dev dependencies, and then adding :tasks [namespace.tasks], the namespace is not found. I fixed it by adding it back (for now, anyway, just to test my task).

The exact jar I'm using is cake-0.4.16-20100917.180912.jar.

To reproduce, just try adding tasks to any project. Here is my project.clj:

(defproject irclj "0.3.0-SNAPSHOT"
  :description "A simple IRC library/bot framework."
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]]
  :tasks [cake-autodoc.tasks]
  :dev-dependencies [[swank-clojure "1.2.1"]
                     [cake-autodoc "0.0.1-SNAPSHOT"]])

I also tried with the protobuf library, just in case I had broken something myself. It didn't work either.

Here is the exception:

java.io.FileNotFoundException: Could not locate cake_autodoc/tasks__init.class or cake_autodoc/tasks.clj on classpath: 
 at clojure.lang.RT.load (RT.java:412)
    clojure.lang.RT.load (RT.java:381)
    clojure.core$load$fn__4511.invoke (core.clj:4905)
    clojure.core$load.doInvoke (core.clj:4904)
    clojure.lang.RestFn.invoke (RestFn.java:409)
    clojure.core$load_one.invoke (core.clj:4729)
    clojure.core$load_lib.doInvoke (core.clj:4766)
    clojure.lang.RestFn.applyTo (RestFn.java:143)
    clojure.core$apply.invoke (core.clj:542)
    clojure.core$load_libs.doInvoke (core.clj:4800)
    clojure.lang.RestFn.applyTo (RestFn.java:138)
    clojure.core$apply.invoke (core.clj:542)
    clojure.core$require.doInvoke (core.clj:4869)
    clojure.lang.RestFn.invoke (RestFn.java:409)
    cake.core$eval1436.invoke (project.clj:1)
    clojure.lang.Compiler.eval (Compiler.java:5424)
    clojure.lang.Compiler.eval (Compiler.java:5414)
    clojure.lang.Compiler.load (Compiler.java:5857)
    clojure.lang.Compiler.loadFile (Compiler.java:5820)
    clojure.lang.RT$3.invoke (RT.java:296)
    cake.project$init.invoke (project.clj:29)
    cake.core$start_server.invoke (core.clj:213)
    user$eval889.invoke (NO_SOURCE_FILE:1)
    clojure.lang.Compiler.eval (Compiler.java:5424)
    clojure.lang.Compiler.eval (Compiler.java:5391)
    clojure.core$eval.invoke (core.clj:2382)
    clojure.main$eval_opt.invoke (main.clj:235)
    clojure.main$initialize.invoke (main.clj:254)
    clojure.main$null_opt.invoke (main.clj:279)
    clojure.main$main.doInvoke (main.clj:354)
    clojure.lang.RestFn.invoke (RestFn.java:422)
    clojure.lang.Var.invoke (Var.java:369)
    clojure.lang.AFn.applyToHelper (AFn.java:165)
    clojure.lang.Var.applyTo (Var.java:482)
    clojure.main.main (main.java:37)

I was able to temporarily fix the problem by editing Ruby file (cake) and adding "lib/dev/*" on line 800 and 805.

Cake and ZSH [Escape sequences not recognized by Java]

Apparently cake does not work well if the calling shell is zsh (which is my main shell).
I work on OS X right now; however, I can try to replicate the bug on Linux as well.
Essentially, this is what happens when I run a clojure script:

% cake run counter.clj
  clojure.lang.LispReader$ReaderException: java.lang.Exception: Unsupported escape character: \e
  at clojure.lang.LispReader.read (LispReader.java:180)
clojure.core$read.invoke (core.clj:2884)
clojure.core$read.invoke (core.clj:2882)
clojure.core$read.invoke (core.clj:2880)
clojure.core$read.invoke (core.clj:2878)
cake.server$create$fn__3919.invoke (server.clj:112)
cake.contrib.server_socket$accept_fn$fn__3618$fn__3621.invoke (server_socket.clj:39)
cake.contrib.server_socket$accept_fn$fn__3618.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:637)

The very same script, when run with bash works perfectly:
$ cake run counter.clj

Calling bash from zsh and the running cake does not work:

$ cake run counter.clj
  clojure.lang.LispReader$ReaderException: java.lang.Exception: Unsupported escape character: \e
  at clojure.lang.LispReader.read (LispReader.java:180)
clojure.core$read.invoke (core.clj:2884)
clojure.core$read.invoke (core.clj:2882)
clojure.core$read.invoke (core.clj:2880)
clojure.core$read.invoke (core.clj:2878)
cake.server$create$fn__3919.invoke (server.clj:112)
cake.contrib.server_socket$accept_fn$fn__3618$fn__3621.invoke (server_socket.clj:39)
cake.contrib.server_socket$accept_fn$fn__3618.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:637)

cake repl works in every environment.

cake repl does not work on Windows XP and Windows 7

I installed cake as gem and I have latest (cake - 0.3.13). But got this error:
C:/Ruby191/lib/ruby/gems/1.9.1/gems/cake-0.3.13/bin/cake:13:in require': no such file to load -- win32/process (LoadError) from C:/Ruby191/lib/ruby/gems/1.9.1/gems/cake-0.3.13/bin/cake:13:in<top (required)>'
from C:/Ruby191/bin/cake:19:in load' from C:/Ruby191/bin/cake:19:in

'

Can you look into this? Thanks.

∞ nils

a bad binding form passed to bake creates an infinite loop of nils:
(deftask gen-context
(bake [(:use xmlgen.core)]

(gen-context)))

lance:xmlgen $ cake gen-context
evaluating form: (let (:use xmlgen.core))

java.lang.RuntimeException: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector (NO_SOURCE_FILE:0)
at clojure.lang.LazySeq.sval (LazySeq.java:47)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.LazySeq.next (LazySeq.java:85)
clojure.lang.RT.next (RT.java:560)
clojure.core$next.invoke (core.clj:61)
clojure.core$last.invoke (core.clj:228)
cake.server$eval_multi.invoke (server.clj:81)
bake.core$project_eval.invoke (core.clj:23)
cake.server$create$fn__2177.invoke (server.clj:133)
cake.contrib.server_socket$accept_fn$fn__1845$fn__1848.invoke (server_socket.clj:39)
cake.contrib.server_socket$accept_fn$fn__1845.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:637)
Caused by: clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval (Compiler.java:5440)
clojure.lang.Compiler.eval (Compiler.java:5391)
clojure.core$eval.invoke (core.clj:2382)
cake.server$eval_verbose.invoke (server.clj:71)
cake.server$eval_multi$iter__2140__2144$fn__2145$fn__2146.invoke (server.clj:82)
cake.server$eval_multi$iter__2140__2144$fn__2145.invoke (server.clj:81)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.LazySeq.next (LazySeq.java:85)
clojure.lang.RT.next (RT.java:560)
clojure.core$next.invoke (core.clj:61)
clojure.core$last.invoke (core.clj:228)
cake.server$eval_multi.invoke (server.clj:81)
bake.core$project_eval.invoke (core.clj:23)
cake.server$create$fn__2177.invoke (server.clj:133)
cake.contrib.server_socket$accept_fn$fn__1845$fn__1848.invoke (server_socket.clj:39)
cake.contrib.server_socket$accept_fn$fn__1845.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:637)
Caused by: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector
at clojure.core$let.doInvoke (core.clj:3469)
clojure.lang.RestFn.invoke (RestFn.java:468)
clojure.lang.Var.invoke (Var.java:377)
clojure.lang.AFn.applyToHelper (AFn.java:174)
clojure.lang.Var.applyTo (Var.java:482)
clojure.lang.Compiler.macroexpand1 (Compiler.java:5286)
clojure.lang.Compiler.macroexpand (Compiler.java:5341)
clojure.lang.Compiler.eval (Compiler.java:5409)
clojure.lang.Compiler.eval (Compiler.java:5391)
clojure.core$eval.invoke (core.clj:2382)
cake.server$eval_verbose.invoke (server.clj:71)
cake.server$eval_multi$iter__2140__2144$fn__2145$fn__2146.invoke (server.clj:82)
cake.server$eval_multi$iter__2140__2144$fn__2145.invoke (server.clj:81)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.LazySeq.next (LazySeq.java:85)
clojure.lang.RT.next (RT.java:560)
clojure.core$next.invoke (core.clj:61)
clojure.core$last.invoke (core.clj:228)
cake.server$eval_multi.invoke (server.clj:81)
bake.core$project_eval.invoke (core.clj:23)
cake.server$create$fn__2177.invoke (server.clj:133)
cake.contrib.server_socket$accept_fn$fn__1845$fn__1848.invoke (server_socket.clj:39)
cake.contrib.server_socket$accept_fn$fn__1845.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:637)
nil
nil
nil
nil
nil
nil
nil
nil
nil
nil
nil
nil

[Windows] "cake repl" hangs up forever

E:\clojure\istext>cake repl
Fetching dependencies...
 [deps] Copying 1 file to e:\clojure\istext\build\lib
 [deps] Deleting directory e:\clojure\istext\lib
 [deps] Attempting to rename dir: build\lib to lib

(now waits forever, no timeout)

[Windows] "cake deps" sometimes can't delete lib/ clojure jar file

First, let's invoke uberjar:

E:\clojure\istext>cake uberjar
[jar] Building jar: E:\clojure\istext\istext-1.0.jar
[uberjar] Building jar: E:\clojure\istext\istext-1.0-standalone.jar

Fine, now deps:

E:\clojure\istext>cake deps
Fetching dependencies...
     [deps] Copying 1 file to E:\clojure\istext\build\lib
     [deps] Deleting directory E:\clojure\istext\lib
org.apache.tools.ant.BuildException: Unable to delete file E:\clojure\istext\lib\clojure-1.1.0.jar
 at org.apache.tools.ant.taskdefs.Delete.handle (Delete.java:701)
    org.apache.tools.ant.taskdefs.Delete.removeDir (Delete.java:750)
    org.apache.tools.ant.taskdefs.Delete.execute (Delete.java:572)
    sun.reflect.NativeMethodAccessorImpl.invoke0 (:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke (:-1)
    sun.reflect.DelegatingMethodAccessorImpl.invoke (:-1)
    java.lang.reflect.Method.invoke (:-1)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:90)
    clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:265)
    cake.tasks.dependencies$eval4443$fn__4450.invoke (dependencies.clj:120)
    cake$run_task$fn__4087.invoke (cake.clj:102)
    cake$run_task.invoke (cake.clj:101)
    cake$process_command.invoke (cake.clj:162)
    cake.server$create$fn__3914.invoke (server.clj:107)
    cake.contrib.server_socket$accept_fn$fn__3617$fn__3620.invoke (server_socket.clj:39)
    cake.contrib.server_socket$accept_fn$fn__3617.invoke (server_socket.clj:38)
    clojure.lang.AFn.run (AFn.java:24)
    java.lang.Thread.run (:-1)

...and it starts working again after "cake clean".

Doesn't work on Windows, as it uses File.readlink

cake help

d:/Ruby/lib/ruby/gems/1.8/gems/cake-0.3.6/bin/cake:47:in readlink': readlink() function is unimplemented on this machine (NotImplementedError) from d:/Ruby/lib/ruby/gems/1.8/gems/cake-0.3.6/bin/cake:47 from d:/Ruby/bin/cake:19:inload'
from d:/Ruby/bin/cake:19

Invalid maximum heap size

cake

http://github.com/ninjudd/cake-standalone/raw/master/jars/cake-0.4.18.jar
[=============================================================================]
Invalid maximum heap size: -Xmx8192M
The specified size exceeds the maximum representable size.

Could not create the Java virtual machine.

env | grep JAVA
JAVA_OPTS=-server -Xmx8192M -Xms512M -agentlib:yjpagent -Dfile.encoding=UTF-8 -Dswank.encoding=utf-8 -Djava.awt.headless=true

I have no problems running 8GB JVMs, so cake should not complain. It doesn't start with -Xmx4096M, either.

simple authentication by adding cookie to .pid

As an alternative to add some simple authentication to the cake-client and server interaction, the cake-server could add a cookie to the .pid file (some random number or uuid), which the client can communicate for example in the ping/pong exchange.
The idea is that if the .pid files can only be read/written by the user, then the user is the only one who can read the cookie and send it.
The client is also the only one who can read the port number rom the .pid file, but there are other ways to find open ports (netstat and friends) that could be misused.
"Well configured systems" allow only root privileges to snoop on the tcp stream (tcpdump/wireshark), which means that encryption is normally not needed for communication over the loopback (unless you're paranoid...).
Anyway - some lightweight authentication mechanism between cake client-server that would prevent any other user on the system to connect to the cake-server, would be good.

Can't (read) in cake repl

Calling read in a cake repl causes the repl to hang waiting for input.

This affects at least cake 0.3.4

Global Bake Tasks

Feature:
~/.bake/tasks.clj exists as the global list of tasks -- you can use them anywhere on your system.

[Windows] with a new JVM instance, every first call to "cake clean" == exception

With a new JVM instance, every first call to "cake clean":

E:\clojure\istext>cake clean
java.net.SocketException: Connection reset
 at java.net.SocketInputStream.read (:-1)
    sun.nio.cs.StreamDecoder.readBytes (:-1)
    sun.nio.cs.StreamDecoder.implRead (:-1)
    sun.nio.cs.StreamDecoder.read (:-1)
    java.io.InputStreamReader.read (:-1)
    java.io.BufferedReader.fill (:-1)
    java.io.BufferedReader.readLine (:-1)
    java.io.BufferedReader.readLine (:-1)
    cake$bake_STAR_.invoke (cake.clj:138)
    cake.tasks.clean$eval6075$fn__6076.invoke (clean.clj:8)
    cake$run_task$fn__4087.invoke (cake.clj:102)
    cake$run_task.invoke (cake.clj:101)
    cake$process_command.invoke (cake.clj:162)
    cake.server$create$fn__3914.invoke (server.clj:107)
    cake.contrib.server_socket$accept_fn$fn__3617$fn__3620.invoke (server_socket.clj:39)
    cake.contrib.server_socket$accept_fn$fn__3617.invoke (server_socket.clj:38)
    clojure.lang.AFn.run (AFn.java:24)
    java.lang.Thread.run (:-1)

poor-man's mutual-authentication for cake-client and jvms thru lsof

On those systems that have lsof available (macosx does), you can easily find out who the user is associated with an socket port for loopback/localhost connections.

You could use that to implement a simple access control rule that you only accept connections from the same user as you are...

Unfortunately the info that lsof gets is not easily available thru (portable) system calls (at least not a couple years ago when i looked at it), so you would have to run lsof from the command line and parse.


~>cat ~/.cake/.cake/*.pid
897
35447
0.4.13-SNAPSHOT
889
32566
0.4.13-SNAPSHOT
~>lsof -i :35447
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 897 franks 20u IPv6 0x06ef71f0 0t0 TCP [::127.0.0.1]:35447 (LISTEN)
java 897 franks 24u IPv6 0x078826d0 0t0 TCP [::127.0.0.1]:35447->[::127.0.0.1]:51889 (ESTABLISHED)
ruby 1211 franks 3u IPv4 0x0c55cb1c 0t0 TCP localhost:51889->localhost:35447 (ESTABLISHED)
~>whoami
franks
~>lsof -i :32566
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 889 franks 20u IPv6 0x078810e0 0t0 TCP [::127.0.0.1]:32566 (LISTEN)

~>

implement ivy for dependency management

the configuration concept looks to be a better solution to transitive dependencies than maven exclusions. i imagine this will probably break compatibility with lein project.clj's, so thats worth some discussion

Running two cake tasks with no cake JVMs can cause one to fail or hang

Using cake 0.4.16.

Start with no cake JVMs (cake stop).

Steps to reproduce:

  1. Open two command lines on same machine
  2. Go to cake compatible project in each command line
  3. Run "cake swank" in one command line
  4. Immediately run "cake test" in the other

Expected:
Both tasks run.

Actual:
Once I saw a crash. Another time I saw this at the "cake swank" prompt:

$ cake swank
[cake] connection to cake jvm is taking a long time...
[cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart

Option parsing malfunction

rayne@ubuntu:~/cljprojs/cake-github$ cake github.repos.create cake-github --description="A command-line interface to the Github API as a cake plugin. Tasty."
{:github.repos.create ["cake-github" "--description=A command-line interface to the Github API as a cake plugin. Tasty."]}

It doesn't seem to like quotes after a --option. Note that all that task did was print the options raw.

`gem_original_require': no such file to load -- io/wait

Installed ruby (1.8.7), gems, cake (gem) and win32-process (gem) under Cygwin on Windows XP SP3 but still get the following error when running the cake script:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- io/wait (LoadError)

cake war puts src files in /

Hello,
I really like the way cake uses ant to build war files and I prefer it over the leiningen plugin that I wrote.

However, at the moment cake war puts src/*.clj files into / of the war file. I feel that it would be better if they went into WEB-INF/classes because:

  1. Clojure can't load namespaces from '/' but can from WEB-INF/classes.
  2. The source code is currently servable by the web container e.g
    http://www.banking.com/db-passwords.clj

Saul

cake repl doesn't work the very first time from a project directory

The first time you run cake repl in a directory with a project.clj file, the repl does not actually launch. If you run it a second time it works.

I note that outside of a directory that contains a project.clj file, cake repl properly launches a repl the first time.

I'm on OS X 10.6, JDK 1.6 64bit

Running task with sudo then normal user causes Operation not permitted

Cake version 0.4.17
OS: Mac OS X 10.6.4

This happens in a common use case of cake upgrade followed by another use of cake.

Start with not Cake JVMs (cake stop)

  1. Run "sudo cake upgrade"
  2. Go to cake project
  3. Run "cake swank" or "cake test"

Expected:
Task runs

Actual:
$ cake test
/Library/Ruby/Gems/1.8/gems/cake-0.4.17/bin/cake:336:in kill': Operation not permitted (Errno::EPERM) from /Library/Ruby/Gems/1.8/gems/cake-0.4.17/bin/cake:336:inrefresh'
from /Library/Ruby/Gems/1.8/gems/cake-0.4.17/bin/cake:317:in initialize' from /Library/Ruby/Gems/1.8/gems/cake-0.4.17/bin/cake:807:innew'
from /Library/Ruby/Gems/1.8/gems/cake-0.4.17/bin/cake:807
from /usr/bin/cake:19:in `load'
from /usr/bin/cake:19

My theory is that running cake via sudo causes cake to run JVMs as superuser. No other task can access these JVMs.

Note the following appears to work:

  1. Run "cake swank" (starting persistent JVM)
  2. Run "sudo cake upgrade"

Workaround:
$ sudo cake stop

Solution suggestions:
Add special case code for "cake upgrade" that detects (1) if no JVMs are running, and (2) if running as superuser. If both 1 and 2 are true, then run task in non-persistent JVM.

Alternately, If there's some way to run as the user that started sudo, launching the persistent JVM as that user may work.

Compile needs to restart project JVM

When you run 'cake test' and are doing AOT compilation or java compilation, test runs in the stale project JVM and thus does not see your changes.

To fix this, we need a way to restart bake over the socket.

Specify Default Options for `bake new`

Give the ability to set default options for new project.clj files. For instance, allow user to set default :dev-dependencies, :dependencies, :tasks location, etc.

Add cake upgrade task

There are three cases, depending on how cake was installed:

  1. git checkout: cake clean; git pull; cake deps
  2. naked script: replace the script itself with the most current version
  3. gem install: gem update cake

Specifying :tasks key causes Unable to resolve symbol: deftask

project.clj:
...
:tasks [foo.tasks]
...

foo/src/foo/tasks.clj:
(ns foo.tasks)
(deftask hello-world
(println "hello world."))

$ cake help

Exception in thread "main" java.lang.Exception: Unable to resolve symbol: deftask in this context (tasks.clj:3)
at clojure.lang.Compiler.analyze(Compiler.java:5200)
at clojure.lang.Compiler.analyze(Compiler.java:5146)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3031)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5366)

autotest fail

Hi I am trying to run the autotest task but it fails. Here is the trace.

cake autotest
/home/pdelgallego/bin/cake/bin/cake:830:in `send_command': wrong number of arguments (2 for 1) (ArgumentError)
from /home/pdelgallego/bin/cake/bin/cake:830

Cake test task seems to work alright.

cake test

Testing tmp.test.core
FAIL in (replace-me) (core.clj:6)
No tests have been written.
expected: false
actual: false

Ran 1 tests containing 1 assertions.

1 failures, 0 errors.

Finished in 0.032693399 seconds.

This is on ubuntu 10.04, clojure 1.2

Cake alters my code when compiling

I have a project which I can compile with 'lein compile && lein uberjar' to produce a working jar file. Executing java -jar jarfile.jar starts the application. Running 'cake compile' works fine and the application compiles, running 'cake uberjar' produces the standalone jar file as it should, then this:

$ java -jar application-1.0.0-SNAPSHOT-standalone.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalStateException: Can't change/establish root binding of: warn-on-reflection with set (core.clj:1)
....

If the referred core.clj is my own core.clj, then it has injected a reference to warn-on-reflection which for some odd reason cannot be resolved. If its clojure/core.clj, the something else is going on. Either way, the uberjar functionality is broken.

rebuild gracefully when ~/.cake is blown away

I discovered that there were still RC2 clojure jars in the ~/.cake directory, so I deleted ~/.cake thinking that it would automatically be rebuild...
cake started spewing errors wanting to chdir in .cake and wasn't happy until I mkdir ~/.cake... after which it rebuild the .cake directory tree with the latest and greatest clojure jars...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.