lux-fw 0.2.3 → 0.5.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/bin/README.md +33 -0
  4. data/bin/build_gem +76 -0
  5. data/bin/cli/config.rb +44 -0
  6. data/bin/cli/console.rb +61 -0
  7. data/bin/cli/dbconsole.rb +8 -0
  8. data/bin/cli/eval.rb +32 -0
  9. data/bin/cli/generate.rb +88 -0
  10. data/bin/cli/get.rb +12 -0
  11. data/bin/cli/new.rb +22 -0
  12. data/bin/cli/routes.rb +90 -0
  13. data/bin/cli/secrets.rb +40 -0
  14. data/bin/cli/server.rb +24 -0
  15. data/bin/cli/stats.rb +133 -0
  16. data/bin/lux +24 -65
  17. data/lib/common/class_attributes.rb +40 -64
  18. data/lib/common/class_callbacks.rb +34 -51
  19. data/lib/common/crypt.rb +10 -8
  20. data/lib/common/free_struct.rb +42 -0
  21. data/lib/common/hash_with_indifferent_access.rb +1 -1
  22. data/lib/common/html_tag_builder.rb +26 -2
  23. data/lib/common/url.rb +58 -40
  24. data/lib/lux/application/application.rb +290 -117
  25. data/lib/lux/application/lib/nav.rb +64 -38
  26. data/lib/lux/application/lib/render.rb +2 -1
  27. data/lib/lux/cache/cache.rb +87 -62
  28. data/lib/lux/cache/lib/{ram.rb → memory.rb} +5 -7
  29. data/lib/lux/cache/lib/null.rb +6 -8
  30. data/lib/lux/config/config.rb +109 -52
  31. data/lib/lux/config/lib/plugin.rb +65 -0
  32. data/lib/lux/config/lib/secrets.rb +48 -0
  33. data/lib/lux/controller/controller.rb +241 -0
  34. data/lib/lux/current/current.rb +33 -47
  35. data/lib/lux/current/lib/session.rb +72 -0
  36. data/lib/lux/delayed_job/delayed_job.rb +14 -7
  37. data/lib/lux/delayed_job/lib/memory.rb +7 -5
  38. data/lib/lux/delayed_job/lib/redis.rb +1 -1
  39. data/lib/lux/error/error.rb +164 -62
  40. data/lib/lux/event_bus/event_bus.rb +27 -0
  41. data/lib/lux/lux.rb +103 -66
  42. data/lib/lux/mailer/mailer.rb +23 -25
  43. data/lib/lux/response/lib/file.rb +81 -0
  44. data/lib/lux/response/lib/header.rb +14 -1
  45. data/lib/lux/response/response.rb +64 -56
  46. data/lib/lux/view/cell.rb +102 -0
  47. data/lib/lux/{helper → view}/helper.rb +39 -23
  48. data/lib/lux/view/lib/cell_helpers.rb +29 -0
  49. data/lib/lux/{helper/helpers/mailer_helper.rb → view/lib/helper_modules.rb} +7 -1
  50. data/lib/lux/{template/template.rb → view/view.rb} +21 -24
  51. data/lib/lux-fw.rb +4 -2
  52. data/lib/overload/array.rb +12 -6
  53. data/lib/overload/blank.rb +0 -1
  54. data/lib/overload/dir.rb +18 -0
  55. data/lib/overload/file.rb +1 -6
  56. data/lib/overload/hash.rb +56 -13
  57. data/lib/overload/integer.rb +2 -2
  58. data/lib/overload/it.rb +4 -4
  59. data/lib/overload/object.rb +37 -8
  60. data/lib/overload/{r.rb → raise_variants.rb} +23 -4
  61. data/lib/overload/string.rb +22 -6
  62. data/misc/demo/app/cells/demo_cell.rb +12 -0
  63. data/misc/demo/app/controllers/application_controller.rb +7 -0
  64. data/misc/demo/app/controllers/main/root_controller.rb +9 -0
  65. data/misc/demo/app/routes.rb +5 -0
  66. data/misc/demo/config/application.rb +14 -0
  67. data/misc/demo/config/assets.rb +6 -0
  68. data/misc/demo/config/environment.rb +7 -0
  69. data/misc/puma_auto_tune.rb +43 -0
  70. data/misc/unicorn.rb +37 -0
  71. data/{lib/lux → plugins}/api/api.rb +46 -29
  72. data/plugins/api/lib/attr.rb +31 -0
  73. data/{lib/lux → plugins}/api/lib/dsl.rb +3 -6
  74. data/{lib/lux → plugins}/api/lib/error.rb +0 -0
  75. data/{lib/lux → plugins}/api/lib/model_api.rb +51 -12
  76. data/{lib/lux → plugins}/api/lib/response.rb +31 -17
  77. data/{bin/cli/am → plugins/db/auto_migrate/auto_migrate.rb} +18 -35
  78. data/plugins/db/helpers/array_search.rb +27 -0
  79. data/plugins/db/helpers/before_save_filters.rb +32 -0
  80. data/plugins/db/helpers/composite_primary_keys.rb +36 -0
  81. data/plugins/db/helpers/core.rb +94 -0
  82. data/plugins/db/helpers/dataset_methods.rb +138 -0
  83. data/plugins/db/helpers/enums_plugin.rb +52 -0
  84. data/plugins/db/helpers/find_precache.rb +31 -0
  85. data/plugins/db/helpers/link_objects.rb +84 -0
  86. data/plugins/db/helpers/schema_checks.rb +83 -0
  87. data/plugins/db/helpers/typero_adapter.rb +71 -0
  88. data/plugins/db/logger/config.rb +22 -0
  89. data/plugins/db/logger/lux_response_adapter.rb +10 -0
  90. data/plugins/db/paginate/helper.rb +32 -0
  91. data/plugins/db/paginate/sequel_adapter.rb +23 -0
  92. data/plugins/exceptions/simple_exception.rb +64 -0
  93. data/plugins/favicon/favicon.rb +10 -0
  94. data/plugins/html/html_form.rb +118 -0
  95. data/plugins/html/html_input.rb +98 -0
  96. data/plugins/html/html_menu.rb +79 -0
  97. data/plugins/html/input_types.rb +346 -0
  98. data/plugins/js_widgets/js_widgets.rb +15 -0
  99. data/plugins/oauth/lib/facebook.rb +35 -0
  100. data/plugins/oauth/lib/github.rb +38 -0
  101. data/plugins/oauth/lib/google.rb +41 -0
  102. data/plugins/oauth/lib/linkedin.rb +41 -0
  103. data/plugins/oauth/lib/stackexchange.rb +41 -0
  104. data/plugins/oauth/lib/twitter.rb +38 -0
  105. data/plugins/oauth/oauth.rb +42 -0
  106. data/{lib/common → plugins/policy}/policy.rb +6 -7
  107. data/tasks/loader.rb +49 -0
  108. metadata +151 -49
  109. data/bin/cli/assets +0 -41
  110. data/bin/cli/console +0 -51
  111. data/bin/cli/dev +0 -1
  112. data/bin/cli/eval +0 -24
  113. data/bin/cli/exceptions +0 -62
  114. data/bin/cli/generate +0 -86
  115. data/bin/cli/get +0 -5
  116. data/bin/cli/nginx +0 -34
  117. data/bin/cli/production +0 -1
  118. data/bin/cli/render +0 -18
  119. data/bin/cli/routes +0 -14
  120. data/bin/cli/server +0 -4
  121. data/bin/cli/stat +0 -1
  122. data/bin/cli/systemd +0 -36
  123. data/bin/txt/nginx.conf +0 -46
  124. data/bin/txt/siege-and-puma.txt +0 -3
  125. data/lib/common/base32.rb +0 -47
  126. data/lib/common/dynamic_class.rb +0 -28
  127. data/lib/common/folder_model.rb +0 -50
  128. data/lib/common/generic_model.rb +0 -62
  129. data/lib/lux/application/lib/plugs.rb +0 -10
  130. data/lib/lux/application/lib/route_test.rb +0 -64
  131. data/lib/lux/cache/lib/memcached.rb +0 -3
  132. data/lib/lux/cell/cell.rb +0 -261
  133. data/lib/lux/current/lib/static_file.rb +0 -103
  134. data/lib/lux/helper/helpers/application_helper.rb +0 -3
  135. data/lib/lux/helper/helpers/html_helper.rb +0 -3
  136. data/lib/overload/auto_loader.rb +0 -27
  137. data/lib/overload/module.rb +0 -10
  138. data/lib/overload/string_inflections.rb +0 -8
