xrt 0.0.8 → 0.0.9

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: 6e794554d3ea1a41e6b8baf7b319eef351a0e75c
4
- data.tar.gz: 6f474d42d839fcabd1d80bedd8e730c9033f4cb2
3
+ metadata.gz: 7ca60b37f3d5fb5acab81879c1544798a34fefeb
4
+ data.tar.gz: c5198a67465e9b06bbe2a3bc4df4ad5dff94aa9d
5
5
  SHA512:
6
- metadata.gz: 6d9c72d02fe07ecaa4175ea58f1f690dc9226824965320e875e31a928a41b54f3c28b745f4a2aff834c5bb2e4e81082a5e6ecfafd420d6759fb1da3ec0ebf46e
7
- data.tar.gz: 5da38ce8f05c3f78548d09a8d9221c89ba7b9815e20feb19b5979aed68f212ca5ccceab26ee3d8bc690ed43663a6032648e8588502db9b2804b6981ad20d4dac
6
+ metadata.gz: 484545f084afa66d9d77874769cdd1ee7e9684bd69a65358a5b8a74efd4fa83e279a4e37f4cee7e2ba0ef9c0774abeadd852fc9a81d1169b41f3a28e32bb7cb0
7
+ data.tar.gz: 4bbe85919e5dd9a401d161f6098e2639efa58bb309ab53badd3ce8fedc1fde331d742dc48ede71ec520b80883520e221e79758950b2b10f530547aac84c9ae3d
@@ -34,6 +34,10 @@ module XRT
34
34
 
35
35
  def commit!
36
36
  files.each_pair{|path, content|
37
+ unless full_path(path).dirname.exist?
38
+ full_path(path).dirname.mkpath
39
+ end
40
+
37
41
  full_path(path).open('w') {|f|
38
42
  f.write content
39
43
  }
@@ -1,3 +1,3 @@
1
1
  module Xrt
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -27,6 +27,15 @@ class TestTransaction < Test::Unit::TestCase
27
27
  }
28
28
  end
29
29
 
30
+ def test_new_file_with_directory
31
+ Dir.mktmpdir{|dir|
32
+ transaction = XRT::Transaction.new
33
+ transaction.new_file transaction.full_path(dir, 'some_dir/hello.txt').to_s, 'Hello!'
34
+ transaction.commit!
35
+ assert_equal 'Hello!', transaction.full_path(dir, 'some_dir', 'hello.txt').open.read
36
+ }
37
+ end
38
+
30
39
  def test_new_file_throws_error_when_conflict
31
40
  Dir.mktmpdir{|dir|
32
41
  Pathname(dir).join('hello.txt').open('w'){ |f| f.write 'existing content' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - hitode909