writefully 0.5.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/writefully/indices.rb +1 -1
- data/lib/writefully/postable.rb +1 -1
- data/lib/writefully/process.rb +2 -2
- data/lib/writefully/storage.rb +4 -0
- data/lib/writefully/tools/eraser.rb +22 -2
- data/lib/writefully/tools/pigeon.rb +4 -2
- data/lib/writefully/tools/stationery.rb +1 -0
- data/lib/writefully/version.rb +1 -1
- data/lib/writefully/workers/journalist.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 149f326e3911550cb5ef5cac21138f9129eaf526
|
4
|
+
data.tar.gz: aae249683286ce662929eaf6334565719f5957cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3670fca4f1caa0f244503c7bdcc11d7154b2f30a6698e863bd4ff61a17bad28ad8ec87692083e6d2dff443d5300f7ca3a8f3f2e308ece6417e96d9ee2c199079
|
7
|
+
data.tar.gz: 7994231c1257090ee029832060471dec9dd58c14f0d1b1fc6b2d87a01c05f04d1d63389971c64c9e5c2c5b7969c4f41c24d1bfa7aa95bd3b66084a77ff8da72d
|
data/lib/writefully/indices.rb
CHANGED
data/lib/writefully/postable.rb
CHANGED
data/lib/writefully/process.rb
CHANGED
@@ -78,7 +78,7 @@ module Writefully
|
|
78
78
|
Proc.new do |modified, added, removed|
|
79
79
|
queue_jobs(Indices.build_from(modified), :write)
|
80
80
|
queue_jobs(Indices.build_from(added), :write)
|
81
|
-
|
81
|
+
queue_jobs(Indices.build_from(removed), :remove)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -94,7 +94,7 @@ module Writefully
|
|
94
94
|
|
95
95
|
JOBS = {
|
96
96
|
write: -> (index) { Writefully.add_job :journalists, index.merge({task: :publish}) },
|
97
|
-
remove: -> (index) { Writefully.add_job :journalists, index.merge({task: :remove})
|
97
|
+
remove: -> (index) { Writefully.add_job :journalists, index.merge({task: :remove}) }
|
98
98
|
}
|
99
99
|
|
100
100
|
def queue_jobs indices, action
|
data/lib/writefully/storage.rb
CHANGED
@@ -3,14 +3,34 @@ module Writefully
|
|
3
3
|
class Eraser < Stationery
|
4
4
|
|
5
5
|
def use
|
6
|
-
|
6
|
+
trash
|
7
|
+
remove_assets
|
8
|
+
destroyed = future.destroy
|
9
|
+
terminate if destroyed.value
|
7
10
|
end
|
8
11
|
|
9
|
-
def
|
12
|
+
def trash
|
10
13
|
compute_type.by_site(site_id)
|
11
14
|
.where(slug: content.slug)
|
12
15
|
.first.update_attributes(trashed: true)
|
13
16
|
end
|
17
|
+
|
18
|
+
def remove_assets
|
19
|
+
Writefully::Storage.directory.files.map do |file|
|
20
|
+
file.key if file.key.match(::Regexp.new(index[:slug]))
|
21
|
+
end.compact.each do |key|
|
22
|
+
Celluloid::Actor[:pigeons].future.remove(key)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy
|
27
|
+
compute_type.by_site(site_id).where(slug: content.slug).first.destroy
|
28
|
+
end
|
29
|
+
|
30
|
+
def directory_exists?
|
31
|
+
File.directory?(File.join(Writefully.options[:content],
|
32
|
+
index[:site], index[:resource], index[:slug]))
|
33
|
+
end
|
14
34
|
end
|
15
35
|
end
|
16
36
|
end
|
data/lib/writefully/version.rb
CHANGED
@@ -8,9 +8,13 @@ module Writefully
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def remove
|
11
|
-
Writefully.logger.info "Removing #{message[:resource]} #{message[:slug]}"
|
12
11
|
eraser = Tools::Eraser.new_link(message)
|
13
|
-
eraser.
|
12
|
+
unless eraser.directory_exists?
|
13
|
+
Writefully.logger.info "Removing #{message[:resource]} #{message[:slug]}"
|
14
|
+
eraser.perform
|
15
|
+
else
|
16
|
+
eraser.terminate
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def message_with_tries
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: writefully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zack Siri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|