$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__) # Rubygems and so with bundler require 'rubygems' require 'bundler' Bundler.setup require 'rails' require 'active_record' require 'json' require 'ropenlayer/version' module Ropenlayer autoload :Node, 'ropenlayer/node' autoload :Localization, 'ropenlayer/localization' autoload :ActsAs, 'ropenlayer/acts_as' autoload :FormBuilder, 'ropenlayer/form_builder' module ActsAs autoload :Mapper, 'ropenlayer/acts_as/mapper' autoload :Nodeable, 'ropenlayer/acts_as/nodeable' end module JsHelper autoload :Jquery, 'ropenlayer/js_helper/jquery' autoload :Prototype, 'ropenlayer/js_helper/prototype' end module Openlayer autoload :Js, 'ropenlayer/openlayer/js' autoload :Map, 'ropenlayer/openlayer/map' autoload :Control, 'ropenlayer/openlayer/control' autoload :Feature, 'ropenlayer/openlayer/feature' module BoxControl autoload :Base, 'ropenlayer/openlayer/box_control/base' autoload :EditMap, 'ropenlayer/openlayer/box_control/edit_map' autoload :LayersSelect, 'ropenlayer/openlayer/box_control/layers_select' end module Layer autoload :Base, 'ropenlayer/openlayer/layer/base' autoload :ElementsMarker, 'ropenlayer/openlayer/layer/elements_marker' autoload :ElementsVector, 'ropenlayer/openlayer/layer/elements_vector' end end # js_helper provides access to js framework constructor. Define your own at Rails.root + "config/initializers/ropenlayer.rb" # By default Jquery is used mattr_accessor :js_helper @@js_helper = Ropenlayer::JsHelper::Jquery # Configure ropenlayer module variables though config/initializers/ropenlayer.rb def self.setup yield self end # Extend ActiveRecord with ActsAs behavior. # Extend also FormBuilder # FIXME support Formstatic class Railtie < Rails::Railtie initializer 'ropenlayer.initialize' do ActiveRecord::Base.extend Ropenlayer::ActsAs ActiveSupport.on_load(:action_view) do ActionView::Helpers::FormBuilder.send :include, Ropenlayer::FormBuilder end end end end