organic-sitemap 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25a753e3c05e6d9cc7638560aa7d60291dc41b64
4
- data.tar.gz: 08850357c0eda30093911b4a1aa0f5d76c07edd7
3
+ metadata.gz: 550d7496372f4d7a51fab04c239469b01b7dd16e
4
+ data.tar.gz: 3ed2ed70b7af47dff51d9cb7dd9cab368ac50062
5
5
  SHA512:
6
- metadata.gz: c4c050134631f2f6efda43de0b8658d097e0097f8e6a80f648d48ebeabc97a8dfd89c6bb6b054385380287c3d80148d3de5629ae199f2e35a68d41a026d60b46
7
- data.tar.gz: df40f3371fd9cdb9863d49d11852e81223d19b46fada509792de2acc1a1d1c93b829f3e21e50b79a935c7d1c5ec8a0a21dcc181e97b30af40442e4cdc41e4ae9
6
+ metadata.gz: aed731809b5b558160b4d8ee24b861b38ec5a62438f3daeb4ecb281bd66d7c01d9f6c710165410da5b4de736570ee81f3e74d56404d4d472627fd578177a7ab6
7
+ data.tar.gz: 73a9bad75585e3c16d83dec8db8dacdb67e624a7625dfdd03c87d3b6fb41c94fcc698ebea5eb61fa8222a953139d745378e48f8d810645145fc733e5557f39c1
@@ -0,0 +1,6 @@
1
+ ## 0.1.2
2
+
3
+ ### Changed
4
+
5
+ - Added function for remove keys from redis
6
+ - Change gems development dependencies
@@ -8,12 +8,15 @@ OrganicSitemap.configure do |config|
8
8
  # OrganicSitemap ignore query_params to identify urls. You can add you allowed params
9
9
  # config.allowed_params = [...]
10
10
 
11
- # By default, all urls are saved on Redis.new(url: 'redis://127.0.0.1:6379'), but you can set you own connection
11
+ # By default, all urls are saved on Redis.new(url: 'redis://127.0.0.1:6379'),
12
+ # but you can set you own connection
12
13
  # config.redis_connection = Your redis connection
13
14
 
14
15
  # url are saved on a set on redis called "sitemap-urls", but if you want you can change it
15
16
  # config.storage_key = your key
16
17
 
17
- # By dafault all url have a expiry time in 7 days, after this time, if no one load this page, it will be removed from the set. To change it (expect number of days):
18
+ # By dafault all url have a expiry time in 7 days
19
+ # after this time, if no one load this page, it will be removed from the set.
20
+ # To change it (number of days):
18
21
  # config.expiry_time = X
19
22
  end
@@ -2,29 +2,41 @@ module OrganicSitemap
2
2
  class RedisManager
3
3
  def self.add(key)
4
4
  return unless key
5
- OrganicSitemap.configuration.
6
- redis_connection.
7
- zadd(OrganicSitemap.configuration.storage_key,
8
- (DateTime.now + OrganicSitemap.configuration.expiry_time.to_i).to_time.to_i,
9
- key)
5
+ redis_connection.zadd(storage_key, (DateTime.now + expiry_time).to_time.to_i, key)
10
6
  end
11
7
 
12
8
  def self.clean_set(time = Time.now)
13
- OrganicSitemap.configuration.
14
- redis_connection.
15
- zremrangebyscore(OrganicSitemap.configuration.storage_key,
16
- "-inf",
17
- time.to_i)
9
+ redis_connection.zremrangebyscore(storage_key, "-inf", time.to_i)
18
10
  end
19
11
 
20
12
  def self.sitemap_urls(from: nil, to: nil)
21
13
  from = from ? from.to_time.to_i : '-inf'
22
14
  to = to ? to.to_time.to_i : '+inf'
23
- OrganicSitemap.configuration.
24
- redis_connection.
25
- zrangebyscore(OrganicSitemap.configuration.storage_key,
26
- from,
27
- to)
15
+ redis_connection.zrangebyscore(storage_key, from, to)
16
+ end
17
+
18
+ def self.remove_key(key: nil)
19
+ return if key.nil?
20
+ redis_connection.zrem(storage_key, key)
21
+ end
22
+
23
+ def self.remove_keys(keys: [])
24
+ return unless keys.any?
25
+ keys.each do |key|
26
+ remove_key key
27
+ end
28
+ end
29
+ private
30
+ def self.redis_connection
31
+ OrganicSitemap.configuration.redis_connection
32
+ end
33
+
34
+ def self.storage_key
35
+ OrganicSitemap.configuration.storage_key
36
+ end
37
+
38
+ def self.expiry_time
39
+ OrganicSitemap.configuration.expiry_time.to_i
28
40
  end
29
41
  end
30
42
  end
@@ -1,3 +1,3 @@
1
1
  module OrganicSitemap
2
- VERSION = "0.1.1" # First stable version
2
+ VERSION = "0.1.2" # Add more redis Z methods
3
3
  end
Binary file
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.9"
25
25
  spec.add_development_dependency "rspec", '~> 0'
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency 'simplecov', '~> 0'
28
- spec.add_development_dependency 'redis', '~> 0'
29
- spec.add_development_dependency 'pry', '~> 0'
30
- spec.add_development_dependency 'fakeredis', '~> 0'
27
+ spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'redis'
29
+ spec.add_development_dependency 'pry'
30
+ spec.add_development_dependency 'fakeredis'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: organic-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaskito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -76,56 +76,56 @@ dependencies:
76
76
  name: simplecov
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: redis
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: pry
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - "~>"
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: fakeredis
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  description: Create your Sitemap in a organic way.
@@ -140,6 +140,7 @@ files:
140
140
  - ".ruby-gemset"
141
141
  - ".ruby-version"
142
142
  - ".travis.yml"
143
+ - CHANGELOG.md
143
144
  - Gemfile
144
145
  - LICENSE.txt
145
146
  - README.md
@@ -155,6 +156,7 @@ files:
155
156
  - lib/organic-sitemap/redis_manager.rb
156
157
  - lib/organic-sitemap/url_processor.rb
157
158
  - lib/organic-sitemap/version.rb
159
+ - organic-sitemap-0.1.1.gem
158
160
  - organic_sitemap.gemspec
159
161
  homepage: https://github.com/abelardogilm/organic-sitemap/
160
162
  licenses: