rghost_rails 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rghost_rails.rb +35 -0
  2. metadata +62 -0
@@ -0,0 +1,35 @@
1
+ require 'rghost'
2
+
3
+ RGhost::Document.class_eval do
4
+ alias_method :grid, :rails_grid
5
+ end
6
+
7
+ class ActionController::Base
8
+ def rghost_render(format, options)
9
+ v=case options[:report]
10
+ when Hash
11
+ File.join(view_paths, options[:report][:controller] ||self.controller_name, options[:report][:action])
12
+ when String,Symbol
13
+ File.join(view_paths, controller_path, options[:report].to_s)
14
+ when NilClass
15
+ File.join(view_paths, controller_path, self.action_name)
16
+ end
17
+
18
+ ActionView::Helpers.included_modules.each{|m| extend m}
19
+ r=File.readlines("#{v}.rghost.rb")
20
+ @__rgdoc__=nil
21
+ eval("@__rgdoc__=#{r}")
22
+ #instance_eval("@__doc__=#{r}")
23
+ options.delete(:report)
24
+ filename=options.delete(:filename)
25
+
26
+ rg=@__rgdoc__.render(format,options)
27
+ out=rg.output
28
+ raise "RGhost::Error #{rg.errors} - #{out}" if rg.error?
29
+ data=out.readlines.join
30
+ rg.clear_output
31
+ send_data(data, :filename => filename, :type => Mime::Type.lookup_by_extension(format.to_s))
32
+
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rghost_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.3"
5
+ platform: ruby
6
+ authors:
7
+ - Shairon Toledo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-18 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rghost
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.8.7
24
+ version:
25
+ description:
26
+ email: shairon.toledo@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - lib/rghost_rails.rb
35
+ has_rdoc: false
36
+ homepage: http://github.com/shairontoledo/RGhost-Rails
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project: An Rails adapter to work with RGhost in the view layer
57
+ rubygems_version: 1.3.1
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: An Rails adapter to work with RGhost in the view layer
61
+ test_files: []
62
+