elm-compiler 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elm/compiler.rb +12 -12
- data/lib/elm/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd623879a5dc44e26f5b089cd71555e2d372e280
|
4
|
+
data.tar.gz: 8937ab452b9f834746f68aee4db4872c8f99a736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53ebb4b0311735dad5ba9d5267c1dfb19bd4bb754bd3634a2a3d68ef0743e11bd416584ed65fb355f375a9f7f583a3712766e1509d49d187abff31d46987413a
|
7
|
+
data.tar.gz: b1b670d091b6211d742f8a62bd23658e51147b1dd27b158b141737b90dbb5695ed83202b10cf189051c1c35ff9e0c6ec334fd16d5295fd5db468a08ba6f23cbe
|
data/lib/elm/compiler.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
require 'elm/compiler/exceptions'
|
2
2
|
require 'open3'
|
3
3
|
require 'tempfile'
|
4
|
-
require 'mkmf'
|
5
4
|
|
6
5
|
module Elm
|
7
6
|
class Compiler
|
8
7
|
class << self
|
9
|
-
def compile(elm_files, output_path: nil, elm_make_path:
|
10
|
-
|
11
|
-
fail ExecutableNotFound unless elm_executable_exists?(elm_executable)
|
8
|
+
def compile(elm_files, output_path: nil, elm_make_path: "elm-make")
|
9
|
+
fail ExecutableNotFound unless elm_executable_exists?(elm_make_path)
|
12
10
|
|
13
11
|
if output_path
|
14
|
-
elm_make(
|
12
|
+
elm_make(elm_make_path, elm_files, output_path)
|
15
13
|
else
|
16
|
-
compile_to_string(
|
14
|
+
compile_to_string(elm_make_path, elm_files)
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
private
|
21
19
|
|
22
|
-
def elm_executable_exists?(
|
23
|
-
|
20
|
+
def elm_executable_exists?(elm_make_path)
|
21
|
+
Open3.popen2(elm_make_path){}.nil?
|
22
|
+
rescue Errno::ENOENT, Errno::EACCES
|
23
|
+
false
|
24
24
|
end
|
25
25
|
|
26
|
-
def compile_to_string(
|
26
|
+
def compile_to_string(elm_make_path, elm_files)
|
27
27
|
Tempfile.open(['elm', '.js']) do |tempfile|
|
28
|
-
elm_make(
|
28
|
+
elm_make(elm_make_path, elm_files, tempfile.path)
|
29
29
|
return File.read tempfile.path
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def elm_make(
|
34
|
-
Open3.popen3({"LANG" => "en_US.UTF8" },
|
33
|
+
def elm_make(elm_make_path, elm_files, output_path)
|
34
|
+
Open3.popen3({"LANG" => "en_US.UTF8" }, elm_make_path, *elm_files, '--yes', '--output', output_path) do |_stdin, _stdout, stderr, wait_thr|
|
35
35
|
fail CompileError, stderr.gets(nil) if wait_thr.value.exitstatus != 0
|
36
36
|
end
|
37
37
|
end
|
data/lib/elm/compiler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elm-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|