@@ -0,0 +1,42 @@
1
+ class LuxOauth
2
+ class_attribute :local_path, 'callback'
3
+
4
+ class << self
5
+ def get target
6
+ "LuxOauth::#{target.to_s.classify}".constantize.new
7
+ end
8
+
9
+ def login target
10
+ get(target).login
11
+ end
12
+ end
13
+
14
+ ###
15
+
16
+ def initialize
17
+ @target = self.class.to_s.split('::').last.downcase.to_sym
18
+ @opts = opts_loader
19
+
20
+ raise ArgumentError, 'Host is invalid' unless host =~ /^https?:/
21
+
22
+ for el in %i[key secret]
23
+ raise ArgumentError.new('OAUTH %s needed for %s' % [el, @target]) unless @opts.send(el)
24
+ end
25
+ end
26
+
27
+ def redirect_url
28
+ [host, LuxOauth.local_path, @target].join('/')
29
+ end
30
+
31
+ private
32
+
33
+ def opts_loader
34
+ Lux.secrets.send(@target).oauth
35
+ rescue
36
+ raise "Can't load Oauth secrets for #{@target}: #{$!.message}"
37
+ end
38
+
39
+ def host
40
+ Lux.config(:host)
41
+ end
42
+ end
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # base caller
4
- # UserPolicy.new(model: @model, user: User.current).can?(:update) -> can current user update @user
5
- # ApplicationPolicy.new(user: Lux.current.var.user).can?(:admin_login?) -> can current user login to admin
4
+ # Policy::User.new(model: @model, user: User.current).can?(:update) -> can current user update @user
6
5
 
