sortme 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb9630f7d3c5ba2b94a614c318aff02f1d55e269
4
+ data.tar.gz: f6616a58d37c6861f149cad4422c31fe401aeed2
5
+ SHA512:
6
+ metadata.gz: 5745737b4f4953ddcba83b0290909c332e66087727d8ebb04ee78de6bc95b9d016ada1bf15e3630c3d52b1ea26c71f926dfcffbbbb3ede7e1c1fcaab9c847863
7
+ data.tar.gz: 00d8c6918dbd9141106c229408c3acdc3ef46e33b3d73b300551fbdb5f9eb5402fc00fd14d0c5d21e7e9c4d012f4b6a889d193292bbd09f46c73539dc7ce2860
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,234 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ - "db/schema.rb"
5
+ - "lib/filesorter.rb"
6
+ UseCache: false
7
+ Style/CollectionMethods:
8
+ Description: Preferred collection methods.
9
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
10
+ Enabled: true
11
+ PreferredMethods:
12
+ collect: map
13
+ collect!: map!
14
+ find: detect
15
+ find_all: select
16
+ reduce: inject
17
+ Style/DotPosition:
18
+ Description: Checks the position of the dot in multi-line method calls.
19
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
20
+ Enabled: true
21
+ EnforcedStyle: trailing
22
+ SupportedStyles:
23
+ - leading
24
+ - trailing
25
+ Style/FileName:
26
+ Description: Use snake_case for source file names.
27
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
28
+ Enabled: false
29
+ Exclude: []
30
+ Style/GuardClause:
31
+ Description: Check for conditionals that can be replaced with guard clauses
32
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
33
+ Enabled: false
34
+ MinBodyLength: 1
35
+ Style/IfUnlessModifier:
36
+ Description: Favor modifier if/unless usage when you have a single-line body.
37
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
38
+ Enabled: false
39
+ MaxLineLength: 80
40
+ Style/OptionHash:
41
+ Description: Don't use option hashes when you can use keyword arguments.
42
+ Enabled: false
43
+ Style/PercentLiteralDelimiters:
44
+ Description: Use `%`-literal delimiters consistently
45
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
46
+ Enabled: false
47
+ PreferredDelimiters:
48
+ "%": "()"
49
+ "%i": "()"
50
+ "%q": "()"
51
+ "%Q": "()"
52
+ "%r": "{}"
53
+ "%s": "()"
54
+ "%w": "()"
55
+ "%W": "()"
56
+ "%x": "()"
57
+ Style/PredicateName:
58
+ Description: Check the names of predicate methods.
59
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
60
+ Enabled: true
61
+ NamePrefix:
62
+ - is_
63
+ - has_
64
+ - have_
65
+ NamePrefixBlacklist:
66
+ - is_
67
+ Exclude:
68
+ - spec/**/*
69
+ Style/RaiseArgs:
70
+ Description: Checks the arguments passed to raise/fail.
71
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
72
+ Enabled: false
73
+ EnforcedStyle: exploded
74
+ SupportedStyles:
75
+ - compact
76
+ - exploded
77
+ Style/SignalException:
78
+ Description: Checks for proper usage of fail and raise.
79
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
80
+ Enabled: false
81
+ EnforcedStyle: semantic
82
+ SupportedStyles:
83
+ - only_raise
84
+ - only_fail
85
+ - semantic
86
+ Style/SingleLineBlockParams:
87
+ Description: Enforces the names of some block params.
88
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
89
+ Enabled: false
90
+ Methods:
91
+ - reduce:
92
+ - a
93
+ - e
94
+ - inject:
95
+ - a
96
+ - e
97
+ Style/SingleLineMethods:
98
+ Description: Avoid single-line methods.
99
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
100
+ Enabled: false
101
+ AllowIfMethodIsEmpty: true
102
+ Style/StringLiterals:
103
+ Description: Checks if uses of quotes match the configured preference.
104
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
105
+ Enabled: true
106
+ EnforcedStyle: double_quotes
107
+ SupportedStyles:
108
+ - single_quotes
109
+ - double_quotes
110
+ Style/StringLiteralsInInterpolation:
111
+ Description: Checks if uses of quotes inside expressions in interpolated strings
112
+ match the configured preference.
113
+ Enabled: true
114
+ EnforcedStyle: single_quotes
115
+ SupportedStyles:
116
+ - single_quotes
117
+ - double_quotes
118
+ Style/TrailingCommaInArguments:
119
+ Description: Checks for trailing comma in parameter lists and literals.
120
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
121
+ Enabled: false
122
+ EnforcedStyleForMultiline: no_comma
123
+ SupportedStyles:
124
+ - comma
125
+ - no_comma
126
+ Metrics/AbcSize:
127
+ Description: A calculated magnitude based on number of assignments, branches, and
128
+ conditions.
129
+ Enabled: false
130
+ Max: 15
131
+ Metrics/ClassLength:
132
+ Description: Avoid classes longer than 100 lines of code.
133
+ Enabled: false
134
+ CountComments: false
135
+ Max: 100
136
+ Metrics/ModuleLength:
137
+ CountComments: false
138
+ Max: 100
139
+ Description: Avoid modules longer than 100 lines of code.
140
+ Enabled: false
141
+ Metrics/CyclomaticComplexity:
142
+ Description: A complexity metric that is strongly correlated to the number of test
143
+ cases needed to validate a method.
144
+ Enabled: false
145
+ Max: 6
146
+ Metrics/MethodLength:
147
+ Description: Avoid methods longer than 10 lines of code.
148
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
149
+ Enabled: false
150
+ CountComments: false
151
+ Max: 10
152
+ Metrics/ParameterLists:
153
+ Description: Avoid parameter lists longer than three or four parameters.
154
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
155
+ Enabled: false
156
+ Max: 5
157
+ CountKeywordArgs: true
158
+ Metrics/PerceivedComplexity:
159
+ Description: A complexity metric geared towards measuring complexity for a human
160
+ reader.
161
+ Enabled: false
162
+ Max: 7
163
+ Lint/AssignmentInCondition:
164
+ Description: Don't use assignment in conditions.
165
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
166
+ Enabled: false
167
+ AllowSafeAssignment: true
168
+ Style/InlineComment:
169
+ Description: Avoid inline comments.
170
+ Enabled: false
171
+ Style/AccessorMethodName:
172
+ Description: Check the naming of accessor methods for get_/set_.
173
+ Enabled: false
174
+ Style/Alias:
175
+ Description: Use alias_method instead of alias.
176
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
177
+ Enabled: false
178
+ Style/Documentation:
179
+ Description: Document classes and non-namespace modules.
180
+ Enabled: false
181
+ Style/DoubleNegation:
182
+ Description: Checks for uses of double negation (!!).
183
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
184
+ Enabled: false
185
+ Style/EachWithObject:
186
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
187
+ Enabled: false
188
+ Style/EmptyLiteral:
189
+ Description: Prefer literals to Array.new/Hash.new/String.new.
190
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
191
+ Enabled: false
192
+ Style/ModuleFunction:
193
+ Description: Checks for usage of `extend self` in modules.
194
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
195
+ Enabled: false
196
+ Style/OneLineConditional:
197
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
198
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
199
+ Enabled: false
200
+ Style/PerlBackrefs:
201
+ Description: Avoid Perl-style regex back references.
202
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
203
+ Enabled: false
204
+ Style/Send:
205
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
206
+ may overlap with existing methods.
207
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
208
+ Enabled: false
209
+ Style/SpecialGlobalVars:
210
+ Description: Avoid Perl-style global variables.
211
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
212
+ Enabled: false
213
+ Style/VariableInterpolation:
214
+ Description: Don't interpolate global, instance and class variables directly in
215
+ strings.
216
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
217
+ Enabled: false
218
+ Style/WhenThen:
219
+ Description: Use when x then ... for one-line cases.
220
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
221
+ Enabled: false
222
+ Lint/EachWithObjectArgument:
223
+ Description: Check for immutable argument given to each_with_object.
224
+ Enabled: true
225
+ Lint/HandleExceptions:
226
+ Description: Don't suppress exception.
227
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
228
+ Enabled: false
229
+ Lint/LiteralInCondition:
230
+ Description: Checks of literals used in conditions.
231
+ Enabled: false
232
+ Lint/LiteralInInterpolation:
233
+ Description: Checks for literals used in interpolation.
234
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sortme.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TODO: Write your name
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,62 @@
1
+ [![Code Climate](https://codeclimate.com/github/andela-oosiname/sortme/badges/gpa.svg)](https://codeclimate.com/github/andela-oosiname/sortme) [![Build Status](https://travis-ci.org/andela-oosiname/sortme.svg?branch=master)](https://travis-ci.org/andela-oosiname/sortme)
2
+
3
+
4
+ # Sort Me
5
+
6
+ Sortme is a ruby application that helps you organize your media files by moving them from their current location to the appropriate media folder.
7
+
8
+ At the initial run, user sets up his path of preference for video, audio and picture files.
9
+
10
+ ## Installation
11
+
12
+ The User should have ruby set on his pc
13
+
14
+ The app is installed as a gem by running:
15
+
16
+ $ gem install sortme
17
+
18
+ ## Usage
19
+
20
+ After installation
21
+
22
+ Navigate via commandline to the folder you wish to sort your media files from and type `sortme`.
23
+
24
+ At first run, user has the option to use system default paths or custom paths
25
+
26
+ - To use default paths enter "y" at the prompt
27
+ - To use custom paths enter "n" and proceed to set up your media paths like so
28
+
29
+ `/Users/USER/movies`
30
+
31
+ `/Users/USER/music`
32
+
33
+ `/Users/USER/pictures`
34
+
35
+ Note: This is just an example path. If you are not familiar with file paths, hit y and press enter to use default paths for your system
36
+
37
+ The files are then moved to the set folders according to their media type.
38
+
39
+ You do not need to set paths on subsequent calls of `sortme` as the default paths will be saved in a .json file.
40
+
41
+ ## Changing Paths
42
+
43
+ ### Advanced
44
+
45
+ To edit your default paths, navigate to your home and locate `sortme_settings.json` and edit..
46
+
47
+ ### Others
48
+
49
+ - Go to your home directory and delete the `sortme_settings.json` file.
50
+ - Run sortme again
51
+ - do not edit if you are not familiar with json file format
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it ( https://github.com/andela-oosiname/filtersort/fork )
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create a new Pull Request
60
+
61
+ Note: I might not be immediately available to respond to pull requests as I am mostly busy..
62
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sortme"
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
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/bin/sortme ADDED
@@ -0,0 +1,2 @@
1
+ require "sortme"
2
+ Sortme::Sort.new.start
data/latest ADDED
@@ -0,0 +1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BjmqJI2NpJnuH/Ltyv9pU/805tL4crAVL6SJEpPyW1WpXkFupndJhO0/n89bjrplvkNgTURzFFpAIDtwahs9LBZhMWBY7irXve7ibygSTZAgoGCJ6ya+yXCXT2Nfc69gA5/VJ7TuE8e1UkPU8J2k0Y9 sname@Olumuyiwas-MacBook-Pro.local
@@ -0,0 +1,74 @@
1
+ module Sortme
2
+ class Path
3
+ require "json"
4
+
5
+ def self.set
6
+ puts "Do you want to use default paths? (type y if you are unsure) (y/n) "
7
+ choice = gets.chomp.downcase
8
+
9
+ @@mac_home = home = File.expand_path("~")
10
+ if choice=="y" && mac?
11
+ default_mac
12
+ elsif choice=="y" && windows?
13
+ default_windows
14
+ elsif choice=="custom"
15
+ custom
16
+ else
17
+ p "oops! run again"
18
+ exit
19
+ end
20
+
21
+ end
22
+
23
+ def self.mac?
24
+ /darwin/ =~ RUBY_PLATFORM
25
+ end
26
+
27
+ def self.windows?
28
+ /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
29
+ end
30
+
31
+ def self.custom
32
+ puts "Enter video path"
33
+ video_path = gets.chomp
34
+
35
+ puts "Enter music path"
36
+ music_path = gets.chomp
37
+
38
+ puts "Enter picture path"
39
+ picture_path = gets.chomp
40
+
41
+ save video_path, music_path, picture_path
42
+ end
43
+
44
+ def self.get
45
+ home = File.expand_path("~")
46
+ settings = "#{home}/sortme_settings.json"
47
+ json = File.read(settings)
48
+ JSON.parse(json)
49
+ end
50
+
51
+ def self.default_mac
52
+ picture_path = "#{@@mac_home}/Pictures"
53
+ video_path = "#{@@mac_home}/Movies"
54
+ music_path = "#{@@mac_home}/Music"
55
+
56
+ save video_path, music_path, picture_path
57
+ end
58
+
59
+ def self.save(video_path, music_path, picture_path)
60
+ home = File.expand_path("~")
61
+
62
+ system "echo '{\"video\":\"#{video_path}\",\"picture\":\"#{picture_path}\"
63
+ ,\"music\":\"#{music_path}\"}' > #{home}/sortme_settings.json"
64
+ end
65
+
66
+ def self.default_windows
67
+ picture_path =
68
+ video_path =
69
+ music_path =
70
+
71
+ save video_path, music_path, picture_path
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,3 @@
1
+ module Sortme
2
+ VERSION = "0.1.0".freeze
3
+ end
data/lib/sortme.rb ADDED
@@ -0,0 +1,38 @@
1
+ require "sortme/path"
2
+ require "sortme/version"
3
+
4
+ module Sortme
5
+ class Sort
6
+ def start
7
+ home = File.expand_path("~")
8
+ Path.set unless File.file?("#{home}/sortme_settings.json")
9
+ count = 0
10
+ Dir.foreach(".") do |file|
11
+ if media?(file)
12
+ path = get_path(file)
13
+ count += 1 if system "mv \"#{file}\" #{path}"
14
+ end
15
+ end
16
+ puts "#{count} files moved"
17
+ end
18
+
19
+ def get_all_paths
20
+ Path.get
21
+ end
22
+
23
+ def get_path(file)
24
+ paths = get_all_paths
25
+ case File.extname(file)
26
+ when ".png", ".jpg", ".gif" then paths["picture"]
27
+ when ".flv", ".mp4", ".vob", ".avi" then paths["video"]
28
+ when ".mp3", ".wma", ".wav" then paths["music"]
29
+ end
30
+ end
31
+
32
+ def media?(file)
33
+ extensions = [".png", ".gif", ".jpg", ".flv", ".mp4", ".vob", ".avi",
34
+ ".mp3", ".wma", ".wav"]
35
+ extensions.include? File.extname(file)
36
+ end
37
+ end
38
+ end
data/sortme.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "sortme/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sortme"
8
+ spec.version = Sortme::VERSION
9
+ spec.authors = ["Olumuyiwa Osiname"]
10
+ spec.email = ["olumuyiwa.osiname@andela.com"]
11
+
12
+ spec.summary = ["This gem installs sortme on your local machine"]
13
+ spec.description = ["Sortme is a script that helps move your media files from a folder into your library media folders"]
14
+ spec.homepage = "https://github.com/andela-oosiname/sortme"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = ["sortme"]
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.12"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sortme
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Olumuyiwa Osiname
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-09 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.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
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: '["Sortme is a script that helps move your media files from a folder
56
+ into your library media folders"]'
57
+ email:
58
+ - olumuyiwa.osiname@andela.com
59
+ executables:
60
+ - sortme
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".DS_Store"
65
+ - ".gitignore"
66
+ - ".rspec"
67
+ - ".rubocop.yml"
68
+ - ".travis.yml"
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - bin/sortme
76
+ - latest
77
+ - latest.pub
78
+ - lib/sortme.rb
79
+ - lib/sortme/path.rb
80
+ - lib/sortme/version.rb
81
+ - sortme.gemspec
82
+ homepage: https://github.com/andela-oosiname/sortme
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.5.1
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: '["This gem installs sortme on your local machine"]'
106
+ test_files: []