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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a22cb64058f5d0317d5eca7e70d53e0eb05819a8
4
- data.tar.gz: 66bf2ee4d3349832e6ec155fdbf2fdcf227617b5
3
+ metadata.gz: fd623879a5dc44e26f5b089cd71555e2d372e280
4
+ data.tar.gz: 8937ab452b9f834746f68aee4db4872c8f99a736
5
5
  SHA512:
6
- metadata.gz: 6cc9ae96a797f4249b066e5bd6976b823ac7129efd18fc884791b5948541d0e60c09cc6715d56cdf1675f656dcb2d2b0adc62f474ffe73a6c3b07bb14431439c
7
- data.tar.gz: 07fbb644d45b8571da8202db901ff309d2abc514edafea7c25ba67e3aebc45dfbbae1282539aa31ee9ce9aeaf6f0b66897cc3341e23e7160ae310cfe6c4d71ee
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: nil)
10
- elm_executable = elm_make_path || find_executable0("elm-make")
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(elm_executable, elm_files, output_path)
12
+ elm_make(elm_make_path, elm_files, output_path)
15
13
  else
16
- compile_to_string(elm_executable, elm_files)
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?(elm_executable)
23
- File.executable?(elm_executable)
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(elm_executable, elm_files)
26
+ def compile_to_string(elm_make_path, elm_files)
27
27
  Tempfile.open(['elm', '.js']) do |tempfile|
28
- elm_make(elm_executable, elm_files, tempfile.path)
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(elm_executable, elm_files, output_path)
34
- Open3.popen3({"LANG" => "en_US.UTF8" }, elm_executable, *elm_files, '--yes', '--output', output_path) do |_stdin, _stdout, stderr, wait_thr|
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
@@ -1,5 +1,5 @@
1
1
  module Elm
2
2
  class Compiler
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
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.0
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-05-20 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler