fileman 0.1.10208
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +9 -0
- data/bin/fileman +4 -0
- data/bin/fm +4 -0
- data/fileman.gemspec +37 -0
- data/lib/fileman.rb +3 -0
- data/lib/fileman/delete.rb +12 -0
- data/lib/fileman/rename.rb +56 -0
- data/lib/fileman/scripts/core.rb +131 -0
- data/lib/fileman/version.rb +1 -0
- data/test/test_helper.rb +14 -0
- data/test/toolbelt/fixture.rb +12 -0
- data/test/unit/delete_file_and_folder_test.rb +28 -0
- data/test/unit/rename_recursively_test.rb +79 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a2f1e3a813fbfcfff9d7ae4545870201f57226b7
|
4
|
+
data.tar.gz: e3f9ef0ddb09fbaf0715a94b68d6cb60bc1b6fac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21d0a2b488f2f618eda7915c9f02e30b6435ff0893c459e587908ef9e533a3b2f1379cef010c2e1ec1e0e1c3e6175a4bd5290e839039f7c8891b74f672d51c82
|
7
|
+
data.tar.gz: 97db3896dfdadb4c0792ac378e6f5ed2506e090d8d9b7c1b25dbb7d1e6b6044fee7de8a94884f2fe88c79c59796ce25f42a3d429d1b7fe1e972bc05a3e4b4e8d
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 ndao
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Fileman
|
2
|
+
|
3
|
+
Fileman was originally designed to solve the Windows delete issue when a folder contains files whose path is greater than 260 characters. Over time, it got extended to support other features like renaming files inside folders following patterns.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'fileman'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install fileman
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
### Overview
|
21
|
+
Once installed, fileman is immediately available in the terminal through the 'fileman' or 'fm' command. For more details, simply type:
|
22
|
+
```sh
|
23
|
+
fm
|
24
|
+
```
|
25
|
+
### Examples
|
26
|
+
#### Delete a folder
|
27
|
+
```sh
|
28
|
+
fm rm your_folder
|
29
|
+
```
|
30
|
+
#### Rename a folder as well as all its subfolders
|
31
|
+
```sh
|
32
|
+
fm rn "your_folder" "new_name"
|
33
|
+
```
|
34
|
+
#### Rename a folder as well as all its subfolder, including files
|
35
|
+
```sh
|
36
|
+
fm rn "your_folder" "new_name" -i
|
37
|
+
```
|
38
|
+
#### Rename a folder as well as all its subfolder, including files without the files extension
|
39
|
+
```sh
|
40
|
+
fm rn "your_folder" "new_name" -ie
|
41
|
+
```
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it ( https://github.com/[my-github-username]/fileman/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/fileman
ADDED
data/bin/fm
ADDED
data/fileman.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
version = "0.1.%s" % ((Time.now.utc - Time.utc(2014, 7, 8))/60).round
|
5
|
+
version_file_path = File.join(lib, "fileman", "version.rb")
|
6
|
+
updated_content = nil
|
7
|
+
|
8
|
+
# update content
|
9
|
+
File.open(version_file_path, "rb") do |f|
|
10
|
+
content = f.read
|
11
|
+
updated_content = content.gsub(/(?<=").*?(?=")/, "%s" % version)
|
12
|
+
end
|
13
|
+
|
14
|
+
# overwrite version.rb with new content
|
15
|
+
File.open(version_file_path, "w") do |f|
|
16
|
+
f.write(updated_content)
|
17
|
+
end
|
18
|
+
|
19
|
+
Gem::Specification.new do |spec|
|
20
|
+
spec.name = "fileman"
|
21
|
+
spec.version = version
|
22
|
+
spec.authors = ["nicolasdao"]
|
23
|
+
spec.email = ["nicolas.dao@gmail.com"]
|
24
|
+
spec.summary = %q{Files and directories management in windows with super powers}
|
25
|
+
spec.description = %q{Enhance files and directories management in windows(e.g. deleting files and folders whose path is longer than 260 charatcers)}
|
26
|
+
spec.homepage = ""
|
27
|
+
spec.license = "MIT"
|
28
|
+
|
29
|
+
spec.files = `git ls-files -z`.split("\x0")
|
30
|
+
spec.executables = ['fileman', 'fm']
|
31
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "turn", "~> 0.9"
|
37
|
+
end
|
data/lib/fileman.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'fileman/rename'
|
3
|
+
|
4
|
+
module Fileman
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def remove(folder_path)
|
8
|
+
new_name = Fileman.rename_r(folder_path, 'a', {:include_files => true, :ignore_ext => true})
|
9
|
+
new_path = File.expand_path("../#{new_name}", folder_path)
|
10
|
+
FileUtils.remove_dir new_path, true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Fileman
|
4
|
+
module_function
|
5
|
+
|
6
|
+
# Rename folder and all its subfolders
|
7
|
+
#
|
8
|
+
# Arguments:
|
9
|
+
# ----------
|
10
|
+
# +folder_path+ Folder's path
|
11
|
+
# +new_name+ New name that is used to rename the folder and all its subfolder.
|
12
|
+
# If there is multiple subfolders, then a incremetal number is appened
|
13
|
+
# straight after the 'new_name'(e.g. if new_name is 'a', and there are
|
14
|
+
# 2 subfolder 'subf_a' and 'subf_b', then the new names will respectively
|
15
|
+
# be 'a1' and 'a2')
|
16
|
+
# +options+ Optional parameters defined as follow:
|
17
|
+
# +:include_files+ If true, all files will also be renamed. Extensions will be removed
|
18
|
+
# +:ignore_ext+ If true, and if 'include_files' is also true, then file's extensions
|
19
|
+
# are ignored
|
20
|
+
#
|
21
|
+
# Returns the new name of the root folder
|
22
|
+
def rename_r(folder_path, new_name, options={})
|
23
|
+
include_files = !options[:include_files].nil? && options[:include_files]
|
24
|
+
increment_name = lambda { |inc| inc == 0 ? new_name : "#{new_name}#{inc}" }
|
25
|
+
|
26
|
+
rename_item = lambda { |f, is_item_func|
|
27
|
+
parent_folder = File.expand_path("../", f)
|
28
|
+
file_ext = options[:ignore_ext] ? '' : File.extname(f)
|
29
|
+
counter = 0
|
30
|
+
while is_item_func.call(File.join(parent_folder, "#{increment_name.call(counter)}#{file_ext}")) do
|
31
|
+
counter+=1
|
32
|
+
end
|
33
|
+
final_name = increment_name.call(counter)
|
34
|
+
final_name = "#{final_name}#{file_ext}" unless options[:ignore_ext]
|
35
|
+
FileUtils.mv f, File.join(parent_folder, final_name)
|
36
|
+
final_name
|
37
|
+
}
|
38
|
+
|
39
|
+
is_dir = lambda { |x| File.directory? x}
|
40
|
+
is_file = lambda { |x| File.file? x}
|
41
|
+
|
42
|
+
final_new_name = new_name
|
43
|
+
all_items = Dir["#{folder_path}/**/*"]
|
44
|
+
items_per_folder = all_items.group_by { |x| File.expand_path('../',x)}
|
45
|
+
|
46
|
+
sorted_items = items_per_folder.map { |k,v| v.sort_by{|y| y}.reverse }.flatten.reverse
|
47
|
+
(sorted_items << folder_path).each { |f|
|
48
|
+
if File.directory?(f)
|
49
|
+
final_new_name = rename_item.call(f, is_dir)
|
50
|
+
elsif include_files && File.file?(f)
|
51
|
+
rename_item.call(f, is_file)
|
52
|
+
end
|
53
|
+
}
|
54
|
+
return final_new_name
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileman'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
def help
|
7
|
+
text = "usage: fileman <command> [<args>]\n" +
|
8
|
+
"\n" +
|
9
|
+
"The fileman commands are:\n" +
|
10
|
+
" rename, or rn\t Rename a folder as well as all its content with the same name\n" +
|
11
|
+
" remove, or rm\t Delete a folder\n" +
|
12
|
+
"\n" +
|
13
|
+
"For more details about each command, use fileman <command> -h"
|
14
|
+
puts text.colorize(:yellow)
|
15
|
+
end
|
16
|
+
|
17
|
+
def rename_help(rename_command)
|
18
|
+
text = "usage: fileman #{rename_command} <path> <new-name> [<args>]\n" +
|
19
|
+
"\n" +
|
20
|
+
"Optional arguments are:\n" +
|
21
|
+
" -i\t Include files so they are also renamed\n" +
|
22
|
+
" -e\t Remove files extension. Only valid if -i option is also specified"
|
23
|
+
puts text.colorize(:yellow)
|
24
|
+
end
|
25
|
+
|
26
|
+
def remove_help(rename_command)
|
27
|
+
text = "usage: fileman #{rename_command} <folder path>"
|
28
|
+
puts text.colorize(:yellow)
|
29
|
+
end
|
30
|
+
|
31
|
+
def command_help(command)
|
32
|
+
case command
|
33
|
+
when "rename"
|
34
|
+
rename_help("rename")
|
35
|
+
when "rn"
|
36
|
+
rename_help("rn")
|
37
|
+
when "remove"
|
38
|
+
remove_help("remove")
|
39
|
+
when "rm"
|
40
|
+
remove_help("rm")
|
41
|
+
else
|
42
|
+
puts "Command #{command} does not exist. Use 'fileman help' to find out about the usage".colorize(:red)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_rename_options
|
47
|
+
args = ARGV.clone
|
48
|
+
args.shift(3) # ignore the first 2 arguments by removing them from the array
|
49
|
+
options = {}
|
50
|
+
if (args.size > 0)
|
51
|
+
args.each { |x|
|
52
|
+
x.gsub('-', '').split('').each { |y|
|
53
|
+
case y
|
54
|
+
when 'i'
|
55
|
+
options[:include_files] = true
|
56
|
+
when 'e'
|
57
|
+
options[:ignore_ext] = true
|
58
|
+
end
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
return options
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_rename_arguments
|
66
|
+
arguments = {}
|
67
|
+
args = ARGV.clone
|
68
|
+
args.shift(1) # ignore the first argument by removing them from the array
|
69
|
+
arguments[:path] = args[0]
|
70
|
+
arguments[:name] = args[1]
|
71
|
+
options = get_rename_options
|
72
|
+
arguments[:include_files] = options[:include_files]
|
73
|
+
arguments[:ignore_ext] = options[:ignore_ext]
|
74
|
+
|
75
|
+
return arguments
|
76
|
+
end
|
77
|
+
|
78
|
+
# Usage: fileman rn "your_folder_path" "new_name" -ie
|
79
|
+
def rename
|
80
|
+
argsize = ARGV.size
|
81
|
+
if argsize == 1
|
82
|
+
puts "Missing argument(0 for 2..3). Use 'fileman help' to find out about the usage".colorize(:red)
|
83
|
+
elsif argsize == 2
|
84
|
+
puts "Missing argument(1 for 2..3). Use 'fileman help' to find out about the usage".colorize(:red)
|
85
|
+
else
|
86
|
+
args = get_rename_arguments
|
87
|
+
options = {}
|
88
|
+
options[:include_files] = true if args[:include_files]
|
89
|
+
options[:ignore_ext] = true if args[:ignore_ext]
|
90
|
+
Fileman.rename_r(args[:path], args[:name], options) unless args[:error]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def remove
|
95
|
+
argsize = ARGV.size
|
96
|
+
if argsize == 1
|
97
|
+
puts "Missing argument(0 for 1). Use 'fileman help' to find out about the usage".colorize(:red)
|
98
|
+
else
|
99
|
+
folder_path = ARGV[1].downcase
|
100
|
+
Fileman.remove folder_path
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
argsize = ARGV.size
|
105
|
+
|
106
|
+
if argsize > 0
|
107
|
+
main_command = ARGV[0].downcase
|
108
|
+
|
109
|
+
if argsize > 1 && ARGV[1] == "-h"
|
110
|
+
command_help main_command
|
111
|
+
else
|
112
|
+
case main_command
|
113
|
+
when "rn"
|
114
|
+
rename
|
115
|
+
when "rename"
|
116
|
+
rename
|
117
|
+
when "rm"
|
118
|
+
remove
|
119
|
+
when "remove"
|
120
|
+
remove
|
121
|
+
when "help"
|
122
|
+
help
|
123
|
+
when "h"
|
124
|
+
help
|
125
|
+
else
|
126
|
+
help
|
127
|
+
end
|
128
|
+
end
|
129
|
+
else
|
130
|
+
help
|
131
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'minitest/spec'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'fileman'
|
4
|
+
require 'toolbelt/fixture'
|
5
|
+
require 'pathname'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
# Attempt to load turn to show formatted test results
|
9
|
+
begin
|
10
|
+
require "turn"
|
11
|
+
Turn.config.format = :pretty
|
12
|
+
Turn.config.natural = true
|
13
|
+
rescue LoadError
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "erb"
|
3
|
+
require "pathname"
|
4
|
+
|
5
|
+
fixture_root = Pathname("../../fixtures").expand_path(__FILE__)
|
6
|
+
|
7
|
+
Fixtures = Hash.new do |hash, f_name|
|
8
|
+
filepath = fixture_root.join("#{f_name}.yml")
|
9
|
+
file_contents = open(filepath).read
|
10
|
+
YAML.load(ERB.new(file_contents).result).to_hash
|
11
|
+
hash[f_name] = YAML.load(ERB.new(file_contents).result).to_hash
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe "#Fileman.remove" do
|
4
|
+
let(:folder_name) { "TestFolder" }
|
5
|
+
let(:new_folder_name) { "a" }
|
6
|
+
|
7
|
+
before do
|
8
|
+
FileUtils.remove_dir(folder_name) if File.directory?(folder_name)
|
9
|
+
FileUtils.mkdir folder_name
|
10
|
+
FileUtils.mkdir "#{folder_name}/SubFolder_1"
|
11
|
+
FileUtils.mkdir "#{folder_name}/SubFolder_2"
|
12
|
+
FileUtils.touch "#{folder_name}/SubFolder_1/test_file.txt"
|
13
|
+
FileUtils.touch "#{folder_name}/SubFolder_2/test_file.txt"
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
FileUtils.remove_dir(new_folder_name) if File.directory?(new_folder_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#delete folder' do
|
21
|
+
|
22
|
+
it 'delete the folder and all its content recursively' do
|
23
|
+
File.directory?(folder_name).must_equal true
|
24
|
+
Fileman.remove folder_name
|
25
|
+
File.directory?(folder_name).must_equal false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe "#Fileman.rename_r" do
|
4
|
+
let(:folder_name) { "TestFolder" }
|
5
|
+
let(:new_folder_name) { "a" }
|
6
|
+
|
7
|
+
before do
|
8
|
+
FileUtils.remove_dir(folder_name) if File.directory?(folder_name)
|
9
|
+
FileUtils.mkdir folder_name
|
10
|
+
FileUtils.mkdir "#{folder_name}/SubFolder_1"
|
11
|
+
FileUtils.mkdir "#{folder_name}/SubFolder_2"
|
12
|
+
FileUtils.touch "#{folder_name}/SubFolder_1/test_file.txt"
|
13
|
+
FileUtils.touch "#{folder_name}/SubFolder_1/test_file_1.txt"
|
14
|
+
FileUtils.touch "#{folder_name}/SubFolder_2/test_file.txt"
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
FileUtils.remove_dir(new_folder_name) if File.directory?(new_folder_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'rename folder' do
|
22
|
+
|
23
|
+
it 'rename the folder and all its subfolders recursively' do
|
24
|
+
File.directory?(folder_name).must_equal true
|
25
|
+
File.directory?("#{folder_name}/SubFolder_1").must_equal true
|
26
|
+
File.directory?("#{folder_name}/SubFolder_2").must_equal true
|
27
|
+
File.file?("#{folder_name}/SubFolder_1/test_file.txt").must_equal true
|
28
|
+
File.file?("#{folder_name}/SubFolder_1/test_file_1.txt").must_equal true
|
29
|
+
File.file?("#{folder_name}/SubFolder_2/test_file.txt").must_equal true
|
30
|
+
|
31
|
+
Fileman.rename_r folder_name, new_folder_name
|
32
|
+
|
33
|
+
File.directory?("a").must_equal true
|
34
|
+
File.directory?("a/a").must_equal true
|
35
|
+
File.directory?("a/a1").must_equal true
|
36
|
+
File.file?("a/a/test_file.txt").must_equal true
|
37
|
+
File.file?("a/a/test_file_1.txt").must_equal true
|
38
|
+
File.file?("a/a1/test_file.txt").must_equal true
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'rename the folder and all its subfolders recursively, including all files ' +
|
42
|
+
'if option :include_files is true' do
|
43
|
+
File.directory?(folder_name).must_equal true
|
44
|
+
File.directory?("#{folder_name}/SubFolder_1").must_equal true
|
45
|
+
File.directory?("#{folder_name}/SubFolder_2").must_equal true
|
46
|
+
File.file?("#{folder_name}/SubFolder_1/test_file.txt").must_equal true
|
47
|
+
File.file?("#{folder_name}/SubFolder_1/test_file_1.txt").must_equal true
|
48
|
+
File.file?("#{folder_name}/SubFolder_2/test_file.txt").must_equal true
|
49
|
+
|
50
|
+
Fileman.rename_r folder_name, new_folder_name, {:include_files => true}
|
51
|
+
|
52
|
+
File.directory?("a").must_equal true
|
53
|
+
File.directory?("a/a").must_equal true
|
54
|
+
File.directory?("a/a1").must_equal true
|
55
|
+
File.file?("a/a/a.txt").must_equal true
|
56
|
+
File.file?("a/a/a1.txt").must_equal true
|
57
|
+
File.file?("a/a1/a.txt").must_equal true
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'rename the folder and all its subfolders recursively, including all files ' +
|
61
|
+
'WITHOUT their extensions if both options :include_files and :ignore_ext are true' do
|
62
|
+
File.directory?(folder_name).must_equal true
|
63
|
+
File.directory?("#{folder_name}/SubFolder_1").must_equal true
|
64
|
+
File.directory?("#{folder_name}/SubFolder_2").must_equal true
|
65
|
+
File.file?("#{folder_name}/SubFolder_1/test_file.txt").must_equal true
|
66
|
+
File.file?("#{folder_name}/SubFolder_1/test_file_1.txt").must_equal true
|
67
|
+
File.file?("#{folder_name}/SubFolder_2/test_file.txt").must_equal true
|
68
|
+
|
69
|
+
Fileman.rename_r folder_name, new_folder_name, {:include_files => true, :ignore_ext => true}
|
70
|
+
|
71
|
+
File.directory?("a").must_equal true
|
72
|
+
File.directory?("a/a").must_equal true
|
73
|
+
File.directory?("a/a1").must_equal true
|
74
|
+
File.file?("a/a/a").must_equal true
|
75
|
+
File.file?("a/a/a1").must_equal true
|
76
|
+
File.file?("a/a1/a").must_equal true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fileman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.10208
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nicolasdao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: turn
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
description: Enhance files and directories management in windows(e.g. deleting files
|
56
|
+
and folders whose path is longer than 260 charatcers)
|
57
|
+
email:
|
58
|
+
- nicolas.dao@gmail.com
|
59
|
+
executables:
|
60
|
+
- fileman
|
61
|
+
- fm
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/fileman
|
71
|
+
- bin/fm
|
72
|
+
- fileman.gemspec
|
73
|
+
- lib/fileman.rb
|
74
|
+
- lib/fileman/delete.rb
|
75
|
+
- lib/fileman/rename.rb
|
76
|
+
- lib/fileman/scripts/core.rb
|
77
|
+
- lib/fileman/version.rb
|
78
|
+
- test/test_helper.rb
|
79
|
+
- test/toolbelt/fixture.rb
|
80
|
+
- test/unit/delete_file_and_folder_test.rb
|
81
|
+
- test/unit/rename_recursively_test.rb
|
82
|
+
homepage: ''
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.0.14
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Files and directories management in windows with super powers
|
106
|
+
test_files:
|
107
|
+
- test/test_helper.rb
|
108
|
+
- test/toolbelt/fixture.rb
|
109
|
+
- test/unit/delete_file_and_folder_test.rb
|
110
|
+
- test/unit/rename_recursively_test.rb
|