lux-fw 0.1.17 → 0.1.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/bin/cli/am +38 -29
  4. data/bin/cli/assets +8 -4
  5. data/bin/cli/exceptions +6 -6
  6. data/bin/cli/generate +0 -0
  7. data/bin/cli/get +0 -0
  8. data/bin/cli/nginx +11 -5
  9. data/bin/cli/routes +0 -0
  10. data/bin/cli/systemd +36 -0
  11. data/bin/forever +0 -0
  12. data/bin/job_que +0 -0
  13. data/bin/lux +1 -0
  14. data/lib/common/base32.rb +0 -0
  15. data/lib/common/class_attributes.rb +13 -4
  16. data/lib/common/crypt.rb +6 -10
  17. data/lib/common/dynamic_class.rb +23 -0
  18. data/lib/common/generic_model.rb +0 -0
  19. data/lib/common/hash_with_indifferent_access.rb +352 -0
  20. data/lib/common/method_attr.rb +69 -0
  21. data/lib/lux/api/api.rb +26 -27
  22. data/lib/lux/api/lib/application_api.rb +26 -7
  23. data/lib/lux/api/lib/doc_builder.rb +18 -17
  24. data/lib/lux/api/lib/dsl.rb +23 -41
  25. data/lib/lux/api/lib/error.rb +3 -0
  26. data/lib/lux/api/lib/model_api.rb +22 -20
  27. data/lib/lux/api/lib/rescue.rb +5 -15
  28. data/lib/lux/api/lib/response.rb +46 -0
  29. data/lib/lux/cache/cache.rb +13 -6
  30. data/lib/lux/cell/cell.rb +3 -14
  31. data/lib/lux/config/config.rb +4 -3
  32. data/lib/lux/controller/controller.rb +3 -3
  33. data/lib/lux/controller/lib/nav.rb +6 -2
  34. data/lib/lux/error/error.rb +15 -14
  35. data/lib/lux/helper/helper.rb +5 -5
  36. data/lib/lux/helper/lib/html_tag.rb +67 -0
  37. data/lib/lux/html/lib/input_types.rb +26 -16
  38. data/lib/lux/lib/lux.rb +51 -0
  39. data/lib/lux/lux.rb +5 -52
  40. data/lib/lux/page/lib/response.rb +178 -0
  41. data/lib/lux/page/page.rb +72 -51
  42. data/lib/lux/rescue_from/rescue_from.rb +8 -6
  43. data/lib/lux/template/template.rb +1 -0
  44. data/lib/lux-fw.rb +2 -0
  45. data/lib/overload/array.rb +4 -0
  46. data/lib/overload/date.rb +2 -0
  47. data/lib/overload/hash.rb +19 -10
  48. data/lib/overload/it.rb +29 -0
  49. data/lib/overload/object.rb +3 -19
  50. data/lib/overload/r.rb +53 -0
  51. data/lib/overload/string.rb +5 -6
  52. data/lib/overload/string_inflections.rb +4 -3
  53. data/lib/plugins/assets/assets_plug.rb +9 -4
  54. data/lib/plugins/assets/helper_module_adapter.rb +4 -2
  55. data/lib/plugins/db_helpers/link_plugin.rb +2 -2
  56. data/lib/plugins/db_logger/init.rb +1 -1
  57. data/lib/vendor/mini_assets/lib/asset/css.rb +19 -0
  58. data/lib/vendor/mini_assets/lib/asset/js.rb +17 -0
  59. data/lib/vendor/mini_assets/lib/asset.rb +71 -0
  60. data/lib/vendor/mini_assets/lib/base/javascript.rb +13 -0
  61. data/lib/vendor/mini_assets/lib/base/stylesheet.rb +5 -0
  62. data/lib/vendor/mini_assets/lib/base.rb +69 -0
  63. data/lib/vendor/mini_assets/lib/manifest.rb +18 -0
  64. data/lib/vendor/mini_assets/lib/opts.rb +16 -0
  65. data/lib/vendor/mini_assets/mini_assets.rb +74 -0
  66. metadata +23 -10
  67. data/lib/common/class_method_params.rb +0 -94
  68. data/lib/overload/hash_wia.rb +0 -282
  69. data/lib/overload/inflections.rb +0 -199
  70. data/lib/vendor/mini_assets/mini_asset/base.rb +0 -167
  71. data/lib/vendor/mini_assets/mini_asset/css.rb +0 -38
  72. data/lib/vendor/mini_assets/mini_asset/js.rb +0 -38
  73. data/lib/vendor/mini_assets/mini_asset.rb +0 -31
