require"action_view"moduleSprocketsmoduleHelpersmoduleRailsHelperextendActiveSupport::ConcernincludeActionView::Helpers::AssetTagHelperdefasset_paths@asset_paths||=beginpaths=RailsHelper::AssetPaths.new(config,controller)paths.asset_environment=asset_environmentpaths.asset_digests=asset_digestspaths.compile_assets=compile_assets?paths.digest_assets=digest_assets?pathsendenddefjavascript_include_tag(*sources)options=sources.extract_options!debug=options.key?(:debug)?options.delete(:debug):debug_assets?body=options.key?(:body)?options.delete(:body):falsedigest=options.key?(:digest)?options.delete(:digest):digest_assets?sources.collectdo|source|ifdebug&&asset=asset_paths.asset_for(source,'js')asset.to_a.map{|dep|super(dep.pathname.to_s,{:src=>path_to_asset(dep,:ext=>'js',:body=>true,:digest=>digest)}.merge!(options))}elsesuper(source.to_s,{:src=>path_to_asset(source,:ext=>'js',:body=>body,:digest=>digest)}.merge!(options))endend.flatten.uniq.join("\n").html_safeenddefstylesheet_link_tag(*sources)options=sources.extract_options!debug=options.key?(:debug)?options.delete(:debug):debug_assets?body=options.key?(:body)?options.delete(:body):falsedigest=options.key?(:digest)?options.delete(:digest):digest_assets?sources.collectdo|source|ifdebug&&asset=asset_paths.asset_for(source,'css')asset.to_a.map{|dep|super(dep.pathname.to_s,{:href=>path_to_asset(dep,:ext=>'css',:body=>true,:protocol=>:request,:digest=>digest)}.merge!(options))}elsesuper(source.to_s,{:href=>path_to_asset(source,:ext=>'css',:body=>body,:protocol=>:request,:digest=>digest)}.merge!(options))endend.flatten.uniq.join("\n").html_safeenddefasset_path(source,options={})source=source.logical_pathifsource.respond_to?(:logical_path)path=asset_paths.compute_public_path(source,asset_prefix,options.merge(:body=>true))options[:body]?"#{path}?body=1":pathendalias_method:path_to_asset,:asset_path# aliased to avoid conflicts with an asset_path named routedefimage_path(source)path_to_asset(source)endalias_method:path_to_image,:image_path# aliased to avoid conflicts with an image_path named routedeffont_path(source)path_to_asset(source)endalias_method:path_to_font,:font_path# aliased to avoid conflicts with an font_path named routedefjavascript_path(source)path_to_asset(source,:ext=>'js')endalias_method:path_to_javascript,:javascript_path# aliased to avoid conflicts with an javascript_path named routedefstylesheet_path(source)path_to_asset(source,:ext=>'css')endalias_method:path_to_stylesheet,:stylesheet_path# aliased to avoid conflicts with an stylesheet_path named routeprivatedefdebug_assets?compile_assets?&&(Rails.application.config.assets.debug||params[:debug_assets])rescueNameErrorfalseend# Override to specify an alternative prefix for asset path generation.# When combined with a custom +asset_environment+, this can be used to# implement themes that can take advantage of the asset pipeline.## If you only want to change where the assets are mounted, refer to# +config.assets.prefix+ instead.defasset_prefixRails.application.config.assets.prefixenddefasset_digestsRails.application.config.assets.digestsenddefcompile_assets?Rails.application.config.assets.compileenddefdigest_assets?Rails.application.config.assets.digestend# Override to specify an alternative asset environment for asset# path generation. The environment should already have been mounted# at the prefix returned by +asset_prefix+.defasset_environmentRails.application.assetsendclassAssetPaths<::ActionView::AssetPaths#:nodoc:attr_accessor:asset_environment,:asset_prefix,:asset_digests,:compile_assets,:digest_assetsclassAssetNotPrecompiledError<StandardError;enddefasset_for(source,ext)source=source.to_sreturnnilifis_uri?(source)source=rewrite_extension(source,nil,ext)asset_environment[source]rescueSprockets::FileOutsidePathsnilenddefdigest_for(logical_path)ifdigest_assets&&asset_digests&&(digest=asset_digests[logical_path])returndigestendifcompile_assetsifdigest_assets&&asset=asset_environment[logical_path]returnasset.digest_pathendreturnlogical_pathelseraiseAssetNotPrecompiledError.new("#{logical_path} isn't precompiled")endenddefrewrite_asset_path(source,dir,options={})ifsource[0]==?/sourceelseifdigest_assets&&options[:digest]!=falsesource=digest_for(source)endsource=File.join(dir,source)source="/#{source}"unlesssource=~/^\//sourceendenddefrewrite_extension(source,dir,ext)source_ext=File.extname(source)[1..-1]if!ext||ext==source_extsourceelsifsource_ext.blank?"#{source}.#{ext}"elsifFile.exists?(source)||exact_match_present?(source)sourceelse"#{source}.#{ext}"endenddefexact_match_present?(source)pathname=asset_environment.resolve(source)pathname.to_s=~/#{Regexp.escape(source)}\Z/rescueSprockets::FileNotFoundfalseendendendendend