asset_sync 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ require "asset_sync/version"
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "asset_sync"
8
8
  s.version = AssetSync::VERSION
9
- s.date = "2012-03-07"
9
+ s.date = "2012-04-18"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Simon Hamilton", "David Rice", "Phil McClure"]
12
12
  s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk", "pmcclure@rumblelabs.com"]
@@ -43,7 +43,7 @@ module AssetSync
43
43
  def manifest_path
44
44
  directory =
45
45
  Rails.application.config.assets.manifest || default_manifest_directory
46
- "#{directory}/manifest.yml"
46
+ File.join(directory, "manifest.yml")
47
47
  end
48
48
 
49
49
  def gzip?
@@ -75,7 +75,7 @@ module AssetSync
75
75
  end
76
76
 
77
77
  def yml_path
78
- File.join(Rails.root, "config/asset_sync.yml")
78
+ Rails.root.join("config", "asset_sync.yml").to_s
79
79
  end
80
80
 
81
81
  def assets_prefix
@@ -137,7 +137,7 @@ module AssetSync
137
137
  private
138
138
 
139
139
  def default_manifest_directory
140
- File.join(Rails.root, 'public', assets_prefix)
140
+ File.join(Rails.public_path, assets_prefix)
141
141
  end
142
142
  end
143
143
  end
@@ -3,8 +3,8 @@ class Engine < Rails::Engine
3
3
  engine_name "asset_sync"
4
4
 
5
5
  initializer "asset_sync config", :group => :all do |app|
6
- app_initializer = File.join(Rails.root, 'config/initializers/asset_sync.rb')
7
- app_yaml = File.join(Rails.root, 'config/asset_sync.yml')
6
+ app_initializer = Rails.root.join('config', 'initializers', 'asset_sync.rb').to_s
7
+ app_yaml = Rails.root.join('config', 'asset_sync.yml').to_s
8
8
 
9
9
  if File.exists?( app_initializer )
10
10
  AssetSync.log "AssetSync: using #{app_initializer}"
@@ -1,24 +1,4 @@
1
1
  class Rails::Railtie::Configuration
2
- # Adds compass configuration accessor to the application configuration.
3
- #
4
- # If a configuration file for compass exists, it will be read in and
5
- # the project's configuration values will already be set on the config
6
- # object.
7
- #
8
- # For example:
9
- #
10
- # module MyApp
11
- # class Application < Rails::Application
12
- # config.compass.line_comments = !Rails.env.production?
13
- # config.compass.fonts_dir = "app/assets/fonts"
14
- # end
15
- # end
16
- #
17
- # It is suggested that you create a compass configuration file if you
18
- # want a quicker boot time when using the compass command line tool.
19
- #
20
- # For more information on available configuration options see:
21
- # http://compass-style.org/help/tutorials/configuration-reference/
22
2
  def asset_sync
23
3
  AssetSync.config
24
4
  end
@@ -27,7 +27,7 @@ module AssetSync
27
27
  end
28
28
 
29
29
  def path
30
- "#{Rails.root.to_s}/public"
30
+ Rails.public_path
31
31
  end
32
32
 
33
33
  def local_files
@@ -45,7 +45,9 @@ module AssetSync
45
45
  end
46
46
  end
47
47
  log "Using: Directory Search of #{path}/#{self.config.assets_prefix}"
48
- Dir["#{path}/#{self.config.assets_prefix}/**/**"].map { |f| f[path.length+1,f.length-path.length] }
48
+ Dir.chdir(path) do
49
+ Dir["#{self.config.assets_prefix}/**/**"]
50
+ end
49
51
  end
50
52
 
51
53
  def get_remote_files
@@ -115,6 +117,13 @@ module AssetSync
115
117
  log "Uploading: #{f} instead of #{gzipped} (compression increases this file by #{percentage}%)"
116
118
  end
117
119
  else
120
+ if !config.gzip? && File.extname(f) == ".gz"
121
+ # set content encoding for gzipped files this allows cloudfront to properly handle requests with Accept-Encoding
122
+ # http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
123
+ file.merge!({
124
+ :content_encoding => 'gzip'
125
+ })
126
+ end
118
127
  log "Uploading: #{f}"
119
128
  end
120
129
 
@@ -1,3 +1,3 @@
1
1
  module AssetSync
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -35,9 +35,10 @@ shared_context "mock Rails without_yml" do
35
35
 
36
36
  before(:each) do
37
37
  set_rails_root('without_yml')
38
+ Rails.stub(:public_path).and_return(Rails.root.join('public').to_s)
38
39
  end
39
40
  end
40
41
 
41
42
  def set_rails_root(path)
42
- Rails.stub(:root).and_return(File.join(File.dirname(__FILE__), path))
43
+ Rails.stub(:root).and_return(Pathname.new(File.join(File.dirname(__FILE__), path)))
43
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-03-07 00:00:00.000000000Z
14
+ date: 2012-04-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog
18
- requirement: &70246151754820 !ruby/object:Gem::Requirement
18
+ requirement: &70129442881380 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70246151754820
26
+ version_requirements: *70129442881380
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
- requirement: &70246151754400 !ruby/object:Gem::Requirement
29
+ requirement: &70129442880400 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70246151754400
37
+ version_requirements: *70129442880400
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec
40
- requirement: &70246151753980 !ruby/object:Gem::Requirement
40
+ requirement: &70129442879500 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70246151753980
48
+ version_requirements: *70129442879500
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: bundler
51
- requirement: &70246151753560 !ruby/object:Gem::Requirement
51
+ requirement: &70129442879060 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70246151753560
59
+ version_requirements: *70129442879060
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: jeweler
62
- requirement: &70246151753140 !ruby/object:Gem::Requirement
62
+ requirement: &70129442878560 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70246151753140
70
+ version_requirements: *70129442878560
71
71
  description: After you run assets:precompile your compiled assets will be synchronised
72
72
  with your S3 bucket.
73
73
  email:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project: asset_sync
123
- rubygems_version: 1.8.10
123
+ rubygems_version: 1.8.15
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and