massive_sitemap-writer-s3 0.0.1.rc1 → 0.0.1.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1.rc1
1
+ 0.0.1.rc2
@@ -5,37 +5,30 @@ module MassiveSitemap
5
5
  module Writer
6
6
  class S3 < MassiveSitemap::Writer::GzipFile
7
7
 
8
- def initalize(service, bucket, options = {})
9
- @service = service
10
- @bucket = service.buckets.find(bucket)
11
- # read sreams, tale filename (without ext as filter),order DESC
12
- # delete last file
13
- # delete random files
8
+ def initialize(cfg, options = {})
9
+ @service = ::S3::Service.new(cfg)
10
+ @bucket = @service.buckets.find(cfg[:bucket])
14
11
  super(options)
15
12
  end
16
13
 
17
14
  protected
18
15
  def close_stream(stream)
16
+ @filename = filename
19
17
  super
20
- @bucket.objects.build(::File.basename(filename)).tap do |object|
21
- object.content = ::File.open(filename)
18
+ # upload to amazon
19
+ # TODO what if fail??
20
+ @bucket.objects.build(::File.basename(@filename)).tap do |object|
21
+ object.content = ::File.open(@filename)
22
22
  object.save
23
23
  end
24
- # add to stream
25
- # @streams << current
26
24
  end
27
25
 
28
- def init?
29
- # check if file is part of streams, fail if so
30
- #if !options[:force_overwrite] && streams.include?(filename)
31
- # raise FileExistsException, "Can not create file: #{filename} exits"
32
- #end
33
- super
34
- end
35
-
36
- def streams
37
- # @streams
38
- super
26
+ def load_stream_ids
27
+ @bucket.objects.find_all.each do |object|
28
+ if ::File.extname(object.key) == ::File.extname(filename)
29
+ add_stream_id(object.key, object.last_modified)
30
+ end
31
+ end
39
32
  end
40
33
 
41
34
  end
data/spec/s3_spec.rb CHANGED
@@ -9,4 +9,16 @@ describe MassiveSitemap::Writer::S3 do
9
9
  # writer.close_stream(stream)
10
10
 
11
11
  end
12
+
13
+ describe "initialize" do
14
+ # @stream_ids.clear
15
+ it "doesn't take streams ids from disk" do
16
+ end
17
+ end
18
+
19
+ describe "close_stream" do
20
+ it "uploads to amazon" do
21
+ end
22
+ end
12
23
  end
24
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: massive_sitemap-writer-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc1
4
+ version: 0.0.1.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-13 00:00:00.000000000Z
12
+ date: 2012-02-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: s3
16
- requirement: &70170132137220 !ruby/object:Gem::Requirement
16
+ requirement: &70292589728700 !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: :runtime
23
23
  prerelease: false
24
- version_requirements: *70170132137220
24
+ version_requirements: *70292589728700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: massive_sitemap
27
- requirement: &70170132136760 !ruby/object:Gem::Requirement
27
+ requirement: &70292589728240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70170132136760
35
+ version_requirements: *70292589728240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70170132136240 !ruby/object:Gem::Requirement
38
+ requirement: &70292589727720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70170132136240
46
+ version_requirements: *70292589727720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70170132135780 !ruby/object:Gem::Requirement
49
+ requirement: &70292589727260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70170132135780
57
+ version_requirements: *70292589727260
58
58
  description: Amazon S3 Writer extension for MassiveSitemap
59
59
  email:
60
60
  - tobi@soundcloud.com