caboose-cms 0.7.15 → 0.7.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3bc91a68ac489055a20331a782782326c88372c
4
- data.tar.gz: 77c3b560746c55e2041fc8fdc582f467f59df528
3
+ metadata.gz: 5296ff62df1d3dca4dc184aa275bb11324a4a5d5
4
+ data.tar.gz: 7170556acc8d764c0859353cf077576ec72d08fb
5
5
  SHA512:
6
- metadata.gz: 313817ce1e2ef39a0a17e1fb8bbeed8e6d01e8b7b0bd9da1c5ef4f714a7be5f04b8690ccc7707e4460d9bdb05db2447580323fbe20e43b8b36681327863b1531
7
- data.tar.gz: 5e837e9d369992d23e50abfe29060c18a6aee1c0c7d3b85471a69653857ae29d392efc86e2e977d5a915e5b1e06ce8fcbc25d6a8ca9581390008c425a0eb1c45
6
+ metadata.gz: 7597b374c85781663a6af491668112579c21cce9dbe32d550ffbd8ddcc27b8a57e9044a9f9a49c5323d05f9357591db65e5745a398f3abbf808abb98a8214ed1
7
+ data.tar.gz: 4ca180a513d793b898def98f75d5a7db0f6f486de6e7cf7d76738d75c801f75575c77d33df732d5614f095fa8b49dcee31b5286f240633c79b5f44e2d6ebff0f
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.15'
2
+ VERSION = '0.7.16'
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "caboose/version"
2
+ require 'aws-sdk'
2
3
 
3
4
  namespace :caboose do
4
5
 
@@ -296,57 +297,79 @@ end
296
297
  namespace :assets do
297
298
 
298
299
  desc "Precompile assets, upload to S3, then remove locally"
299
- task :purl => :environment do
300
-
301
- # Copy any site assets into the host app assets directory first
302
- puts "Copying site assets into host assets..."
303
- Caboose::Site.all.each do |site|
304
- site_js = Rails.root.join('sites', site.name, 'js')
305
- site_css = Rails.root.join('sites', site.name, 'css')
306
- site_images = Rails.root.join('sites', site.name, 'images')
307
- site_fonts = Rails.root.join('sites', site.name, 'fonts')
308
-
309
- host_js = Rails.root.join('app', 'assets', 'javascripts' , site.name)
310
- host_css = Rails.root.join('app', 'assets', 'stylesheets' , site.name)
311
- host_images = Rails.root.join('app', 'assets', 'images' , site.name)
312
- host_fonts = Rails.root.join('app', 'assets', 'fonts' , site.name)
300
+ task :purl, [:filename] => :environment do |t, args|
301
+
302
+ # PURL a single file
303
+ if args.filename
304
+ dest = "#{Rails.root}/tmp/#{args.filename}"
313
305
 
314
- `mkdir -p #{host_js }` if File.directory?(site_js)
315
- `mkdir -p #{host_css }` if File.directory?(site_css)
316
- `mkdir -p #{host_images }` if File.directory?(site_images)
317
- `mkdir -p #{host_fonts }` if File.directory?(site_fonts)
318
-
319
- `cp -R #{site_js } #{host_js }` if File.directory?(site_js)
320
- `cp -R #{site_css } #{host_css }` if File.directory?(site_css)
321
- `cp -R #{site_images } #{host_images }` if File.directory?(site_images)
322
- `cp -R #{site_fonts } #{host_fonts }` if File.directory?(site_fonts)
323
- end
306
+ # Compile the file
307
+ puts "Compiling #{args.filename}..."
308
+ File.write(dest, Uglifier.compile(Rails.application.assets.find_asset(args.filename).to_s))
309
+
310
+ # Copy the file from dest to s3/assets
311
+ puts "Copying #{args.filename} to s3..."
312
+ config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))['production']
313
+ AWS.config({ :access_key_id => config['access_key_id'], :secret_access_key => config['secret_access_key'] })
314
+ bucket = AWS::S3::Bucket.new(config['bucket'])
315
+ obj = bucket.objects["assets/#{args.filename}"]
316
+ obj.write(:file => dest, :acl => :public_read)
317
+
318
+ # Remove the temp file
319
+ puts "Cleaning up..."
320
+ `rm -rf #{dest}`
324
321
 
