drawers 0.9.0 → 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
2
  SHA1:
3
- metadata.gz: f965ef04831e18fcc88dbafe26068c72ac7e40cf
4
- data.tar.gz: dea8bf6cdd778e52b2c89872cbbf1788ae3da39e
3
+ metadata.gz: 547bbfdc39e1cc5b38254434164b02117a230183
4
+ data.tar.gz: fc3935786da5d374eea5396f311b38013e8270cb
5
5
  SHA512:
6
- metadata.gz: 11d4e29fdb9b5d62addbacc152bf8750c001e616a295a561e46a6067375fc7155a0a3ce76f66991c46255a128140f3d5ac7633d835980735b241d171df83653c
7
- data.tar.gz: 94322be4dcd79e7285c20398228dc367edf8dcd26e9122681abb25e34525708533da8c56c51f8ef90fa3d9a576020b7b98f99dfc094654509ce074c8004642aa
6
+ metadata.gz: b5306dd6851fc5657187a102ab3440e479ceb4aec382a965014515b73afed89d4bbfd94f510296f0a43b07d5ae2d7147a097320364f8472a4ad45b94ffd02414
7
+ data.tar.gz: 374d3683b4ff1d5defe22d287e60ad73e42099bbc38c78224395dafd9c3a63162f7590b36322c0bca5a74250afb84713ac8e07971a08ba50fe259d94de4c236a
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # drawers
2
- Group like-classes together. No more silos.
1
+ # Drawers
2
+ Group related classes together. No more silos.
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/drawers.svg)](https://badge.fury.io/rb/drawers)
5
5
  [![Build Status](https://travis-ci.org/NullVoxPopuli/drawers.svg?branch=master)](https://travis-ci.org/NullVoxPopuli/drawers)
@@ -127,3 +127,11 @@ Sets the folder for the new structure to be in the `app/pods` directory if you w
127
127
  Feel free to open an issue, or fork and make a pull request.
128
128
 
129
129
  All discussion is welcome :-)
130
+
131
+
132
+ ---------------
133
+
134
+ The gem name 'Drawers' was provided by @bartboy011.
135
+ Thanks @bartboy011!
136
+
137
+ The previous name of this gem was Rails Module Unification -- which, while a homage to its inspiration, Ember's Module Unification app architecture, it's quite a mouthful, and doesn't exactly make for a good gem name.
@@ -3,6 +3,7 @@ module Drawers
3
3
  module DependencyExtensions
4
4
  RESOURCE_SUFFIX_NAMES = %w(
5
5
  Controller
6
+ Form
6
7
  Serializer
7
8
  Operations
8
9
  Presenters
@@ -11,6 +12,8 @@ module Drawers
11
12
  Services
12
13
  ).freeze
13
14
 
15
+ ERROR_CIRCULAR_DEPENDENCY = 'Circular dependency detected while autoloading constant'
16
+
14
17
  # Join all the suffix names together with an "OR" operator
15
18
  RESOURCE_SUFFIXES = /(#{RESOURCE_SUFFIX_NAMES.join('|')})/
16
19
 
@@ -21,16 +24,14 @@ module Drawers
21
24
  expanded = File.expand_path(file_path)
22
25
  expanded.sub!(/\.rb\z/, '')
23
26
 
24
- if loading.include?(expanded)
25
- raise "Circular dependency detected while autoloading constant #{qualified_name}"
26
- else
27
- require_or_load(expanded, qualified_name)
28
- unless from_mod.const_defined?(const_name, false)
29
- raise LoadError, "Unable to autoload constant #{qualified_name}, expected #{file_path} to define it"
30
- end
27
+ raise "#{ERROR_CIRCULAR_DEPENDENCY} #{qualified_name}" if loading.include?(expanded)
31
28
 
32
- return from_mod.const_get(const_name)
29
+ require_or_load(expanded, qualified_name)
30
+ unless from_mod.const_defined?(const_name, false)
31
+ raise LoadError, "Unable to autoload constant #{qualified_name}, expected #{file_path} to define it"
33
32
  end
33
+
34
+ from_mod.const_get(const_name)
34
35
  end
35
36
 
36
37
  # A look for the possible places that various qualified names could be
@@ -105,9 +106,25 @@ module Drawers
105
106
  break if file_path.present?
106
107
  end
107
108
 
109
+ # Note that sometimes, the resource_type path may only be defined in a
110
+ # resource type folder
111
+ # So, look for the first file within the resource type folder
112
+ # because of ruby namespacing conventions if there is a file in the folder,
113
+ # it MUST define the namespace
114
+ file_path = path_for_first_file_in(path_options.last) unless file_path
115
+
108
116
  file_path
109
117
  end
110
118
 
119
+ def path_for_first_file_in(path)
120
+ return if path.blank?
121
+
122
+ path_in_app = "#{Rails.root}/app/resources/#{path.pluralize}"
123
+ return unless File.directory?(path_in_app)
124
+
125
+ Dir.glob("#{path_in_app}/*.rb").first
126
+ end
127
+
111
128
  def to_path(*args)
112
129
  args.flatten.reject(&:blank?).map(&:underscore).join('/')
113
130
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Drawers
3
- VERSION = '0.9.0'
3
+ VERSION = '1.0.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-18 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description: Group like-classes together. No more silos.
139
+ description: Group related classes together. No more silos.
140
140
  email: LPSego3+dev@gmail.com
141
141
  executables: []
142
142
  extensions: []
@@ -172,8 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.5.1
175
+ rubygems_version: 2.5.2
176
176
  signing_key:
177
177
  specification_version: 4
178
- summary: Drawers-0.9.0
178
+ summary: Drawers-1.0.0
179
179
  test_files: []