Sha256: b03f9f3fb8b74464ce389b5b1e0746ebc8aa274497c946f2ac7ee26e40d08763

Contents?: true

Size: 1.63 KB

Versions: 9

Compression:

Stored size: 1.63 KB

Contents

require 'mongodb_logger/server/sprokets'
namespace :mongodb_logger do
  namespace :assets do
    desc 'compile assets'
    task :compile, [:output_dir] => [:compile_js, :compile_css, :compile_imgs] do
    end

    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_imgs, [: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

9 entries across 9 versions & 1 rubygems

Version Path
mongodb_logger-0.4.2 lib/tasks/mongodb_logger.rake
mongodb_logger-0.4.1 lib/tasks/mongodb_logger.rake
mongodb_logger-0.4.0 lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.3-jruby lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.3 lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.2-jruby lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.2 lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.1-jruby lib/tasks/mongodb_logger.rake
mongodb_logger-0.3.1 lib/tasks/mongodb_logger.rake