hx 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0
1
+ 0.18.0
@@ -33,7 +33,9 @@ class RawFiles
33
33
  def initialize(input, options)
34
34
  @entry_dir = Hx.get_pathname(options, :entry_dir)
35
35
  @postedit_cmd = options[:postedit_cmd]
36
+ @postdelete_cmd = options[:postdelete_cmd]
36
37
  @postedit_cmd = @postedit_cmd.split(/\s+/) if @postedit_cmd
38
+ @postdelete_cmd = @postdelete_cmd.split(/\s+/) if @postdelete_cmd
37
39
  end
38
40
 
39
41
  def path_to_pathname(path) ; @entry_dir + path ; end
@@ -53,8 +55,16 @@ class RawFiles
53
55
  text = prototype['content'].to_s
54
56
  end
55
57
  text = yield text
56
- Hx.write_file(pathname, text)
57
- system *(@postedit_cmd + [pathname]) if @postedit_cmd
58
+ if text
59
+ Hx.write_file(pathname, text)
60
+ system *(@postedit_cmd + [pathname]) if @postedit_cmd
61
+ else
62
+ begin
63
+ File.unlink(pathname)
64
+ system *(@postdelete_cmd + [pathname]) if @postdelete_cmd
65
+ rescue Errno::ENOENT
66
+ end
67
+ end
58
68
  self
59
69
  end
60
70
 
@@ -43,7 +43,7 @@ class DateArchive
43
43
 
44
44
  def each_entry(selector)
45
45
  indices = {}
46
- @input.each_entry_path(Path::ALL) do |path, entry|
46
+ @input.each_entry(Path::ALL) do |path, entry|
47
47
  date = @date_fields.map { |field| entry[field] }.compact.first
48
48
  next unless date
49
49
  month_path = "%04d/%02d/#{@index_name}" % [date.year, date.month]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 91
4
+ hash: 87
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 17
8
+ - 18
9
9
  - 0
10
- version: 0.17.0
10
+ version: 0.18.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - MenTaLguY
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-07 00:00:00 -08:00
18
+ date: 2011-03-12 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency