clementine 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -2,8 +2,7 @@ Clementine
|
|
2
2
|
====
|
3
3
|
|
4
4
|
* https://github.com/yokolet/clementine
|
5
|
-
* http://yokolet.blogspot.com/
|
6
|
-
* http://yokolet.blogspot.com/2011/11/tilt-template-for-clojurescript.html
|
5
|
+
* http://yokolet.blogspot.com/2012/10/clementine-gem-clojurescript-on-rails.html
|
7
6
|
|
8
7
|
Description
|
9
8
|
-----------
|
@@ -11,11 +10,16 @@ Description
|
|
11
10
|
Clementine is a gem to use ClojureScript (https://github.com/clojure/clojurescript) from Ruby.
|
12
11
|
Clementine is a Tilt (https://github.com/rtomayko/tilt) Template, which is available to use
|
13
12
|
on Rails asset pipeline. Also, it is avilable to use in a Tilt way.
|
13
|
+
You don't need to compile ClojureScript by yourself anymore. Clementine does for you.
|
14
14
|
|
15
15
|
Clementine runs on Rails 3.1 and later.
|
16
16
|
|
17
17
|
Clementine supports JRuby and CRuby. When you use from CRuby, make sure java command is on your PATH.
|
18
18
|
|
19
|
+
Please be aware. When you run Clementine on CRuby, you hook up JVM everytime ClojureScript code is changed.
|
20
|
+
This takes long time since starting JVM is a heavy weight job.
|
21
|
+
For a shorter compilation time, I recommend using JRuby.
|
22
|
+
|
19
23
|
Installation
|
20
24
|
-----------
|
21
25
|
|
@@ -23,29 +27,43 @@ Installation
|
|
23
27
|
gem install clementine
|
24
28
|
```
|
25
29
|
|
30
|
+
While installing this gem, you'll see a confusing phrase, "Installing clementine (version string) with native extensions."
|
31
|
+
This means clementine is bootstrapping ClojureScript. Clementine never relies on any C library.
|
32
|
+
|
26
33
|
Configuration
|
27
34
|
-----------
|
28
35
|
|
29
36
|
Create clementine.rb file in your ${Rails.root}/config/initializer directory.
|
30
37
|
|
31
|
-
|
38
|
+
Example:
|
32
39
|
|
33
40
|
```ruby
|
34
|
-
Clementine.options[:optimizations] = :
|
35
|
-
Clementine.options[:
|
41
|
+
Clementine.options[:optimizations] = :whitespace
|
42
|
+
Clementine.options[:pretty_print] = true
|
36
43
|
```
|
37
44
|
|
38
45
|
Available options:
|
39
46
|
|
40
47
|
```
|
41
|
-
KEY VALUES
|
42
|
-
------------------ -----------------------
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
48
|
+
KEY VALUES DEFAULT
|
49
|
+
------------------ ----------------------- -------------------
|
50
|
+
:optimizations :whitespace, :advanced :advanced
|
51
|
+
:pretty_print false, true false
|
52
|
+
:target :nodejs (none)
|
53
|
+
:output_dir directory name (none)
|
54
|
+
:output_to file name (none)
|
47
55
|
```
|
48
56
|
|
57
|
+
*note*<br/>
|
58
|
+
If you want to see a readable JavaScript code on the browser,
|
59
|
+
set :whitespace for :optimazations and true for :pretty_print in
|
60
|
+
${Rails.root}/config/initializer/clementine.rb like the example above.
|
61
|
+
|
62
|
+
*note*<br/>
|
63
|
+
ClojureScript has :none value for :optimizations, which also works with Clementine.
|
64
|
+
However, there's no way to see the output with Rails asset pipeline.
|
65
|
+
So, I didn't add :none in the above table.
|
66
|
+
|
49
67
|
Copyright and License
|
50
68
|
-----------
|
51
69
|
Clementine is Copyright (c) 2011-2012 [Yoko Harada](https://github.com/yokolet) and
|
@@ -54,4 +72,4 @@ distributed under the MIT license.
|
|
54
72
|
Clojure and ClojureSript are Copyright (c) Rich Hickey and covered by the Eclipse
|
55
73
|
Public License 1.0 [http://opensource.org/licenses/eclipse-1.0.php](http://opensource.org/licenses/eclipse-1.0.php)
|
56
74
|
|
57
|
-
Google Closure Compiler and Library are covered by Apache License 2.0
|
75
|
+
Google Closure Compiler and Library are covered by Apache License 2.0.
|
data/Rakefile
CHANGED
@@ -2,14 +2,7 @@
|
|
2
2
|
module Clementine
|
3
3
|
class ClojureScriptEngineBase
|
4
4
|
def default_opts
|
5
|
-
|
6
|
-
value = ""
|
7
|
-
if defined?(Rails)
|
8
|
-
value = File.join(Rails.root, "app", "assets", "javascripts", "clementine")
|
9
|
-
else
|
10
|
-
value = Dir.pwd
|
11
|
-
end
|
12
|
-
{key => value}
|
5
|
+
{:optimizations => :advanced, :pretty_print => false}
|
13
6
|
end
|
14
7
|
end
|
15
8
|
end
|
@@ -19,7 +19,7 @@ module Clementine
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def compile
|
22
|
-
@options = Clementine.options if
|
22
|
+
@options = default_opts.merge(Clementine.options) if Clementine.options
|
23
23
|
cl_opts = PersistentHashMap.create(convert_options(@options))
|
24
24
|
RT.loadResourceScript("cljs/closure.clj")
|
25
25
|
builder = RT.var("cljs.closure", "build")
|
@@ -29,7 +29,6 @@ module Clementine
|
|
29
29
|
#private
|
30
30
|
def convert_options(options)
|
31
31
|
opts = {}
|
32
|
-
options = options.empty? ? default_opts : options
|
33
32
|
options.each do |k, v|
|
34
33
|
cl_key = Keyword.intern(Clementine.ruby2clj(k.to_s))
|
35
34
|
case
|
@@ -15,7 +15,7 @@ module Clementine
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def compile
|
18
|
-
@options = Clementine.options if
|
18
|
+
@options = default_opts.merge(Clementine.options) if Clementine.options
|
19
19
|
begin
|
20
20
|
cmd = %Q{#{command} #{@file} '#{convert_options(@options)}' 2>&1}
|
21
21
|
result = `#{cmd}`
|
data/lib/clementine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clementine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|