Skip to content

Commit

Permalink
update to use clojure.main
Browse files Browse the repository at this point in the history
  • Loading branch information
trampoline committed Jun 22, 2009
1 parent adf34cd commit 3450206
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.txt
Expand Up @@ -17,20 +17,21 @@ a loader for clojure. configures java classpath with minimal fuss
- pass arbitrary clojure program options
- follow symlink from bin dir to find clojure repos
- rlwrap support
- script and repl support

== PROBLEMS:

a poor substitute for a real package manager

== SYNOPSIS:

# invoke clojure.lang.Script with clojure-json lib and with both java and script args
# run a script with clojure-json lib and with both java and script args
/path/to/clojure-load.rb/clojure --script -l clojure-json -- -Xmx1g -- script args

# invoke clojure.lang.Script with clojure-http-client lib and script args
# run a script with clojure-http-client lib and script args
/path/to/clojure-load.rb/clojure --script -l clojure-http-client -- script args

# invoke clojure.lang.Repl with clojureql and incanter libs and java args only
# start a repl with clojureql and incanter libs and java args only
/path/to/clojure-load.rb/clojure -l clojureql -l incanter -- -Xmx1g --

== REQUIREMENTS:
Expand Down
9 changes: 5 additions & 4 deletions clojure
Expand Up @@ -21,7 +21,8 @@ def parse_opts(argv)
:clj_home => File.join( File.dirname(FILE), "..", "clojure" ),
:clj_root => File.join( File.dirname(FILE), ".." ),
:default_libs => ["clojure-contrib"],
:main => "clojure.lang.Repl",
:main => "clojure.main",
:repl => true,
:rlwrap => nil,
:java => "java",
:debug => false,
Expand All @@ -48,7 +49,7 @@ def parse_opts(argv)
end

opts.on( "--script" , "use clojure.lang.Script as the main java class" ) do
options[:main] = "clojure.lang.Script"
options[:repl] = false
end

opts.on( "--nodefaultlibs", "disable inclusion of default clojure libs on classpath" ) do
Expand Down Expand Up @@ -177,7 +178,7 @@ def squish_argv(argv)
end

def rlwrap(options)
%x{which rlwrap}.strip if options[:rlwrap] || (options[:rlwrap].nil? && options[:main] == "clojure.lang.Repl" )
%x{which rlwrap}.strip if options[:rlwrap] || (options[:rlwrap].nil? && options[:repl] )
end

def launch_clojure(options)
Expand All @@ -189,7 +190,7 @@ def launch_clojure(options)
clj_args = ARGV
end

cmd_line = "#{rlwrap(options)} #{options[:java]} -Dpid=#{Process.pid} #{squish_argv(java_args)} -cp #{classpath(options)} #{options[:main]} #{squish_argv(clj_args)}".strip
cmd_line = "#{rlwrap(options)} #{options[:java]} -Dpid=#{Process.pid} #{squish_argv(java_args)} -cp #{classpath(options)} #{options[:main]} #{"--repl" if options[:repl]} #{squish_argv(clj_args)}".strip
$stderr << cmd_line << "\n" if DEBUG
exec( cmd_line )
end
Expand Down

0 comments on commit 3450206

Please sign in to comment.