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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 358f90040914655f57b8587936f038b9dd9a50db
4
- data.tar.gz: ccc85a4d53981b2cfa5949964a982cecad6289d1
3
+ metadata.gz: 70c3138e6af3b10a50119c69c86f103813f25cde
4
+ data.tar.gz: cef4833fbe9068c304bebc2de133912c4170981b
5
5
  SHA512:
6
- metadata.gz: bb1275829dc2f91e8ff319c8a6cb1eb2dba4a147c2a1a8e28f655119e43d96e51082908e899f846e32a8c2b436598cdf0007b85083dae3f9a03ad74a4503d797
7
- data.tar.gz: f22c0273c39cf19f9d48ad232129cbb35a9c59ba20bff78df481d12af229c70260cfbc9b64cd91bb3cdeb0678186685c9951c202a11cb2af468b3d0fa0ecc750
6
+ metadata.gz: 25bfe8ce63a82528798cb3d75bc528a969db5a1e74849f72e4c8c9810e21b9d5c13e51c6562d154971a9c1eb01986f7beba1c634c5d9a0b5309db7474d5be75c
7
+ data.tar.gz: 1c4314276d771991c8335f91529828d53b5bc695e2d441493d76495f921c67bedd1855c03f7c29da60c46a5cad3b8ee6ac8d08b6f64acde161f7d9b2a550a4dc
@@ -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
 
@@ -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.update(tmpfile.read)
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
@@ -1,3 +1,3 @@
1
1
  module Artifact
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomás Pollak