clone 1.0.0.alpha → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +1 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +22 -1
  6. data/VERSION +1 -1
  7. data/bin/clone +7 -0
  8. data/clone.gemspec +4 -0
  9. data/docs/readme +16 -0
  10. data/docs/readme.txt +5 -0
  11. data/lib/clone.rb +13 -2
  12. data/lib/clone/config/config.rb +19 -0
  13. data/lib/clone/config/config.yml +22 -0
  14. data/lib/clone/config/default_config.yml +20 -0
  15. data/lib/clone/config/require.rb +3 -0
  16. data/lib/clone/config/version.rb +10 -0
  17. data/lib/clone/config/yml.rb +22 -0
  18. data/lib/clone/config/z_defaults.rb +28 -0
  19. data/lib/clone/generator/engine.rb +581 -0
  20. data/lib/clone/generator/terminal.rb +104 -0
  21. data/lib/clone/helpers/helper_methods.rb +251 -0
  22. data/lib/clone/helpers/local_methods.rb +150 -0
  23. data/lib/clone/helpers/require.rb +37 -0
  24. data/module/Marshal.4.8 +0 -0
  25. data/module/Marshal.4.8.Z +0 -0
  26. data/module/gems/commander-4.1.3/.gitignore +6 -0
  27. data/module/gems/commander-4.1.3/.travis.yml +11 -0
  28. data/module/gems/commander-4.1.3/DEVELOPMENT +15 -0
  29. data/module/gems/commander-4.1.3/Gemfile +3 -0
  30. data/module/gems/commander-4.1.3/History.rdoc +345 -0
  31. data/module/gems/commander-4.1.3/Manifest +38 -0
  32. data/module/gems/commander-4.1.3/README.rdoc +375 -0
  33. data/module/gems/commander-4.1.3/Rakefile +10 -0
  34. data/module/gems/commander-4.1.3/bin/commander +55 -0
  35. data/module/gems/commander-4.1.3/commander.gemspec +26 -0
  36. data/module/gems/commander-4.1.3/lib/commander.rb +32 -0
  37. data/module/gems/commander-4.1.3/lib/commander/blank.rb +8 -0
  38. data/module/gems/commander-4.1.3/lib/commander/command.rb +213 -0
  39. data/module/gems/commander-4.1.3/lib/commander/core_ext.rb +3 -0
  40. data/module/gems/commander-4.1.3/lib/commander/core_ext/array.rb +26 -0
  41. data/module/gems/commander-4.1.3/lib/commander/core_ext/object.rb +11 -0
  42. data/module/gems/commander-4.1.3/lib/commander/delegates.rb +13 -0
  43. data/module/gems/commander-4.1.3/lib/commander/help_formatters.rb +8 -0
  44. data/module/gems/commander-4.1.3/lib/commander/help_formatters/base.rb +18 -0
  45. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal.rb +20 -0
  46. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal/command_help.erb +35 -0
  47. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal/help.erb +36 -0
  48. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal_compact.rb +12 -0
  49. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal_compact/command_help.erb +27 -0
  50. data/module/gems/commander-4.1.3/lib/commander/help_formatters/terminal_compact/help.erb +29 -0
  51. data/module/gems/commander-4.1.3/lib/commander/import.rb +10 -0
  52. data/module/gems/commander-4.1.3/lib/commander/platform.rb +8 -0
  53. data/module/gems/commander-4.1.3/lib/commander/runner.rb +411 -0
  54. data/module/gems/commander-4.1.3/lib/commander/user_interaction.rb +521 -0
  55. data/module/gems/commander-4.1.3/lib/commander/version.rb +3 -0
  56. data/module/gems/commander-4.1.3/spec/command_spec.rb +157 -0
  57. data/module/gems/commander-4.1.3/spec/core_ext/array_spec.rb +20 -0
  58. data/module/gems/commander-4.1.3/spec/core_ext/object_spec.rb +21 -0
  59. data/module/gems/commander-4.1.3/spec/help_formatters/terminal_spec.rb +67 -0
  60. data/module/gems/commander-4.1.3/spec/runner_spec.rb +526 -0
  61. data/module/gems/commander-4.1.3/spec/spec_helper.rb +59 -0
  62. data/module/gems/commander-4.1.3/spec/ui_spec.rb +30 -0
  63. data/module/gems/hello.rb +1 -0
  64. data/module/gems/highline-1.6.19/.gitignore +2 -0
  65. data/module/gems/highline-1.6.19/AUTHORS +3 -0
  66. data/module/gems/highline-1.6.19/CHANGELOG +346 -0
  67. data/module/gems/highline-1.6.19/COPYING +340 -0
  68. data/module/gems/highline-1.6.19/INSTALL +55 -0
  69. data/module/gems/highline-1.6.19/LICENSE +7 -0
  70. data/module/gems/highline-1.6.19/README.rdoc +63 -0
  71. data/module/gems/highline-1.6.19/Rakefile +50 -0
  72. data/module/gems/highline-1.6.19/TODO +6 -0
  73. data/module/gems/highline-1.6.19/examples/ansi_colors.rb +38 -0
  74. data/module/gems/highline-1.6.19/examples/asking_for_arrays.rb +18 -0
  75. data/module/gems/highline-1.6.19/examples/basic_usage.rb +75 -0
  76. data/module/gems/highline-1.6.19/examples/color_scheme.rb +32 -0
  77. data/module/gems/highline-1.6.19/examples/get_character.rb +12 -0
  78. data/module/gems/highline-1.6.19/examples/limit.rb +12 -0
  79. data/module/gems/highline-1.6.19/examples/menus.rb +65 -0
  80. data/module/gems/highline-1.6.19/examples/overwrite.rb +19 -0
  81. data/module/gems/highline-1.6.19/examples/page_and_wrap.rb +322 -0
  82. data/module/gems/highline-1.6.19/examples/password.rb +7 -0
  83. data/module/gems/highline-1.6.19/examples/repeat_entry.rb +21 -0
  84. data/module/gems/highline-1.6.19/examples/trapping_eof.rb +22 -0
  85. data/module/gems/highline-1.6.19/examples/using_readline.rb +17 -0
  86. data/module/gems/highline-1.6.19/highline.gemspec +37 -0
  87. data/module/gems/highline-1.6.19/lib/highline.rb +1012 -0
  88. data/module/gems/highline-1.6.19/lib/highline/color_scheme.rb +134 -0
  89. data/module/gems/highline-1.6.19/lib/highline/compatibility.rb +16 -0
  90. data/module/gems/highline-1.6.19/lib/highline/import.rb +41 -0
  91. data/module/gems/highline-1.6.19/lib/highline/menu.rb +398 -0
  92. data/module/gems/highline-1.6.19/lib/highline/question.rb +475 -0
  93. data/module/gems/highline-1.6.19/lib/highline/simulate.rb +48 -0
  94. data/module/gems/highline-1.6.19/lib/highline/string_extensions.rb +131 -0
  95. data/module/gems/highline-1.6.19/lib/highline/style.rb +181 -0
  96. data/module/gems/highline-1.6.19/lib/highline/system_extensions.rb +222 -0
  97. data/module/gems/highline-1.6.19/setup.rb +1360 -0
  98. data/module/gems/highline-1.6.19/site/.cvsignore +1 -0
  99. data/module/gems/highline-1.6.19/site/highline.css +65 -0
  100. data/module/gems/highline-1.6.19/site/images/logo.png +0 -0
  101. data/module/gems/highline-1.6.19/site/index.html +58 -0
  102. data/module/gems/highline-1.6.19/test/string_methods.rb +32 -0
  103. data/module/gems/highline-1.6.19/test/tc_color_scheme.rb +96 -0
  104. data/module/gems/highline-1.6.19/test/tc_highline.rb +1128 -0
  105. data/module/gems/highline-1.6.19/test/tc_import.rb +52 -0
  106. data/module/gems/highline-1.6.19/test/tc_menu.rb +439 -0
  107. data/module/gems/highline-1.6.19/test/tc_string_extension.rb +20 -0
  108. data/module/gems/highline-1.6.19/test/tc_string_highline.rb +38 -0
  109. data/module/gems/highline-1.6.19/test/tc_style.rb +567 -0
  110. data/module/gems/highline-1.6.19/test/ts_all.rb +16 -0
  111. data/module/latest_specs.4.8 +0 -0
  112. data/module/latest_specs.4.8.gz +0 -0
  113. data/module/prerelease_specs.4.8 +0 -0
  114. data/module/prerelease_specs.4.8.gz +0 -0
  115. data/module/specs.4.8 +0 -0
  116. data/module/specs.4.8.gz +0 -0
  117. data/samples/blather/restlike/Gemfile +4 -0
  118. data/samples/blather/restlike/cmd.yml +1 -0
  119. data/samples/blather/restlike/lib/blather.rb +9 -0
  120. data/samples/blather/restlike/lib/blather/dsl/api.rb +78 -0
  121. data/samples/blather/restlike/lib/blather/dsl/call.rb +13 -0
  122. data/samples/blather/restlike/lib/blather/dsl/client.rb +58 -0
  123. data/samples/blather/restlike/lib/blather/dsl/config.rb +11 -0
  124. data/samples/blather/restlike/lib/blather/dsl/extraDSL.rb +163 -0
  125. data/samples/blather/restlike/lib/blather/meta/require.rb +8 -0
  126. data/samples/blather/restlike/lib/blather/meta/xmpp.yml +5 -0
  127. data/samples/blather/restlike/lib/blather/vendors/xmpp_default.rb +27 -0
  128. data/samples/blather/restlike/readme +2 -0
  129. data/samples/grape/init/Gemfile +2 -0
  130. data/samples/grape/init/cmd.yml +3 -0
  131. data/samples/grape/init/config.ru +2 -0
  132. data/samples/grape/init/docs/grape/documentation.txt +939 -0
  133. data/samples/grape/init/docs/grape/generate_rest_routes.rb +37 -0
  134. data/samples/grape/init/docs/grape/ls_routes.rb +31 -0
  135. data/samples/grape/init/lib/grape.rb +4 -0
  136. data/samples/grape/init/lib/grape/meta/subclasses.rb +20 -0
  137. data/samples/grape/init/lib/grape/xpath/app.rb +30 -0
  138. data/samples/grape/init/lib/grape/xpath/ruotes.rb +6 -0
  139. data/samples/grape/init/readme +1 -0
  140. data/samples/grape/readme +29 -0
  141. data/samples/grape/vendor/lib/grape/vendors/v1/rest.rb +57 -0
  142. data/samples/mongoid/cmd.yml +1 -0
  143. data/samples/mongoid/init/Gemfile +3 -0
  144. data/samples/mongoid/init/cmd.yml +2 -0
  145. data/samples/mongoid/init/docs/mongoid/ModelsRelations.rb +11 -0
  146. data/samples/mongoid/init/docs/mongoid/documents.xls +0 -0
  147. data/samples/mongoid/init/docs/mongoid/generate_modelsToDocs.rb +25 -0
  148. data/samples/mongoid/init/docs/mongoid/modelsToDocs.rb +25 -0
  149. data/samples/mongoid/init/docs/mongoid/relations.txt +1354 -0
  150. data/samples/mongoid/init/lib/mongoid.rb +44 -0
  151. data/samples/mongoid/init/lib/mongoid/dsl/extraDSL_CRUD.rb +446 -0
  152. data/samples/mongoid/init/lib/mongoid/dsl/extraDSL_MP.rb +517 -0
  153. data/samples/mongoid/init/lib/mongoid/dsl/init.rb +37 -0
  154. data/samples/mongoid/init/lib/mongoid/dsl/params.rb +67 -0
  155. data/samples/mongoid/init/lib/mongoid/meta/banned.rb +147 -0
  156. data/samples/mongoid/init/lib/mongoid/meta/control.yml +13 -0
  157. data/samples/mongoid/init/lib/mongoid/meta/mongoid.yml +6 -0
  158. data/samples/mongoid/init/lib/mongoid/meta/mpatch.rb +14 -0
  159. data/samples/mongoid/model/lib/mongoid/models/model.rb +28 -0
  160. data/samples/mongoid/readme +33 -0
  161. data/samples/rack/init/Gemfile +10 -0
  162. data/samples/rack/init/cmd.yml +2 -0
  163. data/samples/rack/init/config.ru +1 -0
  164. data/samples/rack/init/docs/rack/rake introducing.txt +60 -0
  165. data/samples/rack/init/docs/rack/webservers/Thin +43 -0
  166. data/samples/rack/init/docs/rack/webservers/ebb +72 -0
  167. data/samples/rack/init/docs/rack/webservers/fcgi +103 -0
  168. data/samples/rack/init/docs/rack/webservers/mongrel +74 -0
  169. data/samples/rack/init/docs/rack/webservers/passenger +37 -0
  170. data/samples/rack/init/docs/rack/webservers/scgi +188 -0
  171. data/samples/rack/init/lib/rack.rb +1 -0
  172. data/samples/rack/init/lib/rack/meta/webserver/thin.rb +45 -0
  173. data/samples/rack/init/lib/rack/meta/webserver/thin.yml +6 -0
  174. data/samples/rack/init/server.rb +0 -0
  175. data/samples/rack/readme +13 -0
  176. data/samples/rest_client/init/Gemfile +5 -0
  177. data/samples/rest_client/init/boot.rb +2 -0
  178. data/samples/rest_client/init/cmd.yml +1 -0
  179. data/samples/rest_client/init/config/rest_client/defaults.rb +16 -0
  180. data/samples/rest_client/init/docs/rest_client/simple overlook +251 -0
  181. data/samples/rest_client/init/test/rest_client/rest_dsl.rb +5 -0
  182. data/samples/rest_client/readme +7 -0
  183. data/samples/scripts/lines_counter/lines_number.rb +32 -0
  184. data/samples/scripts/lines_counter/readme +5 -0
  185. data/samples/scripts/readme +1 -0
  186. metadata +197 -7
  187. data/lib/clone/cms.rb +0 -56
  188. data/lib/clone/ext.rb +0 -77
  189. data/sample/test.rb +0 -30
