redcar-clojure 0.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
File without changes
@@ -0,0 +1,65 @@
1
+
2
+ module Redcar
3
+ class Clojure
4
+ class ReplMirror < Redcar::REPL::ReplMirror
5
+
6
+ def title
7
+ "Clojure REPL"
8
+ end
9
+
10
+ def grammar_name
11
+ "Clojure REPL"
12
+ end
13
+
14
+ def prompt
15
+ "user=>"
16
+ end
17
+
18
+ def evaluator
19
+ @evaluator ||= Evaluator.new(self)
20
+ end
21
+
22
+ def format_error(e)
23
+ "ERROR: #{e.message}\n\n#{e.backtrace.join("\n")}"
24
+ end
25
+
26
+ class Evaluator
27
+ attr_reader :wrapper
28
+
29
+ def self.load_dependencies
30
+ unless @loaded
31
+ Clojure.load_dependencies
32
+ import 'redcar.repl.Wrapper'
33
+ @loaded = true
34
+ end
35
+ end
36
+
37
+ def initialize(mirror)
38
+ Evaluator.load_dependencies
39
+ @mirror = mirror
40
+ @wrapper ||= begin
41
+ wrapper = Wrapper.new
42
+
43
+ @thread = Thread.new do
44
+ loop do
45
+ output = wrapper.getResult
46
+ output =~ /^(.*)\nuser=> /
47
+ @result = $1
48
+ end
49
+ end
50
+
51
+ wrapper
52
+ end
53
+ end
54
+
55
+ def execute(expr)
56
+ wrapper.sendToRepl(expr)
57
+ true until @result
58
+ str = @result
59
+ @result = nil
60
+ str
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
data/lib/clojure.rb ADDED
@@ -0,0 +1,39 @@
1
+
2
+ require 'clojure/repl_mirror'
3
+
4
+ puts "loading the clojure plugin"
5
+
6
+ module Redcar
7
+ class Clojure
8
+
9
+ def self.menus
10
+ Menu::Builder.build do
11
+ sub_menu "Plugins" do
12
+ sub_menu "REPL" do
13
+ item "Open Clojure REPL", OpenClojureREPL
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ def self.load_dependencies
20
+ unless @loaded
21
+ require File.join(vendor_dir, "clojure-1.2beta1.jar")
22
+ require File.join(vendor_dir, "clojure-contrib-1.2beta1.jar")
23
+ require File.join(vendor_dir, "org-enclojure-repl-server.jar")
24
+ require File.join(vendor_dir, "enclojure-wrapper.jar")
25
+ @loaded = true
26
+ end
27
+ end
28
+
29
+ def self.vendor_dir
30
+ File.expand_path("../../vendor", __FILE__)
31
+ end
32
+
33
+ class OpenClojureREPL < Redcar::REPL::OpenREPL
34
+ def execute
35
+ open_repl(ReplMirror.new)
36
+ end
37
+ end
38
+ end
39
+ end
data/plugin.rb ADDED
@@ -0,0 +1,9 @@
1
+
2
+ Plugin.define do
3
+ name "clojure"
4
+ version "1.0"
5
+ file "lib", "clojure"
6
+ object "Redcar::Clojure"
7
+ dependencies "redcar", ">0",
8
+ "repl", ">0"
9
+ end
@@ -0,0 +1,16 @@
1
+ (ns redcar.repl.Wrapper
2
+ (:require [org.enclojure.repl.main])
3
+ (:gen-class
4
+ :state state
5
+ :init init
6
+ :methods [[getResult [] String]
7
+ [sendToRepl [String] void]]))
8
+
9
+ (defn -init []
10
+ [[] (org.enclojure.repl.main/create-clojure-repl)])
11
+
12
+ (defn -getResult [this]
13
+ ((:result-fn (.state this))))
14
+
15
+ (defn -sendToRepl [this expr]
16
+ ((:repl-fn (.state this)) expr))
Binary file
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redcar-clojure
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: java
7
+ authors:
8
+ - Daniel Lucraft
9
+ - Delisa Mason
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2011-06-11 00:00:00 +01:00
15
+ default_executable:
16
+ dependencies: []
17
+
18
+ description: ""
19
+ email:
20
+ - dan@fluentradical.com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files: []
26
+
27
+ files:
28
+ - lib/clojure.rb
29
+ - lib/clojure/repl_mirror.rb
30
+ - README.md
31
+ - plugin.rb
32
+ - vendor/clojure-1.2beta1.jar
33
+ - vendor/clojure-contrib-1.2beta1.jar
34
+ - vendor/enclojure-wrapper.jar
35
+ - vendor/Wrapper.clj
36
+ has_rdoc: true
37
+ homepage: http://github.com/danlucraft/redcar-clojure
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.5.1
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: A Redcar plugin for Clojure development
64
+ test_files: []
65
+