rubyhexagon 0.2.5 → 0.2.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.
Files changed (3) hide show
  1. data/lib/examples/sync.rb +17 -1
  2. data/lib/rubyhexagon.rb +1 -1
  3. metadata +2 -2
data/lib/examples/sync.rb CHANGED
@@ -91,7 +91,23 @@ class Sync
91
91
  set.name = set.name.gsub("_"," ")
92
92
  rescue
93
93
  @log.error("Error on #{mod} #{id}")
94
- raise
94
+ net = Net::HTTP.new("e621.net",443)
95
+ net.use_ssl = true
96
+ body = net.get("/#{mod}/show/#{id}").body
97
+ File.open("/tmp/e621.html","w"){|f|f.print body}
98
+ if body.match("ActiveRecord::RecordNotFound")
99
+ pools_f, pools = File.expand_path("~/.hexagon/#{mod}s.json"), Array.new
100
+ File.open(pools_f) do |f|
101
+ pools = f.read.parse
102
+ end
103
+ pools.delete(id)
104
+ File.open(pools_f,"w") do |f|
105
+ f.print pools.to_json
106
+ end
107
+ @log.info("Removed: #{id} doesn't exist in #{mod} pool anymore.")
108
+ puts "Removed: #{id} doesn't exist in #{mod} pool anymore."
109
+ end
110
+ next
95
111
  end
96
112
  @log.info("Fetching #{mod} \"#{set.name}\"")
97
113
  set.name = "Love_Can_Be_Different" if set.name == "Love_can_be_different"
data/lib/rubyhexagon.rb CHANGED
@@ -30,5 +30,5 @@ require "pool"
30
30
 
31
31
  module E621
32
32
  Name = "rubyhexagon"
33
- Version = "0.2.5"
33
+ Version = "0.2.6"
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhexagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-19 00:00:00.000000000 Z
12
+ date: 2015-04-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rubyhexagon provides Ruby bindings for the e621 [dot] net API.
15
15
  email: maxine_red1@yahoo.com