@@ -0,0 +1,44 @@
1
+
2
+ ### connect to the database
3
+ #CONFIGURATION OPTIONS
4
+ #
5
+ #Mongoid currently supports the following configuration options, either
6
+ #provided in the mongoid.yml or programatically (defaults in parenthesis).
7
+ #
8
+ # allow_dynamic_fields (true): When attributes are not defined as
9
+ # fields but added to an object, they will get fields added for them dynamically and will get persisted. If set to false an error will get raised when attempting to set a value that has no field defined.
10
+ # autocreate_indexes (false): When set to true Mongoid will attempt to create indexes each time a class is loaded. This is not recommended for any environment other than development or test.
11
+ # identity_map_enabled (false): When set to true Mongoid will store
12
+ # documents loaded from the database in the identity map by their ids,
13
+ # so subsequent database queries for the same document in the same unit
14
+ # of work do not hit the database. This is only for relation queries at
15
+ # the moment. See the identity map documentation for more info.
16
+ #
17
+ # include_root_in_json (false): When set to true mongoid will include the
18
+ # name of the root document and the name of each association as the root
19
+ # element when calling #to_json on a model.
20
+ #
21
+ #max_retries_on_connection_failure (0): If you would like Mongoid to retry
22
+ #operations if a Mongo::ConnectionFailure occurs you may specify this option
23
+ #in your config. Mongoid will retry the operation every half second up to the
24
+ #limit that is set. This is particularly useful when using replica sets.
25
+ # parameterize_keys (true): Tells Mongoid to convert basic special characters in composite keys to SEO friendly substrings.
26
+ # persist_in_safe_mode (false): Tells Mongoid to perform all database operations in MongoDB's safe mode. This will cause the driver to double check operations and raise an error if they failed. Switching to true will be safe but will be a slight performance hit.
27
+ #preload_models (false): Tells Mongoid to preload all application model classes
28
+ #on each request in environments where classes are not being cached. This should
29
+ #only be used by applications that use single collection inheritance due to
30
+ #performance issues with enabling this.
31
+ #
32
+ #raise_not_found_error (true): Will raise a Mongoid::Errors::DocumentNotFound
33
+ # when attempting to find a document by an id that doesnt exist. When set to
34
+ #false will only return nil for the same query.
35
+ #skip_version_check (false): If you are having issues authenticating against
36
+ #MongoHQ or MongoMachine because of access to the system collection being not
37
+ #allowed, set this to true.
38
+ Mongoid.configure do |config|
39
+ config.master = Mongo::Connection.new.db("default")
40
+ end
41
+
42
+ ### Require Mongoid parts
43
+ require_relative_directory File.join "mongoid","dsl"
44
+ require_relative_directory File.join "mongoid","models"
@@ -0,0 +1,446 @@
1
+ module Mongoid
2
+ module ExtraDSL
3
+ ### Mongoid::ExtraDSL.CRUD_name(
4
+ # *models, #target , parent
5
+ # *param_hashTags,
6
+ # [optionable]relation_type_string
7
+ #)
8
+ class << self
9
+
10
+ def input(*args)
11
+
12
+ ### defaults
13
+ begin
14
+
15
+ relation_type_model = nil
16
+
17
+ parent_model = nil
18
+ target_model = nil
19
+
20
+ models_array = Array.new
21
+ params = Hash.new
22
+ pager = Hash.new
23
+ properties = Hash.new
24
+
25
+ end
26
+
27
+ ### fill up defaults by argumens
28
+ begin
29
+ args.each do |argument|
30
+ case argument.class.to_s.downcase
31
+
32
+ when "class"
33
+ models_array.push argument
34
+
35
+ when "hash","hashie::mash"
36
+ argument.each do |key,value|
37
+ case key.to_s.downcase
38
+
39
+ when "db_page_limit","db_page_number"
40
+ pager[key.to_s.downcase]= value
41
+
42
+ else
43
+ params[key]=value
44
+
45
+ end
46
+ end
47
+
48
+ when "string"
49
+ begin
50
+ if argument.to_s.downcase.include?("mongoid::relations")
51
+ #argument=argument.split('::')
52
+ #2.times do
53
+ # argument.shift()
54
+ #end
55
+ #argument=argument.join('::')
56
+ relation_type_model= argument
57
+ else
58
+ begin
59
+ if argument.constantize != Object
60
+ models_array.push argument.constantize
61
+ end
62
+ rescue NameError
63
+ relation_type_model= argument
64
+ end
65
+ end
66
+ end
67
+
68
+ end
69
+ end
70
+ if models_array.count <= 1
71
+ target_model= models_array[0]
72
+ models_array.shift()
73
+ else
74
+
75
+ target_model= models_array[0]
76
+ models_array.shift()
77
+
78
+ parent_model= models_array[0]
79
+ models_array.shift()
80
+
81
+ end
82
+ end
83
+
84
+ ### params sub key remove
85
+ begin
86
+ if !params['params'].nil?
87
+
88
+ tmp_hash=Hash.new
89
+ tmp_hash= params['params']
90
+ params.delete 'params'
91
+ tmp_hash.each do |key,value|
92
+ params[key]= value
93
+ end
94
+
95
+ end
96
+ end
97
+
98
+ ### BSON::ObjectId convert in params
99
+ begin
100
+ tmp_hash= Hash.new
101
+ params.each do |key,value|
102
+ if key.to_s == '_id'
103
+ tmp_hash[key]= Moped::BSON::ObjectId.from_string(value.to_s)
104
+ end
105
+ if key.to_s == 'id'
106
+ tmp_hash['_id']= Moped::BSON::ObjectId.from_string(value.to_s)
107
+ params.delete 'id'
108
+ end
109
+ end
110
+ if tmp_hash != Hash.new
111
+ tmp_hash.each do |key,value|
112
+ params[key]= value
113
+ end
114
+ end
115
+ end
116
+
117
+ ### parent_id key search
118
+ begin
119
+ parent_id_key= "#{parent_model.convert_model_name.to_s.downcase}_id"
120
+ parent_id_key= "parent_id" if parent_id_key=='_id'
121
+
122
+ tmp_hash= Hash.new
123
+ params.each do |key,value|
124
+ case key.to_s.downcase
125
+ when "parent_id","parentid",parent_id_key
126
+ properties['parent_id']=value
127
+ else
128
+ tmp_hash[key]=value
129
+ end
130
+ end
131
+ params= tmp_hash
132
+ end
133
+
134
+ ### params trim by banned elements
135
+ begin
136
+ Mongoid::Banned.list.each do |category,category_elements|
137
+ case category
138
+
139
+ when :ProtocolElements
140
+ category_elements.each do |one_banned_global_key|
141
+ params.delete one_banned_global_key
142
+ end
143
+
144
+ else
145
+ #nothing
146
+
147
+ end
148
+ end
149
+ end
150
+
151
+ ### generate model connection type
152
+ begin
153
+ begin
154
+ relation_type_model ||= target_model.reverse_relation_connection_type(parent_model)
155
+ rescue Exception
156
+ relation_type_model ||= parent_model.relation_connection_type(target_model)
157
+ end
158
+ end
159
+
160
+ ### return processed data as hash table
161
+ begin
162
+ return_hash= {
163
+ :parent_model => parent_model,
164
+ :target_model => target_model,
165
+ :models => models_array,
166
+ :model_type => relation_type_model,
167
+ :params => params,
168
+ :pager => pager,
169
+ :properties => properties
170
+ }
171
+ return return_hash
172
+ end
173
+
174
+ end
175
+
176
+ def read(*args)
177
+
178
+ ### defaults
179
+ begin
180
+ input_hash = self.input(*args)
181
+ parent_model = input_hash[:parent_model]
182
+ target_model = input_hash[:target_model]
183
+ model_type = input_hash[:model_type]
184
+ params = input_hash[:params]
185
+ pager = input_hash[:pager]
186
+ properties = input_hash[:properties]
187
+ return_object = nil
188
+ end
189
+
190
+ #puts args.inspect,""
191
+ #puts input_hash.inspect,""
192
+
193
+ ### processing
194
+ begin
195
+ case true
196
+
197
+ when model_type.downcase.include?("none"),
198
+ model_type.downcase.include?("self")
199
+ begin
200
+ if params.find_hashize == Hash.new
201
+ return_object= target_model._all
202
+ elsif !params.find_hashize['_id'].nil?
203
+ return_object= target_model._find(params.find_hashize['_id'])
204
+ else
205
+ return_object= target_model._where(params.find_hashize)
206
+ end
207
+ end
208
+
209
+ when model_type.downcase.include?("embedded"),
210
+ model_type.downcase.include?("referenced")
211
+ begin
212
+ if !properties['parent_id'].nil?
213
+ ### find embeds collection by parent_id
214
+ return_object= parent_model._find_by(
215
+ properties['parent_id']).__send__(target_model.convert_model_name)
216
+ else
217
+ ### find by params
218
+ if !params['_id'].nil?
219
+ return_object= target_model._find_by(params.find_hashize)
220
+ elsif params.find_hashize == Hash.new
221
+ return_object= target_model._all(parent_model)
222
+ else
223
+ return_object= target_model._where(params.find_hashize)
224
+ end
225
+ end
226
+ end
227
+
228
+ end
229
+ end
230
+
231
+ ### after limiting
232
+ begin
233
+ if pager != Hash.new && return_object.class == Mongoid::Criteria && !pager['db_page_limit'].nil?
234
+ if pager['db_page_number'].nil?
235
+ return_object= return_object.limit(pager['db_page_limit'])
236
+ else
237
+ return_object= return_object.limit(pager['db_page_limit'].to_i).offset(
238
+ (pager['db_page_number'].to_i * pager['db_page_limit'].to_i))
239
+ end
240
+ end
241
+ end
242
+
243
+ ### grape readable formating
244
+ begin
245
+
246
+ #if return_object.class == Mongoid::Criteria
247
+ # return_object= Array[*return_object]
248
+ #end
249
+
250
+
251
+ return return_object
252
+ end
253
+
254
+ end
255
+
256
+ def create(*args)
257
+
258
+ ### defaults
259
+ begin
260
+ input_hash = self.input(*args)
261
+ parent_model = input_hash[:parent_model]
262
+ target_model = input_hash[:target_model]
263
+ model_type = input_hash[:model_type]
264
+ params = input_hash[:params]
265
+ properties = input_hash[:properties]
266
+ return_key = 'id'
267
+ return_object = nil
268
+ end
269
+
270
+ ### params trim by banned elements
271
+ begin
272
+ Mongoid::Banned.list.each do |category,category_elements|
273
+ case category
274
+
275
+ when :Elements
276
+ category_elements.each do |one_banned_global_key|
277
+ params.delete one_banned_global_key
278
+ end
279
+
280
+ when :ModelElements
281
+ category_elements.each do |one_info_hash|
282
+ if one_info_hash.keys[0].to_s == target_model.to_s
283
+ params.delete one_info_hash.values[0]
284
+ end
285
+ end
286
+
287
+ end
288
+ end
289
+ end
290
+
291
+ ### processing
292
+ begin
293
+ case true
294
+
295
+ when model_type.downcase.include?("none"),
296
+ model_type.downcase.include?("self")
297
+ begin
298
+
299
+
300
+ new_data= target_model.new(params.new_hashize)
301
+
302
+ begin
303
+ new_data.save
304
+ rescue Exception
305
+ return_object= false
306
+ end
307
+
308
+ if return_object.nil?
309
+ return_object= new_data['_id']
310
+ end
311
+
312
+ end
313
+
314
+ when model_type.downcase.include?("embedded::many"),
315
+ model_type.downcase.include?("referenced::many")
316
+ begin
317
+ parent= parent_model._find(properties['parent_id'])
318
+ if params['_id'].nil?
319
+ parent.__send__(target_model.convert_model_name.to_s).push(
320
+ target_model.new((params.new_hashize)))
321
+ else
322
+ parent.__send__(target_model.convert_model_name.to_s).push(
323
+ target_model._find((params.find_hashize['_id'])))
324
+ end
325
+ begin
326
+ parent.save!
327
+ rescue Exception
328
+ return_object= false
329
+ end
330
+
331
+ if return_object.nil?
332
+ return_object= parent.__send__(target_model.convert_model_name.to_s).last['_id']
333
+ end
334
+
335
+ end
336
+
337
+ when model_type.downcase.include?("embedded::one"),
338
+ model_type.downcase.include?("referenced::one")
339
+ begin
340
+ parent= parent_model._find(properties['parent_id'])
341
+ if params['_id'].nil?
342
+ parent.__send__("#{target_model.convert_model_name}=",
343
+ target_model.new(params.new_hashize))
344
+ else
345
+ parent.__send__("#{target_model.convert_model_name}=",
346
+ target_model._find((params.find_hashize['_id'])))
347
+ end
348
+
349
+ begin
350
+ parent.save
351
+ rescue Exception
352
+ return_object= false
353
+ end
354
+
355
+ if return_object.nil?
356
+ return_object= parent.__send__(target_model.convert_model_name.to_s)['_id']
357
+ end
358
+
359
+ end
360
+
361
+ end
362
+ end
363
+
364
+ ### return return_obj
365
+ begin
366
+ #return { return_key => return_object }
367
+ return return_object
368
+
369
+ end
370
+
371
+ end
372
+
373
+ def update(*args)
374
+
375
+ ### defaults
376
+ begin
377
+ input_hash = self.input(*args)
378
+ parent_model = input_hash[:parent_model]
379
+ target_model = input_hash[:target_model]
380
+ model_type = input_hash[:model_type]
381
+ params = input_hash[:params]
382
+ end
383
+
384
+ ### processing
385
+ begin
386
+ case true
387
+
388
+ when false
389
+ #do nothing
390
+
391
+ else
392
+ begin
393
+
394
+ new_data= target_model._find(params['_id'])
395
+ params.new_hashize.each do |key,value|
396
+ new_data[key]=value
397
+ end
398
+ new_data.save!
399
+
400
+ end
401
+
402
+ end
403
+ end
404
+
405
+ end
406
+
407
+ def delete(*args)
408
+
409
+ ### defaults
410
+ begin
411
+ input_hash = self.input(*args)
412
+ parent_model = input_hash[:parent_model]
413
+ target_model = input_hash[:target_model]
414
+ model_type = input_hash[:model_type]
415
+ params = input_hash[:params]
416
+ end
417
+
418
+ ### processing
419
+ begin
420
+ case true
421
+
422
+ when false
423
+ #do nothing
424
+
425
+ else
426
+ ### embeds collections
427
+ begin
428
+
429
+ something_to_delete= target_model._find(params['_id'])
430
+ something_to_delete.delete
431
+ begin
432
+ something_to_delete.save
433
+ rescue Exception
434
+ false
435
+ end
436
+
437
+ end
438
+
439
+ end
440
+ end
441
+
442
+ end
443
+
444
+ end
445
+ end
446
+ end