dir-to-xml 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dir-to-xml.rb +11 -4
  2. metadata +3 -3
data/lib/dir-to-xml.rb CHANGED
@@ -1,8 +1,7 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # file: dir-to-xml.rb
4
4
 
5
- require 'rexle'
6
5
  require 'dynarex'
7
6
 
8
7
  class DirToXML
@@ -101,9 +100,17 @@ summary = "
101
100
  def run(a)
102
101
 
103
102
  doc = Rexle.new(File.open('dir.xml','r').read)
103
+
104
+ doc.root.xpath('records/file').each do |x|
105
+ x.element('last_modified').text = File.mtime x.text('name')
106
+ end
107
+
104
108
  a_dir = doc.root.xpath('records/file/name/text()').sort
105
-
106
- return [doc, "nothing new"] if a == a_dir
109
+
110
+ if a == a_dir then
111
+ File.open('dir.xml','w'){|f| doc.write f}
112
+ return [doc, "nothing new"]
113
+ end
107
114
 
108
115
  # files to add
109
116
  files_to_insert = a - a_dir
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dir-to-xml
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.9
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-07 00:00:00 Z
13
+ date: 2012-10-28 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dynarex
@@ -59,6 +59,6 @@ rubyforge_project:
59
59
  rubygems_version: 1.8.23
60
60
  signing_key:
61
61
  specification_version: 3
62
- summary: dir-to-xml
62
+ summary: dir-to-xml saves a directory listing in a Dynarex XML format
63
63
  test_files: []
64
64