require_smasher 0.4.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1bdabdf18d5f1fc092d39b3f11338a9c2eabfe94
4
- data.tar.gz: 031b277e8b2bad03fb7bff60c39f1cb64f4a5ee5
2
+ SHA256:
3
+ metadata.gz: 104ba3ed74359a5dd0d3609452331e22cb898ebccfbcd9bbc4df8a51ac01c96c
4
+ data.tar.gz: d3fa6986eec33a53a0b1be54921ca9a8dc6fa7b3e02fff0b05b70e18bbb996d7
5
5
  SHA512:
6
- metadata.gz: d7a1f2c21c4724a026bc6914f0f33e7f7cfc2ee1163d82d06e761eb48b94eeb6d962439e607f0c0b53fc536a10de110b116342b4c1a20b01a6c80dfb20f99931
7
- data.tar.gz: 1f0a87d959d93bb05f872b7c295d100241d48a042da53c981624b625b12558448054c1fe4d508f88ce55e07695901fc621f938f3c6bf5a7d3c92958c44b22d13
6
+ metadata.gz: a461b50c194892268df37dc576db7a92d0f3d172c520e594bc8011d780dae6a568a3333934a20e6ff23693e09e68506102ef4a555ccfd31e520e7a1c289b2e62
7
+ data.tar.gz: 28f700ef8cdd20f682a35b4f96da5f62c0fdc8b645bd643b527dcaa6f58fcf2571db821cd32469f4aedcf1b0ee51d7706742bffaa037794f5e07576aa54e7a5c
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'require_smasher/version'
2
4
  require 'require_smasher/file_smasher'
3
5
  require 'require_smasher/classifier'
@@ -1,19 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Classify elements in files or gems
2
4
 
3
5
  module Classifier
4
6
  class << self
5
7
  def classify(elements)
6
- files = []
7
- gems = []
8
-
9
- elements.uniq.each do |element|
10
- case element_type(element)
11
- when :file then files << element
12
- when :directory then files.concat(FileSmasher.files_by(element))
13
- else gems << element
14
- end
15
- end
16
- { files: files, gems: gems }
8
+ elements.uniq!
9
+ files = elements.select { |element| element_type(element) == :file }
10
+ directories = (elements - files).select { |element| element_type(element) == :directory }
11
+ gems = elements - files - directories
12
+ files << directories.map { |directory| FileSmasher.files_by(directory) }
13
+ { files: files.flatten, gems: gems }
17
14
  end
18
15
 
19
16
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define base class for handle errors
2
4
 
3
5
  class BaseError < StandardError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define super class for handle errors about elements that do not exist
2
4
 
3
5
  class NotExistError < BaseError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define class for handle errors about inexistent directory
2
4
 
3
5
  class DirNotExistError < NotExistError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define super class for handle errors about elements that were not informed
2
4
 
3
5
  class NotInformedError < BaseError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define class for handle error when a directory is not informed
2
4
 
3
5
  class DirNotInformedError < NotInformedError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define class for handle error when a file is not informed
2
4
 
3
5
  class FileNotInformedError < NotInformedError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define class for handle error when a gem is not informed
2
4
 
3
5
  class GemNotInformedError < NotInformedError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Define class for handle error when a file is required
2
4
 
3
5
  class RequireFileError < BaseError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Find files
2
4
 
3
5
  module FileSmasher
@@ -11,12 +13,7 @@ module FileSmasher
11
13
  def files(directories)
12
14
  raise DirNotInformedError if directories.empty?
13
15
 
14
- files = []
15
- directories.uniq.each do |directory|
16
- files.concat(FileSmasher.files_by(directory))
17
- end
18
-
19
- files
16
+ directories.uniq.map { |directory| FileSmasher.files_by(directory) }.flatten
20
17
  end
21
18
 
22
19
  def file?(element)
@@ -1,18 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Handle requiring files
2
4
 
3
5
  module RequireFile
4
6
  class << self
5
- def require(files)
7
+ def require(files, total = nil)
6
8
  raise FileNotInformedError if files.empty?