7
6
  # block will capture error message and be triggered only if error is present
8
7
  # User.can?(:login) { |msg| http_error 401, "Err: #{msg}".red; return 'no access' }
@@ -32,11 +31,11 @@ class Policy
32
31
  def call &block
33
32
  return true if before(@action)
34
33
  return true if send(@action)
35
- raise UnauthorizedError, 'Access disabled in policy'
36
- rescue UnauthorizedError
34
+ raise Lux::Error.unauthorized('Access disabled in policy')
35
+ rescue Lux::Error
37
36
  error = $!.message
38
- error += " - #{self.class}.#{@action}" if Lux.config(:show_server_errors)
39
- raise UnauthorizedError, error unless block
37
+ error += " - #{self.class}.#{@action}" if Lux.config(:dump_errors)
38
+ raise Lux::Error.unauthorized(error) unless block
40
39
  block.call(error)
41
40
  false
42
41
  end
@@ -48,7 +47,7 @@ class Policy
48
47
  end
49
48
 
50
49
  def error message
51
- raise UnauthorizedError, message
50
+ raise Lux::Error.unauthorized(message)
52
51
  end
53
52
 
54
53
  end
data/tasks/loader.rb ADDED
@@ -0,0 +1,49 @@
1
+ def run what
2
+ puts what.yellow
3
+ system what
4
+ end
5
+
6
+ def die what
7
+ puts '%s (%s)' % [what.red. caller[0]]
8
+ exit
9
+ end
10
+
11
+ def info text
12
+ puts '* %s' % text.yellow
13
+ end
14
+
15
+ def tpool list, parallel=6, &block
16
+ t = Thread.pool(parallel)
17
+ for el in list
18
+ t.process(el) { |o| block.call(o) }
19
+ end
20
+ t.shutdown
21
+ end
22
+
23
+ ###
24
+
25
+ task :env do
26
+ require './config/application'
27
+ end
28
+
29
+ task :default do
30
+ puts '"rake -T" to show all tasks'
31
+ end
32
+
33
+ ###
34
+
35
+ require 'bundler/setup'
36
+ require 'dotenv'
37
+
38
+ Dotenv.load
39
+ Bundler.require :default, ENV.fetch('RACK_ENV')
40
+
41
+ tasks = []
42
+ tasks += Dir['%s/tasks/*.rake' % Lux.fw_root]
43
+ tasks += Dir['./lib/**/*.rake']
44
+
45
+ for dir in Lux.plugin.loaded.map(&:folder)
46
+ tasks += Dir['%s/**/*.rake' % dir]
47
+ end
48
+
49
+ tasks.each { |file| eval File.read file }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lux-fw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.5.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Reic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -142,14 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.3'
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: dotenv
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0.3'
166
+ version: '2'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: mail
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +178,34 @@ dependencies:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
180
  version: '2'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rake
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '12'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '12'
195
+ - !ruby/object:Gem::Dependency
196
+ name: thor
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: clipboard
169
211
  requirement: !ruby/object:Gem::Requirement
