prependers 0.2.0 → 0.3.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
2
  SHA256:
3
- metadata.gz: 65760c94b14be5acf986ae0a58fa3306ac97b90a3c06cc8e191e62bbf91cc400
4
- data.tar.gz: 3c32036d252c8638148aea455b9159301c4d28b4b35831f36a00de1b519d75ec
3
+ metadata.gz: c33986e6c228a6eea44d3093e16717cb5327b57f23439bc492a8bea1154b7be8
4
+ data.tar.gz: f4e7cc9175ba8b51a242346f8ee5d08dcee79fe4befb0f806a45706f2b61f394
5
5
  SHA512:
6
- metadata.gz: 3a0e324243c77caefb069f2774107d8572b8780fb62de9d1d263be26919d6f5c3a3135588c1108b318a9a44d3ca814d93861c588f1eb6d1eff6007cc797f6f1a
7
- data.tar.gz: c2a74e634f32940401aa3fe3ebe6f9dff39c5a0be7bacb4b2da610995caff135e29cf27dc99c3046c11cd9f4d3703cdf18ffbea3e6c1f94aad505ba18e137630
6
+ metadata.gz: b71e78f24c52085bac6e5102306626097601799bb377c8e9dbb6bf768122fccd3a4cc853164c13f98239ba9db722426319c766f261fe1cc303fcc8220c2d0f37
7
+ data.tar.gz: a105daf60dd5b44393f9719ad1b2c1913a52cb2d6a90f5d9d2486a4ee6a1672b7c07d38693487f22568739e53bfb851d3858807b66bdc33a24fffcaeb8882922
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,29 +1,41 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## [Unreleased](https://github.com/nebulab/prependers/tree/HEAD)
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6
- adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ [Full Changelog](https://github.com/nebulab/prependers/compare/v0.2.0...HEAD)
7
6
 
8
- ## [Unreleased]
7
+ **Merged pull requests:**
9
8
 
10
- ## [0.2.0] - 2019-07-09
9
+ - Add Rails setup helper [\#8](https://github.com/nebulab/prependers/pull/8) ([aldesantis](https://github.com/aldesantis))
11
10
 
12
- ### Added
11
+ ## [v0.2.0](https://github.com/nebulab/prependers/tree/v0.2.0) (2019-07-09)
13
12
 
14
- - `ClassMethods` is now automagically prepended to the singleton class ([#5](https://github.com/nebulab/prependers/pull/5))
13
+ [Full Changelog](https://github.com/nebulab/prependers/compare/v0.1.1...v0.2.0)
15
14
 
16
- ## [0.1.1] - 2019-06-21
15
+ **Closed issues:**
17
16
 
18
- ### Fixed
17
+ - Add a simple way to extend class methods [\#4](https://github.com/nebulab/prependers/issues/4)
19
18
 
20
- - Prependers are now always loaded in alphabetical order ([#3](https://github.com/nebulab/prependers/pull/3))
19
+ **Merged pull requests:**
21
20
 
22
- ## [0.1.0] - 2019-06-21
21
+ - Automatically prepend ClassMethods to singleton\_class [\#5](https://github.com/nebulab/prependers/pull/5) ([aldesantis](https://github.com/aldesantis))
23
22
 
24
- Initial release.
23
+ ## [v0.1.1](https://github.com/nebulab/prependers/tree/v0.1.1) (2019-07-02)
25
24
 
26
- [Unreleased]: https://github.com/nebulab/prependers/compare/v0.2.0...HEAD
27
- [0.2.0]: https://github.com/nebulab/prependers/compare/v0.1.1...v0.2.0
28
- [0.1.1]: https://github.com/nebulab/prependers/compare/v0.1.0...v0.1.1
29
- [0.1.0]: https://github.com/nebulab/prependers/releases/tag/v0.1.0
25
+ [Full Changelog](https://github.com/nebulab/prependers/compare/v0.1.0...v0.1.1)
26
+
27
+ **Merged pull requests:**
28
+
29
+ - Load prependers in alphabetical order [\#3](https://github.com/nebulab/prependers/pull/3) ([mtylty](https://github.com/mtylty))
30
+
31
+ ## [v0.1.0](https://github.com/nebulab/prependers/tree/v0.1.0) (2019-06-21)
32
+
33
+ [Full Changelog](https://github.com/nebulab/prependers/compare/3059d0a9697a6fa5a8fc7bc84b0c8af8fdc29fef...v0.1.0)
34
+
35
+ **Merged pull requests:**
36
+
37
+ - Configure CircleCI [\#1](https://github.com/nebulab/prependers/pull/1) ([aldesantis](https://github.com/aldesantis))
38
+
39
+
40
+
41
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -49,7 +49,7 @@ If you want to extend a module's class methods, you can define a `ClassMethods`
49
49
  prepender:
50
50
 
51
51
  ```ruby
52
- module Animals::Dog::AddBarking
52
+ module Animals::Dog::AddFamily
53
53
  include Prependers::Prepender.new
54
54
 
55
55
  module ClassMethods
@@ -134,21 +134,11 @@ To use prependers in your Rails app, simply create them under `app/prependers/mo
134
134
  `app/prependers/controllers` etc. and add the following to your `config/application.rb`:
135
135
 
136
136
  ```ruby
137
- config.to_prepare do
138
- Dir.glob(Rails.root.join('app', 'prependers', '**', '*.rb')) do |c|
139
- Rails.configuration.cache_classes ? require(c) : load(c)
140
- end
141
-
142
- prepender_paths = Dir.glob(Rails.root.join('app', 'prependers', '*')).map do |p|
143
- File.expand_path(p, __FILE__)
144
- end
145
-
146
- Prependers.load_paths(*prepender_paths)
147
- end
137
+ Prependers.setup_for_rails
148
138
  ```
149
139
 
150
- If you want to use a namespace, just pass the `:namespace` option to `#load_paths` and name your
151
- files and modules accordingly.
140
+ If you want to use a namespace, just pass the `:namespace` option to `#setup_for_rails` and name
141
+ your files and modules accordingly.
152
142
 
153
143
  ## Development
154
144
 
data/lib/prependers.rb CHANGED
@@ -8,9 +8,21 @@ require "prependers/loader"
8
8
  module Prependers
9
9
  class << self
10
10
  def load_paths(*paths, **options)
11
- Array(paths).each do |path|
11
+ paths.flatten.each do |path|
12
12
  Loader.new(path, options).load
13
13
  end
14
14
  end
15
+
16
+ def setup_for_rails(load_options = {})
17
+ prependers_directories = Rails.root.join('app', 'prependers').glob('*')
18
+
19
+ Rails.application.config.tap do |config|
20
+ config.autoload_paths += prependers_directories
21
+
22
+ config.to_prepare do
23
+ Prependers.load_paths(prependers_directories, load_options)
24
+ end
25
+ end
26
+ end
15
27
  end
16
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prependers
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/prependers.gemspec CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.17"
27
+ spec.add_development_dependency "gem-release", "~> 2.1"
28
+ spec.add_development_dependency "github_changelog_generator", "~> 1.15"
27
29
  spec.add_development_dependency "rake", "~> 10.0"
28
30
  spec.add_development_dependency "rspec", "~> 3.0"
29
31
  spec.add_development_dependency "rspec_junit_formatter", '~> 0.4.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prependers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gem-release
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: github_changelog_generator
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rake
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +151,6 @@ files:
123
151
  - ".travis.yml"
124
152
  - CHANGELOG.md
125
153
  - Gemfile
126
- - Gemfile.lock
127
154
  - LICENSE.txt
128
155
  - README.md
129
156
  - Rakefile
@@ -154,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
181
  - !ruby/object:Gem::Version
155
182
  version: '0'
156
183
  requirements: []
157
- rubygems_version: 3.0.4
184
+ rubygems_version: 3.0.6
158
185
  signing_key:
159
186
  specification_version: 4
160
187
  summary: Easily and cleanly extend third-party code.
data/Gemfile.lock DELETED
@@ -1,60 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- prependers (0.2.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.0)
10
- diff-lcs (1.3)
11
- jaro_winkler (1.5.3)
12
- parallel (1.17.0)
13
- parser (2.6.3.0)
14
- ast (~> 2.4.0)
15
- rainbow (3.0.0)
16
- rake (10.5.0)
17
- rspec (3.8.0)
18
- rspec-core (~> 3.8.0)
19
- rspec-expectations (~> 3.8.0)
20
- rspec-mocks (~> 3.8.0)
21
- rspec-core (3.8.2)
22
- rspec-support (~> 3.8.0)
23
- rspec-expectations (3.8.4)
24
- diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.8.0)
26
- rspec-mocks (3.8.1)
27
- diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-support (3.8.2)
30
- rspec_junit_formatter (0.4.1)
31
- rspec-core (>= 2, < 4, != 2.12.0)
32
- rubocop (0.70.0)
33
- jaro_winkler (~> 1.5.1)
34
- parallel (~> 1.10)
35
- parser (>= 2.6)
36
- rainbow (>= 2.2.2, < 4.0)
37
- ruby-progressbar (~> 1.7)
38
- unicode-display_width (>= 1.4.0, < 1.7)
39
- rubocop-performance (1.3.0)
40
- rubocop (>= 0.68.0)
41
- rubocop-rspec (1.33.0)
42
- rubocop (>= 0.60.0)
43
- ruby-progressbar (1.10.1)
44
- unicode-display_width (1.6.0)
45
-
46
- PLATFORMS
47
- ruby
48
-
49
- DEPENDENCIES
50
- bundler (~> 1.17)
51
- prependers!
52
- rake (~> 10.0)
53
- rspec (~> 3.0)
54
- rspec_junit_formatter (~> 0.4.1)
55
- rubocop (~> 0.70.0)
56
- rubocop-performance (~> 1.3)
57
- rubocop-rspec (~> 1.33)
58
-
59
- BUNDLED WITH
60
- 1.17.3