drawers 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 547bbfdc39e1cc5b38254434164b02117a230183
4
- data.tar.gz: fc3935786da5d374eea5396f311b38013e8270cb
3
+ metadata.gz: 6501ca69ca387b5fcdadca2cefc421dd6ce4218b
4
+ data.tar.gz: eb848da7400a579adee113d08ce014d653e8c28b
5
5
  SHA512:
6
- metadata.gz: b5306dd6851fc5657187a102ab3440e479ceb4aec382a965014515b73afed89d4bbfd94f510296f0a43b07d5ae2d7147a097320364f8472a4ad45b94ffd02414
7
- data.tar.gz: 374d3683b4ff1d5defe22d287e60ad73e42099bbc38c78224395dafd9c3a63162f7590b36322c0bca5a74250afb84713ac8e07971a08ba50fe259d94de4c236a
6
+ metadata.gz: 634e42977c1b7ebb23b47a092f594e89880622b8e8112e5ef3fa35384d916b9ce990c15c71301c4b94ab047dae29495238ae1f37c13ad413d057a941ea051441
7
+ data.tar.gz: 93a4fe1015c817bf47d4759c8f2dfdd119d84353091de35e288d5aa4d263666ce6e0bb782da7563f56db8f577d40503b2b5ebbeca720559e4784c1361b3c53e1
data/README.md CHANGED
@@ -33,6 +33,8 @@ app/
33
33
  │ └── notification_mailer.rb
34
34
  └── resources/
35
35
  ├── posts/
36
+ │ ├── forms/
37
+ │ │ └── new_post_form.rb
36
38
  │ ├── controller.rb # or posts_controller.rb
37
39
  │ ├── operations.rb # or post_operations.rb
38
40
  │ ├── policy.rb # or post_policy.rb
@@ -3,7 +3,7 @@ module Drawers
3
3
  module DependencyExtensions
4
4
  RESOURCE_SUFFIX_NAMES = %w(
5
5
  Controller
6
- Form
6
+ Forms
7
7
  Serializer
8
8
  Operations
9
9
  Presenters
@@ -78,14 +78,33 @@ module Drawers
78
78
  #
79
79
  # @param [String] qualified_name fully qualified class/module name to find the file location for
80
80
  def resource_path_from_qualified_name(qualified_name)
81
+ path_options = path_options_for_qualified_name(qualified_name)
82
+
83
+ file_path = ''
84
+ path_options.uniq.each do |path_option|
85
+ file_path = search_for_file(path_option)
86
+
87
+ break if file_path.present?
88
+ end
89
+
90
+ return file_path if file_path
91
+
92
+ # Note that sometimes, the resource_type path may only be defined in a
93
+ # resource type folder
94
+ # So, look for the first file within the resource type folder
95
+ # because of ruby namespacing conventions if there is a file in the folder,
96
+ # it MUST define the namespace
97
+ path_for_first_file_in(path_options.last) || path_for_first_file_in(path_options[-2])
98
+ end
99
+
100
+ def path_options_for_qualified_name(qualified_name)
81
101
  namespace,
82
102
  resource_name,
83
103
  resource_type, named_resource_type,
84
104
  class_path = ResourceParts.from_name(qualified_name)
85
105
 
86
106
  # build all the possible places that this file could be
87
- path_options = [
88
-
107
+ [
89
108
  # api/v2/posts/operations/update
90
109
  to_path(namespace, resource_name, resource_type, class_path),
91
110
 
@@ -97,23 +116,7 @@ module Drawers
97
116
 
98
117
  # api/v2/posts/controller
99
118
  to_path(namespace, resource_name, resource_type)
100
- ].uniq
101
-
102
- file_path = ''
103
- path_options.each do |path_option|
104
- file_path = search_for_file(path_option)
105
-
106
- break if file_path.present?
107
- end
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
-
116
- file_path
119
+ ]
117
120
  end
118
121
 
119
122
  def path_for_first_file_in(path)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Drawers
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
@@ -175,5 +175,5 @@ rubyforge_project:
175
175
  rubygems_version: 2.5.2
176
176
  signing_key:
177
177
  specification_version: 4
178
- summary: Drawers-1.0.0
178
+ summary: Drawers-1.0.1
179
179
  test_files: []