rails-latex 1.0.9 → 1.0.10

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.
@@ -1,5 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '~> 3.1'
3
+ gem 'rails', '~> 3.2'
4
4
 
5
5
  gem 'rails-latex', :path => '../../'
@@ -3,17 +3,19 @@ class LatexExampleController < ApplicationController
3
3
  end
4
4
 
5
5
  def barcode
6
- render :layout => 'barcode'
6
+ render :layout => 'barcode', formats: [:pdf]
7
7
  end
8
8
 
9
9
  def barcode_as_string
10
- old_formats = formats
11
- self.formats = ['pdf']
12
- @pdf=render_to_string(action: 'barcode', layout: "barcode")
10
+
11
+ old_content_type = self.content_type
12
+ @pdf=render_to_string(action: 'barcode', layout: "barcode", formats: [:pdf])
13
+ self.content_type = old_content_type # render_to_string changes content_type
14
+
13
15
  File.open(file="#{Rails.root}/tmp/a.pdf",'w:binary') do |io|
14
16
  io.write(@pdf)
15
17
  end
16
- self.formats = old_formats
18
+
17
19
  render text: "wrote #{file}"
18
20
  end
19
21
  end
@@ -4,5 +4,8 @@
4
4
 
5
5
  <li><%= link_to "print barcode", latex_example_barcode_path(:format => :pdf) %></li>
6
6
 
7
+ <li><%= link_to "print barcode - with no '.pdf' in url", latex_example_barcode_path %></li>
8
+
9
+
7
10
  <li><%= link_to "generate barcode pdf as string", latex_example_barcode_as_string_path %> and write to <tt><%= "#{Rails.root}/tmp/a.pdf" %></tt> </li>
8
11
  </ul>
@@ -3,4 +3,4 @@
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
5
  # Mime::Type.register_alias "text/html", :iphone
6
- Mime::Type.register "application/pdf", :pdf, ['text/pdf'], ['pdf']
6
+ # Mime::Type.register "application/pdf", :pdf, ['text/pdf'], ['pdf']
@@ -18,22 +18,23 @@ class LatexToPdf
18
18
  input=File.join(dir,'input.tex')
19
19
  FileUtils.mkdir_p(dir)
20
20
  File.open(input,'wb') {|io| io.write(code) }
21
- Process.waitpid(fork do
22
- begin
23
- Dir.chdir dir
24
- STDOUT.reopen("input.log","a")
25
- STDERR.reopen(STDOUT)
26
- args=config[:arguments] + ['-shell-escape','-interaction','batchmode',"input.tex"]
27
- system config[:command],'-draftmode',*args if parse_twice
28
- exec config[:command],*args
29
- rescue
30
- File.open("input.log",'a') {|io|
31
- io.write("#{$!.message}:\n#{$!.backtrace.join("\n")}\n")
32
- }
33
- ensure
34
- Process.exit! 1
35
- end
36
- end)
21
+ Process.waitpid(
22
+ fork do
23
+ begin
24
+ Dir.chdir dir
25
+ STDOUT.reopen("input.log","a")
26
+ STDERR.reopen(STDOUT)
27
+ args=config[:arguments] + %w[-shell-escape -interaction batchmode -halt-on-error input.tex]
28
+ system config[:command],'-draftmode',*args if parse_twice
29
+ exec config[:command],*args
30
+ rescue
31
+ File.open("input.log",'a') {|io|
32
+ io.write("#{$!.message}:\n#{$!.backtrace.join("\n")}\n")
33
+ }
34
+ ensure
35
+ Process.exit! 1
36
+ end
37
+ end)
37
38
  if File.exist?(pdf_file=input.sub(/\.tex$/,'.pdf'))
38
39
  FileUtils.mv(input.sub(/\.tex$/,'.log'),File.join(dir,'..','input.log'))
39
40
  result=File.read(pdf_file)
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Latex
3
- VERSION = "1.0.9"
3
+ VERSION = "1.0.10"
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ class TestLatexToPdf < Test::Unit::TestCase
32
32
  end
33
33
  assert_equal "The last page is ??.\n\n1\n\n\f", `pdftotext #{pdf_file} -`
34
34
 
35
- assert_equal ["#{TMP_DIR}/rails-latex/input.log"], Dir["#{TMP_DIR}/rails-latex/*"]
35
+ assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*"]
36
36
  end
37
37
 
38
38
  def test_generate_pdf_two_parse
@@ -42,7 +42,7 @@ class TestLatexToPdf < Test::Unit::TestCase
42
42
  end
43
43
  assert_equal "The last page is 1.\n\n1\n\n\f", `pdftotext #{pdf_file} -`
44
44
 
45
- assert_equal ["#{TMP_DIR}/rails-latex/input.log"], Dir["#{TMP_DIR}/rails-latex/*"]
45
+ assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*"]
46
46
  end
47
47
 
48
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-20 00:00:00.000000000 Z
12
+ date: 2012-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &21839880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *21839880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: RedCloth
27
- requirement: &22068460 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: 4.2.7
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *22068460
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 4.2.7
36
46
  description: rails-latex is a renderer for rails 3 which allows tex files with erb
37
47
  to be turned into an inline pdf.
38
48
  email:
@@ -108,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
118
  version: '0'
109
119
  requirements: []
110
120
  rubyforge_project:
111
- rubygems_version: 1.8.15
121
+ rubygems_version: 1.8.19
112
122
  signing_key:
113
123
  specification_version: 3
114
124
  summary: A LaTeX to pdf rails 3 renderer.