7
9
 
8
- errors_list = require_files(files)
9
- files_with_error = errors_list[:files_with_error]
10
-
11
- return if files_with_error.empty?
10
+ results = require_files(files)
11
+ results.select! { |r| r[:error] }
12
+ return if results.empty?
13
+ raise RequireFileError, (results.map { |result| result[:message] }) if total == results.count
12
14
 
13
- raise RequireFileError, errors_list[:errors] if files == files_with_error
14
-
15
- require(files_with_error)
15
+ require(results.map { |result| result[:file] }, results.count)
16
16
  end
17
17
 
18
18
  def require_directories(directories)
@@ -24,18 +24,12 @@ module RequireFile
24
24
  private
25
25
 
26
26
  def require_files(files)
27
- errors_list = { files_with_error: [], errors: [] }
28
-
29
- files.uniq.each do |file|
30
- begin
31
- require_relative File.expand_path("./#{file}")
32
- rescue LoadError, StandardError => error
33
- errors_list[:files_with_error] << file
34
- errors_list[:errors] << "Error while requiring file #{file}: #{error.message}"
35
- end
27
+ files.uniq.map do |file|
28
+ require_relative File.expand_path("./#{file}")
29
+ { file: file, error: false, message: nil }
30
+ rescue LoadError, StandardError => e
31
+ { file: file, error: true, message: "Error while requiring file #{file}: #{e.message}" }
36
32
  end
37
-
38
- errors_list
39
33
  end
40
34
  end
41
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RequireSmasher
2
- VERSION = '0.4.1'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_smasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joacir Junior
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-14 00:00:00.000000000 Z
11
+ date: 2020-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,98 +16,116 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.1.4
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 13.0.1
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '10.0'
43
+ version: '13.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 13.0.1
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rspec
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '3.0'
53
+ version: '3.9'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '3.0'
60
+ version: '3.9'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: simplecov
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0.16'
67
+ version: 0.18.5
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0.16'
74
+ version: 0.18.5
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rubocop
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0.59'
81
+ version: 0.86.0
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0.59'
88
+ version: 0.86.0
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: byebug
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '10.0'
95
+ version: '11.1'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 11.1.3
90
99
  type: :development
91
100
  prerelease: false
92
101
  version_requirements: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - "~>"
95
104
  - !ruby/object:Gem::Version
96
- version: '10.0'
105
+ version: '11.1'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 11.1.3
97
109
  - !ruby/object:Gem::Dependency
98
110
  name: rubycritic
99
111
  requirement: !ruby/object:Gem::Requirement
100
112
  requirements:
101
113
  - - "~>"
102
114
  - !ruby/object:Gem::Version
103
- version: '3.4'
115
+ version: '4.5'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 4.5.1
104
119
  type: :development
105
120
  prerelease: false
106
121
  version_requirements: !ruby/object:Gem::Requirement
107
122
  requirements:
108
123
  - - "~>"
109
124
  - !ruby/object:Gem::Version
110
- version: '3.4'
125
+ version: '4.5'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 4.5.1
111
129
  description: Require Smasher give you the power to require ruby files in a list of
112
130
  directories and their sub-directories (recursively), a list of ruby files and a
113
131
  list of gems, with just one command.
@@ -117,16 +135,6 @@ executables: []
117
135
  extensions: []
118
136
  extra_rdoc_files: []
119
137
  files:
120
- - ".gitignore"
121
- - ".rspec"
122
- - ".rubocop.yml"
123
- - ".travis.yml"
124
- - CODE_OF_CONDUCT.md
125
- - Gemfile
126
- - LICENSE.txt
127
- - README.md
128
- - README.pt-BR.md
129
- - Rakefile
130
138
  - bin/console
131
139
  - bin/setup
132
140
  - lib/require_smasher.rb
@@ -142,8 +150,6 @@ files:
142
150
  - lib/require_smasher/file_smasher.rb
143
151
  - lib/require_smasher/require_file.rb
144
152
  - lib/require_smasher/version.rb