data/lib/overload/r.rb ADDED
@@ -0,0 +1,53 @@
1
+ class LocalRaiseError < StandardError
2
+ end
3
+
4
+ class Object
5
+ # raise object
6
+ def r what
7
+ opath = what.class.ancestors
8
+ out = opath.join("\n> ")
9
+
10
+ data = what.is_a?(Hash) ? JSON.pretty_generate(what) : what.ai(plain:true)
11
+ out = [data, out, ''].join("\n\n-\n\n")
12
+
13
+ # unique_methods = what.methods - what.class.ancestors[0].instance_methods
14
+ # raise unique_methods
15
+
16
+ raise LocalRaiseError.new out
17
+ end
18
+
19
+ # better console log dump
20
+ def rr what
21
+ ap ['--- START (%s) ---' % what.class, what, '--- END ---']
22
+ end
23
+
24
+ # unique methods for object
25
+ # includes methods from modules
26
+ def rm object
27
+ dump = []
28
+
29
+ dump.push ['Class', object.class]
30
+
31
+ instance_unique = object.methods - object.class.ancestors[0].instance_methods
32
+ class_unique = object.methods
33
+
34
+ object.class.ancestors.drop(1).each do |_|
35
+ class_unique -= _.instance_methods
36
+
37
+ if _.class != Module
38
+ dump.push ['Parent Class', _]
39
+ break
40
+ end
41
+ end
42
+
43
+ dump.push ['Instance uniqe', instance_unique.sort] if instance_unique[0]
44
+ dump.push ['Uniqe from parent', class_unique.sort]
45
+ dump.push ['Uniqe from parent simple', object.class.instance_methods(false)]
46
+
47
+ r dump
48
+ end
49
+
50
+ def instance_variables_hash
51
+ Hash[instance_variables.map { |name| [name, instance_variable_get(name)] } ]
52
+ end
53
+ end
@@ -1,9 +1,7 @@
1
1
  class String
2
2
  # simple markdown
3
3
  def as_html
4
- ret = self
5
- ret = ret.gsub(/([\w\.])\n(\w)/,"\\1<br/>\\2")
6
- ret
4
+ self.gsub($/, '<br />')
7
5
  end
8
6
 
9
7
  # convert escaped strings, remove scritpts
@@ -46,10 +44,11 @@ class String
46
44
  end
47
45
 
48
46
  def to_url
49
- # str_from = 'šđč枊ĐČĆŽäÄéeöÖüüÜß'
50
- # str_to = 'sdcczSDCCZaAeeoOuuUs'
47
+ str_from = 'šđč枊ĐČĆŽäÄéeöÖüüÜß'
48
+ str_to = 'sdcczSDCCZaAeeoOuuUs'
49
+ str = self.downcase.gsub(/\s+/,'-').tr(str_from, str_to)
51
50
  # self.downcase.gsub(/\s+/,'-').tr(str_from, str_to).gsub(/[^\w\-]/,'')
52
- self.gsub('&',' and ').gsub('.',' dot ').parameterize.gsub('-dot-','.').downcase[0, 50]
51
+ str.sub(/\.$/, '').gsub('&',' and ').gsub('.',' dot ').parameterize.gsub('-dot-','.').downcase[0, 50].sub(/[\.\-]$/,'')
53
52
  end
54
53
 
55
54
  def css_to_hash
@@ -1,7 +1,8 @@
1
1
  # http://sequel.jeremyevans.net/rdoc/classes/Sequel/Inflections.html
2
2
 
3
3
  String.inflections do |inflect|
4
- inflect.plural 'bonus', 'bonuses'
5
- inflect.plural 'clothing', 'clothes'
6
- inflect.plural 'people', 'people'
4
+ inflect.plural 'bonus', 'bonuses'
5
+ inflect.plural 'clothing', 'clothes'
6
+ inflect.plural 'people', 'people'
7
+ inflect.singular /news$/, 'news'
7
8
  end
