dynarex-blog 0.1.12 → 0.1.13
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 +8 -8
- metadata +2 -2
data/lib/dynarex-blog.rb
CHANGED
@@ -14,7 +14,7 @@ class DynarexBlog
|
|
14
14
|
def initialize(file_path='./')
|
15
15
|
@file_path = file_path[/\/$/] ? file_path : file_path + '/'
|
16
16
|
if File.exists? (@file_path + 'index.xml') then open(@file_path) else fresh_start() end
|
17
|
-
@current_lookup = '
|
17
|
+
@current_lookup = '_entry_lookup.xml'
|
18
18
|
super()
|
19
19
|
end
|
20
20
|
|
@@ -31,7 +31,7 @@ class DynarexBlog
|
|
31
31
|
end
|
32
32
|
@index.save @file_path + 'index.xml'
|
33
33
|
|
34
|
-
create_record(record, @id.to_s, name='
|
34
|
+
create_record(record, @id.to_s, name='_entry', type='main')
|
35
35
|
record[:tags].split(/\s/).each do |tag|
|
36
36
|
create_record(record, @id.to_s, name=tag, type='tags')
|
37
37
|
end
|
@@ -43,7 +43,7 @@ class DynarexBlog
|
|
43
43
|
# delete from the tags files (entry and lookup), the entry file and lookup
|
44
44
|
# look the id up in lookup.xml
|
45
45
|
|
46
|
-
doc_entry, entry = open_lookup_record '
|
46
|
+
doc_entry, entry = open_lookup_record '_entry', id
|
47
47
|
|
48
48
|
dynarex_file = @file_path + entry.text('file').to_s
|
49
49
|
dynarex = Document.new(File.open(dynarex_file,'r').read)
|
@@ -54,7 +54,7 @@ class DynarexBlog
|
|
54
54
|
File.open(dynarex_file,'w'){|f| dynarex.write f}
|
55
55
|
|
56
56
|
entry.parent.delete entry
|
57
|
-
lookup = "%s%s" % [@file_path, '
|
57
|
+
lookup = "%s%s" % [@file_path, '_entry_lookup.xml']
|
58
58
|
File.open(lookup,'w'){|f| doc_entry.write f}
|
59
59
|
|
60
60
|
tags.each do |tag_name|
|
@@ -71,7 +71,7 @@ class DynarexBlog
|
|
71
71
|
node_records.parent.delete node_records
|
72
72
|
records = Element.new 'records'
|
73
73
|
|
74
|
-
new_records = select_page('
|
74
|
+
new_records = select_page('_entry_lookup.xml', 1)
|
75
75
|
new_records.each {|record| records.add record}
|
76
76
|
doc.root.add records
|
77
77
|
|
@@ -84,7 +84,7 @@ class DynarexBlog
|
|
84
84
|
def fresh_start()
|
85
85
|
|
86
86
|
@id = 1
|
87
|
-
@dynarex = new_blog_file '
|
87
|
+
@dynarex = new_blog_file '_entry1.xml'
|
88
88
|
@index = new_blog_file 'index.xml'
|
89
89
|
|
90
90
|
@entities = Polyrex.new('entities/section[name]/entity[name,count]')
|
@@ -93,7 +93,7 @@ class DynarexBlog
|
|
93
93
|
@entities.create.section({name: 'tags'}, id='tags')
|
94
94
|
@entities.save @file_path + 'entities.xml'
|
95
95
|
|
96
|
-
@lookup = new_lookup_file '
|
96
|
+
@lookup = new_lookup_file '_entry_lookup.xml'
|
97
97
|
end
|
98
98
|
|
99
99
|
def open(file_path='./')
|
@@ -108,7 +108,7 @@ class DynarexBlog
|
|
108
108
|
|
109
109
|
def page(number)
|
110
110
|
current_lookup = @current_lookup
|
111
|
-
@current_lookup = '
|
111
|
+
@current_lookup = '_entry_lookup.xml'
|
112
112
|
select_page(current_lookup, number)
|
113
113
|
end
|
114
114
|
|
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.1.
|
4
|
+
version: 0.1.13
|
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-06-
|
12
|
+
date: 2010-06-25 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|