rakali 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/.rakali.yml +8 -3
- data/.travis.yml +12 -10
- data/Gemfile.lock +8 -1
- data/README.md +4 -8
- data/Rakefile +19 -0
- data/examples/fenner_2011.epub +0 -0
- data/examples/fenner_2013.epub +0 -0
- data/lib/rakali/converter.rb +2 -1
- data/lib/rakali/document.rb +16 -5
- data/lib/rakali/version.rb +1 -1
- data/rakali.gemspec +1 -0
- data/spec/spec_helper.rb +3 -0
- metadata +17 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fbcaba4904aa189e1f6d70fb4b4c1f988c1d79bc
|
|
4
|
+
data.tar.gz: 2d606db038c01b720c0842efaa821f90ca0893a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a81348d6aedbc7680d92e752d2eb594265d401def51cb9d810f17f8fa2b7f52ccb0d1e2e3531123ea7e4a161831aaf1343a5f120263b7c5912b20c5fc4936277
|
|
7
|
+
data.tar.gz: 75cff22509e12081aab80da77f6a72b77ffe4bb10e017795a6a960fb0de473584093fa925f8dce997067f096911b74a04a3fef6b3d14351c7cf71531afd91ccb
|
data/.gitignore
CHANGED
data/.rakali.yml
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
language: haskell
|
|
2
|
-
|
|
3
2
|
rvm:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
- 1.9.3
|
|
4
|
+
- 2.1.2
|
|
7
5
|
install:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
- travis_retry cabal install pandoc pandoc-citeproc
|
|
7
|
+
- travis_retry bundle install
|
|
11
8
|
script:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
- bundle exec rake
|
|
10
|
+
- bundle exec rakali convert .rakali.yml
|
|
11
|
+
- bundle exec rake repo:push
|
|
15
12
|
deploy:
|
|
16
13
|
provider: rubygems
|
|
17
14
|
api_key:
|
|
@@ -20,3 +17,8 @@ deploy:
|
|
|
20
17
|
on:
|
|
21
18
|
tags: true
|
|
22
19
|
repo: rakali/rakali.rb
|
|
20
|
+
env:
|
|
21
|
+
global:
|
|
22
|
+
- secure: hO+7d+PxnOAk0tLbJOSisF6aKzGjll6E3TsaMuZHoBAA93WCvpZgYmn5VyJy1eRCobxqeP/7xIfiCHBMzHNtr7BC4wHMWx+z6tE/M3osTwQVVsg8Cdviq4LU/XvgXjk4dI8Owsk2aEC/Dw2uRm3XBmvnpMwrj3QoNjunCUeXwo4=
|
|
23
|
+
- secure: JCEDpRmeSeR3nqJg3659mXafpjyvHG5jdg5Uk54zdb/jQfDoHX7qHO5bPG0IJTAKx+vnVWpcs6JMC6ADocymaMxv195Acu9Ch3IEjcYBwdZFoqbBC7d5ZgmhloAVrWBAWgT9zoOj7ppiO3U2iUuj/vHOL57Nnf/DCkW4oxB6ykU=
|
|
24
|
+
- secure: MLmk4mLBqOK8rDbYaT+IZnP0IoxLueCWTGwoNpyx2HdcUIny2235iCmJGE66FY0/ULFsQ3WmFuB5OWgRGkj1bvYAOFiucWotZzDnsUrWyGcH+ZL4xBaZuP9qEFedtB7r1Dv9nrBn6CuhLi1l+BJwk01PpPVq0UPWXxTQ8f9wbhI=
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rakali (0.1.
|
|
4
|
+
rakali (0.1.2)
|
|
5
5
|
colorator (~> 0.1)
|
|
6
6
|
json-schema (~> 2.2)
|
|
7
7
|
safe_yaml (~> 1.0)
|
|
@@ -17,6 +17,8 @@ GEM
|
|
|
17
17
|
builder (3.2.2)
|
|
18
18
|
childprocess (0.5.3)
|
|
19
19
|
ffi (~> 1.0, >= 1.0.11)
|
|
20
|
+
codeclimate-test-reporter (0.3.0)
|
|
21
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
|
20
22
|
colorator (0.1)
|
|
21
23
|
cucumber (1.3.16)
|
|
22
24
|
builder (>= 2.1.2)
|
|
@@ -41,6 +43,10 @@ GEM
|
|
|
41
43
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
42
44
|
rspec-mocks (2.99.2)
|
|
43
45
|
safe_yaml (1.0.3)
|
|
46
|
+
simplecov (0.7.1)
|
|
47
|
+
multi_json (~> 1.0)
|
|
48
|
+
simplecov-html (~> 0.7.1)
|
|
49
|
+
simplecov-html (0.7.1)
|
|
44
50
|
thor (0.19.1)
|
|
45
51
|
|
|
46
52
|
PLATFORMS
|
|
@@ -48,6 +54,7 @@ PLATFORMS
|
|
|
48
54
|
|
|
49
55
|
DEPENDENCIES
|
|
50
56
|
aruba (~> 0)
|
|
57
|
+
codeclimate-test-reporter (~> 0)
|
|
51
58
|
cucumber (~> 1.3)
|
|
52
59
|
rakali!
|
|
53
60
|
rake (~> 0)
|
data/README.md
CHANGED
|
@@ -4,6 +4,7 @@ rakali.rb
|
|
|
4
4
|
[](https://travis-ci.org/rakali/rakali.rb)
|
|
5
5
|
[](http://badge.fury.io/rb/rakali)
|
|
6
6
|
[](https://codeclimate.com/github/rakali/rakali.rb)
|
|
7
|
+
[](https://codeclimate.com/github/rakali/rakali.rb)
|
|
7
8
|
|
|
8
9
|
Rakali is a wrapper for the [Pandoc](http://johnmacfarlane.net/pandoc/) document converter with the following features:
|
|
9
10
|
|
|
@@ -40,21 +41,16 @@ strict: false
|
|
|
40
41
|
merge: false
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
The only required key for the input yaml file is `from` `folder
|
|
44
|
+
The only required key for the input yaml file is `from` `folder` (missing in the default file), and you can override any key in the default file.
|
|
44
45
|
|
|
45
46
|
* **schema**: JSON schema used for validation. Use `your_folder/schema.json` for a custom schema, or use one of the built-in schemata (see [pandoc-schemata](https://github.com/rakali/pandoc-schemata) for a list.)
|
|
46
47
|
* **citations**: include `-f citeproc-pandoc` for citation formatting
|
|
47
48
|
* **strict**: abort conversion on validation errors
|
|
48
49
|
* **merge**: merge all input files into a single file
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
Validation against **JSON Schema** also works directly with Pandoc, generate a JSON representation of the internal Pandoc document format (abstract syntax tree or AST) with `pandoc -o file.json`, and use a JSON Schema file for validation. If possible, please contribute your schema files to the [pandoc-schemata](https://github.com/rakali/pandoc-schemata).
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
language: haskell
|
|
54
|
-
script:
|
|
55
|
-
- gem install rakali
|
|
56
|
-
- rakali convert .rakali.yml
|
|
57
|
-
```
|
|
53
|
+
To integrate rakali into a continuous integration environment such as [Travis CI](https://travis-ci.org), add a configuration file (e.g. `.rakali.yml`) into the root folder of your repo, install Pandoc and the rakali gem and run `rakali convert .rakali.yml`. Look at `.travis.yml`, `.rakali.yml` and the `examples` folder in this repo for a working example.
|
|
58
54
|
|
|
59
55
|
## Feedback
|
|
60
56
|
|
data/Rakefile
CHANGED
|
@@ -6,5 +6,24 @@ require 'rspec/core/rake_task'
|
|
|
6
6
|
Bundler::GemHelper.install_tasks
|
|
7
7
|
RSpec::Core::RakeTask.new('spec')
|
|
8
8
|
|
|
9
|
+
namespace :repo do
|
|
10
|
+
desc "push files generated with rakali to remote"
|
|
11
|
+
task :push do
|
|
12
|
+
|
|
13
|
+
# Configure git if this is run in Travis CI
|
|
14
|
+
if ENV["TRAVIS"]
|
|
15
|
+
sh "git config --global user.name '#{ENV['GIT_NAME']}'"
|
|
16
|
+
sh "git config --global user.email '#{ENV['GIT_EMAIL']}'"
|
|
17
|
+
sh "git config --global push.default simple"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Commit and push to github
|
|
21
|
+
sh "git add --all ."
|
|
22
|
+
sh "git commit -m 'Committing converted files.'"
|
|
23
|
+
sh "git push https://${GH_TOKEN}@github.com/rakali/rakali.rb master --quiet"
|
|
24
|
+
puts "Pushed converted files to repo"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
9
28
|
# default task is running rspec tests
|
|
10
29
|
task :default => :spec
|
|
Binary file
|
|
Binary file
|
data/lib/rakali/converter.rb
CHANGED
data/lib/rakali/document.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Rakali
|
|
4
4
|
class Document
|
|
5
5
|
|
|
6
|
-
attr_accessor :config, :source, :destination, :content, :schema, :errors, :to_folder
|
|
6
|
+
attr_accessor :config, :source, :destination, :content, :schema, :errors, :options, :variables, :to_folder
|
|
7
7
|
|
|
8
8
|
def initialize(document, config)
|
|
9
9
|
begin
|
|
@@ -26,11 +26,19 @@ module Rakali
|
|
|
26
26
|
@destination = @source.sub(/\.#{@from_format}$/, ".#{@to_format}")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# add pandoc options from config
|
|
30
|
+
options = @config.fetch('options') || {}
|
|
31
|
+
@options = options.map { |k,v| "--#{k}=#{v}" }.join(" ")
|
|
32
|
+
|
|
33
|
+
# add pandoc variables from config
|
|
34
|
+
variables = @config.fetch('variables', nil) || {}
|
|
35
|
+
@variables = variables.map { |k,v| "--variable #{k}='#{v}'" }.join(" ")
|
|
36
|
+
|
|
29
37
|
# use citeproc-pandoc if citations flag is set
|
|
30
|
-
bibliography = @config.fetch('citations') ? "-f citeproc-pandoc" : ""
|
|
38
|
+
bibliography = @config.fetch('citations') ? "-f citeproc-pandoc " : ""
|
|
31
39
|
|
|
32
40
|
# convert source document into JSON version of native AST
|
|
33
|
-
@content = convert(nil, @from_folder, "#{@source} #{bibliography}-t json")
|
|
41
|
+
@content = convert(nil, @from_folder, "#{@source} #{bibliography}-t json #{@options} #{@variables}")
|
|
34
42
|
|
|
35
43
|
# read in JSON schema, use included schemata folder if no folder is given
|
|
36
44
|
@schema = scheme
|
|
@@ -39,7 +47,7 @@ module Rakali
|
|
|
39
47
|
@errors = validate
|
|
40
48
|
|
|
41
49
|
# convert to destination document from JSON version of native AST
|
|
42
|
-
@output = convert(@content, @to_folder, "-f json #{bibliography}-o #{@destination}")
|
|
50
|
+
@output = convert(@content, @to_folder, "-f json #{bibliography}-o #{@destination} #{@options} #{@variables}")
|
|
43
51
|
Rakali.logger.abort_with "Fatal:", "Writing file #{@destination} failed" unless created?
|
|
44
52
|
|
|
45
53
|
if @errors.empty?
|
|
@@ -67,7 +75,10 @@ module Rakali
|
|
|
67
75
|
end
|
|
68
76
|
|
|
69
77
|
# abort with log message if non-zero exit_status
|
|
70
|
-
|
|
78
|
+
unless exit_status.success?
|
|
79
|
+
Rakali.logger.error "Pandoc Args:", "#{args}."
|
|
80
|
+
Rakali.logger.abort_with "Fatal:", "#{captured_stderr}."
|
|
81
|
+
end
|
|
71
82
|
|
|
72
83
|
# otherwise return stdout
|
|
73
84
|
captured_stdout
|
data/lib/rakali/version.rb
CHANGED
data/rakali.gemspec
CHANGED
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
|
22
22
|
s.add_development_dependency "rspec", '~> 2.6'
|
|
23
23
|
s.add_development_dependency "cucumber", '~> 1.3'
|
|
24
24
|
s.add_development_dependency "aruba", '~> 0'
|
|
25
|
+
s.add_development_dependency "codeclimate-test-reporter", '~> 0'
|
|
25
26
|
|
|
26
27
|
s.files = `git ls-files`.split($/)
|
|
27
28
|
s.executables = ["rakali"]
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rakali
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
@@ -122,6 +122,20 @@ dependencies:
|
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: codeclimate-test-reporter
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
125
139
|
description: A Pandoc command-line wrapper written in Ruby.
|
|
126
140
|
email: mf@martinfenner.org
|
|
127
141
|
executables:
|
|
@@ -143,7 +157,9 @@ files:
|
|
|
143
157
|
- examples/2014-07-24-dont-reinvent-the-wheel.md
|
|
144
158
|
- examples/2014-08-06-what-is-doi.md
|
|
145
159
|
- examples/fenner_2011.docx
|
|
160
|
+
- examples/fenner_2011.epub
|
|
146
161
|
- examples/fenner_2013.docx
|
|
162
|
+
- examples/fenner_2013.epub
|
|
147
163
|
- filters/caps.rb
|
|
148
164
|
- filters/default.rb
|
|
149
165
|
- lib/rakali.rb
|