binky-builder 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 +7 -0
- data/.gitignore +8 -0
- data/.idea/workspace.xml +277 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/binky-builder.gemspec +29 -0
- data/lib/binky/builder.rb +44 -0
- data/lib/binky/builder/builder_helper.rb +48 -0
- data/lib/binky/builder/version.rb +5 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b6b8eee725400de668f60ad65a6fafcadfb42e7d8bf9a46b368895f836aec738
|
4
|
+
data.tar.gz: a922b112a9ca5b7ebab7b40354a3aa700db03808442ec0faca0e219c581e442f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2519044fbad4ae56d7c2b0c130be0ac3545084e81c3705727d8c1169d1bdbfba3f91bdd1de67a2ef4d121fa71cd658a3f4619e589d60e39a511255ef3e3cf2cc
|
7
|
+
data.tar.gz: 86a4ea8575f7317140b3cb58488a1f1f39121a28d234a9fc91d09755cfb942feb3e66fad3540e2e4dbb5cd320485c6a15f546ed60eaf416c667e10037de452b1
|
data/.gitignore
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,277 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="c1900bce-76f3-4483-9969-b14ec05dbe50" name="Default Changelist" comment="">
|
5
|
+
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
6
|
+
<change beforePath="$PROJECT_DIR$/binky-builder.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/binky-builder.gemspec" afterDir="false" />
|
7
|
+
</list>
|
8
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
9
|
+
<option name="SHOW_DIALOG" value="false" />
|
10
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
11
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
12
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
13
|
+
</component>
|
14
|
+
<component name="FileEditorManager">
|
15
|
+
<leaf>
|
16
|
+
<file pinned="false" current-in-tab="false">
|
17
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder.rb">
|
18
|
+
<provider selected="true" editor-type-id="text-editor">
|
19
|
+
<state relative-caret-position="754">
|
20
|
+
<caret line="29" column="24" selection-start-line="29" selection-start-column="9" selection-end-line="29" selection-end-column="24" />
|
21
|
+
</state>
|
22
|
+
</provider>
|
23
|
+
</entry>
|
24
|
+
</file>
|
25
|
+
<file pinned="false" current-in-tab="false">
|
26
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder/builder_helper.rb">
|
27
|
+
<provider selected="true" editor-type-id="text-editor">
|
28
|
+
<state relative-caret-position="26">
|
29
|
+
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
30
|
+
</state>
|
31
|
+
</provider>
|
32
|
+
</entry>
|
33
|
+
</file>
|
34
|
+
<file pinned="false" current-in-tab="false">
|
35
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder/version.rb">
|
36
|
+
<provider selected="true" editor-type-id="text-editor">
|
37
|
+
<state relative-caret-position="104">
|
38
|
+
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
39
|
+
</state>
|
40
|
+
</provider>
|
41
|
+
</entry>
|
42
|
+
</file>
|
43
|
+
<file pinned="false" current-in-tab="false">
|
44
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
45
|
+
<provider selected="true" editor-type-id="text-editor" />
|
46
|
+
</entry>
|
47
|
+
</file>
|
48
|
+
<file pinned="false" current-in-tab="true">
|
49
|
+
<entry file="file://$PROJECT_DIR$/binky-builder.gemspec">
|
50
|
+
<provider selected="true" editor-type-id="text-editor">
|
51
|
+
<state relative-caret-position="546">
|
52
|
+
<caret line="21" column="31" lean-forward="true" selection-start-line="21" selection-start-column="31" selection-end-line="21" selection-end-column="31" />
|
53
|
+
</state>
|
54
|
+
</provider>
|
55
|
+
</entry>
|
56
|
+
</file>
|
57
|
+
<file pinned="false" current-in-tab="false">
|
58
|
+
<entry file="file://$PROJECT_DIR$/LICENSE.txt">
|
59
|
+
<provider selected="true" editor-type-id="text-editor" />
|
60
|
+
</entry>
|
61
|
+
</file>
|
62
|
+
<file pinned="false" current-in-tab="false">
|
63
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
64
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
65
|
+
<state split_layout="SPLIT">
|
66
|
+
<first_editor relative-caret-position="208">
|
67
|
+
<caret line="8" column="3" lean-forward="true" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
|
68
|
+
</first_editor>
|
69
|
+
<second_editor />
|
70
|
+
</state>
|
71
|
+
</provider>
|
72
|
+
</entry>
|
73
|
+
</file>
|
74
|
+
<file pinned="false" current-in-tab="false">
|
75
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
76
|
+
<provider selected="true" editor-type-id="text-editor" />
|
77
|
+
</entry>
|
78
|
+
</file>
|
79
|
+
</leaf>
|
80
|
+
</component>
|
81
|
+
<component name="FileTemplateManagerImpl">
|
82
|
+
<option name="RECENT_TEMPLATES">
|
83
|
+
<list>
|
84
|
+
<option value="Ruby File" />
|
85
|
+
</list>
|
86
|
+
</option>
|
87
|
+
</component>
|
88
|
+
<component name="Git.Settings">
|
89
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
90
|
+
</component>
|
91
|
+
<component name="IdeDocumentHistory">
|
92
|
+
<option name="CHANGED_PATHS">
|
93
|
+
<list>
|
94
|
+
<option value="$PROJECT_DIR$/lib/binky/builder/builder_helper.rb" />
|
95
|
+
<option value="$PROJECT_DIR$/lib/binky/builder.rb" />
|
96
|
+
<option value="$PROJECT_DIR$/lib/binky/builder/version.rb" />
|
97
|
+
<option value="$PROJECT_DIR$/README.md" />
|
98
|
+
<option value="$PROJECT_DIR$/binky-builder.gemspec" />
|
99
|
+
</list>
|
100
|
+
</option>
|
101
|
+
</component>
|
102
|
+
<component name="ProjectConfigurationFiles">
|
103
|
+
<option name="files">
|
104
|
+
<list>
|
105
|
+
<option value="$PROJECT_DIR$/.idea/binky-builder.iml" />
|
106
|
+
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
107
|
+
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
108
|
+
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
109
|
+
<option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
110
|
+
</list>
|
111
|
+
</option>
|
112
|
+
</component>
|
113
|
+
<component name="ProjectFrameBounds" extendedState="6">
|
114
|
+
<option name="width" value="1920" />
|
115
|
+
<option name="height" value="1200" />
|
116
|
+
</component>
|
117
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
118
|
+
<component name="ProjectView">
|
119
|
+
<navigator proportions="" version="1">
|
120
|
+
<foldersAlwaysOnTop value="true" />
|
121
|
+
</navigator>
|
122
|
+
<panes>
|
123
|
+
<pane id="ProjectPane">
|
124
|
+
<subPane>
|
125
|
+
<expand>
|
126
|
+
<path>
|
127
|
+
<item name="binky-builder" type="b2602c69:ProjectViewProjectNode" />
|
128
|
+
<item name="binky-builder" type="462c0819:PsiDirectoryNode" />
|
129
|
+
</path>
|
130
|
+
<path>
|
131
|
+
<item name="binky-builder" type="b2602c69:ProjectViewProjectNode" />
|
132
|
+
<item name="binky-builder" type="462c0819:PsiDirectoryNode" />
|
133
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
134
|
+
</path>
|
135
|
+
<path>
|
136
|
+
<item name="binky-builder" type="b2602c69:ProjectViewProjectNode" />
|
137
|
+
<item name="binky-builder" type="462c0819:PsiDirectoryNode" />
|
138
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
139
|
+
<item name="binky" type="462c0819:PsiDirectoryNode" />
|
140
|
+
</path>
|
141
|
+
<path>
|
142
|
+
<item name="binky-builder" type="b2602c69:ProjectViewProjectNode" />
|
143
|
+
<item name="binky-builder" type="462c0819:PsiDirectoryNode" />
|
144
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
145
|
+
<item name="binky" type="462c0819:PsiDirectoryNode" />
|
146
|
+
<item name="builder" type="462c0819:PsiDirectoryNode" />
|
147
|
+
</path>
|
148
|
+
</expand>
|
149
|
+
<select />
|
150
|
+
</subPane>
|
151
|
+
</pane>
|
152
|
+
<pane id="Scope" />
|
153
|
+
</panes>
|
154
|
+
</component>
|
155
|
+
<component name="PropertiesComponent">
|
156
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
157
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
158
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
159
|
+
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
160
|
+
</component>
|
161
|
+
<component name="RunDashboard">
|
162
|
+
<option name="ruleStates">
|
163
|
+
<list>
|
164
|
+
<RuleState>
|
165
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
166
|
+
</RuleState>
|
167
|
+
<RuleState>
|
168
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
169
|
+
</RuleState>
|
170
|
+
</list>
|
171
|
+
</option>
|
172
|
+
</component>
|
173
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
174
|
+
<component name="TaskManager">
|
175
|
+
<task active="true" id="Default" summary="Default task">
|
176
|
+
<changelist id="c1900bce-76f3-4483-9969-b14ec05dbe50" name="Default Changelist" comment="" />
|
177
|
+
<created>1596190242171</created>
|
178
|
+
<option name="number" value="Default" />
|
179
|
+
<option name="presentableId" value="Default" />
|
180
|
+
<updated>1596190242171</updated>
|
181
|
+
<workItem from="1596190243364" duration="1605000" />
|
182
|
+
</task>
|
183
|
+
<task id="LOCAL-00001" summary="Binky Builder gem initial commit.">
|
184
|
+
<created>1596191104643</created>
|
185
|
+
<option name="number" value="00001" />
|
186
|
+
<option name="presentableId" value="LOCAL-00001" />
|
187
|
+
<option name="project" value="LOCAL" />
|
188
|
+
<updated>1596191104643</updated>
|
189
|
+
</task>
|
190
|
+
<option name="localTasksCounter" value="2" />
|
191
|
+
<servers />
|
192
|
+
</component>
|
193
|
+
<component name="TimeTrackingManager">
|
194
|
+
<option name="totallyTimeSpent" value="1605000" />
|
195
|
+
</component>
|
196
|
+
<component name="ToolWindowManager">
|
197
|
+
<frame x="0" y="0" width="1920" height="1200" extended-state="6" />
|
198
|
+
<editor active="true" />
|
199
|
+
<layout>
|
200
|
+
<window_info id="Favorites" side_tool="true" />
|
201
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
|
202
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
203
|
+
<window_info anchor="bottom" id="Docker" />
|
204
|
+
<window_info anchor="bottom" id="Database Changes" />
|
205
|
+
<window_info anchor="bottom" id="Version Control" />
|
206
|
+
<window_info anchor="bottom" id="Terminal" />
|
207
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
208
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
209
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
210
|
+
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.32976827" />
|
211
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
212
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
213
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
214
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
215
|
+
<window_info anchor="right" id="Database" />
|
216
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
217
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
218
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
219
|
+
</layout>
|
220
|
+
</component>
|
221
|
+
<component name="TypeScriptGeneratedFilesManager">
|
222
|
+
<option name="version" value="1" />
|
223
|
+
</component>
|
224
|
+
<component name="VcsManagerConfiguration">
|
225
|
+
<MESSAGE value="Binky Builder gem initial commit." />
|
226
|
+
<option name="LAST_COMMIT_MESSAGE" value="Binky Builder gem initial commit." />
|
227
|
+
</component>
|
228
|
+
<component name="editorHistoryManager">
|
229
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
230
|
+
<provider selected="true" editor-type-id="text-editor" />
|
231
|
+
</entry>
|
232
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
233
|
+
<provider selected="true" editor-type-id="text-editor" />
|
234
|
+
</entry>
|
235
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder/version.rb">
|
236
|
+
<provider selected="true" editor-type-id="text-editor">
|
237
|
+
<state relative-caret-position="104">
|
238
|
+
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
239
|
+
</state>
|
240
|
+
</provider>
|
241
|
+
</entry>
|
242
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder/builder_helper.rb">
|
243
|
+
<provider selected="true" editor-type-id="text-editor">
|
244
|
+
<state relative-caret-position="26">
|
245
|
+
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
246
|
+
</state>
|
247
|
+
</provider>
|
248
|
+
</entry>
|
249
|
+
<entry file="file://$PROJECT_DIR$/lib/binky/builder.rb">
|
250
|
+
<provider selected="true" editor-type-id="text-editor">
|
251
|
+
<state relative-caret-position="754">
|
252
|
+
<caret line="29" column="24" selection-start-line="29" selection-start-column="9" selection-end-line="29" selection-end-column="24" />
|
253
|
+
</state>
|
254
|
+
</provider>
|
255
|
+
</entry>
|
256
|
+
<entry file="file://$PROJECT_DIR$/LICENSE.txt">
|
257
|
+
<provider selected="true" editor-type-id="text-editor" />
|
258
|
+
</entry>
|
259
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
260
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
261
|
+
<state split_layout="SPLIT">
|
262
|
+
<first_editor relative-caret-position="208">
|
263
|
+
<caret line="8" column="3" lean-forward="true" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
|
264
|
+
</first_editor>
|
265
|
+
<second_editor />
|
266
|
+
</state>
|
267
|
+
</provider>
|
268
|
+
</entry>
|
269
|
+
<entry file="file://$PROJECT_DIR$/binky-builder.gemspec">
|
270
|
+
<provider selected="true" editor-type-id="text-editor">
|
271
|
+
<state relative-caret-position="546">
|
272
|
+
<caret line="21" column="31" lean-forward="true" selection-start-line="21" selection-start-column="31" selection-end-line="21" selection-end-column="31" />
|
273
|
+
</state>
|
274
|
+
</provider>
|
275
|
+
</entry>
|
276
|
+
</component>
|
277
|
+
</project>
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
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 edugarcas@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 [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Eduard
|
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,40 @@
|
|
1
|
+
# Binky::Builder  [](https://rubygems.org/gems/binky-builder)
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'binky-builder'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install binky-builder
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Builder modules to create either class ghost methods from a given json or an open struct.
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
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).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eddygarcas/binky-builder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/binky-builder/blob/master/CODE_OF_CONDUCT.md).
|
32
|
+
|
33
|
+
|
34
|
+
## License
|
35
|
+
|
36
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
37
|
+
|
38
|
+
## Code of Conduct
|
39
|
+
|
40
|
+
Everyone interacting in the Binky::Builder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/binky-builder/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "binky/builder"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'lib/binky/builder/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "binky-builder"
|
5
|
+
spec.version = Binky::Builder::VERSION
|
6
|
+
spec.authors = ["Eduard Garcia Castello"]
|
7
|
+
spec.email = ["edugarcas@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{Builder modules to create either class ghost methods from a given json or an open struct.}
|
10
|
+
#spec.description = %q{TODO: Write a longer description or delete this line.}
|
11
|
+
spec.homepage = "https://github.com/eddygarcas/binky-builder"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/eddygarcas/binky-builder"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/eddygarcas/binky-builder"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "binky/builder/version"
|
2
|
+
require "binky/builder/builder_helper"
|
3
|
+
|
4
|
+
module Binky
|
5
|
+
module Builder
|
6
|
+
class Error < StandardError; end
|
7
|
+
include BuilderHelper
|
8
|
+
|
9
|
+
def initialize(json = nil)
|
10
|
+
@attributes = {}
|
11
|
+
json.each do |k, v|
|
12
|
+
self.send("#{k}=", v)
|
13
|
+
end unless json.blank?
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_missing(name, *args)
|
17
|
+
attribute = name.to_s.start_with?(/\d/) ? "_#{name.to_s}" : name.to_s
|
18
|
+
if attribute =~ /=$/
|
19
|
+
if args[0].respond_to?(:key?) || args[0].is_a?(Hash)
|
20
|
+
@attributes[attribute.chop] = self.class.new(args[0])
|
21
|
+
else
|
22
|
+
@attributes[attribute.chop] = args[0]
|
23
|
+
end
|
24
|
+
else
|
25
|
+
@attributes[attribute]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module AccessorBuilder
|
31
|
+
class Error < StandardError; end
|
32
|
+
include BuilderHelper
|
33
|
+
|
34
|
+
def initialize(json = {})
|
35
|
+
json.keys.each do |k|
|
36
|
+
self.send("#{k}=",nested_hash_value(json, k.to_s))
|
37
|
+
end unless json.blank?
|
38
|
+
end
|
39
|
+
|
40
|
+
def method_missing(name,*args)
|
41
|
+
accessor_builder name.to_s.chop, args[0]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module BuilderHelper
|
2
|
+
|
3
|
+
# Builds an instance variable as well as its class method accessors from a key value pair.
|
4
|
+
def accessor_builder k, v
|
5
|
+
self.instance_variable_set("@#{k}", v)
|
6
|
+
self.class.send(:define_method, "#{k}", proc {self.instance_variable_get("@#{k}")})
|
7
|
+
self.class.send(:define_method, "#{k}=", proc {|v| self.instance_variable_set("@#{k}", v)})
|
8
|
+
end
|
9
|
+
|
10
|
+
#Goes through a complex Hash nest and gets the value of a passed key.
|
11
|
+
# First wil check whether the object has the key? method,
|
12
|
+
# which will mean it's a Hash and also if the Hash the method parameter key
|
13
|
+
# if obj.respond_to?(:key?) && obj.key?(key)
|
14
|
+
#
|
15
|
+
# If it's not a Hash will check if it's a Array instead,
|
16
|
+
# checking out whether it responds to a Array.each method or not.
|
17
|
+
# elsif obj.respond_to?(:each)
|
18
|
+
#
|
19
|
+
# For every Array found it make a recursive call to itself passing
|
20
|
+
# the last element of the array and the Key it's looking for.
|
21
|
+
# r = nested_hash_value(a.last, key)
|
22
|
+
def nested_hash_value(obj, key)
|
23
|
+
if obj.respond_to?(:key?) && obj.key?(key)
|
24
|
+
obj[key]
|
25
|
+
elsif obj.respond_to?(:each)
|
26
|
+
r = nil
|
27
|
+
#The asterisk "splat" operator means you can pass multiple parameters in its place and the block will see them as an array.
|
28
|
+
obj.find do |*a|
|
29
|
+
r = nested_hash_value(a.last, key)
|
30
|
+
end
|
31
|
+
r
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Parses a given json structure looking for specific keys inside the structure.
|
36
|
+
# The result of it it's stored on a instance variable called to_hash and accessible through accessors with same name.
|
37
|
+
def parse(json = {},keys = [])
|
38
|
+
accessor_builder('to_hash',{})
|
39
|
+
keys.each do |key|
|
40
|
+
@to_hash.merge!({key => nested_hash_value(json,key)})
|
41
|
+
end unless json.blank?
|
42
|
+
end
|
43
|
+
|
44
|
+
def attribute_from_inner_key(element, attribute, inner_key = nil)
|
45
|
+
{attribute.to_sym => nested_hash_value(element, inner_key.present? ? inner_key : attribute.to_s)}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: binky-builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eduard Garcia Castello
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- edugarcas@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".idea/workspace.xml"
|
22
|
+
- ".travis.yml"
|
23
|
+
- CODE_OF_CONDUCT.md
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- bin/console
|
29
|
+
- bin/setup
|
30
|
+
- binky-builder.gemspec
|
31
|
+
- lib/binky/builder.rb
|
32
|
+
- lib/binky/builder/builder_helper.rb
|
33
|
+
- lib/binky/builder/version.rb
|
34
|
+
homepage: https://github.com/eddygarcas/binky-builder
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata:
|
38
|
+
allowed_push_host: https://rubygems.org/
|
39
|
+
homepage_uri: https://github.com/eddygarcas/binky-builder
|
40
|
+
source_code_uri: https://github.com/eddygarcas/binky-builder
|
41
|
+
changelog_uri: https://github.com/eddygarcas/binky-builder
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.3.0
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubygems_version: 3.1.2
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Builder modules to create either class ghost methods from a given json or
|
61
|
+
an open struct.
|
62
|
+
test_files: []
|