Sha256: 8a2ac1a47bb60210a47850b05cd7373d0903536cdd3e01e0e3d89c0bc98005bf

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

#!/usr/bin/env ruby

if ARGV[0] == 'help'
  puts 'lux assets rm gzip s3://assets'
  puts ' rm        - remove local cached folder for assets'
  puts ' gzip      - gzip files (for nginx)'
  puts ' s3://path - copy files to bucket (must be last argument)'
  exit
end

if ARGV.include?('rm')
  system 'rm -rf ./tmp/assets'
  system 'rm -rf ./public/assets'
end

require './config/application'

assets = Dir['./app/assets/*/index.*'].map { |el| el.sub('./app/assets/','') }

Lux.config.assets_precompile = true

speed = Lux.speed do
  # tpool is not showing compile errors
  # tpool(assets) do |file|
  for file in assets
    asset = MiniAsset.create file
    asset.compile ARGV
    puts "Generated #{file.green} -> #{asset.production_file}"
  end
end

puts "Asset precomlile done in #{speed}"

if ARGV.last && ARGV.last[0,5] == 's3://'
  puts 'Copy to %s'.green % ARGV.last
  system 'aws s3 sync ./public %s --cache-control "max-age=31536000, no-transform, public"' % ARGV.last
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.1.17 ./bin/cli/assets