Module: JRails

Defined in:
lib/jrails.rb,
lib/jrails/engine.rb

Defined Under Namespace

Modules: SelectorAssertions Classes: Engine

Constant Summary collapse

JQUERY_VAR =
'jQuery'
@@config =
{
  :google           => false,
  :jquery_version   => "1.7.2",
  :jqueryui_version => "1.9.1",
  :compressed       => true
}

Class Method Summary collapse

Class Method Details

.compressed?Boolean

Returns:

  • (Boolean)


33
# File 'lib/jrails.rb', line 33

def self.compressed?   ; @@config[:compressed] ; end

.configObject



31
# File 'lib/jrails.rb', line 31

def self.config        ; @@config              ; end

.google?Boolean

Returns:

  • (Boolean)


32
# File 'lib/jrails.rb', line 32

def self.google?       ; @@config[:google]     ; end

.jquery_pathObject



34
# File 'lib/jrails.rb', line 34

def self.jquery_path   ; @@jquery_path         ; end

.jqueryui_i18n_pathObject



36
# File 'lib/jrails.rb', line 36

def self.jqueryui_i18n_path ; @@jqueryui_i18n_path  ; end

.jqueryui_pathObject



35
# File 'lib/jrails.rb', line 35

def self.jqueryui_path ; @@jqueryui_path       ; end

.load_configObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jrails.rb', line 14

def self.load_config
  config_file = File.join("./", "config", "jrails.yml")
  if File.exist? config_file
    loaded_config = YAML.load_file(config_file)
    if loaded_config and loaded_config.key? Rails.env
      @@config.merge!(loaded_config[Rails.env].symbolize_keys)
      if google?
        @@jquery_path   = "http://ajax.googleapis.com/ajax/libs/jquery/#{@@config[:jquery_version]}/jquery#{".min" if compressed?}.js"
        @@jqueryui_path = "http://ajax.googleapis.com/ajax/libs/jqueryui/#{@@config[:jqueryui_version]}/jquery-ui#{".min" if compressed?}.js"
        @@jqueryui_i18n_path = "http://ajax.googleapis.com/ajax/libs/jqueryui/#{@@config[:jqueryui_version]}/i18n/jquery-ui-i18n#{".min" if compressed?}.js"
      end
    else
      raise Exception.new "Failed finding '#{Rails.env}' environment in config. check your 'config/jrails.yml' or delete that file "
    end
  end
end