Skip to content

Commit

Permalink
Merge pull request #51 from takahashim/rubygems
Browse files Browse the repository at this point in the history
packaging as rubygems
  • Loading branch information
kmuto authored Jan 4, 2021
2 parents 1d33b3c + 07ed70d commit 074dde9
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ luac.out
*.x86_64
*.hex

# RubyGems
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/pkg/
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source 'https://rubygems.org'

gem 'simplecov'
gem 'test-unit'
gem 'unicode-eaw'
# Specify your gem's dependencies in pandoc2review.gemspec
gemspec

gem "rake", "~> 12.0"
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "bundler/gem_tasks"
require "rake/testtask"

desc 'Run tests'
task :test, :target do |_, argv|
if argv[:target].nil?
ruby('test/run_test.rb')
else
ruby('test/run_test.rb', "--pattern=#{argv[:target]}")
end
end

task :default => :test
2 changes: 1 addition & 1 deletion pandoc2review → exe/pandoc2review
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# Copyright 2020 Kenshi Muto
require_relative 'pandoc2review-lib'
require 'pandoc2review'
main
File renamed without changes.
4 changes: 2 additions & 2 deletions pandoc2review-lib.rb → lib/pandoc2review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'open3'

def main
bindir = Pathname.new(__FILE__).realpath.dirname
luadir = Pathname.new(__FILE__).realpath.dirname

parse_args

Expand All @@ -15,7 +15,7 @@ def main
puts "#{file} not exist. skip."
next
end
args = ['pandoc', '-t', File.join(bindir, 'review.lua'), '--lua-filter', File.join(bindir, 'filters.lua')]
args = ['pandoc', '-t', File.join(luadir, 'review.lua'), '--lua-filter', File.join(luadir, 'filters.lua')]

if file =~ /\.md$/i
args += ['-f', 'markdown-auto_identifiers-smart+east_asian_line_breaks']
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions pandoc2review.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Gem::Specification.new do |spec|
spec.name = "pandoc2review"
# spec.version = Pandoc2review::VERSION
spec.version = "1.1.0"
spec.authors = ["kmuto"]
spec.email = ["[email protected]"]

spec.summary = %q{Re:VIEW Filter/Writer for Pandoc.}
spec.description = %q{Re:VIEW Filter/Writer for Pandoc.}
spec.homepage = "https://github.com/kmuto/pandoc2review"
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/kmuto/pandoc2review"
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency('unicode-eaw')
spec.add_development_dependency('simplecov')
spec.add_development_dependency('test-unit')
end
5 changes: 4 additions & 1 deletion test/run_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# ALL: ruby test/run_test.rb
# UNIT: ruby test/run_test.rb -v -n test_para
base_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
lib_dir = File.join(base_dir, 'lib')
test_dir = File.join(base_dir, 'test')

$LOAD_PATH.unshift(lib_dir)

require 'simplecov'
SimpleCov.start
require 'test/unit'
require_relative '../pandoc2review-lib'
require 'pandoc2review'

argv = ARGV || ['--max-diff-target-string-size=10000']
exit Test::Unit::AutoRunner.run(true, test_dir, argv)
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'open3'

def pandoc(src, opts: nil, err: nil)
args = 'pandoc -t review.lua --lua-filter=filters.lua -f markdown-auto_identifiers-smart+east_asian_line_breaks'
args = 'pandoc -t lib/review.lua --lua-filter=lib/filters.lua -f markdown-auto_identifiers-smart+east_asian_line_breaks'
if opts
args += ' ' + opts
end
Expand Down

0 comments on commit 074dde9

Please sign in to comment.