texas 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/texas/option_parser.rb +1 -1
- data/lib/texas/runner.rb +2 -2
- data/lib/texas/task/{new.rb → new_project.rb} +6 -2
- data/lib/texas/template/helper/base.rb +17 -3
- data/lib/texas/version.rb +1 -1
- metadata +120 -110
data/lib/texas/option_parser.rb
CHANGED
@@ -49,7 +49,7 @@ module Texas
|
|
49
49
|
|
50
50
|
opts.on("-n", "--new [NAME]",
|
51
51
|
"Create new texas project directory") do |name|
|
52
|
-
options.task = :
|
52
|
+
options.task = :new_project
|
53
53
|
options.check_mandatory_arguments = false
|
54
54
|
options.load_local_libs = false
|
55
55
|
options.new_project_name = name
|
data/lib/texas/runner.rb
CHANGED
@@ -59,11 +59,11 @@ module Texas
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def fallback_task_class
|
62
|
-
class_name = @options.task.to_s.capitalize
|
62
|
+
class_name = @options.task.to_s.split('_').map(&:capitalize).join
|
63
63
|
begin
|
64
64
|
eval("::Texas::Task::#{class_name}")
|
65
65
|
rescue
|
66
|
-
puts "Failed to fallback for ::Task::#{class_name}"
|
66
|
+
puts "Failed to fallback for Texas::Task::#{class_name}"
|
67
67
|
exit
|
68
68
|
end
|
69
69
|
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module Texas
|
2
2
|
module Task
|
3
|
-
class
|
3
|
+
class NewProject < Base
|
4
|
+
def fixtures_dir(name)
|
5
|
+
File.join(Texas.texas_dir, "spec", "fixtures", name)
|
6
|
+
end
|
7
|
+
|
4
8
|
def source_dir
|
5
|
-
|
9
|
+
fixtures_dir "new-project"
|
6
10
|
end
|
7
11
|
|
8
12
|
def dest_dir
|
@@ -16,6 +16,13 @@ module Texas
|
|
16
16
|
].compact
|
17
17
|
end
|
18
18
|
|
19
|
+
# Returns a subdir with the current template's basename
|
20
|
+
#
|
21
|
+
# Example:
|
22
|
+
# In /example/introduction.tex.erb this method
|
23
|
+
# returns "/example/introduction" if that directory exists
|
24
|
+
# and nil if it doesn't.
|
25
|
+
#
|
19
26
|
def path_with_templates_basename
|
20
27
|
subdir = Template.basename @output_filename
|
21
28
|
File.directory?(subdir) ? subdir : nil
|
@@ -54,24 +61,31 @@ module Texas
|
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
64
|
+
# Renders a partial with the given locals.
|
65
|
+
#
|
57
66
|
def partial(name, locals = {})
|
58
67
|
render("_#{name}", locals)
|
59
68
|
end
|
60
69
|
|
70
|
+
# Renders a template with the given locals.
|
71
|
+
#
|
61
72
|
def render(name, locals = {})
|
62
73
|
template_file = find_template_file!([name], template_extensions)
|
63
|
-
Template.create(template_file, build).__run__(locals)
|
74
|
+
Texas::Template.create(template_file, build).__run__(locals)
|
64
75
|
end
|
65
76
|
|
66
77
|
# Returns all extensions the Template::Runner can handle.
|
78
|
+
#
|
67
79
|
def template_extensions
|
68
|
-
Template.known_extensions
|
80
|
+
Texas::Template.known_extensions
|
69
81
|
end
|
70
82
|
|
83
|
+
# Returns all templates in the current template's path matching the given glob
|
84
|
+
#
|
71
85
|
def templates_by_glob(glob = "*")
|
72
86
|
files = Dir[File.join(__path__, glob)]
|
73
87
|
templates = files.map do |f|
|
74
|
-
Template.basename(f).gsub(__path__, '')
|
88
|
+
Texas::Template.basename(f).gsub(__path__, '')
|
75
89
|
end
|
76
90
|
templates.uniq.sort
|
77
91
|
end
|
data/lib/texas/version.rb
CHANGED
metadata
CHANGED
@@ -1,167 +1,177 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: texas
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
7
|
+
authors:
|
8
|
+
- René Föhring
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: term-ansicolor
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: listen
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: listen
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
30
33
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
35
38
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rb-inotify
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rb-inotify
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
41
49
|
none: false
|
42
|
-
requirements:
|
50
|
+
requirements:
|
43
51
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
52
|
+
- !ruby/object:Gem::Version
|
45
53
|
version: 0.8.8
|
46
54
|
type: :runtime
|
47
|
-
|
48
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.8
|
62
|
+
description: A tool for creating LaTex files from ERb templates and processing them
|
63
|
+
into PDF format.
|
49
64
|
email: rf@bamaru.de
|
50
|
-
executables:
|
65
|
+
executables:
|
51
66
|
- texas
|
52
67
|
extensions: []
|
53
|
-
|
54
68
|
extra_rdoc_files: []
|
55
|
-
|
56
|
-
|
57
|
-
- lib/texas/
|
58
|
-
- lib/texas/
|
59
|
-
- lib/texas/
|
60
|
-
- lib/texas/
|
61
|
-
- lib/texas/
|
69
|
+
files:
|
70
|
+
- lib/texas/template/helper/md.rb
|
71
|
+
- lib/texas/template/helper/tex.rb
|
72
|
+
- lib/texas/template/helper/info.rb
|
73
|
+
- lib/texas/template/helper/base.rb
|
74
|
+
- lib/texas/template/runner.rb
|
75
|
+
- lib/texas/template/runner/md.rb
|
76
|
+
- lib/texas/template/runner/tex.rb
|
77
|
+
- lib/texas/template/runner/base.rb
|
78
|
+
- lib/texas/template/helper.rb
|
79
|
+
- lib/texas/build.rb
|
80
|
+
- lib/texas/task/watch.rb
|
81
|
+
- lib/texas/task/new_project.rb
|
82
|
+
- lib/texas/task/base.rb
|
83
|
+
- lib/texas/option_parser.rb
|
84
|
+
- lib/texas/task.rb
|
85
|
+
- lib/texas/version.rb
|
86
|
+
- lib/texas/runner.rb
|
87
|
+
- lib/texas/core_ext/string.rb
|
62
88
|
- lib/texas/build/task/copy_contents_to_build_path.rb
|
63
89
|
- lib/texas/build/task/open_pdf.rb
|
64
90
|
- lib/texas/build/task/publish_pdf.rb
|
65
91
|
- lib/texas/build/task/rewrite_marked_templates.rb
|
92
|
+
- lib/texas/build/task/add_default_templates_to_build_path.rb
|
66
93
|
- lib/texas/build/task/run_before_scripts.rb
|
67
94
|
- lib/texas/build/task/run_master_template.rb
|
68
|
-
- lib/texas/build.rb
|
69
|
-
- lib/texas/
|
95
|
+
- lib/texas/build/task/base.rb
|
96
|
+
- lib/texas/build/base.rb
|
97
|
+
- lib/texas/build/final.rb
|
98
|
+
- lib/texas/build/dry.rb
|
70
99
|
- lib/texas/core_ext.rb
|
71
|
-
- lib/texas/option_parser.rb
|
72
|
-
- lib/texas/runner.rb
|
73
|
-
- lib/texas/task/base.rb
|
74
|
-
- lib/texas/task/new.rb
|
75
|
-
- lib/texas/task/watch.rb
|
76
|
-
- lib/texas/task.rb
|
77
|
-
- lib/texas/template/helper/base.rb
|
78
|
-
- lib/texas/template/helper/info.rb
|
79
|
-
- lib/texas/template/helper/md.rb
|
80
|
-
- lib/texas/template/helper/tex.rb
|
81
|
-
- lib/texas/template/helper.rb
|
82
|
-
- lib/texas/template/runner/base.rb
|
83
|
-
- lib/texas/template/runner/md.rb
|
84
|
-
- lib/texas/template/runner/tex.rb
|
85
|
-
- lib/texas/template/runner.rb
|
86
100
|
- lib/texas/template.rb
|
87
|
-
- lib/texas/version.rb
|
88
101
|
- lib/texas.rb
|
89
|
-
- spec/
|
90
|
-
- spec/
|
91
|
-
- spec/
|
92
|
-
- spec/
|
93
|
-
- spec/
|
94
|
-
- spec/fixtures/basic-tex/contents/contents.tex.erb
|
95
|
-
- spec/fixtures/basic-tex/contents/contents.tex.should
|
96
|
-
- spec/fixtures/basic-tex/contents/input_template.tex.erb
|
97
|
-
- spec/fixtures/basic-tex/contents/input_template.tex.should
|
98
|
-
- spec/fixtures/basic-tex/contents/unused_template.tex.erb
|
102
|
+
- spec/texas/template/runner_spec.rb
|
103
|
+
- spec/texas/template/helper/info_spec.rb
|
104
|
+
- spec/texas/build_spec.rb
|
105
|
+
- spec/texas/template_spec.rb
|
106
|
+
- spec/texas_spec.rb
|
99
107
|
- spec/fixtures/different-master-tex/contents/contents.tex.erb
|
100
108
|
- spec/fixtures/different-master-tex/contents/contents.tex.should
|
101
|
-
- spec/fixtures/different-master-tex/contents/master.tex.erb
|
102
109
|
- spec/fixtures/different-master-tex/contents/master.tex.should
|
103
|
-
- spec/fixtures/
|
104
|
-
- spec/fixtures/
|
105
|
-
- spec/fixtures/
|
106
|
-
- spec/fixtures/
|
107
|
-
- spec/fixtures/
|
108
|
-
- spec/fixtures/
|
109
|
-
- spec/fixtures/
|
110
|
-
- spec/fixtures/
|
111
|
-
- spec/fixtures/
|
112
|
-
- spec/fixtures/
|
113
|
-
- spec/fixtures/helper-methods-tex/contents/template/helper/base.tex.erb
|
114
|
-
- spec/fixtures/helper-methods-tex/contents/template/helper/base.tex.should
|
115
|
-
- spec/fixtures/helper-methods-tex/contents/template/helper/info.md.erb
|
116
|
-
- spec/fixtures/helper-methods-tex/contents/template/helper/info.tex.should
|
117
|
-
- spec/fixtures/helper-methods-tex/contents/test_figure.tex.erb
|
118
|
-
- spec/fixtures/helper-methods-tex/figures/test_figure.png
|
110
|
+
- spec/fixtures/different-master-tex/contents/master.tex.erb
|
111
|
+
- spec/fixtures/basic-tex/contents/unused_template.tex.erb
|
112
|
+
- spec/fixtures/basic-tex/contents/input_template.tex.should
|
113
|
+
- spec/fixtures/basic-tex/contents/input_template.tex.erb
|
114
|
+
- spec/fixtures/basic-tex/contents/contents.tex.erb
|
115
|
+
- spec/fixtures/basic-tex/contents/contents.tex.should
|
116
|
+
- spec/fixtures/basic/figures/test_figure.png
|
117
|
+
- spec/fixtures/basic/contents/contents.tex.erb
|
118
|
+
- spec/fixtures/lib-helpers/lib/init.rb
|
119
|
+
- spec/fixtures/lib-helpers/lib/helpers/document_helper.rb
|
119
120
|
- spec/fixtures/lib-helpers/contents/contents.tex.erb
|
120
121
|
- spec/fixtures/lib-helpers/contents/contents.tex.should
|
121
|
-
- spec/fixtures/lib-helpers/lib/helpers/document_helper.rb
|
122
|
-
- spec/fixtures/lib-helpers/lib/init.rb
|
123
|
-
- spec/fixtures/new-project/contents/contents.tex.erb
|
124
|
-
- spec/fixtures/new-project/lib/helpers/document_helper.rb
|
125
122
|
- spec/fixtures/new-project/lib/init.rb
|
123
|
+
- spec/fixtures/new-project/lib/helpers/document_helper.rb
|
124
|
+
- spec/fixtures/new-project/contents/contents.tex.erb
|
126
125
|
- spec/fixtures/rerun/contents/contents.tex.erb
|
127
126
|
- spec/fixtures/rerun/contents/contents.tex.should
|
127
|
+
- spec/fixtures/basic-md/contents/input_template.md.erb
|
128
|
+
- spec/fixtures/basic-md/contents/contents.tex.should
|
129
|
+
- spec/fixtures/basic-md/contents/contents.md.erb
|
128
130
|
- spec/fixtures/texasrc/contents/contents.tex.erb
|
129
131
|
- spec/fixtures/texasrc/contents/contents.tex.should
|
132
|
+
- spec/fixtures/helper-methods-tex/figures/test_figure.png
|
133
|
+
- spec/fixtures/helper-methods-tex/contents/template/helper/base.tex.erb
|
134
|
+
- spec/fixtures/helper-methods-tex/contents/template/helper/info.tex.should
|
135
|
+
- spec/fixtures/helper-methods-tex/contents/template/helper/_some_partial.md.erb
|
136
|
+
- spec/fixtures/helper-methods-tex/contents/template/helper/base.tex.should
|
137
|
+
- spec/fixtures/helper-methods-tex/contents/template/helper/info.md.erb
|
138
|
+
- spec/fixtures/helper-methods-tex/contents/some_chapter.tex.erb
|
139
|
+
- spec/fixtures/helper-methods-tex/contents/input_template.tex.should
|
140
|
+
- spec/fixtures/helper-methods-tex/contents/some_chapter.tex.should
|
141
|
+
- spec/fixtures/helper-methods-tex/contents/input_template.tex.erb
|
142
|
+
- spec/fixtures/helper-methods-tex/contents/contents.tex.erb
|
143
|
+
- spec/fixtures/helper-methods-tex/contents/contents.tex.should
|
144
|
+
- spec/fixtures/helper-methods-tex/contents/test_figure.tex.erb
|
145
|
+
- spec/fixtures/helper-methods-tex/contents/some_chapter/test_include.tex.erb
|
146
|
+
- spec/fixtures/helper-methods-tex/contents/some_chapter/test_include.tex.should
|
147
|
+
- spec/fixtures/helper-methods-tex/contents/some_chapter/another_include.tex
|
130
148
|
- spec/spec_helper.rb
|
131
|
-
- spec/texas/build_spec.rb
|
132
|
-
- spec/texas/template/helper/info_spec.rb
|
133
|
-
- spec/texas/template/runner_spec.rb
|
134
|
-
- spec/texas/template_spec.rb
|
135
|
-
- spec/texas_spec.rb
|
136
149
|
- bin/texas
|
137
150
|
- contents/_preambel.tex.erb
|
138
151
|
- contents/master.tex.erb
|
139
152
|
homepage: http://github.com/rrrene/texas
|
140
153
|
licenses: []
|
141
|
-
|
142
154
|
post_install_message:
|
143
155
|
rdoc_options: []
|
144
|
-
|
145
|
-
require_paths:
|
156
|
+
require_paths:
|
146
157
|
- lib
|
147
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
159
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version:
|
153
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
165
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version:
|
159
|
-
requirements:
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements:
|
160
171
|
- none
|
161
172
|
rubyforge_project:
|
162
|
-
rubygems_version: 1.8.
|
173
|
+
rubygems_version: 1.8.24
|
163
174
|
signing_key:
|
164
175
|
specification_version: 3
|
165
176
|
summary: A tool for creating LaTex files from ERb templates.
|
166
177
|
test_files: []
|
167
|
-
|