Sha256: bddce27e92e5c603a4d53a0b8539624f6dbe847a0759af13e20f895add1e5fe8

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

require 'ajaxlibs/constants'
require 'ajaxlibs/exceptions'
require 'ajaxlibs/versions_tools'
require 'ajaxlibs/library'
require 'ajaxlibs/libraries/dojo'
require 'ajaxlibs/libraries/jquery'
require 'ajaxlibs/libraries/jqueryui'
require 'ajaxlibs/libraries/jrails'
require 'ajaxlibs/libraries/mootools'
require 'ajaxlibs/libraries/prototype'
require 'ajaxlibs/libraries/scriptaculous'
require 'ajaxlibs/includes_helper'

if Object.const_defined?(:ActionView)
  # Make Ajaxlibs helpers available in views
  ActionView::Base.send(:include, Ajaxlibs::IncludesHelper)

  # Copy all available js libraries to rails public folder
  if Object.const_defined?(:Rails) and File.directory?(File.join(Rails.root, 'public'))
    ajaxlibs_js_path = File.join(Rails.root, 'public', 'javascripts', 'ajaxlibs')
  
    # We do not have already copied local javascript files, copying them right away
    # OPTIMIZE : we should copy only necessary libraries
    unless File.directory?(ajaxlibs_js_path)
      FileUtils.mkdir_p(ajaxlibs_js_path)
      Ajaxlibs::Library.all.each do |library|
        library::Versions.each do |version|
          source      = File.join(File.dirname(__FILE__), '..', 'public', library.library_name, version, '*.*')
          destination = File.join(ajaxlibs_js_path, library.library_name, version)
          FileUtils.mkdir_p(destination)
          FileUtils.cp(Dir.glob(source), destination)
        end
      end
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ajaxlibs-0.1.7 lib/ajaxlibs.rb
ajaxlibs-0.1.6 lib/ajaxlibs.rb
ajaxlibs-0.1.4 lib/ajaxlibs.rb
ajaxlibs-0.1.3 lib/ajaxlibs.rb
ajaxlibs-0.1.2 lib/ajaxlibs.rb