artifact 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/artifact.rb +8 -6
- data/lib/artifact/middleman.rb +1 -1
- data/lib/artifact/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70c3138e6af3b10a50119c69c86f103813f25cde
|
4
|
+
data.tar.gz: cef4833fbe9068c304bebc2de133912c4170981b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25bfe8ce63a82528798cb3d75bc528a969db5a1e74849f72e4c8c9810e21b9d5c13e51c6562d154971a9c1eb01986f7beba1c634c5d9a0b5309db7474d5be75c
|
7
|
+
data.tar.gz: 1c4314276d771991c8335f91529828d53b5bc695e2d441493d76495f921c67bedd1855c03f7c29da60c46a5cad3b8ee6ac8d08b6f64acde161f7d9b2a550a4dc
|
data/lib/artifact.rb
CHANGED
@@ -274,18 +274,20 @@ module Artifact
|
|
274
274
|
|
275
275
|
class WritableFile < ReadableFile
|
276
276
|
|
277
|
+
def save(new_content)
|
278
|
+
Artifact.ensure_dir!(@full_path)
|
279
|
+
# File.open(@full_path, 'wb') { |f| f.write(content.gsub("\r\n", "\n")) }
|
280
|
+
File.open(@full_path, 'wb') { |f| f.write(new_content) }
|
281
|
+
@content = nil
|
282
|
+
end
|
283
|
+
|
277
284
|
def update(new_content, meta = nil)
|
278
285
|
if new_content == read
|
279
286
|
return puts "No changes. No need to write changes to disk."
|
280
287
|
end
|
281
288
|
|
282
|
-
Artifact.ensure_dir!(@full_path)
|
283
289
|
Artifact.run_hook :before_update, new_content
|
284
|
-
|
285
|
-
# File.open(@full_path, 'wb') { |f| f.write(content.gsub("\r\n", "\n")) }
|
286
|
-
File.open(@full_path, 'wb') { |f| f.write(new_content) }
|
287
|
-
@content = nil
|
288
|
-
|
290
|
+
save(new_content)
|
289
291
|
Artifact.run_hook :after_update, new_content
|
290
292
|
end
|
291
293
|
|
data/lib/artifact/middleman.rb
CHANGED
@@ -163,7 +163,7 @@ module Artifact
|
|
163
163
|
else
|
164
164
|
filename = File.basename(name, File.extname(name)).parameterize # without extension
|
165
165
|
file = Artifact.uploads.new(filename, File.extname(name))
|
166
|
-
file.
|
166
|
+
file.save(tmpfile.read)
|
167
167
|
Artifact.repo.save(file.path, current_user) # pass relative path
|
168
168
|
|
169
169
|
updated! # force middleman to rebuild resource list
|
data/lib/artifact/version.rb
CHANGED