folders_renamer 0.1.2 → 0.1.3

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: 4435cbed167eafecf60d8397e12350a675a045f5
4
- data.tar.gz: 49b62f2ffccd8ce6f4eab4664e2471ac952eb5d8
3
+ metadata.gz: 99b81986892d3e6af4ec75d5ecf21625e964a617
4
+ data.tar.gz: 705f0a3cb1e042730ce3799572ed9e7d473090fe
5
5
  SHA512:
6
- metadata.gz: 6f0567f370e6dc320ca482ef2121a965b7e2869c48f1bb29da9d3e9d1bbbe889dc714e54211bead4771d26d8149e81c4468a001925be5d0bbd6909fef139a2d4
7
- data.tar.gz: 75fa20a55585c53dde5ea70561b3d5a6eca4874dc7aa3f8a827d9c22aa0f5eeb090510e9edd6080cd0476b5010a8b89947fa1e93f53ec25f987550d598d716ed
6
+ metadata.gz: baa398bcf5a3dab03e12cd7174bbfe2250e69ed87710402d6835843aa8c876cd218a146aff1e87e22ded668e3c595c9c9f90ad09ddbb0ba885aa3d90bf210853
7
+ data.tar.gz: 000af1d9a38387448826d82513825d6258883e0de5d0ad51f2d9d6e3f91a1f6d212c57fec35ce2af09f9c24a1a6f5cacdccc2c184caa720b0539dea135316245
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Changelogs
2
2
 
3
+ ### 0.1.3
4
+
5
+ * Simplify the CLI usage
6
+
3
7
  ### 0.1.2
4
8
  * Update `filename_cleaner` to 0.3
5
9
  * Add `--commit` options to allow the dry-run
data/README.md CHANGED
@@ -51,10 +51,10 @@ using command like:
51
51
  cd ~/path/to/some_folder/
52
52
 
53
53
  # Perform the dry-run to see what will be changed (no changes)
54
- folders_renamer rename --sep-string _
54
+ folders_renamer --sep-string _
55
55
 
56
56
  # Commit your changes
57
- folders_renamer rename --sep-string _ --commit
57
+ folders_renamer --sep-string _ --commit
58
58
  ```
59
59
 
60
60
  ### Installation
@@ -69,7 +69,7 @@ Type the `folders_rename` without any options to get the help which should be so
69
69
 
70
70
  ```
71
71
  Usage:
72
- folders_renamer rename -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING
72
+ folders_renamer -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING
73
73
 
74
74
  Options:
75
75
  -b, --base-dir=BASE_DIR # Starting directory
data/bin/folders_renamer CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative "../lib/folders_renamer"
3
3
  include FoldersRenamer
4
- FoldersRenamer::CLI.start(ARGV)
4
+ if ARGV.empty?
5
+ FoldersRenamer::CLI.start(%w[usage])
6
+ else
7
+ FoldersRenamer::CLI.start(%w[rename].concat(ARGV))
8
+ end
@@ -14,8 +14,8 @@ module FoldersRenamer
14
14
  required: true
15
15
  method_option :commit,
16
16
  type: :boolean,
17
- aliases: '-c',
18
- desc: 'Commit your changes',
17
+ aliases: "-c",
18
+ desc: "Commit your changes",
19
19
  default: false
20
20
  method_option "version",
21
21
  aliases: "-v",
@@ -34,7 +34,7 @@ module FoldersRenamer
34
34
  def usage
35
35
  puts <<-EOS
36
36
  Usage:
37
- folders_renamer rename -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING
37
+ folders_renamer -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING
38
38
 
39
39
  Options:
40
40
  -b, --base-dir=BASE_DIR # Starting directory
@@ -16,10 +16,12 @@ module FoldersRenamer
16
16
  find_depth_first(Pathname(base_dir)) do |path|
17
17
  if path.directory?
18
18
  new_path = path.dirname + Pathname(FilenameCleaner.sanitize(path.basename.to_s, sep_string))
19
- unless new_path == path
19
+ if new_path != path && !File.exist?(new_path)
20
20
  puts "FYI: rename from: #{path}"
21
21
  puts "FYI: rename to : #{new_path}"
22
22
  path.rename(new_path) if commit
23
+ else
24
+ puts "FYI: skip folder: #{path}"
23
25
  end
24
26
  end
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module FoldersRenamer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: folders_renamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-15 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor