dynarex-blog 0.4.7 → 0.5.0
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.
- data/lib/dynarex-blog.rb +14 -0
- metadata +2 -2
data/lib/dynarex-blog.rb
CHANGED
@@ -56,6 +56,19 @@ class DynarexBlog
|
|
56
56
|
doc_entries = Document.new(@hc_entry_file.read(file) { File.open(@file_path + file,'r').read })
|
57
57
|
XPath.first(doc_entries.root, "records/entry[@id='#{id}']")
|
58
58
|
end
|
59
|
+
|
60
|
+
def update(id, h)
|
61
|
+
lookup = Dynarex.new @file_path + @current_lookup
|
62
|
+
lookup_id = lookup.records[id][:id]
|
63
|
+
file = lookup.records[id][:body][:file]
|
64
|
+
|
65
|
+
dynarex = @hc_entry_file.read(file) { Dynarex.new(@file_path + file) }
|
66
|
+
dynarex.update(id, h).save
|
67
|
+
|
68
|
+
uri = h[:title].gsub(/\s/,'-')
|
69
|
+
lookup.update(lookup_id, uri: uri).save
|
70
|
+
@hc_lookup.write(@current_lookup) { Document.new File.open(@file_path + @current_lookup,'r').read }
|
71
|
+
end
|
59
72
|
|
60
73
|
def delete(id=0)
|
61
74
|
|
@@ -270,6 +283,7 @@ class DynarexBlog
|
|
270
283
|
lookup = Dynarex.new @file_path + lookup_file
|
271
284
|
lookup.create id: id, file: entry_file, year: Time.now.strftime("%Y"), month: Time.now.strftime("%m"), uri: record[:title].gsub(/\s/,'-')
|
272
285
|
lookup.save @file_path + lookup_file
|
286
|
+
@hc_lookup.write(lookup_file) { Document.new File.open(@file_path + lookup_file,'r').read }
|
273
287
|
|
274
288
|
# if there is 15 items create a new entries file
|
275
289
|
if dynarex.records.length >= 15 then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors: []
|
7
7
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-08-
|
12
|
+
date: 2010-08-29 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|