Sha256: d01263dfed70f8d6ccad91c96cb80efd923e6c893bbd527c56a1345876c71d09

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

# require this file to load the tasks
require 'rake'

# Require sitemap_generator at runtime. If we don't do this the ActionView helpers are included
# before the Rails environment can be loaded by other Rake tasks, which causes problems
# for those tasks when rendering using ActionView.
namespace :settings do
  # Require sitemap_generator only. When installed as a plugin the require will fail, so in
  # that case, load the environment first.
  task :require do
    Rake::Task['environment'].invoke
  end

  desc "Dump settings to config/settings.yml; use rake settings:dump[production] to create env-specific template"
  task :dump, [:as_env] => ['settings:require'] do |t, args|
    if args.empty? || args[:as_env].blank?
      path = Settings.root_file_path.join('config/settings.yml')
    else
      path = Settings.root_file_path.join("config/settings.#{args[:as_env]}.yml")
    end
    RailsAdminSettings::Dumper.dump(path)
    puts "dumped settings to #{path}"
  end
  
  desc "Load settings from config/settings.yml without overwriting current values"
  task :load => ['settings:require'] do
    Settings.apply_defaults!(Rails.root.join("config/settings.#{Rails.env.to_s}.yml"))
    Settings.apply_defaults!(Rails.root.join('config/settings.yml'))
  end

  desc "Delete all settings"
  task :delete => ['settings:require'] do
    Settings.destroy_all!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_admin_settings-0.7.7 lib/rails_admin_settings/tasks.rb
rails_admin_settings-0.7.6 lib/rails_admin_settings/tasks.rb
rails_admin_settings-0.7.5 lib/rails_admin_settings/tasks.rb
rails_admin_settings-0.7.4 lib/rails_admin_settings/tasks.rb