textools 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/lib/textools/commands.rb +22 -6
- data/lib/textools/templates/.gitignore +2 -1
- data/lib/textools/templates/.project.erb +17 -0
- data/lib/textools/templates/.texlipse.erb +13 -0
- data/lib/textools/templates/README +1 -0
- data/lib/textools/templates/content.tex.erb +0 -0
- data/lib/textools/templates/header.tex.erb +0 -0
- data/lib/textools/templates/main.tcp.erb +11 -0
- data/lib/textools/templates/main.tex.erb +0 -0
- data/lib/textools/version.rb +1 -1
- data/test/textools/test_commands.rb +47 -9
- metadata +10 -3
data/Rakefile
CHANGED
data/lib/textools/commands.rb
CHANGED
@@ -7,18 +7,21 @@ module Textools
|
|
7
7
|
include Thor::Actions
|
8
8
|
|
9
9
|
desc 'create PROJECT_NAME', 'create a new LaTeX project'
|
10
|
-
method_options
|
10
|
+
method_options %w{working_directory -wd} => :string, %w{texlipse -t} => :boolean, %w{texniccenter -tc} => :boolean
|
11
11
|
def create(name)
|
12
12
|
# workaround as default options does not work
|
13
|
-
parent_directory = options[:working_directory]
|
14
|
-
|
15
|
-
|
13
|
+
parent_directory = options[:working_directory]
|
14
|
+
if parent_directory
|
15
|
+
directory = File.join(parent_directory,name)
|
16
|
+
else
|
17
|
+
directory = name
|
18
|
+
end
|
16
19
|
|
17
20
|
# create project directory
|
18
21
|
empty_directory(directory)
|
19
22
|
|
20
23
|
# copy required files
|
21
|
-
['.gitignore', 'clean.bat', 'clean.sh'].each do |file|
|
24
|
+
['.gitignore', 'clean.bat', 'clean.sh', "README"].each do |file|
|
22
25
|
copy_file file,File.join(directory,file)
|
23
26
|
end
|
24
27
|
|
@@ -26,8 +29,21 @@ module Textools
|
|
26
29
|
empty_directory(File.join(directory, "images"))
|
27
30
|
empty_directory(File.join(directory, "includes"))
|
28
31
|
|
32
|
+
template("main.tex.erb",File.join(directory,"#{name}.tex"))
|
33
|
+
template("header.tex.erb",File.join(directory,"header.tex"))
|
34
|
+
template("content.tex.erb",File.join(directory,"content.tex"))
|
35
|
+
|
36
|
+
if options.texlipse?
|
37
|
+
@name = name
|
38
|
+
template(".project.erb",File.join(directory,".project"))
|
39
|
+
template(".texlipse.erb",File.join(directory,".texlipse"))
|
40
|
+
elsif options.texniccenter?
|
41
|
+
@name = name
|
42
|
+
template("name.tcp.erb",File.join(directory,"#{name}.tcp"))
|
43
|
+
end
|
44
|
+
|
29
45
|
# create containing directory
|
30
|
-
inside(
|
46
|
+
inside(directory, :verbose => true) do |folder|
|
31
47
|
|
32
48
|
# initialize git repository
|
33
49
|
run("git init")
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projectDescription>
|
3
|
+
<name><%= @name %></name>
|
4
|
+
<comment></comment>
|
5
|
+
<projects>
|
6
|
+
</projects>
|
7
|
+
<buildSpec>
|
8
|
+
<buildCommand>
|
9
|
+
<name>net.sourceforge.texlipse.builder.TexlipseBuilder</name>
|
10
|
+
<arguments>
|
11
|
+
</arguments>
|
12
|
+
</buildCommand>
|
13
|
+
</buildSpec>
|
14
|
+
<natures>
|
15
|
+
<nature>net.sourceforge.texlipse.builder.TexlipseNature</nature>
|
16
|
+
</natures>
|
17
|
+
</projectDescription>
|
@@ -0,0 +1 @@
|
|
1
|
+
This LaTeX project has been automatically generated using textools.
|
File without changes
|
File without changes
|
File without changes
|
data/lib/textools/version.rb
CHANGED
@@ -14,26 +14,64 @@ module Textools
|
|
14
14
|
App.new([],{'working_directory' => dir}).create(project)
|
15
15
|
|
16
16
|
assert Dir.exists?(File.join(dir,project))
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
%W{.gitignore README header.tex content.tex clean.bat clean.sh #{project}.tex}.each do |file|
|
18
|
+
assert File.exists?(File.join(dir,project,file)), "no #{file} file"
|
19
|
+
end
|
20
|
+
|
21
|
+
%w{images includes .git}.each do|folder|
|
22
|
+
assert Dir.exists?(File.join(dir,project,folder)), "no #{folder} folder"
|
23
|
+
end
|
24
|
+
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
def
|
28
|
+
def test_create_texclipse
|
29
|
+
Dir.mktmpdir do |dir|
|
30
|
+
|
31
|
+
project = 'test'
|
32
|
+
|
33
|
+
App.new([],{'working_directory' => dir, 'texlipse' => true}).create(project)
|
34
|
+
|
35
|
+
assert Dir.exists?(File.join(dir,project))
|
36
|
+
%W{.gitignore README header.tex content.tex clean.bat clean.sh #{project}.tex .project .texlipse}.each do |file|
|
37
|
+
assert File.exists?(File.join(dir,project,file)), "no #{file} file"
|
38
|
+
end
|
39
|
+
|
40
|
+
%w{images includes .git}.each do|folder|
|
41
|
+
assert Dir.exists?(File.join(dir,project,folder)), "no #{folder} folder"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
28
46
|
|
47
|
+
def test_create_texniccenter
|
29
48
|
Dir.mktmpdir do |dir|
|
30
49
|
|
50
|
+
project = 'test'
|
51
|
+
|
52
|
+
App.new([],{'working_directory' => dir, 'texniccenter' => true}).create(project)
|
53
|
+
|
54
|
+
assert Dir.exists?(File.join(dir,project))
|
55
|
+
%W{.gitignore README header.tex content.tex clean.bat clean.sh #{project}.tex #{project}.tcp}.each do |file|
|
56
|
+
assert File.exists?(File.join(dir,project,file)), "no #{file} file"
|
57
|
+
end
|
58
|
+
|
59
|
+
%w{images includes .git}.each do|folder|
|
60
|
+
assert Dir.exists?(File.join(dir,project,folder)), "no #{folder} folder"
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def test_clean
|
68
|
+
|
69
|
+
Dir.mktmpdir do |dir|
|
31
70
|
File.open(File.join(dir,"test.pdf"), "w") do |f|
|
32
71
|
f << "asdf"
|
33
72
|
end
|
34
73
|
|
35
74
|
App.new([],{'working_directory' => dir}).clean
|
36
|
-
|
37
75
|
assert !File.exists?(File.join(dir,"test.pdf")),"test.pdf should be deleted"
|
38
76
|
end
|
39
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &28986264 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *28986264
|
25
25
|
description: Command Line Tools for Generating and Maintaining LaTeX Projects.
|
26
26
|
email:
|
27
27
|
- simon.harrer@gmail.com
|
@@ -38,8 +38,15 @@ files:
|
|
38
38
|
- lib/textools.rb
|
39
39
|
- lib/textools/commands.rb
|
40
40
|
- lib/textools/templates/.gitignore
|
41
|
+
- lib/textools/templates/.project.erb
|
42
|
+
- lib/textools/templates/.texlipse.erb
|
43
|
+
- lib/textools/templates/README
|
41
44
|
- lib/textools/templates/clean.bat
|
42
45
|
- lib/textools/templates/clean.sh
|
46
|
+
- lib/textools/templates/content.tex.erb
|
47
|
+
- lib/textools/templates/header.tex.erb
|
48
|
+
- lib/textools/templates/main.tcp.erb
|
49
|
+
- lib/textools/templates/main.tex.erb
|
43
50
|
- lib/textools/version.rb
|
44
51
|
- test/textools/test_commands.rb
|
45
52
|
- textools.gemspec
|