filename_cleaner 0.4.7 → 0.4.8

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: 5676826458398c5f25b2a071fc65ebe2b5fe0951
4
- data.tar.gz: 741b7a01dcf985b3306189046d5f72e6881d5b2d
3
+ metadata.gz: ef333b5b9a97ba24c805cbc33ae8294cac652ba4
4
+ data.tar.gz: a04499463cb613ef2f86d350d0ea99ec114c60d9
5
5
  SHA512:
6
- metadata.gz: 45491d2edecbb779ea1a4c3497ddacfac5855541c46523a6311c17997ec329898e80a8f81d4713d7eae10efcfb89aea20516b1ba7d6bd43d842c62853f67c6d6
7
- data.tar.gz: a716938ee36510c6b70bc2969f2415eb19eb0b08b94c970165067039b139875b898aa5d8f6471b6124f8d6634c855f81fb5ea85225480ebd9cec900dacba820c
6
+ metadata.gz: b44ab1c6e0d466df9978e24bd9baee6157ac63d9677056e2e03d9aaae2f9dc7838dc7b611ca0b08b2790a2c1d4fe5aefd5cec0ec2ceeb361468148321c655644
7
+ data.tar.gz: 134ef8d4053727129bb0e766c85b863bc72c697063b9bf9860b05567f037d4ee58c78405773be20904786ba84c2c9fb64dfc5071e1ed3f8e92ddd4ec764658bf
@@ -1,3 +1,8 @@
1
+ ### 0.4.8
2
+
3
+ - Prevent the input filename to be mutated
4
+ - Thanks to [@mbogh](Morten Bøgh) for suggestion and PR
5
+
1
6
  ### 0.4.7
2
7
 
3
8
  - Update gem to the latest version
@@ -30,16 +30,16 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency "thor", "~> 0.19"
31
31
  spec.add_runtime_dependency "agile_utils", "~> 0.3"
32
32
  spec.add_runtime_dependency "code_lister", "~> 0.2"
33
- spec.add_development_dependency "bundler", "~> 1.7"
34
- spec.add_development_dependency "rake", "~> 10.3"
35
- spec.add_development_dependency "awesome_print", "~> 1.2"
33
+ spec.add_development_dependency "bundler", "~> 1.10"
34
+ spec.add_development_dependency "rake", "~> 10.4"
35
+ spec.add_development_dependency "awesome_print", "~> 1.6"
36
36
  spec.add_development_dependency "minitest-spec-context", "~> 0.0"
37
- spec.add_development_dependency "guard-minitest", "~> 2.3"
38
- spec.add_development_dependency "minitest", "~> 5.4"
39
- spec.add_development_dependency "guard", "~> 2.6"
37
+ spec.add_development_dependency "guard-minitest", "~> 2.4"
38
+ spec.add_development_dependency "minitest", "~> 5.8"
39
+ spec.add_development_dependency "guard", "~> 2.13"
40
40
  spec.add_development_dependency "pry", "~> 0.10"
41
41
  spec.add_development_dependency "gem-ctags", "~> 1.0"
42
42
  spec.add_development_dependency "yard", "~> 0.8"
43
- spec.add_development_dependency "rubocop", "~> 0.26"
44
- spec.add_development_dependency "coveralls", "~> 0.7"
43
+ spec.add_development_dependency "rubocop", "~> 0.35"
44
+ spec.add_development_dependency "coveralls", "~> 0.8"
45
45
  end
@@ -64,9 +64,12 @@ module FilenameCleaner
64
64
 
65
65
  # Replace the multiple special characters with a dot string
66
66
  #
67
- # @param [String] name input file
67
+ # @param [String] input_name input file
68
68
  # @return [String] the new name with special characters replaced or removed.
69
- def sanitize_with_dot(name)
69
+ def sanitize_with_dot(input_name)
70
+ # Don't mutate the input name
71
+ name = input_name.clone
72
+
70
73
  # Replace any special characters with a dot
71
74
  name.gsub!(/[^0-9A-Za-z\-_ ]/, DOT)
72
75
 
@@ -87,8 +90,9 @@ module FilenameCleaner
87
90
 
88
91
  # Replace 'dot' string with a given string if specified
89
92
  def replace_dot(string, replace = nil)
90
- string.gsub!(/#{Regexp.quote(DOT)}+/, replace) if replace
91
- string
93
+ result = string.clone
94
+ result.gsub!(/#{Regexp.quote(DOT)}+/, replace) if replace
95
+ result
92
96
  end
93
97
  end
94
98
  end
@@ -1,3 +1,3 @@
1
1
  module FilenameCleaner
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filename_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.7'
61
+ version: '1.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.7'
68
+ version: '1.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.3'
75
+ version: '10.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.3'
82
+ version: '10.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: awesome_print
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.2'
89
+ version: '1.6'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.2'
96
+ version: '1.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: minitest-spec-context
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,42 +114,42 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.3'
117
+ version: '2.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.3'
124
+ version: '2.4'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: minitest
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '5.4'
131
+ version: '5.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '5.4'
138
+ version: '5.8'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '2.6'
145
+ version: '2.13'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '2.6'
152
+ version: '2.13'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: pry
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -198,28 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.26'
201
+ version: '0.35'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.26'
208
+ version: '0.35'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: coveralls
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '0.7'
215
+ version: '0.8'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '0.7'
222
+ version: '0.8'
223
223
  description: " Bulk rename and remove unwanted characters from list of files in any
224
224
  directory recursively.\n Turn something like 'my_#$@#$_bad_$!@_filename!!.txt' into
225
225
  'my_bad_filename.txt'\n "