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.3.3 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.3.2 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.3.1 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.3.0 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.8 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.7 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.6 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.5 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.4 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.3 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.2 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.1 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.2.0 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.7 lib/sinatra/assetpack/rake.rb
sundawg-sinatra-assetpack-fork-0.1.6 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.6 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.5 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.4 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.3 lib/sinatra/assetpack/rake.rb
sinatra-assetpack-0.1.2 lib/sinatra/assetpack/rake.rb