netshade-oembed_links 0.1.5 → 0.1.6
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/History.txt +6 -0
- data/README.txt +1 -1
- data/Rakefile +1 -1
- data/lib/oembed_links/response.rb +3 -3
- data/lib/oembed_links/template_resolver.rb +4 -1
- data/oembed_links.gemspec +1 -1
- data/spec/oembed_links_spec.rb +3 -2
- metadata +1 -1
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -62,7 +62,7 @@ OEmbed.transform("Here is a link to amazon http://www.amazon.com/Complete-Aubrey
|
|
62
62
|
end
|
63
63
|
|
64
64
|
|
65
|
-
To get started quickly in Rails:
|
65
|
+
To get started quickly in Rails (< 2.2. oembed_links doesn't work in 2.2 yet, when rendering w/ Rails templates):
|
66
66
|
|
67
67
|
Copy the included oembed_links_example.yml file to RAILS_ROOT/config/oembed_links.yml,
|
68
68
|
add a dependency to the gem in your environment.rb ( config.gem "oembed_links" )
|
data/Rakefile
CHANGED
@@ -102,11 +102,11 @@ class OEmbed
|
|
102
102
|
def render_content(*args, &block)
|
103
103
|
options = (args.last.is_a?(Hash)) ? args.last : { }
|
104
104
|
if options[:template]
|
105
|
-
@rendered = TemplateResolver.eval_template_for_path(options[:template], @url, @response, self)
|
105
|
+
@rendered = TemplateResolver.eval_template_for_path(options[:template], @url, @response, self).strip
|
106
106
|
elsif block_given?
|
107
|
-
@rendered = yield(@response)
|
107
|
+
@rendered = yield(@response).strip
|
108
108
|
else
|
109
|
-
@rendered = self.to_s
|
109
|
+
@rendered = self.to_s.strip
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -72,6 +72,7 @@ class OEmbed
|
|
72
72
|
#
|
73
73
|
# The evaluated result of the template will be returned.
|
74
74
|
def self.eval_template_for_path(path, url, data, response)
|
75
|
+
rendered_response = nil
|
75
76
|
if defined?(ApplicationController) && defined?(ActionController)
|
76
77
|
if !defined?(ActionController::TestRequest) ||
|
77
78
|
!defined?(ActionController::TestResponse)
|
@@ -84,7 +85,9 @@ class OEmbed
|
|
84
85
|
path,
|
85
86
|
200,
|
86
87
|
true,
|
87
|
-
{ :data => data,
|
88
|
+
{ :data => data,
|
89
|
+
:url => url,
|
90
|
+
:response => response }).body
|
88
91
|
end
|
89
92
|
if rendered_response.nil? && actual_path = resolve_template_path(path)
|
90
93
|
contents = File.read(actual_path)
|
data/oembed_links.gemspec
CHANGED
data/spec/oembed_links_spec.rb
CHANGED
@@ -247,7 +247,8 @@ describe OEmbed, "Rails template resolving functions" do
|
|
247
247
|
OEmbed::TemplateResolver.template_processor = nil
|
248
248
|
@current_path = File.dirname(__FILE__)
|
249
249
|
@template_path = File.join(@current_path, "templates")
|
250
|
-
|
250
|
+
|
251
|
+
gem "actionpack", "< 2.2"
|
251
252
|
require 'actionpack'
|
252
253
|
require 'action_controller'
|
253
254
|
require 'action_controller/test_process'
|
@@ -256,7 +257,7 @@ describe OEmbed, "Rails template resolving functions" do
|
|
256
257
|
|
257
258
|
end
|
258
259
|
ApplicationController.view_paths += [File.dirname(__FILE__)]
|
259
|
-
Dependencies.mark_for_unload(ApplicationController)
|
260
|
+
ActiveSupport::Dependencies.mark_for_unload(ApplicationController)
|
260
261
|
end
|
261
262
|
|
262
263
|
it "should support Rails-like template paths for template selection" do
|