@@ -179,19 +221,47 @@ dependencies:
179
221
  - !ruby/object:Gem::Version
180
222
  version: '1'
181
223
  - !ruby/object:Gem::Dependency
182
- name: nokogiri
224
+ name: pry
183
225
  requirement: !ruby/object:Gem::Requirement
184
226
  requirements:
185
227
  - - "~>"
186
228
  - !ruby/object:Gem::Version
187
- version: '1'
229
+ version: '0'
188
230
  type: :runtime
189
231
  prerelease: false
190
232
  version_requirements: !ruby/object:Gem::Requirement
191
233
  requirements:
192
234
  - - "~>"
193
235
  - !ruby/object:Gem::Version
194
- version: '1'
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: puma
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '3'
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '3'
251
+ - !ruby/object:Gem::Dependency
252
+ name: better_errors
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: '2'
258
+ type: :runtime
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: '2'
195
265
  description: Ruby framework optimized for speed and linghtness
196
266
  email: rejotl@gmail.com
197
267
  executables:
@@ -200,89 +270,121 @@ extensions: []
200
270
  extra_rdoc_files: []
201
271
  files:
202
272
  - "./.version"
203
- - "./bin/cli/am"
204
- - "./bin/cli/assets"
205
- - "./bin/cli/console"
206
- - "./bin/cli/dev"
207
- - "./bin/cli/eval"
208
- - "./bin/cli/exceptions"
209
- - "./bin/cli/generate"
210
- - "./bin/cli/get"
211
- - "./bin/cli/nginx"
212
- - "./bin/cli/production"
213
- - "./bin/cli/render"
214
- - "./bin/cli/routes"
215
- - "./bin/cli/server"
216
- - "./bin/cli/stat"
217
- - "./bin/cli/systemd"
273
+ - "./bin/README.md"
274
+ - "./bin/build_gem"
275
+ - "./bin/cli/config.rb"
276
+ - "./bin/cli/console.rb"
277
+ - "./bin/cli/dbconsole.rb"
278
+ - "./bin/cli/eval.rb"
279
+ - "./bin/cli/generate.rb"
280
+ - "./bin/cli/get.rb"
281
+ - "./bin/cli/new.rb"
282
+ - "./bin/cli/routes.rb"
283
+ - "./bin/cli/secrets.rb"
284
+ - "./bin/cli/server.rb"
285
+ - "./bin/cli/stats.rb"
218
286
  - "./bin/lux"
219
- - "./bin/txt/nginx.conf"
220
- - "./bin/txt/siege-and-puma.txt"
221
- - "./lib/common/base32.rb"
222
287
  - "./lib/common/class_attributes.rb"
223
288
  - "./lib/common/class_callbacks.rb"
224
289
  - "./lib/common/crypt.rb"
225
- - "./lib/common/dynamic_class.rb"
226
- - "./lib/common/folder_model.rb"
227
- - "./lib/common/generic_model.rb"
290
+ - "./lib/common/free_struct.rb"
228
291
  - "./lib/common/hash_with_indifferent_access.rb"
229
292
  - "./lib/common/html_tag_builder.rb"
230
293
  - "./lib/common/method_attr.rb"
231
- - "./lib/common/policy.rb"
232
294
  - "./lib/common/string_base.rb"
233
295
  - "./lib/common/url.rb"
234
296
  - "./lib/lux-fw.rb"
235
- - "./lib/lux/api/api.rb"
236
- - "./lib/lux/api/lib/dsl.rb"
237
- - "./lib/lux/api/lib/error.rb"
238
- - "./lib/lux/api/lib/model_api.rb"
239
- - "./lib/lux/api/lib/response.rb"
240
297
  - "./lib/lux/application/application.rb"
241
298
  - "./lib/lux/application/lib/nav.rb"
242
- - "./lib/lux/application/lib/plugs.rb"
243
299
  - "./lib/lux/application/lib/render.rb"
244
- - "./lib/lux/application/lib/route_test.rb"
245
300
  - "./lib/lux/cache/cache.rb"
246
- - "./lib/lux/cache/lib/memcached.rb"
301
+ - "./lib/lux/cache/lib/memory.rb"
247
302
  - "./lib/lux/cache/lib/null.rb"
248
- - "./lib/lux/cache/lib/ram.rb"
249
- - "./lib/lux/cell/cell.rb"
250
303
  - "./lib/lux/config/config.rb"
304
+ - "./lib/lux/config/lib/plugin.rb"
305
+ - "./lib/lux/config/lib/secrets.rb"
306
+ - "./lib/lux/controller/controller.rb"
251
307
  - "./lib/lux/current/current.rb"
252
308
  - "./lib/lux/current/lib/encrypt_params.rb"
253
- - "./lib/lux/current/lib/static_file.rb"
309
+ - "./lib/lux/current/lib/session.rb"
254
310
  - "./lib/lux/delayed_job/delayed_job.rb"
255
311
  - "./lib/lux/delayed_job/lib/memory.rb"
256
312
  - "./lib/lux/delayed_job/lib/nsq.rb"
257
313
  - "./lib/lux/delayed_job/lib/postgre.rb"
258
314
  - "./lib/lux/delayed_job/lib/redis.rb"
259
315
  - "./lib/lux/error/error.rb"
260
- - "./lib/lux/helper/helper.rb"
261
- - "./lib/lux/helper/helpers/application_helper.rb"
262
- - "./lib/lux/helper/helpers/html_helper.rb"
263
- - "./lib/lux/helper/helpers/mailer_helper.rb"
316
+ - "./lib/lux/event_bus/event_bus.rb"
264
317
  - "./lib/lux/lux.rb"
265
318
  - "./lib/lux/mailer/mailer.rb"
319
+ - "./lib/lux/response/lib/file.rb"
266
320
  - "./lib/lux/response/lib/flash.rb"
267
321
  - "./lib/lux/response/lib/header.rb"
268
322
  - "./lib/lux/response/response.rb"
269
- - "./lib/lux/template/template.rb"
323
+ - "./lib/lux/view/cell.rb"
324
+ - "./lib/lux/view/helper.rb"
325
+ - "./lib/lux/view/lib/cell_helpers.rb"
326
+ - "./lib/lux/view/lib/helper_modules.rb"
327
+ - "./lib/lux/view/view.rb"
270
328
  - "./lib/overload/array.rb"
271
- - "./lib/overload/auto_loader.rb"
272
329
  - "./lib/overload/blank.rb"
330
+ - "./lib/overload/dir.rb"
273
331
  - "./lib/overload/file.rb"
274
332
  - "./lib/overload/float.rb"
275
333
  - "./lib/overload/hash.rb"
276
334
  - "./lib/overload/integer.rb"
277
335
  - "./lib/overload/it.rb"
278
- - "./lib/overload/module.rb"
279
336
  - "./lib/overload/nil.rb"
280
337
  - "./lib/overload/object.rb"
281
- - "./lib/overload/r.rb"
338
+ - "./lib/overload/raise_variants.rb"
282
339
  - "./lib/overload/string.rb"
283
- - "./lib/overload/string_inflections.rb"
284
340
  - "./lib/overload/struct.rb"
285
341
  - "./lib/overload/time.rb"
