Sha256: aca925400728d0f7c3ca7d94c655329c4ea471b3713f10489be849ac9d4b1a6d

Contents?: true

Size: 728 Bytes

Versions: 28

Compression:

Stored size: 728 Bytes

Contents

unless defined?(APP_FILE) && defined?(APP_CLASS)
  $stderr.write "Error: Please set APP_FILE and APP_CLASS before setting up AssetPack rake tasks.\n"
  $stderr.write "Example:\n"
  $stderr.write "    APP_FILE  = 'init.rb'\n"
  $stderr.write "    APP_CLASS = 'Application'\n"
  $stderr.write "    require 'sinatra/assetpack/rake'\n"
  $stderr.write "\n"
  exit
end

def class_from_string(str)
  str.split('::').inject(Object) do |mod, class_name|
    mod.const_get(class_name)
  end
end

def app
  require File.expand_path(APP_FILE, Dir.pwd)
  class_from_string(APP_CLASS)
end

namespace :assetpack do
  desc "Build assets"
  task :build do
    app.assets.build! { |file|
      puts "+ #{file.gsub(Dir.pwd, '')}"
    }
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
sinatra-assetpack-0.1.1 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.0 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-flexible-compression-0.0.1 lib/sinatra/assetpack/rake.rb
sundawg-sinatra-assetpack-fork-0.0.12.pre1 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.0.12.pre1 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.0.11 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.0.10 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.0.9 lib/sinatra/assetpack/rake.rb