folder_stash 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/folder_stash/file_usher.rb +16 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed23473d361dfa0ae4bd1f0a38b113668199c2d4c168c185db38b42d03aaa95
|
4
|
+
data.tar.gz: ac7cdca3255197f1b1b53c8db011c212c5573cb765a15690d53534115a9da0f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 307855d56e517dcf1bb729508a4bd273f66f8bcb26acdbe37b00a8377c8e73f29c2a0951a406c455edca926106ad6a3b0409cb8afb9c4ceadd8d11d397525a36
|
7
|
+
data.tar.gz: 9252ff064589fde254252d8ec9a3f80b53bdc409eddc179adb558addafac69297fb611ddeaa73a55157cfb3d4375cf5242491c5a99f3e5b867c6abd3fc9dc38b
|
@@ -46,8 +46,12 @@ module FolderStash
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Copies +file+ to linked path.
|
49
|
-
|
50
|
-
|
49
|
+
#
|
50
|
+
# The optional <tt>new_basename</tt> argument is passed when the file is to
|
51
|
+
# be renamed.
|
52
|
+
def copy(file, new_basename = nil, pathtype: :tree)
|
53
|
+
filename = new_basename || File.basename(file)
|
54
|
+
path = store_path(filename)
|
51
55
|
File.open(path, 'wb') { |f| f.write(File.new(file).read) }
|
52
56
|
file_path path, pathtype
|
53
57
|
end
|
@@ -77,9 +81,13 @@ module FolderStash
|
|
77
81
|
end
|
78
82
|
|
79
83
|
# Moves +file+ to the #linked_path.
|
80
|
-
|
81
|
-
|
82
|
-
|
84
|
+
#
|
85
|
+
# The optional <tt>new_basename</tt> argument is passed when the file is to
|
86
|
+
# be renamed.
|
87
|
+
def move(file, new_basename = nil, pathtype: :tree)
|
88
|
+
filename = new_basename || File.basename(file)
|
89
|
+
path = store_path(filename)
|
90
|
+
FileUtils.mv File.expand_path(file), path
|
83
91
|
file_path path, pathtype
|
84
92
|
end
|
85
93
|
|
@@ -148,9 +156,10 @@ module FolderStash
|
|
148
156
|
end
|
149
157
|
|
150
158
|
# Returns the next available path (_String_) for a file to be stored under.
|
151
|
-
|
159
|
+
# +filename+ is the basename for the file to be stored.
|
160
|
+
def store_path(filename)
|
152
161
|
update_link if folder_limit && current_folder.count >= folder_limit
|
153
|
-
File.join current_directory,
|
162
|
+
File.join current_directory, filename
|
154
163
|
end
|
155
164
|
|
156
165
|
# Creates new subdirectories points the #current_directory symlink to the
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: folder_stash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Stein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
The folder_stash gem will store files in a directory with a user definable
|