342
+ - "./misc/demo/app/cells/demo_cell.rb"
343
+ - "./misc/demo/app/controllers/application_controller.rb"
344
+ - "./misc/demo/app/controllers/main/root_controller.rb"
345
+ - "./misc/demo/app/routes.rb"
346
+ - "./misc/demo/config/application.rb"
347
+ - "./misc/demo/config/assets.rb"
348
+ - "./misc/demo/config/environment.rb"
349
+ - "./misc/puma_auto_tune.rb"
350
+ - "./misc/unicorn.rb"
351
+ - "./plugins/api/api.rb"
352
+ - "./plugins/api/lib/attr.rb"
353
+ - "./plugins/api/lib/dsl.rb"
354
+ - "./plugins/api/lib/error.rb"
355
+ - "./plugins/api/lib/model_api.rb"
356
+ - "./plugins/api/lib/response.rb"
357
+ - "./plugins/db/auto_migrate/auto_migrate.rb"
358
+ - "./plugins/db/helpers/array_search.rb"
359
+ - "./plugins/db/helpers/before_save_filters.rb"
360
+ - "./plugins/db/helpers/composite_primary_keys.rb"
361
+ - "./plugins/db/helpers/core.rb"
362
+ - "./plugins/db/helpers/dataset_methods.rb"
363
+ - "./plugins/db/helpers/enums_plugin.rb"
364
+ - "./plugins/db/helpers/find_precache.rb"
365
+ - "./plugins/db/helpers/link_objects.rb"
366
+ - "./plugins/db/helpers/schema_checks.rb"
367
+ - "./plugins/db/helpers/typero_adapter.rb"
368
+ - "./plugins/db/logger/config.rb"
369
+ - "./plugins/db/logger/lux_response_adapter.rb"
370
+ - "./plugins/db/paginate/helper.rb"
371
+ - "./plugins/db/paginate/sequel_adapter.rb"
372
+ - "./plugins/exceptions/simple_exception.rb"
373
+ - "./plugins/favicon/favicon.rb"
374
+ - "./plugins/html/html_form.rb"
375
+ - "./plugins/html/html_input.rb"
376
+ - "./plugins/html/html_menu.rb"
377
+ - "./plugins/html/input_types.rb"
378
+ - "./plugins/js_widgets/js_widgets.rb"
379
+ - "./plugins/oauth/lib/facebook.rb"
380
+ - "./plugins/oauth/lib/github.rb"
381
+ - "./plugins/oauth/lib/google.rb"
382
+ - "./plugins/oauth/lib/linkedin.rb"
383
+ - "./plugins/oauth/lib/stackexchange.rb"
384
+ - "./plugins/oauth/lib/twitter.rb"
385
+ - "./plugins/oauth/oauth.rb"
386
+ - "./plugins/policy/policy.rb"
387
+ - "./tasks/loader.rb"
286
388
  - bin/lux
287
389
  homepage: http://trifolium.hr/lux
288
390
  licenses:
