rtex 2.0.1 → 2.0.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.
@@ -0,0 +1,25 @@
1
+ v1.99.0 2008-04-20
2
+
3
+ Released RTeX v1.99.0 as a Rubygem, with a standalone executable for PDF generation
4
+ and support for plugin installation from the executable.
5
+
6
+ This release requires Rails >= 2.0.1
7
+
8
+ Thanks to:
9
+ * Jonas Bähr for a patch with additional LaTeX escaping
10
+ * Fouad Mardini for a TemplateHandler patch
11
+
12
+ v1.0.0+
13
+
14
+ Added quite a few *long* overdue fixes & enhancements sent in by various people.
15
+
16
+ * Added latex escaping 'l' method (Thanks, Benjamin Quorning)
17
+ * Added support for @options_for_rtex hash for configuration:
18
+ * Added :tempdir option, and changed default temporary directory
19
+ (Thanks, Francesco Levorato)
20
+ * Added :preprocess option to support running through latex before pdflatex
21
+ (Thanks Charles Lesburg, Benjamin Quorning)
22
+ * Moved old @filename setting to :filename option in this hash
23
+
24
+ If you're using the same settings for @options_for_rtex often, you might want to
25
+ put your assignment in a before_filter (perhaps overriding :filename, etc in your actions).
@@ -1,24 +1,18 @@
1
- HISTORY.rdoc
2
- Manifest.txt
3
- README.rdoc
4
- README_RAILS.rdoc
5
- Rakefile
6
1
  bin/rtex
2
+ CHANGELOG
7
3
  init.rb
8
- lib/rtex.rb
9
4
  lib/rtex/document.rb
10
5
  lib/rtex/escaping.rb
11
6
  lib/rtex/framework/merb.rb
12
7
  lib/rtex/framework/rails.rb
13
8
  lib/rtex/tempdir.rb
14
9
  lib/rtex/version.rb
10
+ lib/rtex.rb
11
+ Manifest
15
12
  rails/init.rb
16
- tasks/doc.rake
17
- tasks/gem.rake
18
- tasks/manifest.rake
19
- tasks/post_load.rake
20
- tasks/setup.rb
21
- tasks/test.rake
13
+ Rakefile
14
+ README.rdoc
15
+ README_RAILS.rdoc
22
16
  test/document_test.rb
23
17
  test/filter_test.rb
24
18
  test/fixtures/first.tex
data/Rakefile CHANGED
@@ -1,23 +1,21 @@
1
- require File.dirname(__FILE__) << "/lib/rtex/version"
2
-
3
- load 'tasks/setup.rb'
4
-
5
- PROJ.name = 'rtex'
6
- PROJ.authors = ['Bruce Williams', 'Wiebe Cazemier']
7
- PROJ.email = ['bruce@codefluency.com']
8
- PROJ.url = 'http://rtex.rubyforge.org'
9
- PROJ.rubyforge_name = 'rtex'
1
+ require 'rubygems'
2
+ require 'echoe'
10
3
 
11
- PROJ.libs = %w[]
12
- PROJ.ruby_opts = []
13
- PROJ.test_opts = []
14
-
15
- PROJ.rdoc_main = 'README.rdoc'
16
- PROJ.rdoc_include.push 'README.rdoc', 'README_RAILS.rdoc'
17
-
18
- PROJ.description = "LaTeX preprocessor for PDF generation; Rails plugin"
19
- PROJ.summary = PROJ.description
4
+ require File.dirname(__FILE__) << "/lib/rtex/version"
20
5
 
21
- PROJ.version = RTeX::Version::STRING
6
+ Echoe.new 'rtex' do |p|
7
+ p.version = RTeX::Version::STRING
8
+ p.author = ['Bruce Williams', 'Wiebe Cazemier']
9
+ p.email = 'bruce@codefluency.com'
10
+ p.project = 'rtex'
11
+ p.summary = "LaTeX preprocessor for PDF generation; Rails plugin"
12
+ p.url = "http://rtex.rubyforge.org"
13
+ p.include_rakefile = true
14
+ p.development_dependencies = %w(Shoulda echoe)
15
+ p.rcov_options = '--exclude gems --exclude version.rb --sort coverage --text-summary --html -o coverage'
16
+ p.ignore_pattern = /^(pkg|doc|site)|\.svn|CVS|\.bzr|\.DS|\.git/
17
+ end
22
18
 
23
- task 'gem:package' => 'manifest:assert'
19
+ task :coverage do
20
+ system "open coverage/index.html" if PLATFORM['darwin']
21
+ end
@@ -12,14 +12,14 @@ module RTeX
12
12
  # List of replacements
13
13
  def replacements
