ruby-elm
[](https://badge.fury .io/rb/ruby-elm)
Ruby wrapper over elm.
Allow to compile elm files using ruby.
Installation
Prerequisites
- Tested against Ruby 2.3
-
elm make
installed and available in$PATH
Setup
gem install ruby-elm
Usage
Library
require 'elm'
# Compile files to a string
Elm.compiler.files(['test.elm']).to_s
# Compile files to a file
# index.html
Elm.compiler.files(['test.elm']).to_file
# other output
Elm.compiler.files(['test.elm'],
with_options: { output: 'out.js' }).to_file
# Compile content to a string or file
content = <<EOF
import Html exposing (text)
main =
text "Hello, World!"
EOF
Elm.compiler.content(content).to_s
Elm.compiler.content(content).to_file
Some options are available:
-
output
:String
-
yes
:Bool
-
report
::normal
/:json
-
warn
:Bool
-
docs
:String
When compile using Elm.compiler
, yes
is always forced as the ruby wrapper is not interactive.
Executable
The executable works as elm-make
:
ruby-elm-make test.elm --warn --output out.js
yes
is always forced as the wrapper is not interactive.
ToDo
Force json mode and extract warnings and errors to ruby objects.
Contributing
- Fork it
- Install dependencies (
bundle install
) - Create your feature branch (
git checkout -b my-new-feature
) - Write and run tests (
rspec
) - Commit your changes (
git commit -am 'Add some feature
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
LICENSE
Please see LICENSE.