Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

Commit

Permalink
Add rebar build system
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Jul 23, 2013
1 parent f843f31 commit b7c2890
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 8 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ This repository contains a much-improved Erlang package.
- *Goto Symbol* works correctly
- Snippets that *actually* make your life easier when writing Erlang code

## No IDE Functionality
## Build Systems

This package does not provide any functionality related to
building or testing Erlang applications. If you need any of that, check out the [SublimErl] package. Compiling single files is supported.
This package comes with a build system definition for rebar.
It runs rebar in the project folder containing the current file.

There is also a build system that runs erlc.

## Installation

* clone this repository into the ST2 `Packages` folder
* clone this repository into the ST `Packages` folder
* remove the `Erlang` folder inside your ST2 `Packages` folder or (more elegant)
disable the `Erlang` package in your User Settings file.
disable the `Erlang` package in your User Settings file.

This package is not yet available through Package Control.
I recommend tracking this repository using Package Control's "Add Repository" command.
Expand All @@ -32,7 +34,7 @@ to the JSON source.
You are kindly invited to use the included Sublime Text project file.

To build all grammar files from the command line, run:

build/all.py

Pull requests and issues are welcome.
Expand Down
17 changes: 15 additions & 2 deletions plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import sublime
import sublime_plugin
import sublime, sublime_plugin

if (sublime.version() != '') and (sublime.version() < '3000'):
pass
else:
from .st3 import ErlangCommandHooks

class ExecInProjectFolderCommand(sublime_plugin.WindowCommand):
def run(self, **kwargs):
folders = self.window.folders()
if len(folders) >= 1:
kwargs['working_dir'] = folders[0]
v = self.window.active_view()
if v is not None and v.file_name() is not None:
for folder in folders:
if v.file_name().startswith(folder):
kwargs['working_dir'] = folder
break

self.window.run_command("exec", kwargs)
39 changes: 39 additions & 0 deletions rebar.sublime-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cmd": ["rebar", "compile", "skip_deps=true"],
"target": "exec_in_project_folder",
"path": "$HOME/bin:/usr/local/bin:$PATH",
"file_regex": "^([^: ]+):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.erlang",
"variants": [
{
"name": "Clean",
"cmd": ["rebar", "clean", "--verbose", "skip_deps=true"]
},
{
"name": "Build with dependencies",
"cmd": ["rebar", "compile"]
},
{
"name": "Test (common_test)",
"cmd": ["rebar", "ct", "--verbose", "skip_deps=true"]
},
{
"name": "Test (eunit)",
"cmd": ["rebar", "eunit", "--verbose", "skip_deps=true"]
},
{
"name": "Test Current Module (eunit)",
"cmd": ["rebar", "eunit", "--verbose", "skip_deps=true",
"suites=${file_name/\\.erl$//}"]
},
{
"name": "Generate Documentation",
"cmd": ["rebar", "doc", "skip_deps=true"],
"file_regex": "^([^, ]+), .*?\\b(?:at line ([0-9]+)):( )(.*)"
},
{
"name": "Update Dependencies",
"cmd": ["rebar", "get-deps", "update-deps"]
}
]
}

0 comments on commit b7c2890

Please sign in to comment.