14
14
  @replacements ||= [
15
- [/([{}])/, '\\\1'],
15
+ [/([{}])/, '\\\\\1'],
16
16
  [/\\/, '\textbackslash{}'],
17
17
  [/\^/, '\textasciicircum{}'],
18
18
  [/~/, '\textasciitilde{}'],
19
19
  [/\|/, '\textbar{}'],
20
20
  [/\</, '\textless{}'],
21
21
  [/\>/, '\textgreater{}'],
22
- [/([_$&%#])/, '\\\1']
22
+ [/([_$&%#])/, '\\\\\1']
23
23
  ]
24
24
  end
25
25
 
@@ -19,7 +19,12 @@ module RTeX
19
19
  class Template < ::ActionView::TemplateHandlers::ERB
20
20
  def initialize(*args)
21
21
  super
22
- @view.template_format = :pdf
22
+ # Support Rails render API before:
23
+ # commit d2ccb852d4e1f6f1b01e43f32213053ae3bef408
24
+ # Date: Fri Jul 18 16:00:20 2008 -0500
25
+ if defined?(@view)
26
+ @view.template_format = :pdf
27
+ end
23
28
  end
24
29
  end
25
30
 
@@ -65,7 +65,7 @@ module RTeX
65
65
 
66
66
  MAJOR = 2
67
67
  MINOR = 0
68
- TINY = 1
68
+ TINY = 2
69
69
 
70
70
  # The current version as a Version instance
71
71
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -0,0 +1,117 @@
1
+
2
+ # Gem::Specification for Rtex-2.0.2
3
+ # Originally generated by Echoe
4
+
5
+ --- !ruby/object:Gem::Specification
6
+ name: rtex
7
+ version: !ruby/object:Gem::Version
8
+ version: 2.0.2
9
+ platform: ruby
10
+ authors:
11
+ - Bruce Williams, Wiebe Cazemier
12
+ autorequire:
13
+ bindir: bin
14
+
15
+ date: 2008-08-19 00:00:00 -05:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: Shoulda
20
+ type: :development
21
+ version_requirement:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: "0"
27
+ version:
28
+ - !ruby/object:Gem::Dependency
29
+ name: echoe
30
+ type: :development
31
+ version_requirement:
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: "0"
37
+ version:
38
+ description: LaTeX preprocessor for PDF generation; Rails plugin
39
+ email: bruce@codefluency.com
40
+ executables:
41
+ - rtex
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - bin/rtex
46
+ - CHANGELOG
47
+ - lib/rtex/document.rb
48
+ - lib/rtex/escaping.rb
49
+ - lib/rtex/framework/merb.rb
50
+ - lib/rtex/framework/rails.rb
51
+ - lib/rtex/tempdir.rb
52
+ - lib/rtex/version.rb
53
+ - lib/rtex.rb
54
+ - README.rdoc
55
+ - README_RAILS.rdoc
56
+ files:
57
+ - bin/rtex
58
+ - CHANGELOG
59
+ - init.rb
60
+ - lib/rtex/document.rb
61
+ - lib/rtex/escaping.rb
62
+ - lib/rtex/framework/merb.rb
63
+ - lib/rtex/framework/rails.rb
64
+ - lib/rtex/tempdir.rb
65
+ - lib/rtex/version.rb
66
+ - lib/rtex.rb
67
+ - Manifest
68
+ - rails/init.rb
69
+ - Rakefile
70
+ - README.rdoc
71
+ - README_RAILS.rdoc
72
+ - test/document_test.rb
73
+ - test/filter_test.rb
74
+ - test/fixtures/first.tex
75
+ - test/fixtures/first.tex.erb
76
+ - test/fixtures/fragment.tex.erb
77
+ - test/fixtures/text.textile
78
+ - test/tempdir_test.rb
79
+ - test/test_helper.rb
80
+ - vendor/instiki/LICENSE
81
+ - vendor/instiki/redcloth_for_tex.rb
82
+ - rtex.gemspec
83
+ has_rdoc: true
84
+ homepage: http://rtex.rubyforge.org
85
+ post_install_message:
86
+ rdoc_options:
87
+ - --line-numbers
88
+ - --inline-source
89
+ - --title
90
+ - Rtex
91
+ - --main
92
+ - README.rdoc
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ version:
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "="
104
+ - !ruby/object:Gem::Version
105
+ version: "1.2"
106
+ version:
107
+ requirements: []
108
+
109
+ rubyforge_project: rtex
110
+ rubygems_version: 1.2.0
111
+ specification_version: 2
112
+ summary: LaTeX preprocessor for PDF generation; Rails plugin
113
+ test_files:
114
+ - test/document_test.rb
115
+ - test/filter_test.rb
116
+ - test/tempdir_test.rb
117
+ - test/test_helper.rb
@@ -1,70 +1,74 @@
1
1
  require File.dirname(__FILE__) << '/test_helper'
2
2
 
3
- context "Document Generation" do
3
+ class DocumentTest < Test::Unit::TestCase
4
+
5
+ context "Document Generation" do
4
6
 
5
- def setup
6
- change_tmpdir_for_testing
7
- end
7
+ setup do
8
+ change_tmpdir_for_testing
9
+ end
8
10
 
9
- specify "documents have a to_pdf method" do
10
- assert document(:first).respond_to?(:to_pdf)
11
- end
11
+ should "have a to_pdf method" do
12
+ assert document(:first).respond_to?(:to_pdf)
13
+ end
12
14
 
13
- specify "can escape characters" do
14
- assert_equal '\textbackslash{}\textasciitilde{}', RTeX::Document.escape('\~')
15
- end
15
+ should "escape characters" do
16
+ assert_equal '\textbackslash{}\textasciitilde{}', RTeX::Document.escape('\~')
17
+ end
16
18
 
17
- specify "documents can use a to_pdf block to move a file to a relative path" do
18
- begin
19
- path = File.expand_path(File.dirname(__FILE__) << '/tmp/this_is_relative_to_pwd.pdf')
20
- document(:first).to_pdf do |filename|
21
- assert_nothing_raised do
22
- FileUtils.move filename, path
19
+ should "use a to_pdf block to move a file to a relative path" do
20
+ begin
21
+ path = File.expand_path(File.dirname(__FILE__) << '/tmp/this_is_relative_to_pwd.pdf')
22
+ document(:first).to_pdf do |filename|
23
+ assert_nothing_raised do
24
+ FileUtils.move filename, path
25
+ end
26
+ assert File.exists?(path)
23
27
  end
24
- assert File.exists?(path)
28
+ ensure
29
+ FileUtils.rm path rescue nil
25
30
  end
26
- ensure
27
- FileUtils.rm path rescue nil
28
31
  end
29
- end
30
32
 
31
- specify "can generate PDF and return as a string" do
32
- @author = 'Foo'
33
- assert_equal '%PDF', document(:first).to_pdf(binding)[0, 4]
34
- end
33
+ should "generate PDF and return as a string" do
34
+ @author = 'Foo'
35
+ assert_equal '%PDF', document(:first).to_pdf(binding)[0, 4]
36
+ end
35
37
 
36
- specify "can generate TeX source and return as a string with debug option" do
37
- @author = 'Foo'
38
- assert_not_equal '%PDF', document(:first, :tex => true).to_pdf(binding)[0, 4]
39
- end
38
+ should "generate TeX source and return as a string with debug option" do
39
+ @author = 'Foo'
40
+ assert_not_equal '%PDF', document(:first, :tex => true).to_pdf(binding)[0, 4]
41
+ end
40
42
 
41
- specify "can generate PDF and give access to file directly" do
42
- @author = 'Foo'
43
- data_read = nil
44
- invocation_result = document(:first).to_pdf(binding) do |filename|
45
- data_read = File.open(filename, 'rb') { |f| f.read }
46
- :not_the_file_contents
43
+ should "generate PDF and give access to file directly" do
44
+ @author = 'Foo'
45
+ data_read = nil
46
+ invocation_result = document(:first).to_pdf(binding) do |filename|
47
+ data_read = File.open(filename, 'rb') { |f| f.read }
48
+ :not_the_file_contents
49
+ end
50
+ assert_equal '%PDF', data_read[0, 4]
51
+ assert_equal :not_the_file_contents, invocation_result
47
52
  end
48
- assert_equal '%PDF', data_read[0, 4]
49
- assert_equal :not_the_file_contents, invocation_result
50
- end
51
53
 
52
- specify "can generate TeX source and give access to file directly" do
53
- @author = 'Foo'
54
- data_read = nil
55
- invocation_result = document(:first, :tex => true).to_pdf(binding) do |filename|
56
- data_read = File.open(filename, 'rb') { |f| f.read }
57
- :not_the_file_contents
54
+ should "generate TeX source and give access to file directly" do
55
+ @author = 'Foo'
56
+ data_read = nil
57
+ invocation_result = document(:first, :tex => true).to_pdf(binding) do |filename|
58
+ data_read = File.open(filename, 'rb') { |f| f.read }
59
+ :not_the_file_contents
60
+ end
61
+ assert_not_equal '%PDF', data_read[0, 4]
62
+ assert_equal :not_the_file_contents, invocation_result
63
+ end
64
+
65
+ should "wrap in a layout using `yield'" do
66
+ doc = document(:fragment, :layout => 'testing_layout[<%= yield %>]')
67
+ @name = 'ERB'
68
+ source = doc.source(binding)
69
+ assert source =~ /^testing_layout.*?ERB, Fragmented/
58
70
  end
59
- assert_not_equal '%PDF', data_read[0, 4]
60
- assert_equal :not_the_file_contents, invocation_result
61
- end
62
71
 
63
- specify "can wrap in a layout using `yield'" do
64
- doc = document(:fragment, :layout => 'testing_layout[<%= yield %>]')
65
- @name = 'ERB'
66
- source = doc.source(binding)
67
- assert source =~ /^testing_layout.*?ERB, Fragmented/
68
72
  end
69
73
 
70
74
  end
@@ -1,20 +1,24 @@
1
1
  require File.dirname(__FILE__) << '/test_helper'
2
2
 
3
- context "Filtering Documents" do
3
+ class FilterTest < Test::Unit::TestCase
4
+
5
+ context "Filtering Documents" do
4
6
 
5
- specify "can filter through textile" do
6
- doc = document('text.textile', :filter => 'textile')
7
- source = doc.source(binding)
8
- assert source.include?('\item')
9
- end
7
+ should "filter through textile" do
8
+ doc = document('text.textile', :filter => 'textile')
9
+ source = doc.source(binding)
10
+ assert source.include?('\item')
11
+ end
10
12
 
11
- specify "does not affect layouts" do
12
- doc = document('text.textile',
13
- :filter => 'textile',
14
- :layout => "* layout\n* is\n<%= yield %>")
15
- source = doc.source(binding)
16
- assert source.include?("* layout"), "filtered layout"
17
- assert source.include?('\item'), "didn't filter content"
18
- end
13
+ should "not affect layouts" do
14
+ doc = document('text.textile',
15
+ :filter => 'textile',
16
+ :layout => "* layout\n* is\n<%= yield %>")
17
+ source = doc.source(binding)
18
+ assert source.include?("* layout"), "filtered layout"
19
+ assert source.include?('\item'), "didn't filter content"
20
+ end
19
21
 
22
+ end
23
+
20
24
  end
@@ -1,63 +1,67 @@
1
1
  require File.dirname(__FILE__) << '/test_helper'
2
2
 
3
- context "Creating a temporary directory" do
3
+ class TempdirTest < Test::Unit::TestCase
4
+
5
+ context "Creating a temporary directory" do
4
6
 
5
- def setup
6
- change_tmpdir_for_testing
7
- end
7
+ setup do
8
+ change_tmpdir_for_testing
9
+ end
8
10
 
9
- specify "changes directory" do
10
- old_location = Dir.pwd
11
- block_location = nil
12
- RTeX::Tempdir.open do
13
- assert_not_equal old_location, Dir.pwd
14
- block_location = Dir.pwd
11
+ should "change directory" do
12
+ old_location = Dir.pwd
13
+ block_location = nil
14
+ RTeX::Tempdir.open do
15
+ assert_not_equal old_location, Dir.pwd
16
+ block_location = Dir.pwd
17
+ end
18
+ assert_equal old_location, Dir.pwd
19
+ assert !File.exists?(block_location)
15
20
  end
16
- assert_equal old_location, Dir.pwd
17
- assert !File.exists?(block_location)
18
- end
19
21
 
20
- specify "uses a 'rtex' name prefix" do
21
- RTeX::Tempdir.open do
22
- assert_equal 'rtex-', File.basename(Dir.pwd)[0,5]
22
+ should "use a 'rtex' name prefix" do
23
+ RTeX::Tempdir.open do
24
+ assert_equal 'rtex-', File.basename(Dir.pwd)[0,5]
25
+ end
23
26
  end
24
- end
25
27
 
26
- specify "by default, removes the directory after use if no exception occurs" do
27
- path = nil
28
- RTeX::Tempdir.open do
29
- path = Dir.pwd
30
- assert File.exists?(path)
28
+ should "remove the directory after use if no exception occurs by default" do
29
+ path = nil
30
+ RTeX::Tempdir.open do
31
+ path = Dir.pwd
32
+ assert File.exists?(path)
33
+ end
34
+ assert !File.exists?(path)
31
35
  end
32
- assert !File.exists?(path)
33
- end
34
36
 
35
- specify "returns result of last statment if automatically removing the directory" do
36
- result = RTeX::Tempdir.open do
37
- :last
37
+ should "return the result of the last statement if automatically removing the directory" do
38
+ result = RTeX::Tempdir.open do
39
+ :last
40
+ end
41
+ assert_equal :last, :last
38
42
  end
39
- assert_equal :last, :last
40
- end
41
43
 
42
- specify "returns result of last statment if not automatically removing the directory" do
43
- tempdir = nil # to capture value
44
- result = RTeX::Tempdir.open do |tempdir|
45
- :last
44
+ should "return the result of the last statment if not automatically removing the directory" do
45
+ tempdir = nil # to capture value
46
+ result = RTeX::Tempdir.open do |tempdir|
47
+ :last
48
+ end
49
+ tempdir.remove!
50
+ assert_equal :last, :last
46
51
  end
47
- tempdir.remove!
48
- assert_equal :last, :last
49
- end
50
52
 
51
- specify "does not remove the directory after use if an exception occurs" do
52
- path = nil
53
- assert_raises RuntimeError do
54
- RTeX::Tempdir.open do
55
- path = Dir.pwd
56
- assert File.directory?(path)
57
- raise "Test exception!"
53
+ should "not remove the directory after use if an exception occurs" do
54
+ path = nil
55
+ assert_raises RuntimeError do
56
+ RTeX::Tempdir.open do
57
+ path = Dir.pwd
58
+ assert File.directory?(path)
59
+ raise "Test exception!"
60
+ end
58
61
  end
62
+ assert File.directory?(path)
59
63
  end
60
- assert File.directory?(path)
64
+
61
65
  end
62
66
 
63
67
  end
@@ -1,9 +1,12 @@
1
1
  require 'test/unit'
2
2
 
3
- require 'rubygems' rescue nil
4
- require 'test/spec'
5
- require 'flexmock'
6
- require 'flexmock/test_unit'
3
+ require 'rubygems'
4
+ begin
5
+ require 'shoulda'
6
+ require 'flexmock/test_unit'
7
+ rescue LoadError
8
+ abort "the `Shoulda' and `flexmock' gems are required for testing"
9
+ end
7
10
 
8
11
  require File.dirname(__FILE__) << '/../lib/rtex'
9
12
 
metadata CHANGED
@@ -1,52 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Bruce Williams
8
- - Wiebe Cazemier
7
+ - Bruce Williams, Wiebe Cazemier
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
11
 
13
- date: 2008-06-08 00:00:00 -05:00
12
+ date: 2008-08-19 00:00:00 -05:00
14
13
  default_executable:
15
- dependencies: []
16
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: Shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: echoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
17
35
  description: LaTeX preprocessor for PDF generation; Rails plugin
18
- email:
19
- - bruce@codefluency.com
36
+ email: bruce@codefluency.com
20
37
  executables:
21
38
  - rtex
22
39
  extensions: []
23
40
 
24
41
  extra_rdoc_files:
25
- - README.rdoc
26
- - README_RAILS.rdoc
27
42
  - bin/rtex
28
- files:
29
- - HISTORY.rdoc
30
- - Manifest.txt
43
+ - CHANGELOG
44
+ - lib/rtex/document.rb
45
+ - lib/rtex/escaping.rb
46
+ - lib/rtex/framework/merb.rb
47
+ - lib/rtex/framework/rails.rb
48
+ - lib/rtex/tempdir.rb
49
+ - lib/rtex/version.rb
50
+ - lib/rtex.rb
31
51
  - README.rdoc
32
52
  - README_RAILS.rdoc
33
- - Rakefile
53
+ files:
34
54
  - bin/rtex
55
+ - CHANGELOG
35
56
  - init.rb
36
- - lib/rtex.rb
37
57
  - lib/rtex/document.rb
38
58
  - lib/rtex/escaping.rb
39
59
  - lib/rtex/framework/merb.rb
40
60
  - lib/rtex/framework/rails.rb
41
61
  - lib/rtex/tempdir.rb
42
62
  - lib/rtex/version.rb
63
+ - lib/rtex.rb
64
+ - Manifest
43
65
  - rails/init.rb
44
- - tasks/doc.rake
45
- - tasks/gem.rake
46
- - tasks/manifest.rake
47
- - tasks/post_load.rake
48
- - tasks/setup.rb
49
- - tasks/test.rake
66
+ - Rakefile
67
+ - README.rdoc
68
+ - README_RAILS.rdoc
50
69
  - test/document_test.rb
51
70
  - test/filter_test.rb
52
71
  - test/fixtures/first.tex
@@ -57,10 +76,15 @@ files:
57
76
  - test/test_helper.rb
58
77
  - vendor/instiki/LICENSE
59
78
  - vendor/instiki/redcloth_for_tex.rb
79
+ - rtex.gemspec
60
80
  has_rdoc: true
61
81
  homepage: http://rtex.rubyforge.org
62
82
  post_install_message:
63
83
  rdoc_options:
84
+ - --line-numbers
85
+ - --inline-source
86
+ - --title
87
+ - Rtex
64
88
  - --main
65
89
  - README.rdoc
66
90
  require_paths:
@@ -73,14 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
97
  version:
74
98
  required_rubygems_version: !ruby/object:Gem::Requirement
75
99
  requirements:
76
- - - ">="
100
+ - - "="
77
101
  - !ruby/object:Gem::Version
78
- version: "0"
102
+ version: "1.2"
79
103
  version:
80
104
  requirements: []
81
105
 
82
106
  rubyforge_project: rtex
83
- rubygems_version: 1.1.1
107
+ rubygems_version: 1.2.0
84
108
  signing_key:
85
109
  specification_version: 2
86
110
  summary: LaTeX preprocessor for PDF generation; Rails plugin
@@ -88,3 +112,4 @@ test_files:
88
112
  - test/document_test.rb
89
113
  - test/filter_test.rb
90
114
  - test/tempdir_test.rb
115
+ - test/test_helper.rb
@@ -1,29 +0,0 @@
1
- 2008-04-20
2
-
3
- Released RTeX v1.99.0 as a Rubygem, with a standalone executable for PDF generation
4
- and support for plugin installation from the executable.
5
-
6
- This release requires Rails >= 2.0.1
7
-
8
- Thanks to:
9
- * Jonas Bähr for a patch with additional LaTeX escaping
10
- * Fouad Mardini for a TemplateHandler patch
11
-
12
- 2007
13
-
14
- No active development, maintenance primarily by Wiebe Cazemier
15
-
16
- 2006-07-27
17
-
18
- Added quite a few *long* overdue fixes & enhancements sent in by various people.
19
-
20
- * Added latex escaping 'l' method (Thanks, Benjamin Quorning)
21
- * Added support for @options_for_rtex hash for configuration:
22
- * Added :tempdir option, and changed default temporary directory
23
- (Thanks, Francesco Levorato)
24
- * Added :preprocess option to support running through latex before pdflatex
25
- (Thanks Charles Lesburg, Benjamin Quorning)
26
- * Moved old @filename setting to :filename option in this hash
27
-
28
- If you're using the same settings for @options_for_rtex often, you might want to
29
- put your assignment in a before_filter (perhaps overriding :filename, etc in your actions).
@@ -1,48 +0,0 @@
1
- # $Id$
2
-
3
- require 'rake/rdoctask'
4
-
5
- namespace :doc do
6
-
7
- desc 'Generate RDoc documentation'
8
- Rake::RDocTask.new do |rd|
9
- rd.main = PROJ.rdoc_main
10
- rd.rdoc_dir = PROJ.rdoc_dir
11
-
12
- incl = Regexp.new(PROJ.rdoc_include.join('|'))
13
- excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
14
- files = PROJ.files.find_all do |fn|
15
- case fn
16
- when excl; false
17
- when incl; true
18
- else false end
19
- end
20
- rd.rdoc_files.push(*files)
21
-
22
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
23
- title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
24
-
25
- rd.options << "-t #{title}"
26
- rd.options.concat(PROJ.rdoc_opts)
27
- end
28
-
29
- desc 'Generate ri locally for testing'
30
- task :ri => :clobber_ri do
31
- sh "#{RDOC} --ri -o ri ."
32
- end
33
-
34
- task :clobber_ri do
35
- rm_r 'ri' rescue nil
36
- end
37
-
38
- end # namespace :doc
39
-
40
- desc 'Alias to doc:rdoc'
41
- task :doc => 'doc:rdoc'
42
-
43
- desc 'Remove all build products'
44
- task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
45
-
46
- remove_desc_for_task %w(doc:clobber_rdoc)
47
-
48
- # EOF
@@ -1,110 +0,0 @@
1
- # $Id$
2
-
3
- require 'rake/gempackagetask'
4
-
5
- namespace :gem do
6
-
7
- PROJ.spec = Gem::Specification.new do |s|
8
- s.name = PROJ.name
9
- s.version = PROJ.version
10
- s.summary = PROJ.summary
11
- s.authors = Array(PROJ.authors)
12
- s.email = PROJ.email
13
- s.homepage = Array(PROJ.url).first
14
- s.rubyforge_project = PROJ.rubyforge_name
15
- s.post_install_message = PROJ.post_install_message
16
-
17
- s.description = PROJ.description
18
-
19
- PROJ.dependencies.each do |dep|
20
- s.add_dependency(*dep)
21
- end
22
-
23
- s.files = PROJ.files
24
- s.executables = PROJ.executables.map {|fn| File.basename(fn)}
25
- s.extensions = PROJ.files.grep %r/extconf\.rb$/
26
-
27
- s.bindir = 'bin'
28
- dirs = Dir["{#{PROJ.libs.join(',')}}"]
29
- s.require_paths = dirs unless dirs.empty?
30
-
31
- incl = Regexp.new(PROJ.rdoc_include.join('|'))
32
- excl = PROJ.rdoc_exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
33
- excl = Regexp.new(excl.join('|'))
34
- rdoc_files = PROJ.files.find_all do |fn|
35
- case fn
36
- when excl; false
37
- when incl; true
38
- else false end
39
- end
40
- s.rdoc_options = PROJ.rdoc_opts + ['--main', PROJ.rdoc_main]
41
- s.extra_rdoc_files = rdoc_files
42
- s.has_rdoc = true
43
-
44
- if test ?f, PROJ.test_file
45
- s.test_file = PROJ.test_file
46
- else
47
- s.test_files = PROJ.tests.to_a
48
- end
49
-
50
- # Do any extra stuff the user wants
51
- # spec_extras.each do |msg, val|
52
- # case val
53
- # when Proc
54
- # val.call(s.send(msg))
55
- # else
56
- # s.send "#{msg}=", val
57
- # end
58
- # end
59
- end
60
-
61
- desc 'Show information about the gem'
62
- task :debug do
63
- puts PROJ.spec.to_ruby
64
- end
65
-
66
- pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
67
- pkg.need_tar = PROJ.need_tar
68
- pkg.need_zip = PROJ.need_zip
69
- pkg.package_files += PROJ.spec.files
70
- end
71
- Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
72
-
73
- gem_file = if PROJ.spec.platform == Gem::Platform::RUBY
74
- "#{pkg.package_name}.gem"
75
- else
76
- "#{pkg.package_name}-#{PROJ.spec.platform}.gem"
77
- end
78
-
79
- desc "Build the gem file #{gem_file}"
80
- task :package => "#{pkg.package_dir}/#{gem_file}"
81
-
82
- file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.spec.files do
83
- when_writing("Creating GEM") {
84
- Gem::Builder.new(PROJ.spec).build
85
- verbose(true) {
86
- mv gem_file, "#{pkg.package_dir}/#{gem_file}"
87
- }
88
- }
89
- end
90
-
91
- desc 'Install the gem'
92
- task :install => [:clobber, :package] do
93
- sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.full_name}"
94
- end
95
-
96
- desc 'Uninstall the gem'
97
- task :uninstall do
98
- sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' -x #{PROJ.name}"
99
- end
100
-
101
- end # namespace :gem
102
-
103
- desc 'Alias to gem:package'
104
- task :gem => 'gem:package'
105
-
106
- task :clobber => 'gem:clobber_package'
107
-
108
- remove_desc_for_task %w(gem:clobber_package)
109
-
110
- # EOF
@@ -1,49 +0,0 @@
1
- # $Id$
2
-
3
- require 'find'
4
-
5
- namespace :manifest do
6
-
7
- desc 'Verify the manifest'
8
- task :check do
9
- fn = PROJ.manifest_file + '.tmp'
10
- files = manifest_files
11
-
12
- File.open(fn, 'w') {|fp| fp.puts files}
13
- lines = %x(#{DIFF} -du #{PROJ.manifest_file} #{fn}).split("\n")
14
- if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
15
- lines.map! do |line|
16
- case line
17
- when %r/^(-{3}|\+{3})/; nil
18
- when %r/^@/; Console::ANSICode.blue line
19
- when %r/^\+/; Console::ANSICode.green line
20
- when %r/^\-/; Console::ANSICode.red line
21
- else line end
22
- end
23
- end
24
- puts lines.compact
25
- rm fn rescue nil
26
- end
27
-
28
- desc 'Create a new manifest'
29
- task :create do
30
- files = manifest_files
31
- unless test(?f, PROJ.manifest_file)
32
- files << PROJ.manifest_file
33
- files.sort!
34
- end
35
- File.open(PROJ.manifest_file, 'w') {|fp| fp.puts files}
36
- end
37
-
38
- task :assert do
39
- files = manifest_files
40
- manifest = File.read(PROJ.manifest_file).split($/)
41
- raise "ERROR: #{PROJ.manifest_file} is out of date" unless files == manifest
42
- end
43
-
44
- end # namespace :manifest
45
-
46
- desc 'Alias to manifest:check'
47
- task :manifest => 'manifest:check'
48
-
49
- # EOF
@@ -1,26 +0,0 @@
1
- # $Id$
2
-
3
- # This file does not define any rake tasks. It is used to load some project
4
- # settings if they are not defined by the user.
5
-
6
- PROJ.rdoc_exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
7
- PROJ.exclude << "^#{Regexp.escape(PROJ.ann_file)}$"
8
-
9
- PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
10
-
11
- PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
12
-
13
- PROJ.summary ||= PROJ.description.split('.').first
14
-
15
- PROJ.files ||=
16
- if test(?f, PROJ.manifest_file)
17
- files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
18
- files.delete ''
19
- files
20
- else [] end
21
-
22
- PROJ.executables ||= PROJ.files.find_all {|fn| fn =~ %r/^bin/}
23
-
24
- PROJ.rdoc_main ||= PROJ.readme_file
25
-
26
- # EOF
@@ -1,205 +0,0 @@
1
- # $Id$
2
-
3
- require 'rubygems'
4
- require 'rake'
5
- require 'rake/clean'
6
- require 'fileutils'
7
- require 'ostruct'
8
-
9
- PROJ = OpenStruct.new
10
-
11
- PROJ.name = nil
12
- PROJ.summary = nil
13
- PROJ.description = nil
14
- PROJ.changes = nil
15
- PROJ.authors = nil
16
- PROJ.email = nil
17
- PROJ.url = nil
18
- PROJ.version = ENV['VERSION'] || '0.0.0'
19
- PROJ.rubyforge_name = nil
20
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS site .svn/ ^pkg/ ^doc/ ^\. ^rails-example/)
21
- PROJ.release_name = ENV['RELEASE']
22
- PROJ.history_file = 'HISTORY.rdoc'
23
- PROJ.manifest_file = 'Manifest.txt'
24
- PROJ.readme_file = 'README.rdoc'
25
-
26
- # Test::Unit
27
- PROJ.tests = FileList['test/**/*_test.rb']
28
- PROJ.test_file = 'test/all.rb'
29
- PROJ.test_opts = []
30
-
31
- # Rcov
32
- PROJ.rcov_dir = 'coverage'
33
- PROJ.rcov_opts = ['--sort', 'coverage', '-T']
34
- PROJ.rcov_threshold = 90.0
35
- PROJ.rcov_threshold_exact = false
36
-
37
- # Rdoc
38
- PROJ.rdoc_opts = []
39
- PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
40
- PROJ.rdoc_exclude = %w(extconf.rb$)
41
- PROJ.rdoc_main = nil
42
- PROJ.rdoc_dir = 'doc'
43
- PROJ.rdoc_remote_dir = nil
44
-
45
- # Gem Packaging
46
- PROJ.files = nil
47
- PROJ.executables = nil
48
- PROJ.dependencies = []
49
- PROJ.need_tar = true
50
- PROJ.need_zip = false
51
- PROJ.post_install_message = nil
52
-
53
- # Announce
54
- PROJ.ann_file = 'announcement.txt'
55
- PROJ.ann_text = nil
56
- PROJ.ann_paragraphs = []
57
- PROJ.ann_email = {
58
- :from => nil,
59
- :to => %w(ruby-talk@ruby-lang.org),
60
- :server => 'localhost',
61
- :port => 25,
62
- :domain => ENV['HOSTNAME'],
63
- :acct => nil,
64
- :passwd => nil,
65
- :authtype => :plain
66
- }
67
-
68
- # Load the other rake files in the tasks folder
69
- rakefiles = Dir.glob('tasks/*.rake').sort
70
- rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
71
- import(*rakefiles)
72
-
73
- # Setup some constants
74
- WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
75
-
76
- DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
77
-
78
- def quiet( &block )
79
- io = [STDOUT.dup, STDERR.dup]
80
- STDOUT.reopen DEV_NULL
81
- STDERR.reopen DEV_NULL
82
- block.call
83
- ensure
84
- STDOUT.reopen io.first
85
- STDERR.reopen io.last
86
- end
87
-
88
- DIFF = if WIN32 then 'diff.exe'
89
- else
90
- if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
91
- else 'diff' end
92
- end unless defined? DIFF
93
-
94
- SUDO = if WIN32 then ''
95
- else
96
- if quiet {system 'which sudo'} then 'sudo'
97
- else '' end
98
- end
99
-
100
- RCOV = WIN32 ? 'rcov.bat' : 'rcov'
101
- GEM = WIN32 ? 'gem.bat' : 'gem'
102
-
103
- %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
104
- begin
105
- require lib
106
- Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
107
- rescue LoadError
108
- Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
109
- end
110
- end
111
-
112
- # Reads a file at +path+ and spits out an array of the +paragraphs+
113
- # specified.
114
- #
115
- # changes = paragraphs_of('History.txt', 0..1).join("\n\n")
116
- # summary, *description = paragraphs_of('README.txt', 3, 3..8)
117
- #
118
- def paragraphs_of( path, *paragraphs )
119
- title = String === paragraphs.first ? paragraphs.shift : nil
120
- ary = File.read(path).delete("\r").split(/\n\n+/)
121
-
122
- result = if title
123
- tmp, matching = [], false
124
- rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
125
- paragraphs << (0..-1) if paragraphs.empty?
126
-
127
- ary.each do |val|
128
- if val =~ rgxp
129
- break if matching
130
- matching = true
131
- rgxp = %r/^=+/i
132
- elsif matching
133
- tmp << val
134
- end
135
- end
136
- tmp
137
- else ary end
138
-
139
- result.values_at(*paragraphs)
140
- end
141
-
142
- # Adds the given gem _name_ to the current project's dependency list. An
143
- # optional gem _version_ can be given. If omitted, the newest gem version
144
- # will be used.
145
- #
146
- def depend_on( name, version = nil )
147
- spec = Gem.source_index.find_name(name).last
148
- version = spec.version.to_s if version.nil? and !spec.nil?
149
-
150
- PROJ.dependencies << case version
151
- when nil; [name]
152
- when %r/^\d/; [name, ">= #{version}"]
153
- else [name, version] end
154
- end
155
-
156
- # Adds the given arguments to the include path if they are not already there
157
- #
158
- def ensure_in_path( *args )
159
- args.each do |path|
160
- path = File.expand_path(path)
161
- $:.unshift(path) if test(?d, path) and not $:.include?(path)
162
- end
163
- end
164
-
165
- # Find a rake task using the task name and remove any description text. This
166
- # will prevent the task from being displayed in the list of available tasks.
167
- #
168
- def remove_desc_for_task( names )
169
- Array(names).each do |task_name|
170
- task = Rake.application.tasks.find {|t| t.name == task_name}
171
- next if task.nil?
172
- task.instance_variable_set :@comment, nil
173
- end
174
- end
175
-
176
- # Change working directories to _dir_, call the _block_ of code, and then
177
- # change back to the original working directory (the current directory when
178
- # this method was called).
179
- #
180
- def in_directory( dir, &block )
181
- curdir = pwd
182
- begin
183
- cd dir
184
- return block.call
185
- ensure
186
- cd curdir
187
- end
188
- end
189
-
190
- # Scans the current working directory and creates a list of files that are
191
- # candidates to be in the manifest.
192
- #
193
- def manifest_files
194
- files = []
195
- exclude = Regexp.new(PROJ.exclude.join('|'))
196
- Find.find '.' do |path|
197
- path.sub! %r/^(\.\/|\/)/o, ''
198
- next unless test ?f, path
199
- next if path =~ exclude
200
- files << path
201
- end
202
- files.sort!
203
- end
204
-
205
- # EOF
@@ -1,38 +0,0 @@
1
- # $Id$
2
-
3
- require 'rake/testtask'
4
-
5
- namespace :test do
6
-
7
- Rake::TestTask.new(:run) do |t|
8
- t.libs = PROJ.libs
9
- t.test_files = if test(?f, PROJ.test_file) then [PROJ.test_file]
10
- else PROJ.tests end
11
- t.ruby_opts += PROJ.ruby_opts
12
- t.ruby_opts += PROJ.test_opts
13
- end
14
-
15
- if HAVE_RCOV
16
- desc 'Run rcov on the unit tests'
17
- task :rcov => :clobber_rcov do
18
- opts = PROJ.rcov_opts.dup << '-o' << PROJ.rcov_dir
19
- opts = opts.join(' ')
20
- files = if test(?f, PROJ.test_file) then [PROJ.test_file]
21
- else PROJ.tests end
22
- files = files.join(' ')
23
- sh "#{RCOV} #{files} #{opts}"
24
- end
25
-
26
- task :clobber_rcov do
27
- rm_r 'coverage' rescue nil
28
- end
29
- end
30
-
31
- end # namespace :test
32
-
33
- desc 'Alias to test:run'
34
- task :test => 'test:run'
35
-
36
- task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
-
38
- # EOF