fec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/checker.sh +31 -0
- data/bin/console +7 -0
- data/bin/fec +4 -0
- data/bin/setup +8 -0
- data/circle.yml +14 -0
- data/fec.gemspec +36 -0
- data/lib/fec/cli.rb +39 -0
- data/lib/fec/file_helper.rb +7 -0
- data/lib/fec/messenger.rb +7 -0
- data/lib/fec/version.rb +3 -0
- data/lib/fec.rb +5 -0
- data/spec/fec_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 41b107f4b43d1bcebc78e9663bf0f8afc565ad07
|
4
|
+
data.tar.gz: d9a21bc56454b57564338bddb817d118899e10a7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5674784982320609245276dfd06b1249942075ed10f7fa22281508448f79073a74e373725014e61b60c8c70805c50be9551a0fe113173c7d179e5e9e532d8619
|
7
|
+
data.tar.gz: 661900d832d0202024c9bdf22a9134a142b03d1f3e77f6faa7675b3d5ab519f70b1abced53ff8d972558536e6ff3bb20239d6bb81308ee9b9e76bce8fa154975
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Cao Quang Binh
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Fec
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/fec.svg)](https://badge.fury.io/rb/fec)
|
3
|
+
|
4
|
+
Rename all files extension inside folder (including recursive folder).
|
5
|
+
|
6
|
+
Required:
|
7
|
+
|
8
|
+
- `ruby` 1.9 or greater (see https://www.ruby-lang.org/en/installation )
|
9
|
+
- `rubygems` (included with ruby; see https://github.com/rubygems/rubygems )
|
10
|
+
|
11
|
+
Recommended:
|
12
|
+
|
13
|
+
- `rvm` for controlling your versions of ruby (see: https://github.com/rvm/rvm )
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
Install as you would any other ruby gem:
|
17
|
+
|
18
|
+
$ gem install fec
|
19
|
+
|
20
|
+
## Using
|
21
|
+
### Rename files extension inside folder
|
22
|
+
|
23
|
+
$ fec rename /path/to/folder -o old_extension -n new_extension
|
24
|
+
|
25
|
+
### Check Fec version
|
26
|
+
|
27
|
+
$ fec -v (or `--version`)
|
28
|
+
|
29
|
+
## Contributors
|
30
|
+
[@CQBinh](https://github.com/CQBinh) from [AsianTech](http://asiantech.vn) with love.
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork [https://github.com/CQBinh/fec](https://github.com/CQBinh/fec)
|
34
|
+
2. Create your feature branch (`git checkout -b my-awesome-feature`)
|
35
|
+
3. Commit your changes (`git commit -m 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new pull request with a description of your changes
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/checker.sh
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
gem install --no-document rubocop rubocop-checkstyle_formatter \
|
4
|
+
rails_best_practices \
|
5
|
+
reek \
|
6
|
+
checkstyle_filter-git saddler saddler-reporter-github \
|
7
|
+
|
8
|
+
if [ -z "${CI_PULL_REQUEST}" ]; then
|
9
|
+
# when not pull request
|
10
|
+
REPORTER=Saddler::Reporter::Github::CommitReviewComment
|
11
|
+
else
|
12
|
+
REPORTER=Saddler::Reporter::Github::PullRequestReviewComment
|
13
|
+
fi
|
14
|
+
|
15
|
+
echo "********************"
|
16
|
+
echo "* RuboCop *"
|
17
|
+
echo "********************"
|
18
|
+
rubocop --require `gem which rubocop/formatter/checkstyle_formatter` --format RuboCop::Formatter::CheckstyleFormatter --out rubocop.xml
|
19
|
+
cat rubocop.xml \
|
20
|
+
| checkstyle_filter-git diff origin/master \
|
21
|
+
| saddler report \
|
22
|
+
--require saddler/reporter/github \
|
23
|
+
--reporter $REPORTER
|
24
|
+
|
25
|
+
echo "********************"
|
26
|
+
echo "* save outputs *"
|
27
|
+
echo "********************"
|
28
|
+
LINT_RESULT_DIR="$CIRCLE_ARTIFACTS/lint"
|
29
|
+
|
30
|
+
mkdir "$LINT_RESULT_DIR"
|
31
|
+
cp -v "rubocop.xml" "$LINT_RESULT_DIR/"
|
data/bin/console
ADDED
data/bin/fec
ADDED
data/bin/setup
ADDED
data/circle.yml
ADDED
data/fec.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'fec'
|
8
|
+
spec.version = Fec::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.authors = ['CAO Quang Binh']
|
11
|
+
spec.email = ['binhcq@asiantech.vn']
|
12
|
+
|
13
|
+
spec.summary = 'File Extension Changer.'
|
14
|
+
spec.description = 'Change all file extensions in folder.'
|
15
|
+
spec.homepage = 'https://github.com/CQBinh/fec'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_runtime_dependency('rainbow', '2.0')
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.11.2'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_development_dependency 'rubocop'
|
29
|
+
|
30
|
+
# comment linter directly on pull request
|
31
|
+
spec.add_development_dependency 'saddler'
|
32
|
+
spec.add_development_dependency 'saddler-reporter-github'
|
33
|
+
spec.add_development_dependency 'rubocop-checkstyle_formatter'
|
34
|
+
|
35
|
+
spec.add_dependency 'thor'
|
36
|
+
end
|
data/lib/fec/cli.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
require 'thor'
|
3
|
+
require 'rainbow'
|
4
|
+
require_relative 'file_helper'
|
5
|
+
require_relative 'messenger'
|
6
|
+
|
7
|
+
module Fec
|
8
|
+
class FileExtensionChanger < Thor
|
9
|
+
include Fec::FileHelper
|
10
|
+
include Fec::Messenger
|
11
|
+
desc 'version', 'Show the Fec version'
|
12
|
+
map %w(-v --version) => :version
|
13
|
+
|
14
|
+
def version
|
15
|
+
puts "Fec version #{::Fec::VERSION} on Ruby #{RUBY_VERSION}"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'rename', 'rename files extension in folder'
|
19
|
+
method_option :old_extension, aliases: '-o', required: true
|
20
|
+
method_option :new_extension, aliases: '-n', required: true
|
21
|
+
def rename(folder_path)
|
22
|
+
old_extension = options.fetch('old_extension')
|
23
|
+
new_extension = options.fetch('new_extension')
|
24
|
+
|
25
|
+
Dir.entries("#{folder_path}/").each do |name|
|
26
|
+
if directory?(folder_path, name)
|
27
|
+
path = "#{folder_path}/#{name}"
|
28
|
+
notice_message("Processing #{path}")
|
29
|
+
rename(path)
|
30
|
+
elsif name.downcase.include? old_extension
|
31
|
+
old_file_name = "#{folder_path}/#{name}"
|
32
|
+
new_file_name = "#{folder_path}/#{File.basename(name, '.*')}.#{new_extension}"
|
33
|
+
notice_message("Changing #{name}")
|
34
|
+
FileUtils.mv old_file_name, new_file_name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/fec/version.rb
ADDED
data/lib/fec.rb
ADDED
data/spec/fec_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- CAO Quang Binh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rainbow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.11.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.11.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: saddler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: saddler-reporter-github
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-checkstyle_formatter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Change all file extensions in folder.
|
140
|
+
email:
|
141
|
+
- binhcq@asiantech.vn
|
142
|
+
executables:
|
143
|
+
- checker.sh
|
144
|
+
- console
|
145
|
+
- fec
|
146
|
+
- setup
|
147
|
+
extensions: []
|
148
|
+
extra_rdoc_files: []
|
149
|
+
files:
|
150
|
+
- ".gitignore"
|
151
|
+
- ".rubocop.yml"
|
152
|
+
- Gemfile
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- bin/checker.sh
|
157
|
+
- bin/console
|
158
|
+
- bin/fec
|
159
|
+
- bin/setup
|
160
|
+
- circle.yml
|
161
|
+
- fec.gemspec
|
162
|
+
- lib/fec.rb
|
163
|
+
- lib/fec/cli.rb
|
164
|
+
- lib/fec/file_helper.rb
|
165
|
+
- lib/fec/messenger.rb
|
166
|
+
- lib/fec/version.rb
|
167
|
+
- spec/fec_spec.rb
|
168
|
+
- spec/spec_helper.rb
|
169
|
+
homepage: https://github.com/CQBinh/fec
|
170
|
+
licenses:
|
171
|
+
- MIT
|
172
|
+
metadata: {}
|
173
|
+
post_install_message:
|
174
|
+
rdoc_options: []
|
175
|
+
require_paths:
|
176
|
+
- lib
|
177
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
requirements: []
|
188
|
+
rubyforge_project:
|
189
|
+
rubygems_version: 2.4.5.1
|
190
|
+
signing_key:
|
191
|
+
specification_version: 4
|
192
|
+
summary: File Extension Changer.
|
193
|
+
test_files:
|
194
|
+
- spec/fec_spec.rb
|
195
|
+
- spec/spec_helper.rb
|