From 9eab435631e1b0a659126d068972ee88cff160de Mon Sep 17 00:00:00 2001 From: "J.D. Hollis" Date: Tue, 30 Jun 2009 08:58:35 -0400 Subject: Only check for built extensions on gem dependencies that are in vendor/gems. [#2825 state:resolved] Signed-off-by: Yehuda Katz + Carl Lerche --- railties/lib/rails/gem_dependency.rb | 10 +++++++--- railties/test/gem_dependency_test.rb | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 3cc75494e4..06d830ba24 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -122,10 +122,14 @@ module Rails def built? return false unless frozen? - specification.extensions.each do |ext| - makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile') - return false unless File.exists?(makefile) + + if vendor_gem? + specification.extensions.each do |ext| + makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile') + return false unless File.exists?(makefile) + end end + true end diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb index 70f4496685..92132be992 100644 --- a/railties/test/gem_dependency_test.rb +++ b/railties/test/gem_dependency_test.rb @@ -199,6 +199,15 @@ class GemDependencyTest < Test::Unit::TestCase assert_equal true, Rails::GemDependency.new("dummy-gem-i").built? assert_equal false, Rails::GemDependency.new("dummy-gem-j").built? end + + def test_gem_determines_build_status_only_on_vendor_gems + framework_gem = Rails::GemDependency.new('dummy-framework-gem') + framework_gem.stubs(:framework_gem?).returns(true) # already loaded + framework_gem.stubs(:vendor_rails?).returns(false) # but not in vendor/rails + framework_gem.stubs(:vendor_gem?).returns(false) # and not in vendor/gems + framework_gem.add_load_paths # freeze framework gem early + assert framework_gem.built? + end def test_gem_build_passes_options_to_dependencies start_gem = Rails::GemDependency.new("dummy-gem-g") -- cgit v1.2.3 From 51d7b3070c68492f5376c19d24d8e5a2d746d7ea Mon Sep 17 00:00:00 2001 From: Tieg Zaharia Date: Fri, 26 Jun 2009 14:38:18 -0400 Subject: Adds a video_tag helper for the HTML5 video tag (similar to how the image_tag works) (tests included); removes a duplicate test line for image_tag; adds boolean attributes for video tag to tag()'s boolean attributes Signed-off-by: Yehuda Katz + Carl Lerche --- .../lib/action_view/helpers/asset_tag_helper.rb | 67 ++++++++++++++++++++++ actionpack/lib/action_view/helpers/tag_helper.rb | 3 +- actionpack/test/template/asset_tag_helper_test.rb | 43 +++++++++++++- 3 files changed, 110 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 14cdc7a025..a3b99327ce 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -454,6 +454,21 @@ module ActionView end alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route + # Computes the path to a video asset in the public videos directory. + # Full paths from the document root will be passed through. + # Used internally by +video_tag+ to build the video path. + # + # ==== Examples + # video_path("hd") # => /videos/hd + # video_path("hd.avi") # => /videos/hd.avi + # video_path("trailers/hd.avi") # => /videos/trailers/hd.avi + # video_path("/trailers/hd.avi") # => /videos/hd.avi + # video_path("http://www.railsapplication.com/vid/hd.avi") # => http://www.railsapplication.com/vid/hd.avi + def video_path(source) + compute_public_path(source, 'videos') + end + alias_method :path_to_video, :video_path # aliased to avoid conflicts with an video_path named route + # Returns an html image tag for the +source+. The +source+ can be a full # path or a file that exists in your public images directory. # @@ -505,6 +520,58 @@ module ActionView tag("img", options) end + # Returns an html video tag for the +sources+. If +sources+ is a string, + # a single video tag will be returned. If +sources+ is an array, a video + # tag with nested source tags for each source will be returned. The + # +sources+ can be full paths or files that exists in your public videos + # directory. + # + # ==== Options + # You can add HTML attributes using the +options+. The +options+ supports + # two additional keys for convenience and conformance: + # + # * :poster - Set an image (like a screenshot) to be shown + # before the video loads. The path is calculated like the +src+ of +image_tag+. + # * :size - Supplied as "{Width}x{Height}", so "30x45" becomes + # width="30" and height="45". :size will be ignored if the + # value is not in the correct format. + # + # ==== Examples + # video_tag("trailer") # => + #