Sha256: 6f76aed8a03a9dab5fd872843833f925bcf71b6d9a831e9f445890f92033a7b7

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 KB

Contents

require 'rake'
require 'rake/tasklib'
require 'fileutils'

module MuckUsers
  class Tasks < ::Rake::TaskLib
    def initialize
      define
    end
  
    private
    def define
      
      namespace :muck do
        namespace :users do
          desc "Sync files from muck users."
          task :sync do
            path = File.join(File.dirname(__FILE__), *%w[.. ..])
            system "rsync -ruv #{path}/db ."
            system "rsync -ruv #{path}/public ."
          end

          desc "Setup default admin user"
          task :create_admin => :environment do
            ['administrator'].each {|r| Role.create(:rolename => r) }
            user = User.new
            user.login = "admin"
            user.email = GlobalConfig.admin_email
            user.password = "asdfasdf"
            user.password_confirmation = "asdfasdf"
            user.first_name = "Administrator"
            user.last_name = "Administrator"
            user.save
            user.activate!

            user.roles << Role.find_by_rolename('administrator')

            puts 'created admin user'
          end
        end
      end
      
    end
  end
end
MuckUsers::Tasks.new

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
muck-users-0.1.4 lib/muck_users/tasks.rb
muck-users-0.1.5 lib/muck_users/tasks.rb
muck-users-0.1.6 lib/muck_users/tasks.rb
muck-users-0.1.7 lib/muck_users/tasks.rb
muck-users-0.1.8 lib/muck_users/tasks.rb
muck-users-0.1.9 lib/muck_users/tasks.rb
muck-users-0.1.10 lib/muck_users/tasks.rb
muck-users-0.1.11 lib/muck_users/tasks.rb
muck-users-0.1.12 lib/muck_users/tasks.rb
muck-users-0.1.3 lib/muck_users/tasks.rb
muck-users-0.1.2 lib/muck_users/tasks.rb
muck-users-0.1.1 lib/muck_users/tasks.rb