145
- - require_smasher.gemspec
146
- - todos.txt
147
153
  homepage: https://github.com/jrjoacir/require-smasher
148
154
  licenses:
149
155
  - MIT
@@ -165,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
171
  version: '0'
166
172
  requirements: []
167
173
  rubyforge_project:
168
- rubygems_version: 2.6.13
174
+ rubygems_version: 2.7.7
169
175
  signing_key:
170
176
  specification_version: 4
171
177
  summary: A simple way to require ruby files in directories and in its sub-directories,
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- .byebug_history
11
-
12
- # rspec failure tracking
13
- .rspec_status
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,11 +0,0 @@
1
- Metrics/LineLength:
2
- Max: 120
3
-
4
- Style/Documentation:
5
- Enabled: false
6
-
7
- AllCops:
8
- Exclude:
9
- - 'bin/**/*'
10
- Include:
11
- - 'lib/**/*.rb'
@@ -1,14 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- - 2.3.7
6
- - 2.4.0
7
- - 2.4.4
8
- - 2.5.1
9
- before_install:
10
- - gem install bundler -v 1.16.3
11
- - bundle install
12
- install:
13
- - bundle exec rspec
14
- - bundle exec rubocop
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at jr.joacir@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in require_smasher.gemspec
6
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Joacir Junior
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 DELETED
@@ -1,101 +0,0 @@
1
- # RequireSmasher
2
- [![Build Status](https://travis-ci.com/jrjoacir/require-smasher.svg?branch=master)](https://travis-ci.com/jrjoacir/require-smasher)
3
-
4
- Leia esta documentação em [Português do Brasil](README.pt-BR.md).
5
-
6
- This project was born just to solve a problem: require ruby files **recursively** in a directory. However it grew up and learned to solve other simple problems:
7
-
8
- - require ruby files recursively in a directory and its sub-directories, trying to resolve interdependent files (`require_dir`)
9
- - require ruby files recursively in a list of directories and their sub-directories, trying to resolve interdependent files (`require_dirs`)
10
- - require a gem (`require_gem`)
11
- - require a list of gems (`require_gems`)
12
- - require a ruby file (`require_file`)
13
- - require a list of ruby files (`require_files`)
14
- - require a **list of gems**, ruby files in a **list of directories** and their sub-directories and a **list of files** with just **one command** (`require_all`)
15
-
16
- ## Installation
17
-
18
- Add this line to your application's Gemfile:
19
-
20
- ```ruby
21
- gem 'require_smasher'
22
- ```
23
-
24
- And then execute:
25
-
26
- $ bundle
27
-
28
- Or install it yourself as:
29
-
30
- $ gem install require_smasher
31
-
32
- ## Usage
33
-
34
- ### Require All
35
-
36
- ```ruby
37
- require_all 'directory_1', 'directory_2/sub-directory', 'gem_1', 'gem_2', 'directory_3/filename_1', 'filename_2'
38
- ```
39
- This command will require all ruby files found in directory `directory_1` and its sub-directories, all ruby files in directory `directory_2/sub-directory` and in its sub-directories, gem `gem_1` and gem `gem_2`, and files `directory_3/filename_1.rb` and `filename_2.rb`.
40
-
41
- **Note**: the order of elements is not important, because Require Smasher will try to resolve any dependences among them.
42
-
43
- ### Require Dir
44
-
45
- ```ruby
46
- require_dir 'directory_1'
47
- ```
48
- This command will require all ruby files found in directory `directory_1` and in its sub-directories.
49
-
50
- ### Require Dirs
51
-
52
- ```ruby
53
- require_dirs 'directory_1', 'directory_2/sub-directory'
54
- ```
55
- This command accept a list of directories and it will require all ruby files found in directory `directory_1` and in its sub-directories, all ruby files in directory `directory_2/sub-directory` and in its sub-directories.
56
-
57
- ### Require Gem
58
-
59
- ```ruby
60
- require_gem 'gem'
61
- ```
62
- This command will require the informed gem.
63
-
64
- ### Require Gems
65
-
66
- ```ruby
67
- require_gems 'gem_1', 'gem_2'
68
- ```
69
- This command accept a list of gems and it will require gems `gem_1` and `gem_2`.
70
-
71
- ### Require File
72
-
73
- ```ruby
74
- require_file 'filename'
75
- ```
76
- This command will require the file `filename.rb`. You don't have to inform Ruby extension file (**rb**), if you want.
77
-
78
- ### Require Files
79
-
80
- ```ruby
81
- require_files 'filename_1', 'directory/filename_2', 'directory/filename_3.rb'
82
- ```
83
- This command accept a list of files and it will require files `filename_1.rb`, `directory/filename_2.rb` and `directory/filename_3.rb`. You don't have to inform Ruby extension file (**rb**), if you want.
84
-
85
- ## Development
86
-
87
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
88
-
89
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
90
-
91
- ## Contributing
92
-
93
- Bug reports and pull requests are welcome on GitHub at https://github.com/jrjoacir/require-smasher. 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.
94
-
95
- ## License
96
-
97
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
98
-
99
- ## Code of Conduct
100
-
101
- Everyone interacting in the RequireSmasher project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/require_smasher/blob/master/CODE_OF_CONDUCT.md).
@@ -1,102 +0,0 @@
1
- # RequireSmasher
2
- [![Build Status](https://travis-ci.com/jrjoacir/require-smasher.svg?branch=master)](https://travis-ci.com/jrjoacir/require-smasher)
3
-
4
- Read this documentation in [English](README.md).
5
-
6
- Este projeto nasceu apenas para resolver um problema: fazer `require` de arquivos em um diretório recursivamente. Porém ele cresceu e aprendeu a resolver outros problemas simples:
7
-
8
- - fazer `require` em arquivos `ruby` recursivamente em um diretório e seus subdiretórios, tentando resolver interdependências entre os arquivos (`require_dir`)
9
- - fazer `require` em arquivos `ruby` recursivamente em uma lista de diretórios e seus subdiretórios, tentando resolver interdependências entre os arquivos (`require_dirs`)
10
- - fazer `require` de uma `gem` (`require_gem`)
11
- - fazer `require` de uma lista de `gems` (`require_gems`)
12
- - fazer `require` de um arquivo `ruby` (`require_file`)
13
- - fazer `require` de uma lista de arquivos `ruby` (`require_files`)
14
- - fazer `require` de uma **lista de `gems`**, arquivos `ruby` em uma **lista de diretórios** e seus subdiretórios e uma **lista de arquivos** com apenas **um comando** (`require_all`)
15
-
16
- ## Instalação
17
-
18
- Adicione esta linha no arquivo `Gemfile` de sua aplicação:
19
-
20
- ```ruby
21
- gem 'require_smasher'
22
- ```
23
-
24
- E então execute:
25
-
26
- $ bundle
27
-
28
- Ou instale-o isoladamente:
29
-
30
- $ gem install require_smasher
31
-
32
- ## Uso
33
-
34
- ### Require All
35
-
36
- ```ruby
37
- require_all 'directory_1', 'directory_2/sub-directory', 'gem_1', 'gem_2', 'directory_3/filename_1', 'filename_2'
38
- ```
39
-
40
- Este comando fará o `require` de todos os arquivos `ruby` encontrados no diretório `directory_1` e nos seus subdiretórios, todos os arquivos `ruby` no diretório `directory_2/sub-directory` e nos seus subdiretórios, da `gem` `gem_1` e da `gem` `gem_2`, e dos arquivos `directory_3/filename_1.rb` e `filename_2.rb`.
41
-
42
- **Observação:** a ordem dos elementos não importa, pois o `Require Smasher` tentará resolver qualquer dependência entre eles.
43
-
44
- ### Require Dir
45
-
46
- ```ruby
47
- require_dir 'directory_1'
48
- ```
49
- Este comando fará o `require` de todos os arquivos `ruby` encontrados no diretório `directory_1` e em seus subdiretórios.
50
-
51
- ### Require Dirs
52
-
53
- ```ruby
54
- require_dirs 'directory_1', 'directory_2/sub-directory'
55
- ```
56
- Este comando aceita uma lista de diretórios e fará o `require` de todos os arquivos `ruby` encontrados no diretório `directory_1` e em seus subdiretórios, todos os arquivos `ruby` no diretório `directory_2/sub-directory` e em seus subdiretórios.
57
-
58
- ### Require Gem
59
-
60
- ```ruby
61
- require_gem 'gem'
62
- ```
63
- Este comando fará o `require` da `gem` informada.
64
-
65
- ### Require Gems
66
-
67
- ```ruby
68
- require_gems 'gem_1', 'gem_2'
69
- ```
70
- Este comando aceita uma lista de `gems` e fará o `require` das `gems` `gem_1` e `gem_2`.
71
-
72
- ### Require File
73
-
74
- ```ruby
75
- require_file 'filename'
76
- ```
77
- Este comando fará o `require` do arquivo `filename.rb`. Você não precisa informar a extensão `ruby` do arquivo (**rb**), se você não quiser.
78
-
79
- ### Require Files
80
-
81
- ```ruby
82
- require_files 'filename_1', 'directory/filename_2', 'directory/filename_3.rb'
83
- ```
84
- Este comando aceita uma lista de arquivos e fará o `require` dos arquivos `filename_1.rb`, `directory/filename_2.rb` e `directory/filename_3.rb`. Você não precisa informar a extensão `ruby` do arquivo (**rb**), se você não quiser.
85
-
86
- ## Desenvolvimento
87
-
88
- Depois de dar `checkout` neste repositório, execute `bin/setup` para instalar as dependências. Então, execute `rake spec` para executar os testes. Você pode também executar `bin/console` para abrir um `prompt` interativo que permitirá você experimentar esta biblioteca (`gem`).
89
-
90
- Para instalar esta `gem` dentro de uma máquina local, execute `bundle exec rake install`. Para lançar uma nova versão, atualize o número da versão no arquivo `version.rb`, e então execute `bundle exec rake release`, ele criará uma `tag` do `git` para a versão, dará `push` dos `commits` do `git`, e do arquivo `.gem` para [rubygems.org](https://rubygems.org).
91
-
92
- ## Contribuindo
93
-
94
- Reportar erros e `pull requests` são bem-vindo no GitHub em https://github.com/jrjoacir/require-smasher. Este projeto tem a intenção de ser seguro, espaço bem-vindo para colaboração, e é esperado que os contribuidores adiram ao código de conduta do [Contributor Covenant](http://contributor-covenant.org).
95
-
96
- ## Licença
97
-
98
- Esta `gem` está disponível como código aberto e está registrada sobres os termos de licença da [MIT License](http://opensource.org/licenses/MIT).
99
-
100
- ## Código de Conduta
101
-
102
- Todos que interagirem com o código fonte do projeto RequireSmasher, `issue trackers`, salas de bate-papo e lista de emails é esperado seguir o [código de conduta](https://github.com/[USERNAME]/require_smasher/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,40 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "require_smasher/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "require_smasher"
8
- spec.version = RequireSmasher::VERSION
9
- spec.authors = ["Joacir Junior"]
10
- spec.email = ["jr.joacir@gmail.com"]
11
-
12
- spec.summary = %q{A simple way to require ruby files in directories and in its sub-directories, and gems.}
13
- spec.description = %q{Require Smasher give you the power to require ruby files in a list of directories and their sub-directories (recursively), a list of ruby files and a list of gems, with just one command.}
14
- spec.homepage = "https://github.com/jrjoacir/require-smasher"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "bundler", "~> 1.16"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "rspec", "~> 3.0"
36
- spec.add_development_dependency "simplecov", "~> 0.16"
37
- spec.add_development_dependency "rubocop", "~> 0.59"
38
- spec.add_development_dependency "byebug", "~> 10.0"
39
- spec.add_development_dependency "rubycritic", "~> 3.4"
40
- end
data/todos.txt DELETED
@@ -1 +0,0 @@
1
- atualizar readme para informar sobre gemas e arquitetura utilizada para desenvolvimento