waz-sync 0.0.2.2 → 0.0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.rdoc +49 -0
  2. data/waz-sync.gemspec +1 -1
  3. metadata +2 -2
data/README.rdoc CHANGED
@@ -40,6 +40,55 @@ This Gem use a modified version of the waz-storage gem that you can find there :
40
40
 
41
41
  You can find my modified version here : https://github.com/gmontard/waz-storage
42
42
 
43
+ === Extra
44
+
45
+ If you also want to automatically sync your assets cached file (javascripts && stylesheets) created using the include rails helper with :cache condition,
46
+ javascript_include_tag :all, :cache => true
47
+
48
+ you can take a look at this override lib file (tested on Rails 2.3.14) :
49
+
50
+ #####
51
+ ## Add this line to your environment.rb file
52
+ # require 'lib/override_assetfile_cache.rb'
53
+ ####
54
+
55
+ module ActionView
56
+ module Helpers
57
+ module AssetTagHelper
58
+
59
+ def write_asset_file_contents(joined_asset_path, asset_paths)
60
+
61
+ FileUtils.mkdir_p(File.dirname(joined_asset_path))
62
+ File.open(joined_asset_path, "w+") { |cache| cache.write(join_asset_file_contents(asset_paths)) }
63
+
64
+ # Set mtime to the latest of the combined files to allow for
65
+ # consistent ETag without a shared filesystem.
66
+ mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max
67
+ File.utime(mt, mt, joined_asset_path)
68
+
69
+ ######################
70
+ ### Azure CDN Sync ###
71
+ ######################
72
+
73
+ begin
74
+ azure = WazSync.new()
75
+ folder = joined_asset_path.match(/^.*public\/([^\/]*)\/(.*)$/)[1]
76
+ filename = joined_asset_path.match(/^.*public\/([^\/]*)\/(.*)$/)[2]
77
+ container = azure.find_or_create_container(folder)
78
+ azure.send_or_update(container, joined_asset_path, filename)
79
+ rescue
80
+ logger.info("Azure Sync Failed")
81
+ end
82
+
83
+ ######################
84
+
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ (https://gist.github.com/2428488)
91
+
43
92
  === TODO's
44
93
  Tests !!!!
45
94
 
data/waz-sync.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = 'waz-sync'
4
- gem.version = '0.0.2.2'
4
+ gem.version = '0.0.2.3'
5
5
  gem.date = '2012-04-20'
6
6
  gem.description = %q{A simple client library aim to sync assets to Windows Azure CDN, using a modified version of the great waz-storage gem}
7
7
  gem.summary = %q{Client library for Syncing assets to Windows Azure CDN}
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.0.2.2
9
+ - 3
10
+ version: 0.0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Guillaume MONTARD