Sha256: e24a600a67ddfd119c54e4fd83a10b4d87993b38dcd427603d9b22eb4828c2d1

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

#!/usr/bin/env ruby

ENV['RACK_ENV'] = 'production'

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
    assets = MiniAssets.new file

    # asset = MiniAsset.create file
    # asset.compile ARGV
    puts "Generated #{file.green} -> #{assets.render}"
  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, public"' % ARGV.last
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lux-fw-0.2.3 ./bin/cli/assets
lux-fw-0.2.1 ./bin/cli/assets