data/bin/cli/assets DELETED
@@ -1,41 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ENV['RACK_ENV'] = 'production'
4
-
5
- if ARGV[0] == 'help'
6
- puts 'lux assets rm gzip s3://assets'
7
- puts ' rm - remove local cached folder for assets'
8
- puts ' gzip - gzip files (for nginx)'
9
- puts ' s3://path - copy files to bucket (must be last argument)'
10
- exit
11
- end
12
-
13
- if ARGV.include?('rm')
14
- system 'rm -rf ./tmp/assets'
15
- system 'rm -rf ./public/assets'
16
- end
17
-
18
- require './config/application'
19
-
20
- assets = Dir['./app/assets/**/index.*'].map { |el| el.sub('./app/assets/','') }
21
-
22
- Lux.config.assets_precompile = true
23
-
24
- speed = Lux.speed do
25
- # tpool is not showing compile errors
26
- # tpool(assets) do |file|
27
- for file in assets
28
- assets = MiniAssets.new file
29
-
30
- # asset = MiniAsset.create file
31
- # asset.compile ARGV
32
- puts "Generated #{file.green} -> #{assets.render}"
33
- end
34
- end
35
-
36
- puts "Asset precomlile done in #{speed}"
37
-
38
- if ARGV.last && ARGV.last[0,5] == 's3://'
39
- puts 'Copy to %s'.green % ARGV.last
40
- system 'aws s3 sync ./public %s --cache-control "max-age=31536000, public"' % ARGV.last
41
- end
data/bin/cli/console DELETED
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- load_start = Time.now
4
-
5
- require 'awesome_print'
6
- require 'clipboard'
7
- require './config/application'
8
-
9
- Lux.config.show_server_errors = true
10
- Lux.config.log_to_stdout = true
11
-
12
- if File.exist?('./config/console.rb')
13
- puts '* loading ./config/console.rb'
14
- require './config/console'
15
- else
16
- puts '* ./config/console.rb not found'
17
- end
18
-
19
- Lux::Config.live_require_check! if Lux.config(:auto_code_reload)
20
-
21
- puts Lux::Config.show_load_speed load_start
22
-
23
- class Object
24
- def cp data
25
- data = JSON.pretty_generate(data.to_hash) if data.respond_to?(:to_hash)
26
- Clipboard.copy data
27
- 'copied'
28
- end
29
- end
30
-
31
- begin
32
- require 'pry'
33
-
34
- # AwesomePrint.pry!
35
- # nice object dump in console
36
- Pry.print = proc { |output, data|
37
- out = if data.is_a?(Hash)
38
- data.class.to_s+"\n"+JSON.pretty_generate(data).gsub(/"(\w+)":/) { '"%s":' % $1.yellow }
39
- else
40
- data.ai
41
- end
42
-
43
- output.puts out
44
- }
45
-
46
- Pry
47
- rescue LoadError
48
- puts 'pry not found, starting irb'.red
49
- require 'irb'
50
- IRB
51
- end.start
data/bin/cli/dev DELETED
@@ -1 +0,0 @@
1
- LuxCli.run "rerun -p '**/*.{rb,ru}' 'puma -p %s'" % @port
data/bin/cli/eval DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require './config/application'
4
-
5
- if File.exist?('./config/console.rb')
6
- puts '* loading ./config/console.rb'
7
- load './config/console.rb'
8
- end
9
-
10
- command = ARGV.join('; ')
11
-
12
- puts 'Command : %s' % command.light_blue
13
-
14
- data = eval command
15
- puts '-'
16
- puts 'Class : %s' % data.class
17
- puts '-'
18
-
19
- if data.class == String && data.include?('</body>')
20
- require 'nokogiri'
21
- puts Nokogiri::XML(data, &:noblanks)
22
- else
23
- ap data
24
- end
data/bin/cli/exceptions DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'colorize'
4
-
5
- ERROR_FOLDER = './log/exceptions'
6
-
7
- case ARGV[0]
8
- when 'help'
9
- puts ' lux exceptions - show all exceptions'
10
- puts ' lux exceptions clear - to clear error folder'
11
- puts ' lux exceptions NUMBER - to show error on specific number'
12
- exit
13
- when 'clear'
14
- LuxCli.run 'rm -rf "%s"' % ERROR_FOLDER
15
- puts '%s removed' % ERROR_FOLDER
16
- exit
17
- else
18
- end
19
-
20
- show = ARGV[0] ? ARGV[0].to_i : nil
21
-
22
- error_folders = Dir['%s/*' % ERROR_FOLDER].sort_by { |x| File.mtime(x) }.reverse
23
-
24
- if error_folders.length == 0
25
- puts 'Nothing found in %s'.light_blue % ERROR_FOLDER
26
- exit
27
- end
28
-
29
- cnt = 0
30
-
31
- puts 'Add error number as last argument to show full erros'.light_blue
32
-
33
- error_folders.each do |error_folder|
34
- cnt += 1
35
- next if show && show != cnt
36
-
37
- print '%s. %s - ' % [cnt.to_s.rjust(2), error_folder.split('/').last.yellow]
38
- file = Dir['%s/*.txt' % error_folder].sort_by{ |f| File.mtime(f) }.first
39
- next unless file
40
-
41
- last_update = (Time.now - File.mtime(file)).to_i
42
-
43
- if last_update < 60
44
- print '%s sec ago - ' % last_update.to_s.light_blue
45
- elsif last_update < 60*60
46
- print '%s mins ago - ' % (last_update/60).to_i.to_s.light_blue
47
- elsif last_update < 60*60*24
48
- print '%s hours ago - ' % (last_update/(60*60)).to_i.to_s.light_blue
49
- else
50
- print '%s days ago - ' % (last_update/(60*60*24)).to_i.to_s.light_blue
51
- end
52
-
53
- puts file.split('/').last
54
-
55
- if show
56
- puts "\n" + File.read(file)
57
- exit
58
- end
59
-
60
- first_line = File.read(file).split("\n").first
61
- puts ' %s' % first_line
62
- end