nocms 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +2 -0
  2. data/VERSION +1 -1
  3. data/lib/nocms.rb +19 -1
  4. data/nocms.gemspec +2 -2
  5. metadata +4 -4
@@ -22,6 +22,8 @@ Mailing List: http://groups.google.com/group/nocms
22
22
  Twitter: http://twitter.com/powcloud
23
23
 
24
24
  == Changes
25
+ * 0.4.0
26
+ * FEA: Add site_index which returns a hash of paths with an array of the languages for each
25
27
  * 0.3.0
26
28
  * FEA: Add path_has_content? which returns true if the given path has content in the cache in either the current language or the default language
27
29
  * 0.2.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -73,6 +73,24 @@ module NoCMS
73
73
  paths.include?("/#{lang}#{path}") || paths.include?("/#{lang_default}#{path}")
74
74
  end
75
75
 
76
+ def site_index()
77
+ ensure_cache()
78
+
79
+ tmp = cache.read("NOCMS:#{NoCMS::Base.site}:paths")
80
+ paths = !tmp.nil? ? Set.new(ActiveSupport::JSON.decode(tmp)) : Set.new
81
+
82
+ path_hash = {}
83
+ paths.each { |p|
84
+ matches = p.match /\/([^\/]+)(\/.*)/
85
+ lang = matches[1]
86
+ path = matches[2]
87
+ path_hash[path] ||= Set.new
88
+ path_hash[path] << lang
89
+ }
90
+
91
+ return path_hash
92
+ end
93
+
76
94
  def load_cache
77
95
  start_time = Time.now
78
96
  raise '[NOCMS] Must specify a site' if NoCMS::Base.site.nil?
@@ -120,7 +138,7 @@ module NoCMS
120
138
  end
121
139
  end
122
140
 
123
- def path_has_content?(path=nil, options={})
141
+ def nocms_path_has_content?(path=nil, options={})
124
142
  NoCMS::Base.path_has_content?(request,path,options)
125
143
  end
126
144
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nocms}
8
- s.version = "0.3.0"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darren Rush"]
12
- s.date = %q{2010-08-23}
12
+ s.date = %q{2010-08-28}
13
13
  s.description = %q{A Ruby client for the NOCMS.org web service API. Provides server-side helpers for Rails/Sinatra/Rack applications. keywords: ruby, rails, sinatra, rack, CMS, content management systems, search, cloud, SAAS, JSON, web service}
14
14
  s.email = %q{nocms@powcloud.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nocms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darren Rush
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-23 00:00:00 -07:00
18
+ date: 2010-08-28 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency