texmath-ruby 0.0.1 → 0.0.2

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: 58d0d834d41e8dedcde7b731f4aaadb325c2c3b5
4
- data.tar.gz: 4f56df014bc172c78ed1c2ce8de6e400f67903fa
3
+ metadata.gz: f9dff5d67a42043b1dad540fbb1c500a1fe71757
4
+ data.tar.gz: 997738f9777aad5628ffa7ced78dd1eb5f483c97
5
5
  SHA512:
6
- metadata.gz: 68bc2a4a95ced0348f1ddf8be62ec1caaac43a0de3cebf2e59e573e490592c32f898abb9c137395149b9fbb407273026c829f9ae24c38d0e1335fa857e490669
7
- data.tar.gz: 1b79da5a96331ead2c38f5738ddfd74880443b8cadb1ddc510491d4b4824f49d0d8a4eb34511e4f9af81a4e1b655b43cab1fdcafa991f7ab6747c62228f27ef7
6
+ metadata.gz: 9fd78686649201beaa36df08738e147aa473875d5c4279ef8393b4c4525035f19372c383c3c560a7902f015d7cf9e4b9076ddc584588717f5e5d0303d303149b
7
+ data.tar.gz: 41fd4df99d55b4cbc009d5159d3ee90decd2b2ec702d746c156f33864380713e859bae8e2f98a462c25eda65d168c46ffaea941388154c5a28030bdcb56363d9
data/.gitignore CHANGED
@@ -1,22 +1,5 @@
1
- *.gem
2
- *.rbc
3
1
  .bundle
4
- .config
5
- .yardoc
6
2
  Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
3
+ .yardoc/
10
4
  doc/
11
- lib/bundler/man
12
5
  pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
@@ -1,15 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 2.0.0
4
- - 2.1.2
5
- - ruby-head
6
- - jruby-20mode # JRuby in 1.9 mode
7
- - rbx
5
+ - 2.1
6
+ - 2.2
8
7
  matrix:
9
- allow_failures:
10
- - rvm: ruby-head
8
+ fast_finish: true
11
9
  cache: bundler
12
10
  before_install:
13
11
  - sudo apt-get install haskell-platform
14
12
  - cabal update
15
- - cabal install texmath
13
+ - cabal install -fexecutable texmath
14
+ - export PATH=$HOME/.cabal/bin:$PATH
@@ -0,0 +1 @@
1
+ --markup markdown
data/Gemfile CHANGED
@@ -4,9 +4,10 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem 'pry'
7
+ gem 'yard', github: 'lsegal/yard', branch: 'frameless'
7
8
  end
8
9
 
9
- group :development, :test do
10
+ group :test do
10
11
  gem 'bundler', '~> 1.6'
11
12
  gem 'minitest', '~> 5.5'
12
13
  gem 'rake'
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # texmath-ruby
2
2
 
3
+ [![Build Status](https://img.shields.io/travis/hollingberry/texmath-ruby.svg)](https://travis-ci.org/hollingberry/texmath-ruby)
4
+ [![Gem Version](https://img.shields.io/gem/v/texmath-ruby.svg)](https://rubygems.org/gems/texmath-ruby)
5
+ [![Gem Downloads](https://img.shields.io/gem/dt/texmath-ruby.svg)](https://rubygems.org/gems/texmath-ruby)
6
+ [![Code Climate](https://img.shields.io/codeclimate/github/kabisaict/flow.svg)](http://codeclimate.com/github/hollingberry/texmath-ruby)
7
+
3
8
  A wrapper for [TeXMath](https://github.com/jgm/texmath), a Haskell library for
4
9
  converting between formats used to represent mathematics.
5
10
 
@@ -30,13 +30,13 @@ module TeXMath
30
30
 
31
31
  ##
32
32
  # Create a new Converter.
33
- # @param executable [String] the executable path
34
- # @param from [Symbol] the source format
35
- # @param to [Symbol] the destination format
36
- def initialize(executable = 'texmath', from: :tex, to: :mathml)
37
- @executable = executable
38
- self.reader = from
39
- self.writer = to
33
+ # @option options [String] :executable ('texmath') the executable path
34
+ # @option options [Symbol] :from (:tex) the source format
35
+ # @option options [Symbol] :to (:mathml) the destination format
36
+ def initialize(options = {})
37
+ @executable = options.fetch(:executable, 'texmath')
38
+ self.reader = options.fetch(:from, :tex)
39
+ self.writer = options.fetch(:to, :mathml)
40
40
  end
41
41
 
42
42
  attr_reader :executable
@@ -50,23 +50,23 @@ module TeXMath
50
50
  stdin.close
51
51
  output = stdout.read
52
52
  error = stderr.read
53
- raise ConversionError.new(error) unless error.empty?
53
+ raise ConversionError, error unless error.empty?
54
54
  return output.strip
55
55
  end
56
56
  rescue Errno::ENOENT
57
- raise NoExecutableError.new("Can't find the '#{executable}' executable.")
57
+ raise NoExecutableError, "Can't find the '#{executable}' executable."
58
58
  end
59
59
 
60
60
  attr_reader :reader, :writer
61
61
 
62
62
  def reader=(format)
63
- return @reader = format if READERS.has_key?(format.to_s)
64
- raise InvalidReaderError.new("Can't find '#{format}' reader.")
63
+ return @reader = format if READERS.key?(format.to_s)
64
+ raise ArgumentError, "Can't find '#{format}' reader."
65
65
  end
66
66
 
67
67
  def writer=(format)
68
- return @writer = format if WRITERS.has_key?(format.to_s)
69
- raise InvalidWriterError.new("Can't find '#{format}' writer.")
68
+ return @writer = format if WRITERS.key?(format.to_s)
69
+ raise ArgumentError, "Can't find '#{format}' writer."
70
70
  end
71
71
 
72
72
  private
@@ -7,16 +7,4 @@ module TeXMath
7
7
  ##
8
8
  # Error raised when the `texmath` executable can't be found.
9
9
  class NoExecutableError < StandardError; end
10
-
11
- ##
12
- # Error raised when an invalid reader or writer format is specified.
13
- class InvalidFormatError < StandardError; end
14
-
15
- ##
16
- # Error raised when an invalid reader format is specified.
17
- class InvalidReaderError < InvalidFormatError; end
18
-
19
- ##
20
- # Error raised when an invalid writer format is specified.
21
- class InvalidWriterError < InvalidFormatError; end
22
10
  end
@@ -1,3 +1,3 @@
1
1
  module TeXMath
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -37,30 +37,30 @@ class ConverterTest < Minitest::Test
37
37
 
38
38
  def test_executable_not_found
39
39
  assert_raises NoExecutableError, "Can't find the 'ogremath' executable." do
40
- Converter.new('ogremath').convert('\sqrt{3}')
40
+ Converter.new(executable: 'ogremath').convert('\sqrt{3}')
41
41
  end
42
42
  end
43
43
 
44
44
  def test_string_reader_not_found
45
- assert_raises InvalidReaderError, "Can't find 'pears' reader." do
45
+ assert_raises ArgumentError, "Can't find 'pears' reader." do
46
46
  Converter.new(from: 'pears', to: :mathml)
47
47
  end
48
48
  end
49
49
 
50
50
  def test_string_writer_not_found
51
- assert_raises InvalidWriterError, "Can't find 'pears' writer." do
51
+ assert_raises ArgumentError, "Can't find 'pears' writer." do
52
52
  Converter.new(from: :tex, to: 'pears')
53
53
  end
54
54
  end
55
55
 
56
56
  def test_symbol_reader_not_found
57
- assert_raises InvalidReaderError, "Can't find 'pears' reader." do
57
+ assert_raises ArgumentError, "Can't find 'pears' reader." do
58
58
  Converter.new(from: :pears, to: :mathml)
59
59
  end
60
60
  end
61
61
 
62
62
  def test_symbol_writer_not_found
63
- assert_raises InvalidWriterError, "Can't find 'pears' writer." do
63
+ assert_raises ArgumentError, "Can't find 'pears' writer." do
64
64
  Converter.new(from: :tex, to: :pears)
65
65
  end
66
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texmath-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casper Hollingberry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Convert math markup between LaTeX, MathML, and OMML using Ruby. A wrapper
14
14
  for TeXMath, a Haskell library written by the creator of Pandoc.
@@ -20,6 +20,7 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - ".gitignore"
22
22
  - ".travis.yml"
23
+ - ".yardopts"
23
24
  - Gemfile
24
25
  - LICENSE.txt
25
26
  - README.md
@@ -52,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
53
  version: '0'
53
54
  requirements: []
54
55
  rubyforge_project:
55
- rubygems_version: 2.2.2
56
+ rubygems_version: 2.4.5
56
57
  signing_key:
57
58
  specification_version: 4
58
59
  summary: Convert math markup between LaTeX, MathML, and OMML.
@@ -60,3 +61,4 @@ test_files:
60
61
  - test/support/formats.rb
61
62
  - test/test_helper.rb
62
63
  - test/texmath/converter_test.rb
64
+ has_rdoc: