rails_asset_packager 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,22 +1,29 @@
1
- ------------------------------------------------------------------------
1
+ -----------------------------------------------------------------------------
2
+ v0.2.0 | plainprogrammer | 2011-01-26
3
+
4
+ * Files are now checksummed when uploaded to S3 and that checksum is stored
5
+ as metadata on the file to prevent re-uploading the same files overtop of
6
+ each other.
7
+ -----------------------------------------------------------------------------
2
8
  v0.1.3 | plainprogrammer | 2011-01-25
3
9
 
4
10
  * Fixed issue with *_merged helpers that was causing calls to error out.
5
- * Fixed issue with *_merged helpers that was causing calls to get escaped by Rails instead of rendering properly.
6
- ------------------------------------------------------------------------
11
+ * Fixed issue with *_merged helpers that was causing calls to get escaped by
12
+ Rails instead of rendering properly.
13
+ -----------------------------------------------------------------------------
7
14
  v0.1.2 | plainprogrammer | 2011-01-25
8
15
 
9
16
  * Fixed test suite.
10
- ------------------------------------------------------------------------
17
+ -----------------------------------------------------------------------------
11
18
  v0.1.1 | plainprogrammer | 2011-01-18
12
19
 
13
20
  * Fixed issues with development dependencies.
14
21
  * Updated Rakefile to properly include testing and documentation tasks.
15
22
  * Did some minor refactoring inside caching tasks.
16
- ------------------------------------------------------------------------
23
+ -----------------------------------------------------------------------------
17
24
  v0.1.0 | plainprogrammer | 2011-01-16
18
25
 
19
26
  * Converted project into Gem
20
- * Added task to support S3 distribution (http://www.blog.bridgeutopiaweb.com/post/package-assets-for-rails-3-and-upload-to-amazon-s3/)
27
+ * Added task to support S3 distribution
21
28
  * Added handling of other static assets when pushing to S3.
22
- ------------------------------------------------------------------------
29
+ -----------------------------------------------------------------------------
@@ -1,3 +1,3 @@
1
1
  module RailsAssetPackager
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'digest/md5'
2
3
  require File.dirname(__FILE__) + '/../rails_asset_packager/asset_package'
3
4
 
4
5
  namespace :asset do
@@ -20,7 +21,7 @@ namespace :asset do
20
21
  end
21
22
 
22
23
  end
23
-
24
+
24
25
  namespace :cache do
25
26
  task :config do
26
27
  S3_CONFIG = YAML.load_file(File.join(Rails.root, "config/s3.yml"))[Rails.env] rescue nil || {}
@@ -46,7 +47,7 @@ namespace :asset do
46
47
  ASSET_PKG_CONFIG.keys.each do |set|
47
48
  if set == 'javascripts' || set == 'stylesheets'
48
49
  ext = (set == 'javascripts') ? "js" : "css"
49
-
50
+
50
51
  ASSET_PKG_CONFIG[set].each do |val|
51
52
  val.keys.each do |val|
52
53
  files << "./public/#{set}/#{val}_packaged.#{ext}"
@@ -58,28 +59,30 @@ namespace :asset do
58
59
  files = files + Dir.glob("./public/#{val}/**/*.*")
59
60
  end
60
61
  end
61
-
62
+
62
63
  files.uniq!
63
64
  end
64
65
  end
65
66
 
66
67
  files.each do |f|
67
68
  next if File.directory?(f)
68
- puts f
69
69
 
70
70
  key = f.gsub(/\.\/public/, prefix)
71
- puts " -> %s" % key
72
-
73
- AWS::S3::S3Object.store(
74
- key,
75
- File.open(f),
76
- S3_CONFIG['bucket'],
77
- :access => :public_read,
78
- 'Cache-Control' => 'max-age=315360000',
79
- 'x-amz-storage-class' => 'REDUCED_REDUNDANCY'
80
- )
71
+ puts "#{f} -> #{key}"
72
+
73
+ unless AWS::S3::S3Object.exists?(key, S3_CONFIG['bucket']) && AWS::S3::S3Object.about(key, S3_CONFIG['bucket'])['rails_asset_packager-checksum'] == Digest::MD5.file(f)
74
+ AWS::S3::S3Object.store(
75
+ key,
76
+ File.open(f),
77
+ S3_CONFIG['bucket'],
78
+ :access => :public_read,
79
+ 'Cache-Control' => 'max-age=315360000',
80
+ 'x-amz-storage-class' => 'REDUCED_REDUNDANCY',
81
+ 'rails_asset_packager-checksum' => Digest::MD5.file(f)
82
+ )
83
+ end
81
84
  end
82
- end
85
+ end
83
86
 
84
87
  desc "cache assets and update s3 for production"
85
88
  task :production do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_asset_packager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Becker
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-01-25 00:00:00 -06:00
20
+ date: 2011-01-26 00:00:00 -06:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency