Class: LeapWebCore::Dependencies

Inherits:
Object
  • Object
show all
Defined in:
lib/leap_web_core/dependencies.rb

Constant Summary collapse

UI_DEV =
{
  "haml-rails" => "~> 0.3.4",
  "sass-rails" => "~> 3.2.5",
  "coffee-rails" => "~> 3.2.2",
  "uglifier" => "~> 1.2.7"
}
UI =
{
  "haml" =>  "~> 3.1.7",
  "bootstrap-sass" => "~> 2.0.4",
  "jquery-rails" => nil,
  "simple_form" => nil
}

Class Method Summary collapse

Class Method Details

.add_ui_gems_to_spec(spec) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/leap_web_core/dependencies.rb', line 29

def self.add_ui_gems_to_spec(spec)
  UI.each do |dep, version|
    spec.add_dependency dep, version
  end

  UI_DEV.each do |dep, version|
    spec.add_development_dependency dep, version
  end
end

.require_ui_gemsObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/leap_web_core/dependencies.rb', line 17

def self.require_ui_gems
  UI.keys.each {|dep| require dep}
  if Rails.env == "development"
    # This will be run in the app including plugins that run it.
    # However not all development_dependencies might be present.
    # So we better only require those that are.
    available = Bundler.definition.specs.map(&:name)
    gems_to_require = available & UI_DEV.keys
    gems_to_require.each {|dep| require dep}
  end
end