acts_as_indexed 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,7 @@
1
- ===0.7.4 [14th October 2011]
1
+ ===0.7.6 [24th October 2011]
2
+ - Removed support for atomic writes under Windows. Fixes issue #15.
3
+
4
+ ===0.7.5 [14th October 2011]
2
5
  - Screwup fix release.
3
6
 
4
7
  ===0.7.4 [13th October 2011]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.5
1
+ 0.7.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_indexed}
8
- s.version = "0.7.5"
8
+ s.version = "0.7.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Douglas F Shearer}]
12
- s.date = %q{2011-10-13}
12
+ s.date = %q{2011-10-24}
13
13
  s.description = %q{Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app}
14
14
  s.email = %q{dougal.s@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -79,9 +79,9 @@ module ActsAsIndexed #:nodoc:
79
79
 
80
80
  atoms_sorted.each do |e_p, atoms|
81
81
  path = @path.join(e_p.to_s + INDEX_FILE_EXTENSION)
82
-
82
+
83
83
  lock_file(path) do
84
-
84
+
85
85
  if path.exist?
86
86
  from_file = path.open do |f|
87
87
  Marshal.load(f)
@@ -96,7 +96,7 @@ module ActsAsIndexed #:nodoc:
96
96
  Marshal.dump(atoms,f)
97
97
  end
98
98
  end # end lock.
99
-
99
+
100
100
  end
101
101
  end
102
102
 
@@ -121,7 +121,7 @@ module ActsAsIndexed #:nodoc:
121
121
 
122
122
  else
123
123
  @path.mkpath
124
-
124
+
125
125
  # Do we need to lock for this? I don't think so as it is only ever
126
126
  # creating, not modifying.
127
127
  write_file(version_path) do |f|
@@ -157,11 +157,15 @@ module ActsAsIndexed #:nodoc:
157
157
  new_file = file_path.to_s
158
158
  tmp_file = new_file + TEMP_FILE_EXTENSION
159
159
 
160
+ # Windows doesn't seem to play nice with writing then moving the file.
161
+ # https://github.com/dougal/acts_as_indexed/issues/15
162
+ writeable_file = windows? ? new_file : tmp_file
163
+
160
164
  File.open(tmp_file, 'w+') do |f|
161
165
  yield(f)
162
166
  end
163
167
 
164
- FileUtils.mv(tmp_file, new_file)
168
+ FileUtils.mv(tmp_file, new_file) unless windows?
165
169
  end
166
170
 
167
171
  # Borrowed from Rails' ActiveSupport FileStore. Also under MIT licence.
@@ -182,6 +186,8 @@ module ActsAsIndexed #:nodoc:
182
186
  end
183
187
  end
184
188
 
189
+ # Checking for windows all the time seems costly.
190
+ # Write a separate windows storage class, and use it at runtime?
185
191
  def windows?
186
192
  @@is_windows ||= RUBY_PLATFORM[/mswin32|mingw|cygwin/]
187
193
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_indexed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 5
10
- version: 0.7.5
9
+ - 6
10
+ version: 0.7.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Douglas F Shearer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-13 00:00:00 Z
18
+ date: 2011-10-24 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app