# group :development do
#   source 'http://rubygems.org'
# end

gem 'rails', '~> 3.2.3'

gem 'devise'
gem 'devise-i18n'
gem 'devise_unix2_chkpwd_authenticatable'
gem 'cancan'

gem "sqlite3", '>= 1.3.6'

gem 'haml'

gem "ruby-dbus"

gem "fast_gettext", '>= 0.6.4'
gem 'gettext_i18n_rails', '>= 0.4.3'

gem "builder"

#checking which policykit is used
WEBYAST_CONFIG_FILE = "/etc/webyast/config.yml"
if File.exist?(WEBYAST_CONFIG_FILE)
  values = YAML::load(File.open(WEBYAST_CONFIG_FILE, 'r').read)
  ENV['WEBYAST_POLICYKIT']= 'true' if values["polkit1"] == false
end

if ENV['WEBYAST_POLICYKIT']== 'true'
  gem 'polkit'
else
  gem 'polkit1'
end

plugin_path = File.expand_path("../../plugins",  __FILE__)
gemspecs = Dir.glob(File.join(plugin_path, "**", "*.gemspec"))

unless gemspecs.empty?
  #We are in devel. mode. Loading all plugins
  gemspecs.each do |gemspec|
    plugin_name = gemspec.split("/").pop.split(".").first
    gem plugin_name, :path => File.expand_path("../../plugins/#{gemspec.split("/").pop(2).first}", __FILE__)
  end
else
  #Loading webyast gems from the gem path
  Dir.glob(Gem.default_path.map{|p| File.join(p, "gems/webyast-*")}).each do |pth|
    # get gem name from path: /usr/lib64/ruby/gems/1.8/gems/webyast-users-0.1 => webyast-users
    gem File.basename(pth).split("-")[0..-2].join("-")
  end
end

# group :development do
#   gem 'gettext', :require => false
# end

# group :test do
#   gem "factory_girl_rails"
#   gem "mocha",  :require => false
# end

# add extra Gems for development in Git checkout
if File.exists? File.expand_path("../../.git",  __FILE__)
#     group :development do
#       # for downloading online help via "rake download:online_help", but usually not needed
#       # gem 'nokogiri'
# 
#       # for "rake restdoc"
#       gem 'restility'
# 
#       # needed for rake gettext:find
#       gem 'ruby_parser'
# 
#       gem "ruby-debug"
#     end
end