325
- puts "Running precompile..."
326
- Rake::Task['assets:precompile'].invoke
327
-
328
- puts "Removing assets from public/assets, but leaving manifest file..."
329
- `mv #{Rails.root.join('public', 'assets', 'manifest.yml')} #{Rails.root.join('public', 'manifest.yml')}`
330
- `rm -rf #{Rails.root.join('public', 'assets')}`
331
- `mkdir #{Rails.root.join('public', 'assets')}`
332
- `mv #{Rails.root.join('public', 'manifest.yml')} #{Rails.root.join('public', 'assets', 'manifest.yml')}`
322
+ else # Otherwise do a full PURL
333
323
 
334
- # Clean up
335
- puts "Removing site assets from host assets..."
336
- Caboose::Site.all.each do |site|
337
- host_js = Rails.root.join('app', 'assets', 'javascripts' , site.name)
338
- host_css = Rails.root.join('app', 'assets', 'stylesheets' , site.name)
339
- host_images = Rails.root.join('app', 'assets', 'images' , site.name)
340
- host_fonts = Rails.root.join('app', 'assets', 'fonts' , site.name)
341
-
342
- `rm -rf #{host_js }`
343
- `rm -rf #{host_css }`
344
- `rm -rf #{host_images }`
345
- `rm -rf #{host_fonts }`
324
+ # Copy any site assets into the host app assets directory first
325
+ puts "Copying site assets into host assets..."
326
+ Caboose::Site.all.each do |site|
327
+ site_js = Rails.root.join('sites', site.name, 'js')
328
+ site_css = Rails.root.join('sites', site.name, 'css')
329
+ site_images = Rails.root.join('sites', site.name, 'images')
330
+ site_fonts = Rails.root.join('sites', site.name, 'fonts')
331
+
332
+ host_js = Rails.root.join('app', 'assets', 'javascripts' , site.name)
333
+ host_css = Rails.root.join('app', 'assets', 'stylesheets' , site.name)
334
+ host_images = Rails.root.join('app', 'assets', 'images' , site.name)
335
+ host_fonts = Rails.root.join('app', 'assets', 'fonts' , site.name)
336
+
337
+ `mkdir -p #{host_js }` if File.directory?(site_js)
338
+ `mkdir -p #{host_css }` if File.directory?(site_css)
339
+ `mkdir -p #{host_images }` if File.directory?(site_images)
340
+ `mkdir -p #{host_fonts }` if File.directory?(site_fonts)
341
+
342
+ `cp -R #{site_js } #{host_js }` if File.directory?(site_js)
343
+ `cp -R #{site_css } #{host_css }` if File.directory?(site_css)
344
+ `cp -R #{site_images } #{host_images }` if File.directory?(site_images)
345
+ `cp -R #{site_fonts } #{host_fonts }` if File.directory?(site_fonts)
346
+ end
347
+
348
+ puts "Running precompile..."
349
+ Rake::Task['assets:precompile'].invoke
350
+
351
+ puts "Removing assets from public/assets, but leaving manifest file..."
352
+ `mv #{Rails.root.join('public', 'assets', 'manifest.yml')} #{Rails.root.join('public', 'manifest.yml')}`
353
+ `rm -rf #{Rails.root.join('public', 'assets')}`
354
+ `mkdir #{Rails.root.join('public', 'assets')}`
355
+ `mv #{Rails.root.join('public', 'manifest.yml')} #{Rails.root.join('public', 'assets', 'manifest.yml')}`
356
+
357
+ # Clean up
358
+ puts "Removing site assets from host assets..."
359
+ Caboose::Site.all.each do |site|
360
+ host_js = Rails.root.join('app', 'assets', 'javascripts' , site.name)
361
+ host_css = Rails.root.join('app', 'assets', 'stylesheets' , site.name)
362
+ host_images = Rails.root.join('app', 'assets', 'images' , site.name)
363
+ host_fonts = Rails.root.join('app', 'assets', 'fonts' , site.name)
364
+
365
+ `rm -rf #{host_js }`
366
+ `rm -rf #{host_css }`
367
+ `rm -rf #{host_images }`
368
+ `rm -rf #{host_fonts }`
369
+ end
346
370
  end
347
-
348
371
  end
349
-
372
+
350
373
  desc "Fix variant sort order"
351
374
  task :set_variant_sort_order => :environment do
352
375
  Caboose::Product.all.each do |p|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.15
4
+ version: 0.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry