Sha256: 94a594f7f131666da94f65cd8033299d67bab53dc62c1bf5d9dffceb9acc7e2c

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 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

Gem::PackageTask.new(eval File.read('nutcracker-web.gemspec')) do |pkg|
  pkg.need_zip = false
  pkg.need_tar = false
end

task :build => [:compile] do
  `rake gem`
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

5 entries across 5 versions & 1 rubygems

Version Path
nutcracker-web-0.0.6 Rakefile
nutcracker-web-0.0.5 Rakefile
nutcracker-web-0.0.4 Rakefile
nutcracker-web-0.0.3 Rakefile
nutcracker-web-0.0.2 Rakefile