Sha256: 077e39cead60064923f8b30a25f6a28b0c3a600abd40d18ba758bb8e07dab6f0

Contents?: true

Size: 1.84 KB

Versions: 3

Compression:

Stored size: 1.84 KB

Contents

require 'mongodb_logger/server/helpers/sprokets'
require 'mongodb_logger/utils/migrate'

namespace :mongodb_logger do
  desc 'copy data from old mongodb collection to another'
  task :migrate => :environment do |t, args|
    MongodbLogger::Utils::Migrate.new.run
    puts "Operation finished"
  end

  namespace :assets do

    desc 'compile all assets'
    task :compile, [:output_dir] => [:compile_js, :compile_css, :compile_img]

    desc 'compile javascript assets'
    task :compile_js, [:output_dir] => :environment do |t, args|
      return (raise "Specify output dir for assets") if args.output_dir.nil?
      sprockets   = MongodbLogger::Assets.instance
      asset_name  = 'mongodb_logger.js'
      asset       = sprockets[asset_name]
      asset.write_to(File.join(args.output_dir, sprockets.find_asset(asset_name).digest_path))
      puts "successfully compiled js assets"
    end

    desc 'compile css assets'
    task :compile_css, [:output_dir] => :environment do |t, args|
      return (raise "Specify output dir for assets") if args.output_dir.nil?
      sprockets   = MongodbLogger::Assets.instance
      asset_name  = 'mongodb_logger.css'
      asset       = sprockets[asset_name]
      asset.write_to(File.join(args.output_dir, sprockets.find_asset(asset_name).digest_path))
      puts "successfully compiled css assets"
    end

    desc 'compile images assets'
    task :compile_img, [:output_dir] => :environment do |t, args|
      return (raise "Specify output dir for assets") if args.output_dir.nil?
      sprockets   = MongodbLogger::Assets.instance
      asset_names  = ['logo.png', 'spinner.gif']
      asset_names.each do |asset_name|
        asset       = sprockets[asset_name]
        asset.write_to(File.join(args.output_dir, sprockets.find_asset(asset_name).digest_path))
      end
      puts "successfully compiled images assets"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongodb_logger-0.6.5 tasks/mongodb_logger.rake
mongodb_logger-0.6.4 tasks/mongodb_logger.rake
mongodb_logger-0.6.3 tasks/mongodb_logger.rake