@@ -5,17 +5,22 @@ class Lux::Controller
5
5
  def lux_assets_plug
6
6
 
7
7
  # only allow clear in dev
8
+ # clear assets every 4 seconds max
8
9
  if Lux.page.no_cache?
9
- puts '* Clearing assets from ./tmp/assets'
10
- `rm -rf ./tmp/assets`
10
+ Lux.cache.fetch('lux-clear-assets', ttl: 4, log: false, force: false) do
11
+ puts '* Clearing assets from ./tmp/assets'.yellow
12
+ `rm -rf ./tmp/assets && mkdir ./tmp/assets`
13
+ true
14
+ end
11
15
  end
12
16
 
13
17
  path = nav.path.join('/')
14
18
 
15
19
  if nav.root == 'compiled_asset'
16
- asset = MiniAsset.create(path)
20
+ asset = MiniAssets::Asset.call(path)
17
21
  page.content_type asset.content_type
18
- page.body asset.compiled_data
22
+ page.body asset.render
23
+
19
24
  elsif nav.root == 'raw_asset'
20
25
  Lux.error "You can watch raw files only in development" unless Lux.dev?
21
26
 
@@ -32,14 +32,16 @@ module DefaultHelper
32
32
 
33
33
  # return asset link in production or faile unless able
34
34
  unless Lux.config(:compile_assets)
35
- mfile = MiniAsset.manifest['files'][file]
35
+ @@__asset_menifest ||= MiniAssets::Manifest.new
36
+ mfile = @@__asset_menifest.get(file)
36
37
  raise 'Compiled asset link for "%s" not found in manifest.json' % file if mfile.empty?
37
38
  return asset_include Lux.config.assets_root.to_s + mfile
38
39
  end
39
40
 
40
41
  # try to create list of incuded files and show every one of them
41
42
  data = []
42
- asset = MiniAsset.create file
43
+ asset = MiniAssets.new file
44
+
43
45
  for file in asset.files
44
46
  data.push asset_include file
45
47
  end
@@ -19,7 +19,7 @@ module Sequel::Plugins::LuxLink
19
19
  # link :genders, collection: { 1=>'male', 2=>'Female' }
20
20
  # Object.genders
21
21
  # @object.gender
22
- def link(name, opts={})
22
+ def link name, opts={}
23
23
  name_s = name.to_s.singularize
24
24
  name_p = name.to_s.pluralize
25
25
 
@@ -64,7 +64,7 @@ module Sequel::Plugins::LuxLink
64
64
  # puts "* #{to_s}.link :#{name} -> inline #{name_s}_ids".yellow
