texzip 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/bin/texzip +27 -34
- data/lib/texzip/Project.rb +516 -518
- data/lib/texzip.rb +8 -13
- data/spec/spec_helper.rb +1 -2
- data/spec/texzip_spec.rb +38 -41
- data/version.txt +1 -1
- metadata +34 -33
data/lib/texzip.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
1
|
module TeXzip
|
3
|
-
|
4
2
|
# :stopdoc:
|
5
3
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
6
4
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
@@ -11,8 +9,8 @@ module TeXzip
|
|
11
9
|
# they will be joined to the end of the libray path using
|
12
10
|
# <tt>File.join</tt>.
|
13
11
|
#
|
14
|
-
def self.libpath(
|
15
|
-
rv =
|
12
|
+
def self.libpath(*args)
|
13
|
+
rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
16
14
|
if block_given?
|
17
15
|
begin
|
18
16
|
$LOAD_PATH.unshift LIBPATH
|
@@ -21,14 +19,14 @@ module TeXzip
|
|
21
19
|
$LOAD_PATH.shift
|
22
20
|
end
|
23
21
|
end
|
24
|
-
|
22
|
+
rv
|
25
23
|
end
|
26
24
|
|
27
25
|
# Returns the lpath for the module. If any arguments are given,
|
28
26
|
# they will be joined to the end of the path using
|
29
27
|
# <tt>File.join</tt>.
|
30
28
|
#
|
31
|
-
def self.path(
|
29
|
+
def self.path(*args)
|
32
30
|
rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
33
31
|
if block_given?
|
34
32
|
begin
|
@@ -38,7 +36,7 @@ module TeXzip
|
|
38
36
|
$LOAD_PATH.shift
|
39
37
|
end
|
40
38
|
end
|
41
|
-
|
39
|
+
rv
|
42
40
|
end
|
43
41
|
|
44
42
|
# Utility method used to require all files ending in .rb that lie in the
|
@@ -46,15 +44,12 @@ module TeXzip
|
|
46
44
|
# in. Optionally, a specific _directory_ name can be passed in such that
|
47
45
|
# the _filename_ does not have to be equivalent to the directory.
|
48
46
|
#
|
49
|
-
def self.require_all_libs_relative_to(
|
47
|
+
def self.require_all_libs_relative_to(fname, dir = nil)
|
50
48
|
dir ||= ::File.basename(fname, '.*')
|
51
|
-
search_me = ::File.expand_path(
|
52
|
-
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
49
|
+
search_me = ::File.expand_path(::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
53
50
|
|
54
51
|
Dir.glob(search_me).sort.each {|rb| require rb}
|
55
52
|
end
|
56
|
-
|
57
|
-
end # module TeXzip
|
53
|
+
end
|
58
54
|
|
59
55
|
TeXzip.require_all_libs_relative_to(__FILE__)
|
60
|
-
|
data/spec/spec_helper.rb
CHANGED
data/spec/texzip_spec.rb
CHANGED
@@ -1,54 +1,51 @@
|
|
1
|
-
|
2
1
|
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
2
|
|
4
3
|
require 'texzip'
|
5
4
|
require 'tempfile'
|
6
5
|
|
7
6
|
def init_env
|
8
|
-
|
7
|
+
Dir.chdir(File.dirname(__FILE__))
|
9
8
|
end
|
10
9
|
|
11
|
-
describe TeXzip,
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
describe TeXzip, 'on creation' do
|
11
|
+
before do
|
12
|
+
init_env
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
it 'should fail if the file does not exist' do
|
16
|
+
expect { TeXzip::Project.new(File.join('dummy', 'nofile.tex')) }.to raise_error(/find file/)
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
it 'should not fail if the file exists' do
|
20
|
+
expect { TeXzip::Project.new(File.join('dummy', 'root-file.tex')) }.not_to raise_error
|
21
|
+
end
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
@tex_file.cites.sort.should == %w( cite1 cite2 cite3 cite4 cite5 ).sort
|
53
|
-
end
|
24
|
+
describe TeXzip, 'after creation' do
|
25
|
+
before do
|
26
|
+
init_env
|
27
|
+
@tex_file = TeXzip::Project.new('dummy/root-file.tex')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should return its correct path' do
|
31
|
+
expect(@tex_file.master_file).to eq(Pathname.new('dummy/root-file.tex').expand_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should return a list of included sub-files' do
|
35
|
+
expect(@tex_file.tex_files.map(&:path).sort).to eq(%w(dummy/root-file.tex
|
36
|
+
dummy/chapter1.tex
|
37
|
+
dummy/chapter2.tex
|
38
|
+
dummy/chapter3/chapter3.tex
|
39
|
+
dummy/chapter3/chapter3.1.tex
|
40
|
+
dummy/chapter3/chapter3.2.tex
|
41
|
+
dummy/chapter4.tex).map{|p| Pathname.new(p).expand_path}.sort)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should return a list of used bibtex files' do
|
45
|
+
expect(@tex_file.bib_files.map(&:path).sort).to eq(%w(dummy/bib1.bib dummy/bib2.bib).map{|p| Pathname.new(p).expand_path}.sort)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should return a list of used citations' do
|
49
|
+
expect(@tex_file.cites.sort).to eq(%w( cite1 cite2 cite3 cite4 cite5 ).sort)
|
50
|
+
end
|
54
51
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
metadata
CHANGED
@@ -1,109 +1,109 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texzip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Fischer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bibtex-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: trollop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ffi-libarchive
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.1.3
|
48
|
-
- - <
|
48
|
+
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '2.0'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 0.1.3
|
58
|
-
- - <
|
58
|
+
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '2.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: ffi-inliner
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 0.2.4
|
68
|
-
- - <
|
68
|
+
- - "<"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '2.0'
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 0.2.4
|
78
|
-
- - <
|
78
|
+
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '2.0'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: highline
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - ~>
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '1.0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - ~>
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '1.0'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: rspec
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
description:
|
@@ -114,48 +114,49 @@ extensions: []
|
|
114
114
|
extra_rdoc_files:
|
115
115
|
- README.md
|
116
116
|
files:
|
117
|
-
- version.txt
|
118
117
|
- History.txt
|
119
118
|
- README.md
|
120
119
|
- bin/texzip
|
120
|
+
- lib/texzip.rb
|
121
|
+
- lib/texzip/Project.rb
|
122
|
+
- spec/dummy/bib1.bib
|
121
123
|
- spec/dummy/bib2.bib
|
122
|
-
- spec/dummy/chapter2.tex
|
123
|
-
- spec/dummy/root-file.tex
|
124
|
-
- spec/dummy/root-file2.tex
|
125
124
|
- spec/dummy/chapter1.tex
|
126
|
-
- spec/dummy/
|
125
|
+
- spec/dummy/chapter2.tex
|
127
126
|
- spec/dummy/chapter3/chapter3-bad.tex
|
128
127
|
- spec/dummy/chapter3/chapter3.1.tex
|
129
128
|
- spec/dummy/chapter3/chapter3.2.tex
|
130
|
-
- spec/dummy/
|
131
|
-
- spec/dummy/bib1.bib
|
129
|
+
- spec/dummy/chapter3/chapter3.tex
|
132
130
|
- spec/dummy/chapter4.tex
|
133
|
-
- spec/
|
131
|
+
- spec/dummy/root-file.tex
|
132
|
+
- spec/dummy/root-file2.tex
|
133
|
+
- spec/dummy/root-file3.tex
|
134
134
|
- spec/spec_helper.rb
|
135
|
-
-
|
136
|
-
-
|
135
|
+
- spec/texzip_spec.rb
|
136
|
+
- version.txt
|
137
137
|
homepage: http://bitbucket.org/lyro/texzip
|
138
|
-
licenses:
|
138
|
+
licenses:
|
139
|
+
- GPL-3.0
|
139
140
|
metadata: {}
|
140
141
|
post_install_message:
|
141
142
|
rdoc_options:
|
142
|
-
- --main
|
143
|
+
- "--main"
|
143
144
|
- README.md
|
144
145
|
require_paths:
|
145
146
|
- lib
|
146
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
148
|
requirements:
|
148
|
-
- -
|
149
|
+
- - ">="
|
149
150
|
- !ruby/object:Gem::Version
|
150
151
|
version: '0'
|
151
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
153
|
requirements:
|
153
|
-
- -
|
154
|
+
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
156
|
version: '0'
|
156
157
|
requirements: []
|
157
158
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.1
|
159
|
+
rubygems_version: 2.5.1
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: What this thing does
|