rghost_rails 0.3.1 → 0.3.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.
- data/lib/rghost_rails.rb +30 -23
- metadata +22 -11
data/lib/rghost_rails.rb
CHANGED
|
@@ -6,29 +6,36 @@ end
|
|
|
6
6
|
|
|
7
7
|
class ActionController::Base
|
|
8
8
|
def rghost_render(format, options)
|
|
9
|
-
|
|
9
|
+
report = options.delete(:report)
|
|
10
|
+
|
|
11
|
+
template = case report
|
|
10
12
|
when Hash
|
|
11
|
-
File.join(
|
|
12
|
-
when String,Symbol
|
|
13
|
-
File.join(
|
|
13
|
+
File.join(report[:controller] || controller_name, report[:action])
|
|
14
|
+
when String, Symbol
|
|
15
|
+
File.join(controller_path, report.to_s)
|
|
14
16
|
when NilClass
|
|
15
|
-
File.join(
|
|
17
|
+
File.join(controller_path, action_name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
template = view_paths.find_template(template, "rghost.rb", false)
|
|
21
|
+
|
|
22
|
+
ActionView::Helpers.included_modules.each do |m|
|
|
23
|
+
extend m
|
|
16
24
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
data
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
end
|
|
25
|
+
|
|
26
|
+
lines = File.readlines(template.filename)
|
|
27
|
+
doc = eval(lines.join)
|
|
28
|
+
|
|
29
|
+
filename = options.delete(:filename)
|
|
30
|
+
rghost = doc.render(format, options)
|
|
31
|
+
output = rghost.output
|
|
32
|
+
|
|
33
|
+
raise "RGhost::Error #{rghost.errors} - #{output}" if rghost.error?
|
|
34
|
+
|
|
35
|
+
data = output.readlines.join
|
|
36
|
+
rghost.clear_output
|
|
37
|
+
|
|
38
|
+
send_data(data, :filename => filename, :type => Mime::Type.lookup_by_extension(format.to_s))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
metadata
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rghost_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 3
|
|
8
|
+
- 2
|
|
9
|
+
version: 0.3.2
|
|
5
10
|
platform: ruby
|
|
6
11
|
authors:
|
|
7
|
-
- Shairon Toledo
|
|
12
|
+
- Shairon Toledo, Gabriel Sobrinho
|
|
8
13
|
autorequire:
|
|
9
14
|
bindir: bin
|
|
10
15
|
cert_chain: []
|
|
11
16
|
|
|
12
|
-
date: 2010-
|
|
17
|
+
date: 2010-06-01 00:00:00 -04:00
|
|
13
18
|
default_executable:
|
|
14
19
|
dependencies:
|
|
15
20
|
- !ruby/object:Gem::Dependency
|
|
16
21
|
name: rghost
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
prerelease: false
|
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
20
24
|
requirements:
|
|
21
25
|
- - ">="
|
|
22
26
|
- !ruby/object:Gem::Version
|
|
27
|
+
segments:
|
|
28
|
+
- 0
|
|
29
|
+
- 8
|
|
30
|
+
- 7
|
|
23
31
|
version: 0.8.7
|
|
24
|
-
|
|
32
|
+
type: :runtime
|
|
33
|
+
version_requirements: *id001
|
|
25
34
|
description:
|
|
26
|
-
email: shairon.toledo@gmail.com
|
|
35
|
+
email: shairon.toledo@gmail.com, gabriel.sobrinho@gmail.com
|
|
27
36
|
executables: []
|
|
28
37
|
|
|
29
38
|
extensions: []
|
|
@@ -45,18 +54,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
45
54
|
requirements:
|
|
46
55
|
- - ">="
|
|
47
56
|
- !ruby/object:Gem::Version
|
|
57
|
+
segments:
|
|
58
|
+
- 0
|
|
48
59
|
version: "0"
|
|
49
|
-
version:
|
|
50
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
61
|
requirements:
|
|
52
62
|
- - ">="
|
|
53
63
|
- !ruby/object:Gem::Version
|
|
64
|
+
segments:
|
|
65
|
+
- 0
|
|
54
66
|
version: "0"
|
|
55
|
-
version:
|
|
56
67
|
requirements: []
|
|
57
68
|
|
|
58
69
|
rubyforge_project: An Rails adapter to work with RGhost in the view layer
|
|
59
|
-
rubygems_version: 1.3.
|
|
70
|
+
rubygems_version: 1.3.6
|
|
60
71
|
signing_key:
|
|
61
72
|
specification_version: 3
|
|
62
73
|
summary: A Rails adapter to work with RGhost in the view layer
|