texqc 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.0pdd.yml +9 -0
- data/.gitattributes +7 -0
- data/.gitignore +8 -0
- data/.pdd +7 -0
- data/.rubocop.yml +18 -0
- data/.rultor.yml +24 -0
- data/.simplecov +38 -0
- data/.travis.yml +20 -0
- data/Gemfile +25 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +58 -0
- data/bin/texqc +81 -0
- data/cucumber.yml +3 -0
- data/features/cli.feature +33 -0
- data/features/gem_package.feature +24 -0
- data/features/step_definitions/steps.rb +85 -0
- data/features/support/env.rb +23 -0
- data/texqc.gemspec +55 -0
- metadata +181 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 06a73d1f91892dc04f7e1b4864346b7e5e70f87d8dc6aca2a2f8de5b72553d0c
|
4
|
+
data.tar.gz: f85a2583d3420b2fc796bf2d58b24e13fa1423d431ab4123b7a300ba4ecad77a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24c93433d17e8c14990ac23610301bc29657491ec60e87df33e1c302e4c53185f4f84e8b1602a8a65b8a46939bcc0c58fc51eeb697c7dc2766c8e0f0d4674bed
|
7
|
+
data.tar.gz: 7f84739d8dc5ec803a555c8d586d0688f752cc36ec9fe14614565db2c3d265d250f03821214343d3396342f08066b6bdc566cfc29e487222d97ff8a3d8d5daef
|
data/.0pdd.yml
ADDED
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'assets/**/*'
|
4
|
+
DisplayCopNames: true
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
Max: 100
|
9
|
+
Layout/EndOfLine:
|
10
|
+
EnforcedStyle: lf
|
11
|
+
Style/MultilineTernaryOperator:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/BlockLength:
|
14
|
+
Max: 50
|
15
|
+
Layout/AlignParameters:
|
16
|
+
Enabled: false
|
17
|
+
Layout/EmptyLineAfterGuardClause:
|
18
|
+
Enabled: false
|
data/.rultor.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
assets:
|
2
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
|
+
install: |
|
4
|
+
sudo apt install -y aspell
|
5
|
+
pdd -f /dev/null
|
6
|
+
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
7
|
+
release:
|
8
|
+
script: |-
|
9
|
+
bundle exec rake
|
10
|
+
sed -i "s/0\.0\.0/${tag}/g" bin/texqc
|
11
|
+
sed -i "s/0\.0\.0/${tag}/g" texqc.gemspec
|
12
|
+
git add bin/texqc
|
13
|
+
git add texqc.gemspec
|
14
|
+
git commit -m "version set to ${tag}"
|
15
|
+
gem build texqc.gemspec
|
16
|
+
chmod 0600 ../rubygems.yml
|
17
|
+
gem push *.gem --config-file ../rubygems.yml
|
18
|
+
merge:
|
19
|
+
script: |-
|
20
|
+
bundle exec rake
|
21
|
+
deploy:
|
22
|
+
script: |-
|
23
|
+
echo "There is nothing to deploy"
|
24
|
+
exit -1
|
data/.simplecov
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
if Gem.win_platform? then
|
22
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
23
|
+
SimpleCov::Formatter::HTMLFormatter
|
24
|
+
]
|
25
|
+
SimpleCov.start do
|
26
|
+
add_filter "/test/"
|
27
|
+
add_filter "/features/"
|
28
|
+
end
|
29
|
+
else
|
30
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
31
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
32
|
+
)
|
33
|
+
SimpleCov.start do
|
34
|
+
add_filter "/test/"
|
35
|
+
add_filter "/features/"
|
36
|
+
minimum_coverage 60
|
37
|
+
end
|
38
|
+
end
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.6.0
|
4
|
+
cache: bundler
|
5
|
+
branches:
|
6
|
+
only:
|
7
|
+
- master
|
8
|
+
addons:
|
9
|
+
apt:
|
10
|
+
packages:
|
11
|
+
- aspell
|
12
|
+
- aspell-en
|
13
|
+
install:
|
14
|
+
- gem install pdd -v 0.20.5
|
15
|
+
- travis_retry bundle update
|
16
|
+
script:
|
17
|
+
- pdd -f /dev/null
|
18
|
+
- bundle exec rake
|
19
|
+
after_success:
|
20
|
+
- "bash <(curl -s https://codecov.io/bash)"
|
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
source 'https://rubygems.org'
|
24
|
+
ruby '~>2.3'
|
25
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
<img src="/logo.svg" width="64px"/>
|
2
|
+
|
3
|
+
[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
|
4
|
+
[![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
|
5
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/texqc)](http://www.rultor.com/p/yegor256/texqc)
|
6
|
+
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
7
|
+
|
8
|
+
[![Build Status](https://travis-ci.org/yegor256/texqc.svg)](https://travis-ci.org/yegor256/texqc)
|
9
|
+
[![PDD status](http://www.0pdd.com/svg?name=yegor256/texqc)](http://www.0pdd.com/p?name=yegor256/texqc)
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/texqc.svg)](http://badge.fury.io/rb/texqc)
|
11
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/7593273bfae71f87ea8c/maintainability)](https://codeclimate.com/github/yegor256/texqc/maintainability)
|
12
|
+
|
13
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/takes/texqc/master/LICENSE.txt)
|
14
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/texqc.svg)](https://codecov.io/github/yegor256/texqc?branch=master)
|
15
|
+
[![Hits-of-Code](https://hitsofcode.com/github/yegor256/texqc)](https://hitsofcode.com/view/github/yegor256/texqc)
|
16
|
+
|
17
|
+
This tool helps you make sure your LaTeX document compiles without issues.
|
18
|
+
|
19
|
+
First, you install it:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ gem install texqc
|
23
|
+
```
|
24
|
+
|
25
|
+
Then, you just run it after the LaTeX document is compiled:
|
26
|
+
|
27
|
+
```bash
|
28
|
+
$ latexmk -pdf article
|
29
|
+
$ texqc article
|
30
|
+
```
|
31
|
+
|
32
|
+
## How to contribute
|
33
|
+
|
34
|
+
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
35
|
+
Make sure your build is green before you contribute
|
36
|
+
your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
37
|
+
[Bundler](https://bundler.io/) installed. Then:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ bundle update
|
41
|
+
$ bundle exec rake
|
42
|
+
```
|
43
|
+
|
44
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rake'
|
25
|
+
require 'rdoc'
|
26
|
+
require 'rake/clean'
|
27
|
+
|
28
|
+
def name
|
29
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
30
|
+
end
|
31
|
+
|
32
|
+
def version
|
33
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
34
|
+
end
|
35
|
+
|
36
|
+
task default: %i[clean features rubocop copyright]
|
37
|
+
|
38
|
+
require 'rubocop/rake_task'
|
39
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
40
|
+
task.fail_on_error = true
|
41
|
+
task.requires << 'rubocop-rspec'
|
42
|
+
end
|
43
|
+
|
44
|
+
require 'cucumber/rake/task'
|
45
|
+
Cucumber::Rake::Task.new(:features) do
|
46
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
47
|
+
end
|
48
|
+
Cucumber::Rake::Task.new(:'features:html') do |t|
|
49
|
+
t.profile = 'html_report'
|
50
|
+
end
|
51
|
+
|
52
|
+
task :copyright do
|
53
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
54
|
+
--include '*.rb' \
|
55
|
+
--include '*.txt' \
|
56
|
+
--include 'Rakefile' \
|
57
|
+
."
|
58
|
+
end
|
data/bin/texqc
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
VERSION = '0.1.0'
|
25
|
+
|
26
|
+
STDOUT.sync = true
|
27
|
+
|
28
|
+
require 'backtrace'
|
29
|
+
require 'loog'
|
30
|
+
require 'open3'
|
31
|
+
require 'slop'
|
32
|
+
|
33
|
+
begin
|
34
|
+
log = Loog::REGULAR
|
35
|
+
begin
|
36
|
+
opts = Slop.parse(ARGV, strict: true, help: true) do |o|
|
37
|
+
o.banner = "Usage (#{VERSION}): texqc [options] file
|
38
|
+
Options are:"
|
39
|
+
o.array '--dry', 'Don\'t fail the build on errors'
|
40
|
+
o.bool '--version', 'Print current version' do
|
41
|
+
puts VERSION
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
o.bool '--verbose', 'Make it more verbose than usual' do
|
45
|
+
log = Loog::VERBOSE
|
46
|
+
end
|
47
|
+
o.bool '--help', 'Read this: https://github.com/yegor256/texqc' do
|
48
|
+
puts o
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
rescue Slop::Error => ex
|
53
|
+
raise ex.message
|
54
|
+
end
|
55
|
+
raise 'Try --help' if opts.arguments.empty?
|
56
|
+
raise 'Too many arguments' unless opts.arguments.length == 1
|
57
|
+
errors = 0
|
58
|
+
f = "#{opts.arguments[0]}.log"
|
59
|
+
File.readlines(f).each do |t|
|
60
|
+
if t.include?('Underfull')
|
61
|
+
errors += 1
|
62
|
+
puts t
|
63
|
+
end
|
64
|
+
if t.include?('Overfull')
|
65
|
+
errors += 1
|
66
|
+
puts t
|
67
|
+
end
|
68
|
+
end
|
69
|
+
unless errors.zero?
|
70
|
+
log.info("#{errors} LaTeX processing errors found in #{f.inspect}")
|
71
|
+
exit 1
|
72
|
+
end
|
73
|
+
log.info("No LaTeX processing errors found in #{f.inspect}")
|
74
|
+
rescue StandardError => ex
|
75
|
+
if opts[:verbose]
|
76
|
+
puts Backtrace.new(ex).to_s
|
77
|
+
else
|
78
|
+
puts "ERROR: #{ex.message}"
|
79
|
+
end
|
80
|
+
exit(255)
|
81
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Command Line Processing
|
2
|
+
As a author of LaTeX document I want to check spelling
|
3
|
+
|
4
|
+
Scenario: Help can be printed
|
5
|
+
When I run bin/texqc with "--help"
|
6
|
+
Then Exit code is zero
|
7
|
+
And Stdout contains "--help"
|
8
|
+
|
9
|
+
Scenario: Good LaTeX log output can be checked
|
10
|
+
Given I have a "article.tex" file with content:
|
11
|
+
"""
|
12
|
+
\documentclass{article}
|
13
|
+
\begin{document}
|
14
|
+
How are you, my dear friend?
|
15
|
+
\end{document}
|
16
|
+
"""
|
17
|
+
When I run bash with "pdflatex article.tex"
|
18
|
+
Then I run bin/texqc with "article"
|
19
|
+
Then Exit code is zero
|
20
|
+
And Stdout contains "No LaTeX processing errors found"
|
21
|
+
|
22
|
+
Scenario: Bad LaTeX log output checked
|
23
|
+
Given I have a "article.tex" file with content:
|
24
|
+
"""
|
25
|
+
\documentclass{article}
|
26
|
+
\begin{document}
|
27
|
+
HowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyouHowareyou
|
28
|
+
\end{document}
|
29
|
+
"""
|
30
|
+
When I run bash with "pdflatex article.tex"
|
31
|
+
Then I run bin/texqc with "article"
|
32
|
+
Then Exit code is not zero
|
33
|
+
And Stdout contains "1 LaTeX processing errors"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Gem Package
|
2
|
+
As a source code writer I want to be able to
|
3
|
+
package the Gem into .gem file
|
4
|
+
|
5
|
+
Scenario: Gem can be packaged
|
6
|
+
Given It is Unix
|
7
|
+
Given I have a "execs.rb" file with content:
|
8
|
+
"""
|
9
|
+
#!/usr/bin/env ruby
|
10
|
+
require 'rubygems'
|
11
|
+
spec = Gem::Specification::load('./spec.rb')
|
12
|
+
if spec.executables.empty?
|
13
|
+
fail 'no executables: ' + File.read('./spec.rb')
|
14
|
+
end
|
15
|
+
"""
|
16
|
+
When I run bash with:
|
17
|
+
"""
|
18
|
+
cd texqc
|
19
|
+
gem build texqc.gemspec
|
20
|
+
gem specification --ruby texqc-*.gem > ../spec.rb
|
21
|
+
cd ..
|
22
|
+
ruby execs.rb
|
23
|
+
"""
|
24
|
+
Then Exit code is zero
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'tmpdir'
|
24
|
+
require 'English'
|
25
|
+
|
26
|
+
Before do
|
27
|
+
@cwd = Dir.pwd
|
28
|
+
@dir = Dir.mktmpdir('test')
|
29
|
+
FileUtils.mkdir_p(@dir) unless File.exist?(@dir)
|
30
|
+
Dir.chdir(@dir)
|
31
|
+
end
|
32
|
+
|
33
|
+
After do
|
34
|
+
Dir.chdir(@cwd)
|
35
|
+
FileUtils.rm_rf(@dir) if File.exist?(@dir)
|
36
|
+
end
|
37
|
+
|
38
|
+
Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
|
39
|
+
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
|
40
|
+
File.open(file, 'w') do |f|
|
41
|
+
f.write(text.gsub(/\\xFF/, 0xFF.chr))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
When(%r{^I run bin/texqc with "([^"]*)"$}) do |arg|
|
46
|
+
home = File.join(File.dirname(__FILE__), '../..')
|
47
|
+
@stdout = `ruby -I#{home}/lib #{home}/bin/texqc #{arg}`
|
48
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
49
|
+
end
|
50
|
+
|
51
|
+
Then(/^Stdout contains "([^"]*)"$/) do |txt|
|
52
|
+
raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}" unless @stdout.include?(txt)
|
53
|
+
end
|
54
|
+
|
55
|
+
Then(/^Stdout is empty$/) do
|
56
|
+
raise "STDOUT is not empty:\n#{@stdout}" unless @stdout == ''
|
57
|
+
end
|
58
|
+
|
59
|
+
Then(/^Exit code is zero$/) do
|
60
|
+
raise "Non-zero exit #{@exitstatus}:\n#{@stdout}" unless @exitstatus.zero?
|
61
|
+
end
|
62
|
+
|
63
|
+
Then(/^Exit code is not zero$/) do
|
64
|
+
raise 'Zero exit code' if @exitstatus.zero?
|
65
|
+
end
|
66
|
+
|
67
|
+
When(/^I run bash with "([^"]*)"$/) do |text|
|
68
|
+
FileUtils.copy_entry(@cwd, File.join(@dir, 'texqc'))
|
69
|
+
@stdout = `#{text}`
|
70
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
71
|
+
end
|
72
|
+
|
73
|
+
When(/^I run bash with:$/) do |text|
|
74
|
+
FileUtils.copy_entry(@cwd, File.join(@dir, 'texqc'))
|
75
|
+
@stdout = `#{text}`
|
76
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
77
|
+
end
|
78
|
+
|
79
|
+
Given(/^It is Unix$/) do
|
80
|
+
pending if Gem.win_platform?
|
81
|
+
end
|
82
|
+
|
83
|
+
Given(/^It is Windows$/) do
|
84
|
+
pending unless Gem.win_platform?
|
85
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'simplecov'
|
data/texqc.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'English'
|
24
|
+
|
25
|
+
lib = File.expand_path('lib', __dir__)
|
26
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
27
|
+
Gem::Specification.new do |s|
|
28
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
29
|
+
if s.respond_to? :required_rubygems_version=
|
30
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
31
|
+
end
|
32
|
+
s.rubygems_version = '2.2'
|
33
|
+
s.required_ruby_version = '>= 2.3'
|
34
|
+
s.name = 'texqc'
|
35
|
+
s.version = '0.1.0'
|
36
|
+
s.license = 'MIT'
|
37
|
+
s.summary = 'Quality Control of Your LaTeX Build'
|
38
|
+
s.description = 'Run it after you compile your LaTeX document'
|
39
|
+
s.authors = ['Yegor Bugayenko']
|
40
|
+
s.email = 'yegor256@gmail.com'
|
41
|
+
s.homepage = 'http://github.com/yegor256/texqc'
|
42
|
+
s.files = `git ls-files`.split($RS)
|
43
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
44
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
45
|
+
s.rdoc_options = ['--charset=UTF-8']
|
46
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
47
|
+
s.add_runtime_dependency 'backtrace', '~> 0.3'
|
48
|
+
s.add_runtime_dependency 'loog', '~> 0.2'
|
49
|
+
s.add_runtime_dependency 'slop', '~> 4.6'
|
50
|
+
s.add_development_dependency 'codecov', '0.1.10'
|
51
|
+
s.add_development_dependency 'cucumber', '~> 1.3.17'
|
52
|
+
s.add_development_dependency 'rake', '12.0.0'
|
53
|
+
s.add_development_dependency 'rubocop', '0.61.0'
|
54
|
+
s.add_development_dependency 'rubocop-rspec', '1.31.0'
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: texqc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: backtrace
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: loog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: slop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.10
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.10
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cucumber
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.17
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.17
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 12.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 12.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.61.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.61.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.31.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.31.0
|
125
|
+
description: Run it after you compile your LaTeX document
|
126
|
+
email: yegor256@gmail.com
|
127
|
+
executables:
|
128
|
+
- texqc
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- README.md
|
132
|
+
- LICENSE.txt
|
133
|
+
files:
|
134
|
+
- ".0pdd.yml"
|
135
|
+
- ".gitattributes"
|
136
|
+
- ".gitignore"
|
137
|
+
- ".pdd"
|
138
|
+
- ".rubocop.yml"
|
139
|
+
- ".rultor.yml"
|
140
|
+
- ".simplecov"
|
141
|
+
- ".travis.yml"
|
142
|
+
- Gemfile
|
143
|
+
- LICENSE.txt
|
144
|
+
- README.md
|
145
|
+
- Rakefile
|
146
|
+
- bin/texqc
|
147
|
+
- cucumber.yml
|
148
|
+
- features/cli.feature
|
149
|
+
- features/gem_package.feature
|
150
|
+
- features/step_definitions/steps.rb
|
151
|
+
- features/support/env.rb
|
152
|
+
- texqc.gemspec
|
153
|
+
homepage: http://github.com/yegor256/texqc
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options:
|
159
|
+
- "--charset=UTF-8"
|
160
|
+
require_paths:
|
161
|
+
- lib
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.3'
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
requirements: []
|
173
|
+
rubygems_version: 3.0.1
|
174
|
+
signing_key:
|
175
|
+
specification_version: 2
|
176
|
+
summary: Quality Control of Your LaTeX Build
|
177
|
+
test_files:
|
178
|
+
- features/cli.feature
|
179
|
+
- features/gem_package.feature
|
180
|
+
- features/step_definitions/steps.rb
|
181
|
+
- features/support/env.rb
|