65
65
  class_eval %[
66
66
  def #{name_p}
67
- return [] if #{name_s}_ids.blank?
67
+ return if #{name_s}_ids.blank?
68
68
  ids = #{name_s}_ids.join(',')
69
69
  #{klass}.where(Sequel.lit('id in ('+ids+')'))
70
70
  end
@@ -10,7 +10,7 @@ logger.formatter = proc { |severity, datetime, progname, msg|
10
10
  Thread.current[:db_q][:cnt] += 1
11
11
 
12
12
  # append debug=true as query-string to see database queries
13
- Lux.log(" #{Thread.current[:db_q][:cnt].to_s.rjust(2)}. #{time} : #{elms[2].cyan}\n") if Thread.current[:db_q]
13
+ Lux.log(" #{Thread.current[:db_q][:cnt].to_s.rjust(2)}. #{time} : #{elms[2].to_s.cyan}\n") if Thread.current[:db_q]
14
14
  end
15
15
  }
16
16
 
@@ -0,0 +1,19 @@
1
+ class MiniAssets::Asset::Css < MiniAssets::Asset
2
+ def content_type
3
+ 'text/css'
4
+ end
5
+
6
+ def environment_prefix?
7
+ true
8
+ end
9
+
10
+ def compile_scss
11
+ compile_sass
12
+ end
13
+
14
+ def compile_sass
15
+ node_sass = './node_modules/node-sass/bin/node-sass'
16
+ node_opts = opts.production? ? '--output-style compressed' : '--source-comments'
17
+ run! "#{node_sass} #{node_opts} '#{@source}' '#{@cache}'"
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ class MiniAssets::Asset::Js < MiniAssets::Asset
2
+ def content_type
3
+ 'text/javascript'
4
+ end
5
+
6
+ def compile_coffee
7
+ coffee_path = './node_modules/coffee-script/bin/coffee'
8
+ coffee_opts = opts.production? ? '-cp' : '-Mcp --no-header'
9
+
10
+ run! "#{coffee_path} #{coffee_opts} '#{@source}' > '#{@cache}'"
11
+
12
+ data = @cache.read
13
+ data = data.gsub(%r{//#\ssourceURL=[\w\-\.\/]+/app/assets/}, '//# sourceURL=/raw_asset/')
14
+
15
+ @cache.write data
16
+ end
17
+ end
@@ -0,0 +1,71 @@
1
+ class MiniAssets::Asset
2
+ def self.call source
3
+ ext = source.split('.').last
4
+ base = ['css', 'sass', 'scss'].include?(ext) ? MiniAssets::Asset::Css : MiniAssets::Asset::Js
5
+ base.new source
6
+ end
7
+
8
+ def initialize source
9
+ @ext = source.split('.').last.to_sym
10
+ @source = opts.app_root.join source
11
+ @target = opts.public_root.join source
12
+
13
+ cache_file = source.gsub('/', '-')
14
+
15
+ if environment_prefix?
16
+ prefix = opts.production? ? :p : :d
17
+ cache_file = '%s-%s' % [prefix, cache_file]
18
+ end
19
+
20
+ @cache = opts.tmp_root.join cache_file
21
+ end
22
+
23
+ def opts
24
+ MiniAssets::Opts
25
+ end
26
+
27
+ def environment_prefix?
28
+ false
29
+ end
30
+
31
+ def run! what
32
+ puts what.yellow
33
+
34
+ stdin, stdout, stderr, wait_thread = Open3.popen3(what)
35
+
36
+ error = stderr.gets
37
+ while line = stderr.gets do
38
+ error += line
39
+ end
40
+
41
+ # node-sass prints to stderror on complete
42
+ error = nil if error && error.index('Rendering Complete, saving .css file...')
43
+
44
+ if error
45
+ @cache.unlink if @cache.exist?
46
+ @error = error
47
+ end
48
+ end
49
+
50
+ def comment text
51
+ '/* %s */' % text
52
+ end
53
+
54
+ def cached?
55
+ @cache.exist? && @cache.ctime > @source.ctime
56
+ end
57
+
58
+ def render
59
+ func = 'compile_%s' % @ext
60
+
61
+ # if custom method exists, execute it and return cache
62
+ # othervise just read source
63
+ if respond_to?(func)
64
+ send func unless cached?
65
+ @cache.read
66
+ else
67
+ @source.read
68
+ end
69
+ end
70
+ end
71
+
@@ -0,0 +1,13 @@
1
+ class MiniAssets::Base::JavaScript < MiniAssets::Base
2
+ def asset_class
3
+ MiniAssets::Asset::Js
4
+ end
5
+
6
+ def join_string
7
+ ";\n"
8
+ end
9
+
10
+ def render_production
11
+ run! './node_modules/minifier/index.js --no-comments -o "%{file}" "%{file}"' % { file: @target }
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class MiniAssets::Base::StyleSheet < MiniAssets::Base
2
+ def asset_class
3
+ MiniAssets::Asset::Css
4
+ end
5
+ end
@@ -0,0 +1,69 @@
1
+ # base class for production rendering
2
+ # MiniAssets.call('js/main/index.coffee').render
3
+ # MiniAssets::Base::JavasScript.new sorurce, files
4
+
5
+ class MiniAssets::Base
6
+ attr_reader :files
7
+
8
+ def initialize source, files
9
+ @source = source
10
+ @files = files
11
+ end
12
+
13
+ def join_string
14
+ "\n"
15
+ end
16
+
17
+ def render_production
18
+ nil
19
+ end
20
+
21
+ def gzip
22
+ run! 'gzip -k %s' % @target
23
+ end
24
+
25
+ def run! what
26
+ puts what.yellow
27
+ system what
28
+ end
29
+
30
+ def opts
31
+ MiniAssets::Opts
32
+ end
33
+
34
+ # this should only be called in builder for production "lux assets"
35
+ def render
36
+ data = []
37
+
38
+ @files.each do |file|
39
+ asset = asset_class.new file
40
+ data.push asset.comment 'Source: %s' % file unless opts.production?
41
+ data.push asset.render
42
+ end
43
+
44
+ data = data.join(join_string)
45
+ type = asset_class.to_s.split('::').last.downcase
46
+
47
+ @target = opts.public_root.join '%s-%s.%s' % [@source.to_s.gsub(/[^\w]+/,'-'), Digest::SHA1.hexdigest(data), type]
48
+
49
+ # unless target exists, build it and minify it
50
+ unless @target.exist?
51
+ @target.write data
52
+
53
+ render_production
54
+ gzip
55
+
56
+ # force old time stamp
57
+ run! 'touch -t 201001010101 %s' % @target
58
+ run! 'touch -t 201001010101 %s.gz' % @target
59
+ end
60
+
61
+ # update manifest (if needed)
62
+ target = @target.to_s.split('/public').last
63
+ manifest = MiniAssets::Manifest.new
64
+ manifest.add @source, target
65
+
66
+ target
67
+ end
68
+ end
69
+
@@ -0,0 +1,18 @@
1
+ class MiniAssets::Manifest
2
+ def initialize
3
+ @manifest = MiniAssets::Opts.public_root.join('./manifest.json')
4
+ @manifest.write '{"files":{}}' unless @manifest.exist?
5
+ @json = JSON.load @manifest.read
6
+ end
7
+
8
+ def add name, target
9
+ return if @json['files'][name] == target
10
+
11
+ @json['files'][name] = target
12
+ @manifest.write JSON.pretty_generate(@json)
13
+ end
14
+
15
+ def get file
16
+ @json['files'][file]
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module MiniAssets::Opts
2
+ extend self
3
+
4
+ [:app, :tmp, :public].each do |folder|
5
+ name = '%s_root' % folder
6
+ path = Pathname.new './%s/assets' % folder
7
+
8
+ Dir.mkdir(path) unless path.exist?
9
+
10
+ define_method(name) { path }
11
+ end
12
+
13
+ def production?
14
+ ENV['RACK_ENV'] == 'production'
15
+ end
16
+ end
@@ -0,0 +1,74 @@
1
+ # app/assets/main/js.assets
2
+ # ---
3
+ # add 'js_vendor/*'
4
+ # add 'js/*'
5
+ # add 'index.coffee'
6
+
7
+ # render production asset
8
+ # ---
9
+ # MiniAssets.call('js/main/index.coffee').render
10
+
11
+ # render single asset
12
+ # ---
13
+ # asset = MiniAssets::Asset.call(path)
14
+ # asset.content_type
15
+ # asset.render
16
+
17
+ require 'json'
18
+ require 'pathname'
19
+ require 'awesome_print'
20
+ require 'open3'
21
+ require 'digest'
22
+
23
+ # calls base classes
24
+ class MiniAssets
25
+ attr_reader :files
26
+
27
+ def initialize source
28
+ @files = []
29
+ @fsource = source
30
+
31
+ @source = MiniAssets::Opts.app_root.join source
32
+
33
+ # fill @files, via dsl or direct
34
+ if source.split('.').last == 'assets'
35
+ # add './js/*'
36
+ eval @source.read
37
+ else
38
+ @source.read.split($/).each do |line|
39
+ test = line.split(/^[\/#]+=\s*req\w*\s+/)
40
+ add test[1] if test[1]
41
+ end
42
+
43
+ @files.push source
44
+ end
45
+
46
+ # figure out type unless defined
47
+ unless @type
48
+ ext = @files.first.split('.').last
49
+ @type = ['css', 'sass', 'scss'].include?(ext) ? :css : :js
50
+ end
51
+ end
52
+
53
+ def type name
54
+ @type = name
55
+ end
56
+
57
+ def add files
58
+ files = files.sub(/^\.\//,'')
59
+ files += '/*' unless files.include?('*')
60
+ path = @source.dirname.join files
61
+
62
+ @files += Dir[path].sort.map{ |f| f.split(MiniAssets::Opts.app_root.to_s+'/', 2).last }
63
+ end
64
+
65
+ # render production file
66
+ def render
67
+ # load right base class
68
+ base_class = @type == :css ?
69
+ MiniAssets::Base::StyleSheet
70
+ : MiniAssets::Base::JavaScript
71
+
72
+ base_class.new(@fsource, @files).render
73
+ end
74
+ end
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.1.17
4
+ version: 0.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Reic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-08 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -213,6 +213,7 @@ files:
213
213
  - "./bin/cli/routes"
214
214
  - "./bin/cli/server"
215
215
  - "./bin/cli/stat"
216
+ - "./bin/cli/systemd"
216
217
  - "./bin/forever"
217
218
  - "./bin/job_que"
218
219
  - "./bin/lux"
@@ -221,10 +222,12 @@ files:
221
222
  - "./lib/common/base32.rb"
222
223
  - "./lib/common/before_and_after.rb"
223
224
  - "./lib/common/class_attributes.rb"
224
- - "./lib/common/class_method_params.rb"
225
225
  - "./lib/common/crypt.rb"
226
+ - "./lib/common/dynamic_class.rb"
226
227
  - "./lib/common/folder_model.rb"
227
228
  - "./lib/common/generic_model.rb"
229
+ - "./lib/common/hash_with_indifferent_access.rb"
230
+ - "./lib/common/method_attr.rb"
228
231
  - "./lib/common/policy.rb"
229
232
  - "./lib/common/string_base.rb"
230
233
  - "./lib/common/url.rb"
@@ -233,8 +236,10 @@ files:
233
236
  - "./lib/lux/api/lib/application_api.rb"
234
237
  - "./lib/lux/api/lib/doc_builder.rb"
235
238
  - "./lib/lux/api/lib/dsl.rb"
239
+ - "./lib/lux/api/lib/error.rb"
236
240
  - "./lib/lux/api/lib/model_api.rb"
237
241
  - "./lib/lux/api/lib/rescue.rb"
242
+ - "./lib/lux/api/lib/response.rb"
238
243
  - "./lib/lux/cache/cache.rb"
239
244
  - "./lib/lux/cache/lib/memcached.rb"
240
245
  - "./lib/lux/cache/lib/null.rb"
@@ -251,14 +256,17 @@ files:
251
256
  - "./lib/lux/delayed_job/lib/redis.rb"
252
257
  - "./lib/lux/error/error.rb"
253
258
  - "./lib/lux/helper/helper.rb"
259
+ - "./lib/lux/helper/lib/html_tag.rb"
254
260
  - "./lib/lux/html/html.rb"
255
261
  - "./lib/lux/html/lib/form.rb"
256
262
  - "./lib/lux/html/lib/input.rb"
257
263
  - "./lib/lux/html/lib/input_types.rb"
264
+ - "./lib/lux/lib/lux.rb"
258
265
  - "./lib/lux/lux.rb"
259
266
  - "./lib/lux/mailer/mailer.rb"
260
267
  - "./lib/lux/page/lib/encrypt_params.rb"
261
268
  - "./lib/lux/page/lib/flash.rb"
269
+ - "./lib/lux/page/lib/response.rb"
262
270
  - "./lib/lux/page/lib/static_file.rb"
263
271
  - "./lib/lux/page/page.rb"
264
272
  - "./lib/lux/rescue_from/rescue_from.rb"
@@ -268,12 +276,12 @@ files:
268
276
  - "./lib/overload/date.rb"
269
277
  - "./lib/overload/file.rb"
270
278
  - "./lib/overload/hash.rb"
271
- - "./lib/overload/hash_wia.rb"
272
- - "./lib/overload/inflections.rb"
273
279
  - "./lib/overload/integer.rb"
280
+ - "./lib/overload/it.rb"
274
281
  - "./lib/overload/module.rb"
275
282
  - "./lib/overload/nil.rb"
276
283
  - "./lib/overload/object.rb"
284
+ - "./lib/overload/r.rb"
277
285
  - "./lib/overload/string.rb"
278
286
  - "./lib/overload/string_inflections.rb"
279
287
  - "./lib/overload/struct.rb"
@@ -295,10 +303,15 @@ files:
295
303
  - "./lib/plugins/db_logger/lux_response_adapter.rb"
296
304
  - "./lib/plugins/paginate/helper.rb"
297
305
  - "./lib/plugins/paginate/sequel_adapter.rb"
298
- - "./lib/vendor/mini_assets/mini_asset.rb"
299
- - "./lib/vendor/mini_assets/mini_asset/base.rb"
300
- - "./lib/vendor/mini_assets/mini_asset/css.rb"
301
- - "./lib/vendor/mini_assets/mini_asset/js.rb"
306
+ - "./lib/vendor/mini_assets/lib/asset.rb"
307
+ - "./lib/vendor/mini_assets/lib/asset/css.rb"
308
+ - "./lib/vendor/mini_assets/lib/asset/js.rb"
309
+ - "./lib/vendor/mini_assets/lib/base.rb"
310
+ - "./lib/vendor/mini_assets/lib/base/javascript.rb"
311
+ - "./lib/vendor/mini_assets/lib/base/stylesheet.rb"
312
+ - "./lib/vendor/mini_assets/lib/manifest.rb"
313
+ - "./lib/vendor/mini_assets/lib/opts.rb"
314
+ - "./lib/vendor/mini_assets/mini_assets.rb"
302
315
  - "./lib/vendor/oauth/lib/facebook.rb"
303
316
  - "./lib/vendor/oauth/lib/github.rb"
304
317
  - "./lib/vendor/oauth/lib/google.rb"
@@ -327,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
340
  version: '0'
328
341
  requirements: []
329
342
  rubyforge_project:
330
- rubygems_version: 2.6.10
343
+ rubygems_version: 2.6.14
331
344
  signing_key:
332
345
  specification_version: 4
333
346
  summary: Lux - the ruby framework
@@ -1,94 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # allows adding of params to methods
4
- # used in Lux::Api
5
- #
6
- # param :model_id, type: :integer
7
- # param :age, max: 120
8
- # def show
9
- # end
10
-
11
- # class ModelApi
12
- # class << self
13
- # def param *args
14
- # ClassMethodParams.add_param self, args
15
- # end
16
-
17
- # def method_added(m)
18
- # ClassMethodParams.add_method self, m
19
- # end
20
- # end
21
-
22
- # ###
23
-
24
- # param :id
25
- # param :user_id, Integer
26
- # param :model_id, type: :integer
27
- # param :age, max: 120
28
- # def show
29
-
30
- # end
31
-
32
- # end
33
-
34
- # class UserApi < ModelApi
35
-
36
- # param :name
37
- # def edit
38
-
39
- # end
40
-
41
- # end
42
-
43
- # ap ClassMethodParams.params
44
- # ap ClassMethodParams.params UserApi, :show
45
- # ap ClassMethodParams.all UserApi
46
-
47
- module ClassMethodParams
48
- extend self
49
-
50
- @params = {}
51
- @cache = {}
52
-
53
- def add_param klass, param, args
54
- @cache[klass.to_s] ||= {}
55
- @cache[klass.to_s][param] ||= []
56
- @cache[klass.to_s][param].push args
57
- end
58
-
59
- def add_method klass, m
60
- k = klass.to_s
61
- @params[k] ||= {}
62
- @params[k][m] = @cache[k] ? @cache[k].dup : {}
63
- @cache = {}
64
- end
65
-
66
- def all_params
67
- @params
68
- end
69
-
70
- # return all params method in a class
71
- def params klass, m
72
- return @params unless m
73
-
74
- klass.ancestors.map(&:to_s).each do |klass|
75
- return if klass == 'Object'
76
- data = @params[klass]
77
- return data[m] if data && data[m]
78
- end
79
-
80
- nil
81
- end
82
-
83
- # return all methos and all parameters for all methods in a class
84
- def all klass
85
- data = {}
86
- all_methods = klass.instance_methods - Object.instance_methods
87
- all_methods.each do |m|
88
- data[m] = ClassMethodParams.params(klass, m)
89
- end
90
- data
91
- end
92
-
93
- end
94
-