Sha256: a1da5e8982ff87d5ebfb8c11a36958707c732e87a886905abe0eb96fcd004c42

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

$:.unshift File.expand_path '../lib', __FILE__
require 'nutcracker/web'
require 'rake'
require 'rubygems/package_task'
require "rake/testtask"

desc "Compile assets"
task :compile do
  require 'logger'
  require 'pathname'
  require 'sprockets'
  require 'uglifier'
  require 'eco'

  rm_rf 'public'
  mkdir_p 'public/assets'
  build_dir = Pathname(File.dirname(__FILE__)).join("public/assets")
  
  environment = Nutcracker::Web::App.assets
  environment.logger = Logger.new STDOUT
  environment.js_compressor = Uglifier.new(mangle: true)
  
  %w( javascripts/application.js stylesheets/application.css ).each do |target|
    target = File.expand_path("../assets/#{target}",__FILE__)
    environment.logger.info "#{'#'*10} Building #{target} #{'#'*10} "
    asset = environment[target] or abort "Unknown target #{target.inspect}"
    prefix, basename = asset.pathname.to_s.split('/')[-2..-1]
    asset.write_to build_dir.join(basename)
  end
end

task :build => [:compile] do
  Gem::PackageTask.new(eval File.read 'nutcracker-web.gemspec') do |pkg|
    pkg.need_zip = false
    pkg.need_tar = false
  end
  Rake::Task["gem"].invoke
end

task :gem do
  abort "Please use rake build instead"
end

task :install => [:build] do
   sh "gem install pkg/nutcracker-web"
   Rake::Task['clobber_package'].execute
end

## Tests stuff
task :default => :test

Rake::TestTask.new(:test) do |t|
  t.libs << "tests"
  t.pattern = "tests/**/*_test.rb"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nutcracker-web-0.0.12 Rakefile
nutcracker-web-0.0.11 Rakefile
nutcracker-web-0.0.10 Rakefile
nutcracker-web-0.0.9 Rakefile
nutcracker-web-0.0.8 Rakefile
nutcracker-web-0.0.7 Rakefile