static_sync 0.1.5 → 0.1.6

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.
@@ -1,3 +1,5 @@
1
+ require 'cgi'
2
+
1
3
  module StaticSync
2
4
  class Meta
3
5
  class Caching
@@ -13,7 +15,8 @@ module StaticSync
13
15
  if @config.cache.has_key?(type)
14
16
  expiry = @config.cache[type].to_i
15
17
  meta.merge!(
16
- :cache_control => "public, max-age=#{expiry}"
18
+ :cache_control => "public, max-age=#{expiry}",
19
+ :expires => CGI.rfc1123_date(Time.now + expiry)
17
20
  )
18
21
  end
19
22
  meta
@@ -12,12 +12,12 @@ module StaticSync
12
12
  end
13
13
 
14
14
  def sync
15
+ log.info("Synching #{@config.source} to #{@config.target}.") if @config.log
15
16
  verify_remote_directory
16
17
  remote_keys = []
17
18
  remote_directory.files.each do |file|
18
19
  remote_keys << [file.key, file.etag]
19
20
  end
20
- log.info("Synching #{@config.source} to #{@config.target}.") if @config.log
21
21
  Dir.chdir(@config.source) do
22
22
  local_filtered_files.each do |file|
23
23
  current_file = @meta.for(file)
@@ -33,8 +33,8 @@ module StaticSync
33
33
  end
34
34
  end
35
35
  end
36
- log.info("Synching done.") if @config.log
37
36
  end
37
+ log.info("Synching done.") if @config.log
38
38
  end
39
39
 
40
40
  private
@@ -1,3 +1,3 @@
1
1
  module StaticSync
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -41,6 +41,10 @@ describe StaticSync::Meta::Caching do
41
41
  subject.for("index.html", html).should include(:cache_control)
42
42
  end
43
43
 
44
+ it "sets expires headers for html files" do
45
+ subject.for("index.html", html).should include(:expires)
46
+ end
47
+
44
48
  it "does not set cache headers for text files" do
45
49
  subject.for("data.txt", plain).should_not include(:cache_control)
46
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: static_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -104,4 +104,3 @@ test_files:
104
104
  - spec/meta/compression_spec.rb
105
105
  - spec/meta_spec.rb
106
106
  - spec/storage_spec.rb
107
- has_rdoc: false