diff --git a/.travis.yml b/.travis.yml index 3ae10914..43777fc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,11 @@ language: elixir cache: apt env: - - EVM_EMACS=24.3 TEST_RUN="rake test" - - EVM_EMACS=24.4 TEST_RUN="rake test" - - EVM_EMACS=24.5 TEST_RUN="rake test-no-gui" - - EVM_EMACS=25.1 TEST_RUN="rake test" - - EVM_EMACS=25.2 TEST_RUN="rake test" - # - EVM_EMACS=git-snapshot TEST_RUN="rake test" + - EVM_EMACS=24.3 + - EVM_EMACS=24.4 + - EVM_EMACS=24.5 + - EVM_EMACS=25.1 + - EVM_EMACS=25.2 matrix: include: - elixir: 1.0.5 @@ -22,4 +21,4 @@ before_install: install: - cask install script: - - $TEST_RUN + - cask exec ert-runner diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7443d80c..8b4aeffe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,8 @@ should take to help get it added/fixed in emacs-elixir * elixir-mode * emacs - * Ideally, creating a pull request with a (failing) test case demonstrating - what's wrong. This makes it easy for us to reproduce & fix the problem. + * Ideally, creating a pull request with a test case demonstrating what's wrong. + This makes it easy for us to review, reproduce & fix the problem. You might also hop into the IRC channel (``#elixir-lang`` on ``irc.freenode.net``) & raise your question there, as there may be someone who can help you with a @@ -58,14 +58,15 @@ substantial time for the all-volunteer team to get to. ## How to run tests -There are three tools that helps us to test emacs-elixir: +There are two tools that helps us to test emacs-elixir: -* [EVM](https://github.com/rejeep/evm) - a command-line tool which allows you to easily install, manage, and work with multiple Emacs versions. * [Cask](https://github.com/cask/cask) - a project management tool for Emacs that helps automate the package development cycle. * [Ert-runner](https://github.com/rejeep/ert-runner.el) - a tool for Emacs projects tested using Ert. ### Emacs Version Manager +Emacs has many versions and currently we support from version 24+. If you want to reproduce a bug/issue on a specific version of Emacs, there are some alternatives like EVM. Here is a setup for EVM. + To install [EVM](https://github.com/rejeep/evm), run: ```bash @@ -94,7 +95,7 @@ Read more about [EVM](https://github.com/rejeep/evm). To install Cask, run: ```bash -$ curl -fsSkL https://raw.github.com/cask/cask/master/go | python +$ curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python $ export PATH="~/.cask/bin:$PATH" # Add it to your .bashrc or analogue ``` diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 748e3d39..00000000 --- a/Rakefile +++ /dev/null @@ -1,157 +0,0 @@ -EMACS = "emacs" -CASK = "cask" - -task default: %w[test] - -desc "Create a new release." -task release: [:test] do - current_version = run('git tag').split(/\n/).last.strip[1..-1] - version = ask("What version do you want to release? (current: #{current_version}): ") - version_tag = "v%s" % version - - if run('git tag').split(/\n/).include?(version_tag) - raise("This tag has already been committed to the repo.") - end - - run "./release.py v#{current_version} HEAD -t #{version_tag} -f CHANGELOG.md" - - elixir_mode_contents = File.read('elixir-mode.el') - File.write('elixir-mode.el', update_version(elixir_mode_contents, current_version, version)) - git_changes(version, version_tag) -end - -desc "Installed Emacs information" -task 'info' do - process_info "Install Emacs information" - say "" - say "PATH: ", :green, false - system "which #{EMACS}" - say "VERSION: ", :green, false - system "#{CASK} exec #{EMACS} --version | head -1" -end - -desc "Install package dependencies" -task "install" do - process_info "Install package dependencies" - say "" - say "#{indent(3)}Command: ", :yellow, false - sh "cask install" - say "" -end - -desc "Run test suite" -task "test" do - process_info "Run test suite" - say "" - system "#{CASK} exec ert-runner" - - exit_when_failed!("Test suite failed!\n") -end - -desc "Run test suite with Emacs without GUI window" -task "test-no-gui" do - process_info "Run test suite with --no-win" - say "" - system "#{CASK} exec ert-runner --no-win" - - print_when_success("Test suite success\n") - exit_when_failed!("Test suite failed!\n") -end - -namespace :testing do - desc "Run indentation test suite" - task "indentation" do - process_info "Run test suite" - say "" - system "#{CASK} exec ert-runner -t indentation" - - exit_when_failed!("Test suite failed!\n") - end - - desc "Run font highlighting test suite" - task "fontification" do - process_info "Run test suite" - say "" - system "#{CASK} exec ert-runner -t fontification,syntax-table" - - exit_when_failed!("Test suite failed!\n") - end -end - -def git_changes(version, version_tag) - run "git commit -a -m \"prepare #{version}\"" - run "git tag -a -m \"Version #{version}\" #{version_tag}" - run "git push origin" - run "git push origin --tags" -end - -def update_version(content, from, to) - content = content.gsub("Version: #{from}", "Version: #{to}") -end - -def exit_when_failed!(message) - if $?.exitstatus != 0 - warning(message) - exit(1) - end -end - -def print_when_success(message) - if $?.exitstatus == 0 - info(message) - end -end - -def ansi - { - green: "\e[32m", - red: "\e[31m", - white: "\e[37m", - bold: "\e[1m", - on_green: "\e[42m", - ending: "\e[0m" - } -end - -def run(command) - `#{command}` -end - -def say(message, type=:white, newline=true) - message = "#{ansi[type]}#{message}#{ansi[:ending]}" - if newline - puts message - else - print message - end -end - -def process_info(message) - puts "#{ansi[:bold]}#{ansi[:green]}#{message}#{ansi[:ending]}#{ansi[:ending]}" -end - -def info(message) - puts "#{ansi[:green]}#{ansi[:bold]}#{message}#{ansi[:ending]}#{ansi[:ending]}" -end - -def warning(message) - puts "#{ansi[:red]}#{ansi[:bold]}#{message}#{ansi[:ending]}#{ansi[:ending]}" -end - -def ask(question, type=:white) - say(question, type, false) - answer = STDIN.gets.chomp - if answer == "" || answer.nil? - return nil - else - return answer - end -end - -def indent(count) - " " * count -end - -def colorize(string, color) - "#{ansi[color]}#{string}#{ansi[:ending]}" -end diff --git a/release.py b/release.py deleted file mode 100755 index 6ca3c680..00000000 --- a/release.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -"""This script generates release notes for each merged pull request from -git merge-commit messages. - -Usage: - - `python release.py [--output {file,stdout}]` - -For example, if you wanted to find the diff between version 1.0 and 1.2, -and write the output to the release notes file, you would type the -following: - - `python release.py 1.0 1.2 -o file` - -""" -import os.path as op -import re -import subprocess -from collections import deque - - -def commit_msgs(start_commit, end_commit): - """Run the git command that outputs the merge commits (both subject - and body) to stdout, and return the output. - - """ - fmt_string = ("'%s%n* [#{pr_num}]" - "(https://github.com/elixir-editors/emacs-elixir/pull/{pr_num}) - %b'") - return subprocess.check_output([ - "git", - "log", - "--pretty=format:%s" % fmt_string, - "--merges", "%s..%s" % (start_commit, end_commit)]) - - -def release_note_lines(msgs): - """Parse the lines from git output and format the strings using the - pull request number. - - """ - ptn = r"Merge pull request #(\d+).*\n([^\n]*)'$" - pairs = re.findall(ptn, msgs, re.MULTILINE) - return deque(body.format(pr_num=pr_num) for pr_num, body in pairs) - - -def release_header_line(version, release_date=None): - release_date = release_date or datetime.date.today().strftime('%Y/%m/%d') - return "## %s - %s" % (version, release_date) - - -def prepend(filename, lines, release_header=False): - """Write `lines` (i.e. release notes) to file `filename`.""" - if op.exists(filename): - with open(filename, 'r+') as f: - first_line = f.read() - f.seek(0, 0) - f.write('\n\n'.join([lines, first_line])) - else: - with open(filename, 'w') as f: - f.write(lines) - f.write('\n') - - -if __name__ == "__main__": - import argparse - import datetime - - parser = argparse.ArgumentParser() - parser.add_argument('start_commit', metavar='START_COMMIT_OR_TAG') - parser.add_argument('end_commit', metavar='END_COMMIT_OR_TAG') - parser.add_argument('--filepath', '-f', - help="Absolute path to output file.") - parser.add_argument('--tag', '-t', metavar='NEW_TAG') - parser.add_argument( - '--date', '-d', metavar='RELEASE_DATE', - help="Date of release for listed patch notes. Use yyyy/mm/dd format.") - args = parser.parse_args() - start, end = args.start_commit, args.end_commit - lines = release_note_lines(commit_msgs(start, end)) - - if args.tag: - lines.appendleft(release_header_line(args.tag, args.date)) - - lines = '\n'.join(lines) - - if args.filepath: - filename = op.abspath(args.filepath) - prepend(filename, lines) - else: - print lines