anime_renamer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dc144aa572aed08ce9ce7dd6973edd479666747f3dc572632c0ddd24da6a897f
4
+ data.tar.gz: f12ff1bc4790ffd208bea8bf1d78fb5d2df2b1f735876fc31b82511b81c6a41c
5
+ SHA512:
6
+ metadata.gz: 55b3edb5e3e3068fcac2da1599431bb1bd340f3b229a4c7e0c569b1c7e4b72a22b397498bee9dbca77af06a63c307274ce5ac97f8c95d1dfc47e954e32a5c841
7
+ data.tar.gz: 38f45a6356fb00798ebbe821f62095ed9b14b0d9858f66f7f2e1553ee62e40055767a3b1ad627b762d44873a8b21529fa726b75c839e9e82673e4fa3dbfc5f0c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea/*
10
+ !.idea/runConfigurations
11
+ !.idea/*.iml
12
+ !.idea/*.xml
13
+ .idea/workspace.xml
14
+ .idea/vcs.xml
15
+ # rspec failure tracking
16
+ .rspec_status
17
+ *.gem
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,35 @@
1
+ stages:
2
+ - test
3
+ - build
4
+ - publish
5
+
6
+ Unit Test:
7
+ stage: test
8
+ tags:
9
+ - rubygem
10
+ script:
11
+ - bundle install
12
+ - bundle exec rspec
13
+ Build:
14
+ tags:
15
+ - rubygem
16
+ stage: build
17
+ script: gem build $GEM_NAME
18
+ artifacts:
19
+ paths:
20
+ - ./*.gem
21
+ Publish:
22
+ tags:
23
+ - rubygem
24
+ stage: publish
25
+ script:
26
+ - mkdir ~/.gem
27
+ - "echo \":rubygems_api_key: $API_KEY\" > ~/.gem/credentials"
28
+ - chmod 0600 ~/.gem/credentials
29
+ - gem push $GEM_NAME-*.gem
30
+ after_script:
31
+ - shred -vfu ~/.gem/credentials
32
+ only:
33
+ - /v[0-9\.]*/
34
+ except:
35
+ - branches
@@ -0,0 +1,74 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared>
5
+ <configuration default="false" name="Local Install" type="RakeRunConfigurationType" factoryName="Rake">
6
+ <module name="AnimeRenamer" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
9
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
10
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
11
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
12
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
13
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
14
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
15
+ <EXTENSION ID="net.ashald.envfile">
16
+ <option name="IS_ENABLED" value="false" />
17
+ <option name="IS_SUBST" value="false" />
18
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
19
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
20
+ <ENTRIES>
21
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
22
+ </ENTRIES>
23
+ </EXTENSION>
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="install" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
27
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
28
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
29
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
30
+ <method v="2" />
31
+ </configuration>
32
+ <configuration default="false" name="Unit Test" type="RakeRunConfigurationType" factoryName="Rake">
33
+ <module name="AnimeRenamer" />
34
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
35
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
36
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
37
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
38
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
39
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
40
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
41
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
42
+ <EXTENSION ID="net.ashald.envfile">
43
+ <option name="IS_ENABLED" value="false" />
44
+ <option name="IS_SUBST" value="false" />
45
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
46
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
47
+ <ENTRIES>
48
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
49
+ </ENTRIES>
50
+ </EXTENSION>
51
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
52
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
53
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
54
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
55
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
56
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
57
+ <method v="2" />
58
+ </configuration>
59
+ </shared>
60
+ </component>
61
+ <component name="NewModuleRootManager">
62
+ <content url="file://$MODULE_DIR$" />
63
+ <orderEntry type="inheritedJdk" />
64
+ <orderEntry type="sourceFolder" forTests="false" />
65
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.0-p0) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.6.0-p0) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.0-p0) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, ruby-2.6.0-p0) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
73
+ </component>
74
+ </module>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.0-p0" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/AnimeRenamer.iml" filepath="$PROJECT_DIR$/.idea/AnimeRenamer.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,29 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Local Install" type="RakeRunConfigurationType" factoryName="Rake">
3
+ <module name="AnimeRenamer" />
4
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
5
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
6
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
9
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
10
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
11
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
12
+ <EXTENSION ID="net.ashald.envfile">
13
+ <option name="IS_ENABLED" value="false" />
14
+ <option name="IS_SUBST" value="false" />
15
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
16
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
17
+ <ENTRIES>
18
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
19
+ </ENTRIES>
20
+ </EXTENSION>
21
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="install" />
22
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
23
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
27
+ <method v="2" />
28
+ </configuration>
29
+ </component>
@@ -0,0 +1,29 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Unit Test" type="RakeRunConfigurationType" factoryName="Rake">
3
+ <module name="AnimeRenamer" />
4
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
5
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
6
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
9
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
10
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
11
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
12
+ <EXTENSION ID="net.ashald.envfile">
13
+ <option name="IS_ENABLED" value="false" />
14
+ <option name="IS_SUBST" value="false" />
15
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
16
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
17
+ <ENTRIES>
18
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
19
+ </ENTRIES>
20
+ </EXTENSION>
21
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
22
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
23
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
27
+ <method v="2" />
28
+ </configuration>
29
+ </component>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CONTRIBUTING.MD ADDED
@@ -0,0 +1,95 @@
1
+ # Contributing
2
+
3
+ When contributing to this repository, please first discuss the change you wish to make via issue,
4
+ email, or any other method with the owners of this repository before making a change.
5
+
6
+ Please note we have a code of conduct, please follow it in all your interactions with the project.
7
+
8
+ ## Pull Request Process
9
+
10
+ 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11
+ build.
12
+ 2. Update the README.md with details of changes to the interface, this includes new environment
13
+ variables, exposed ports, useful file locations and container parameters.
14
+ 3. Increase the version numbers in any examples files and the README.md to the new version that this
15
+ Pull Request would represent.
16
+
17
+ The versioning scheme we use is [SemVer](http://semver.org/).
18
+
19
+ 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
20
+ do not have permission to do that, you may request the second reviewer to merge it for you.
21
+
22
+ ## Code of Conduct
23
+
24
+ ### Our Pledge
25
+
26
+ In the interest of fostering an open and welcoming environment, we as
27
+ contributors and maintainers pledge to making participation in our project and
28
+ our community a harassment-free experience for everyone, regardless of age, body
29
+ size, disability, ethnicity, gender identity and expression, level of experience,
30
+ nationality, personal appearance, race, religion, or sexual identity and
31
+ orientation.
32
+
33
+ ### Our Standards
34
+
35
+ Examples of behavior that contributes to creating a positive environment
36
+ include:
37
+
38
+ * Using welcoming and inclusive language
39
+ * Being respectful of differing viewpoints and experiences
40
+ * Gracefully accepting constructive criticism
41
+ * Focusing on what is best for the community
42
+ * Showing empathy towards other community members
43
+
44
+ Examples of unacceptable behavior by participants include:
45
+
46
+ * The use of sexualized language or imagery and unwelcome sexual attention or
47
+ advances
48
+ * Trolling, insulting/derogatory comments, and personal or political attacks
49
+ * Public or private harassment
50
+ * Publishing others' private information, such as a physical or electronic
51
+ address, without explicit permission
52
+ * Other conduct which could reasonably be considered inappropriate in a
53
+ professional setting
54
+
55
+ ### Our Responsibilities
56
+
57
+ Project maintainers are responsible for clarifying the standards of acceptable
58
+ behavior and are expected to take appropriate and fair corrective action in
59
+ response to any instances of unacceptable behavior.
60
+
61
+ Project maintainers have the right and responsibility to remove, edit, or
62
+ reject comments, commits, code, wiki edits, issues, and other contributions
63
+ that are not aligned to this Code of Conduct, or to ban temporarily or
64
+ permanently any contributor for other behaviors that they deem inappropriate,
65
+ threatening, offensive, or harmful.
66
+
67
+ ### Scope
68
+
69
+ This Code of Conduct applies both within project spaces and in public spaces
70
+ when an individual is representing the project or its community. Examples of
71
+ representing a project or community include using an official project e-mail
72
+ address, posting via an official social media account, or acting as an appointed
73
+ representative at an online or offline event. Representation of a project may be
74
+ further defined and clarified by project maintainers.
75
+
76
+ ### Enforcement
77
+
78
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
79
+ reported by contacting the project team at [kirinnee](kirinnee@gmail.com). All
80
+ complaints will be reviewed and investigated and will result in a response that
81
+ is deemed necessary and appropriate to the circumstances. The project team is
82
+ obligated to maintain confidentiality with regard to the reporter of an incident.
83
+ Further details of specific enforcement policies may be posted separately.
84
+
85
+ Project maintainers who do not follow or enforce the Code of Conduct in good
86
+ faith may face temporary or permanent repercussions as determined by other
87
+ members of the project's leadership.
88
+
89
+ ### Attribution
90
+
91
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
92
+ available at [http://contributor-covenant.org/version/1/4][version]
93
+
94
+ [homepage]: http://contributor-covenant.org
95
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ anime_renamer (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.8.0)
12
+ rspec-core (~> 3.8.0)
13
+ rspec-expectations (~> 3.8.0)
14
+ rspec-mocks (~> 3.8.0)
15
+ rspec-core (3.8.0)
16
+ rspec-support (~> 3.8.0)
17
+ rspec-expectations (3.8.2)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.8.0)
20
+ rspec-mocks (3.8.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-support (3.8.0)
24
+
25
+ PLATFORMS
26
+ x64-mingw32
27
+
28
+ DEPENDENCIES
29
+ anime_renamer!
30
+ bundler (~> 1.17)
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.17.2
data/LICENSE.MD ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2019 kirinnee
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Anime Renamer
2
+
3
+ CLI to rename anime episodes
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'anime_renamer'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install anime_renamer
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ $ anirename <anime-name> <extension> <glob> <max episode digit>
25
+ ```
26
+ | Name | Description |
27
+ | --- | --- |
28
+ | anime-name | anime name to rename to |
29
+ | extension | extension name to rename |
30
+ | glob | glob to look for files, relative to current directory |
31
+ | max episode digit | number of digits to pad, and look for at most |
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies.
36
+
37
+ Then, run `rake unit` to run the unit tests.
38
+
39
+ To install this gem onto your local machine, run `rake install:local`.
40
+ at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
+
42
+ ## Contributing
43
+ Please read [CONTRIBUTING.md](CONTRIBUTING.MD) for details on our code of conduct, and the process for submitting pull requests to us.
44
+
45
+ ## Versioning
46
+ We use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.
47
+
48
+ ## Authors
49
+ * [kirinnee](mailto:kirinnee@gmail.com)
50
+
51
+ ## License
52
+ This project is licensed under MIT - see the [LICENSE.md](LICENSE.MD) file for details
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task" #
3
+
4
+ RSpec::Core::RakeTask.new(:spec) #
5
+
6
+
7
+ task :unit => :spec
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "anime_renamer/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "anime_renamer"
7
+ spec.version = AnimeRenamer::VERSION
8
+ spec.authors = ["kirinnee"]
9
+ spec.email = ["kirinnee@gmail.com"]
10
+
11
+ spec.summary = %q{CLI to rename anime episodes}
12
+ spec.homepage = "https://gitlab.com/ruby-gem/anime-renamer.git"
13
+ spec.license = "MIT"
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/})}
19
+ end
20
+ spec.executables = ["anirename"]
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.17"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
data/bin/anirename ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "anime_renamer"
3
+
4
+ rename = AnimeRenamer::Renamer.new
5
+ rename.run ARGV
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cyanfoldername"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/files/a.brb ADDED
File without changes
data/files/a.txt ADDED
File without changes
data/files/b.txt ADDED
File without changes
data/files/c.toml ADDED
File without changes
data/files/c.txt ADDED
File without changes
data/files/d.yaml ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ module AnimeRenamer
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,39 @@
1
+ require "anime_renamer/version"
2
+
3
+ module AnimeRenamer
4
+
5
+ class Renamer
6
+
7
+ def run(args)
8
+ name = args[0]
9
+ ext = args[1] || ".mkv"
10
+ dir = args[2] || "./**/*.*"
11
+ digits = args[3] || 2
12
+ get_file_with_extension(dir, ext).map {|x| [x, rename(x, name, digits)]}.each do |file|
13
+ p file[0]
14
+ p file[1]
15
+ change_name file[0], file[1]
16
+ end
17
+ end
18
+
19
+ def get_file_with_extension(dir, ext)
20
+
21
+ Dir.glob(dir).select {|file| File.extname(file) == ext}
22
+ end
23
+
24
+ def change_name(file, new_name)
25
+ ext = File.extname file
26
+ File.rename(file, "#{new_name}#{ext}")
27
+ end
28
+
29
+ def rename(original, name, digits = 2)
30
+ ext = File.extname original
31
+ basename = File.basename original, ext
32
+ basename.sub! /\[.*\]/, ""
33
+ episode, _ = basename.match(/\A.*[^\.0-9]([0-9]{1,#{digits}})[^\.0-9].*\z/i)&.captures
34
+ point5, _ = basename.match(/\A.*[^0-9]([0-9]{1,#{digits}}\.5)[^0-9].*\z/i)&.captures
35
+ return p basename if (episode || point5).nil?
36
+ p "#{name} Episode #{(episode || point5).to_s.rjust(digits, "0")}"
37
+ end
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anime_renamer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - kirinnee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - kirinnee@gmail.com
58
+ executables:
59
+ - anirename
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".gitlab-ci.yml"
65
+ - ".idea/AnimeRenamer.iml"
66
+ - ".idea/encodings.xml"
67
+ - ".idea/misc.xml"
68
+ - ".idea/modules.xml"
69
+ - ".idea/runConfigurations/Local_Install.xml"
70
+ - ".idea/runConfigurations/Unit_Test.xml"
71
+ - ".rspec"
72
+ - CONTRIBUTING.MD
73
+ - Gemfile
74
+ - Gemfile.lock
75
+ - LICENSE.MD
76
+ - README.md
77
+ - Rakefile
78
+ - anime_renamer.gemspec
79
+ - bin/anirename
80
+ - bin/console
81
+ - bin/setup
82
+ - files/a.brb
83
+ - files/a.txt
84
+ - files/b.txt
85
+ - files/c.toml
86
+ - files/c.txt
87
+ - files/d.yaml
88
+ - lib/anime_renamer.rb
89
+ - lib/anime_renamer/version.rb
90
+ homepage: https://gitlab.com/ruby-gem/anime-renamer.git
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubygems_version: 3.0.3
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: CLI to rename anime episodes
113
+ test_files: []