massive_sitemap 2.0.0.rc1 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.rc1
1
+ 2.0.0.rc2
@@ -9,14 +9,16 @@ module MassiveSitemap
9
9
 
10
10
  class FileExistsException < IOError; end
11
11
 
12
- OPTS = {
12
+ OPTS = Base::OPTS.merge(
13
13
  :document_full => '.',
14
14
  :force_overwrite => false,
15
15
  :filename => "sitemap.xml",
16
16
  :index_filename => "sitemap_index.xml",
17
- }
17
+ )
18
18
 
19
19
  def open_stream
20
+ dir = ::File.dirname(tmp_filename)
21
+ Dir.mkdir(dir) unless ::File.exists?(dir)
20
22
  ::File.open(tmp_filename, 'w:ASCII-8BIT')
21
23
  end
22
24
 
@@ -7,6 +7,8 @@ module MassiveSitemap
7
7
  module Writer
8
8
 
9
9
  class GzipFile < File
10
+ OPTS = File::OPTS
11
+
10
12
  def open_stream
11
13
  ::Zlib::GzipWriter.new(super)
12
14
  end
@@ -7,6 +7,8 @@ module MassiveSitemap
7
7
  module Writer
8
8
 
9
9
  class LockingFile < File
10
+ OPTS = File::OPTS
11
+
10
12
  LOCK_FILE = 'generator.lock'
11
13
 
12
14
  def open_stream
@@ -1,20 +1,35 @@
1
1
  require "massive_sitemap/writer/gzip_file"
2
2
 
3
3
  describe MassiveSitemap::Writer::GzipFile do
4
- let(:filename) { 'sitemap.xml' }
5
- let(:tmp_filename) { "#{filename}.tmp" }
6
- let(:gz_filename) { "#{filename}.gz" }
4
+ let(:filename) { 'sitemap.xml' }
5
+ let(:tmp_filename) { "#{filename}.tmp" }
6
+ let(:gz_filename) { "#{filename}.gz" }
7
+
7
8
  let(:writer) { MassiveSitemap::Writer::GzipFile.new.tap { |w| w.init! } }
8
9
 
9
10
  after do
10
- FileUtils.rm(filename) rescue nil
11
- FileUtils.rm(tmp_filename) rescue nil
12
- FileUtils.rm(gz_filename) rescue nil
11
+ writer.each { |path| FileUtils.rm(path.first) rescue nil }
13
12
  end
14
13
 
15
14
  it 'creates gzip file' do
16
15
  expect do
17
16
  writer.close!
18
- end.to change { File.exists?(gz_filename) }.from(false).to(true)
17
+ end.to change { File.exists?(gz_filename) }.to(true)
18
+ end
19
+
20
+ context "with document_full" do
21
+ let(:document_full) { "sitemap"}
22
+
23
+ let(:writer) { MassiveSitemap::Writer::GzipFile.new(:document_full => document_full).tap { |w| w.init! } }
24
+
25
+ after do
26
+ FileUtils.rm_rf(document_full) rescue nil
27
+ end
28
+
29
+ it 'creates gzip file in document root' do
30
+ expect do
31
+ writer.close!
32
+ end.to change { File.exists?("sitemap/#{gz_filename}") }.to(true)
33
+ end
19
34
  end
20
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: massive_sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc1
4
+ version: 2.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70297299930500 !ruby/object:Gem::Requirement
16
+ requirement: &70267113699420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70297299930500
24
+ version_requirements: *70267113699420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70297299930040 !ruby/object:Gem::Requirement
27
+ requirement: &70267113720960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70297299930040
35
+ version_requirements: *70267113720960
36
36
  description: MassiveSitemap - build huge sitemaps painfree. Differential updates keeps
37
37
  generation time short and reduces load on DB. It's heavealy inspired by BigSitemaps
38
38
  and offers compatiable API