lux-fw 0.1.35 → 0.2.1

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.
Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. data/.version +1 -1
  3. data/bin/cli/am +67 -41
  4. data/bin/cli/assets +1 -1
  5. data/bin/cli/console +3 -2
  6. data/bin/cli/eval +11 -2
  7. data/bin/cli/exceptions +1 -1
  8. data/bin/cli/generate +4 -0
  9. data/bin/cli/render +18 -0
  10. data/bin/cli/routes +3 -1
  11. data/bin/cli/server +4 -1
  12. data/bin/lux +10 -1
  13. data/bin/txt/nginx.conf +35 -18
  14. data/lib/common/class_attributes.rb +10 -10
  15. data/lib/common/{before_and_after.rb → class_callbacks.rb} +12 -21
  16. data/lib/common/crypt.rb +10 -6
  17. data/lib/common/dynamic_class.rb +12 -7
  18. data/lib/common/generic_model.rb +6 -6
  19. data/lib/common/hash_with_indifferent_access.rb +6 -284
  20. data/lib/{lux/helper/lib/html_tag.rb → common/html_tag_builder.rb} +1 -1
  21. data/lib/common/policy.rb +2 -2
  22. data/lib/common/url.rb +6 -4
  23. data/lib/lux-fw.rb +2 -13
  24. data/lib/lux/api/api.rb +34 -47
  25. data/lib/lux/api/lib/dsl.rb +2 -2
  26. data/lib/lux/api/lib/model_api.rb +40 -23
  27. data/lib/lux/api/lib/response.rb +30 -5
  28. data/lib/lux/application/application.rb +182 -0
  29. data/lib/lux/{controller → application}/lib/nav.rb +18 -21
  30. data/lib/lux/application/lib/plugs.rb +10 -0
  31. data/lib/lux/application/lib/render.rb +58 -0
  32. data/lib/lux/application/lib/route_test.rb +64 -0
  33. data/lib/lux/cache/cache.rb +27 -16
  34. data/lib/lux/cell/cell.rb +66 -54
  35. data/lib/lux/config/config.rb +51 -27
  36. data/lib/lux/current/current.rb +122 -0
  37. data/lib/lux/{page → current}/lib/encrypt_params.rb +2 -2
  38. data/lib/lux/{page → current}/lib/static_file.rb +29 -25
  39. data/lib/lux/delayed_job/delayed_job.rb +4 -4
  40. data/lib/lux/error/error.rb +31 -16
  41. data/lib/lux/helper/helper.rb +32 -37
  42. data/lib/lux/helper/helpers/application_helper.rb +3 -0
  43. data/lib/lux/helper/helpers/html_helper.rb +3 -0
  44. data/lib/lux/helper/helpers/mailer_helper.rb +11 -0
  45. data/lib/lux/lux.rb +40 -30
  46. data/lib/lux/mailer/mailer.rb +46 -29
  47. data/lib/lux/{page → response}/lib/flash.rb +1 -1
  48. data/lib/lux/response/lib/header.rb +21 -0
  49. data/lib/lux/response/response.rb +237 -0
  50. data/lib/lux/template/template.rb +20 -18
  51. data/lib/overload/array.rb +5 -0
  52. data/lib/overload/auto_loader.rb +27 -0
  53. data/lib/overload/blank.rb +8 -2
  54. data/lib/overload/float.rb +10 -0
  55. data/lib/overload/hash.rb +5 -12
  56. data/lib/overload/integer.rb +1 -5
  57. data/lib/overload/nil.rb +5 -0
  58. data/lib/overload/object.rb +1 -0
  59. data/lib/overload/r.rb +5 -0
  60. data/lib/overload/string.rb +4 -5
  61. data/lib/overload/{date.rb → time.rb} +23 -3
  62. metadata +37 -73
  63. data/bin/forever +0 -65
  64. data/bin/job_que +0 -39
  65. data/lib/lux/api/lib/application_api.rb +0 -38
  66. data/lib/lux/api/lib/doc_builder.rb +0 -19
  67. data/lib/lux/api/lib/rescue.rb +0 -8
  68. data/lib/lux/controller/controller.rb +0 -185
  69. data/lib/lux/controller/lib/plugs.rb +0 -10
  70. data/lib/lux/html/html.rb +0 -3
  71. data/lib/lux/html/lib/form.rb +0 -81
  72. data/lib/lux/html/lib/input.rb +0 -71
  73. data/lib/lux/html/lib/input_types.rb +0 -287
  74. data/lib/lux/lib/lux.rb +0 -51
  75. data/lib/lux/page/lib/response.rb +0 -178
  76. data/lib/lux/page/page.rb +0 -292
  77. data/lib/lux/rescue_from/rescue_from.rb +0 -63
  78. data/lib/plugins/assets/assets_plug.rb +0 -31
  79. data/lib/plugins/assets/helper_module_adapter.rb +0 -51
  80. data/lib/plugins/assets/init.rb +0 -4
  81. data/lib/plugins/db_helpers/array_and_hstore.rb +0 -64
  82. data/lib/plugins/db_helpers/arrays_and_tags.rb +0 -23
  83. data/lib/plugins/db_helpers/before_save.rb +0 -44
  84. data/lib/plugins/db_helpers/cached_find_by.rb +0 -45
  85. data/lib/plugins/db_helpers/class_and_instance.rb +0 -120
  86. data/lib/plugins/db_helpers/dataset_plugin.rb +0 -101
  87. data/lib/plugins/db_helpers/filter_wrappers.rb +0 -21
  88. data/lib/plugins/db_helpers/link_plugin.rb +0 -95
  89. data/lib/plugins/db_helpers/localize_plugin.rb +0 -57
  90. data/lib/plugins/db_helpers/primary_keys.rb +0 -36
  91. data/lib/plugins/db_helpers/typero_attributes.rb +0 -69
  92. data/lib/plugins/db_logger/init.rb +0 -18
  93. data/lib/plugins/db_logger/lux_response_adapter.rb +0 -9
  94. data/lib/plugins/paginate/helper.rb +0 -32
  95. data/lib/plugins/paginate/sequel_adapter.rb +0 -18
  96. data/lib/vendor/mini_assets/lib/asset.rb +0 -71
  97. data/lib/vendor/mini_assets/lib/asset/css.rb +0 -19
  98. data/lib/vendor/mini_assets/lib/asset/js.rb +0 -17
  99. data/lib/vendor/mini_assets/lib/base.rb +0 -69
  100. data/lib/vendor/mini_assets/lib/base/javascript.rb +0 -13
  101. data/lib/vendor/mini_assets/lib/base/stylesheet.rb +0 -5
  102. data/lib/vendor/mini_assets/lib/manifest.rb +0 -18
  103. data/lib/vendor/mini_assets/lib/opts.rb +0 -16
  104. data/lib/vendor/mini_assets/mini_assets.rb +0 -74
  105. data/lib/vendor/oauth/lib/facebook.rb +0 -35
  106. data/lib/vendor/oauth/lib/github.rb +0 -37
  107. data/lib/vendor/oauth/lib/google.rb +0 -41
  108. data/lib/vendor/oauth/lib/linkedin.rb +0 -41
  109. data/lib/vendor/oauth/lib/stackexchange.rb +0 -37
  110. data/lib/vendor/oauth/lib/twitter.rb +0 -41
  111. data/lib/vendor/oauth/oauth.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8da4e12f599558882464c2d4adaf26f4368c541d
4
- data.tar.gz: cb2320787caf49b7b48308d5915fe2abf8945101
2
+ SHA256:
3
+ metadata.gz: 48df51990bdf390ef6f780d624e0bb1624f54dfc5721dee1c77749f02e2ec472
4
+ data.tar.gz: bde0c404e918b91825e90b9e7a183199266d225ece56c54b28e1366366350bc7
5
5
  SHA512:
6
- metadata.gz: 0c3f4d5c4cf8e072ec3559bd9b385454aab6dc914be9aa6a15b1d442e8ab255d548d0d0fb86285af9cdc6d489589a18e7a5baeaedeb7cb743d9ee52a8a43baaa
7
- data.tar.gz: 0222f98dc1a343a2dd2077f0f88a077c8bd19bcb3c0ca0a08543d003a767bf3d7f816c69fdac95b68d4b7f60fe918c82001918c54b50d3f86b4c4437121392c7
6
+ metadata.gz: fc6c0f8bf80608399dac5afe4dd9f7d01d78fd99cbcf45e3cf746e986eabd8a08ba6650722569c6e0f64266fd202a27b44ec6e6e3cfdf8683951605bb03b030f
7
+ data.tar.gz: 106570f909cc6109a9d1f6f7f719d82e4b7514e4b214b62fcc81015590c7e607bf39fbb97c74fe2e1add9986ca260c840743c3f1121b751ef81372c789e32327
data/.version CHANGED
@@ -1 +1 @@
1
- 0.1.35
1
+ 0.2.1
data/bin/cli/am CHANGED
@@ -1,15 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ENV['DB_NAME'] = ARGV[0] if ARGV[0]
3
+ require 'bundler/setup'
4
+ require 'dotenv'
4
5
 
5
- require './config/application'
6
+ Dotenv.load
7
+ Bundler.require(:default)
8
+
9
+ # load app config
10
+ require './config/db'
11
+
12
+ # Sequel extension and plugin test
13
+ DB.run %[DROP TABLE IF EXISTS lux_tests;]
14
+ DB.run %[CREATE TABLE lux_tests (int_array integer[] default '{}', text_array text[] default '{}');]
15
+ class LuxTest < Sequel::Model; end;
16
+ LuxTest.new.save
17
+ die('"DB.extension :pg_array" not loaded') unless LuxTest.first.int_array.class == Sequel::Postgres::PGArray
18
+ DB.run %[DROP TABLE IF EXISTS lux_tests;]
6
19
 
7
20
  class AutoMigrate
8
21
  attr_accessor :fields
9
22
 
10
23
  class << self
11
- def table(table_name)
12
- die "table [#{table_name}] not in plural -> expected [#{table_name.to_s.pluralize}]" unless table_name.to_s.pluralize == table_name.to_s
24
+ def table table_name
25
+ die "Table [#{table_name}] not in plural -> expected [#{table_name.to_s.pluralize}]" unless table_name.to_s.pluralize == table_name.to_s
26
+
27
+ die 'Table name "%s" is not permited' % table_name if [:categories].include?(table_name)
13
28
 
14
29
  unless DB.table_exists?(table_name.to_s)
15
30
  # http://sequel.jeremyevans.net/rdoc/files/doc/schema_modification_rdoc.html
@@ -49,6 +64,20 @@ class AutoMigrate
49
64
  def initialize table_name
50
65
  @table_name = table_name
51
66
  @fields = {}
67
+
68
+ klass = @table_name.to_s.classify
69
+
70
+ if Object.const_defined?(klass)
71
+ puts 'Table name "%s" is not allowed - class "%s" is allready defined'.red % [table_name, klass]
72
+ exit
73
+ end
74
+
75
+ eval %[class ::%s < Sequel::Model; end;] % klass
76
+ @object = klass.constantize.new
77
+ end
78
+
79
+ def transaction_do text
80
+ self.class.transaction_do text
52
81
  end
53
82
 
54
83
  def log_run what
@@ -61,13 +90,12 @@ class AutoMigrate
61
90
  type = vals[0]
62
91
  opts = vals[1]
63
92
 
64
- opts[:limit] ||= 255 if type == :string
93
+ opts[:limit] ||= 255 if type == :string
65
94
  opts[:default] ||= false if type == :boolean
66
-
67
- opts[:null] = true unless opts[:null].class.name == 'FalseClass'
68
- opts[:array] ||= false
69
- opts[:unique] ||= false
70
- opts[:default] = [] if opts[:array]
95
+ opts[:null] = true unless opts[:null].class.name == 'FalseClass'
96
+ opts[:array] ||= false
97
+ opts[:unique] ||= false
98
+ opts[:default] = [] if opts[:array]
71
99
  end
72
100
  end
73
101
 
@@ -76,27 +104,22 @@ class AutoMigrate
76
104
  db_type = type
77
105
  db_type = :varchar if type == :string
78
106
  db_type = Time if type == :datetime
107
+
79
108
  if opts[:array]
80
109
  db_type = '%s(%s)' % [db_type, opts[:limit]] if type == :string
81
110
  db_type = '%s[]' % db_type
82
111
  else
83
112
  db_type = 'varchar(%s)' % opts[:limit] if opts[:limit]
84
113
  end
114
+
85
115
  db_type
86
116
  end
87
117
 
88
118
  def update
89
- begin
90
- obj = @table_name.to_s.classify.constantize
91
- o = obj.new
92
- rescue
93
- puts "Object #{@table_name.to_s.classify.red} does not exist, yet table #{@table_name.to_s.red} exists!"
94
- return
95
- end
119
+ puts "Table #{@table_name.to_s.yellow}, #{@fields.keys.length} fields"
96
120
 
97
121
  # remove extra fields
98
- existing_fields = o.attributes.keys - ['id']
99
- for field in (existing_fields - @fields.keys.map(&:to_s))
122
+ for field in (@object.columns - @fields.keys - [:id])
100
123
  print "Remove colum #{@table_name}.#{field} (y/N): ".light_blue
101
124
  if STDIN.gets.chomp.downcase.index('y')
102
125
  DB.drop_column @table_name, field
@@ -104,8 +127,6 @@ class AutoMigrate
104
127
  end
105
128
  end
106
129
 
107
- puts "Table #{@table_name.to_s.yellow}, #{@fields.keys.length} fields"
108
-
109
130
  # loop trough defined fileds in schema
110
131
  for field, opts_in in @fields
111
132
  type = opts_in[0]
@@ -114,20 +135,19 @@ class AutoMigrate
114
135
  db_type = get_db_column_type(field)
115
136
 
116
137
  # create missing columns
117
- unless obj.columns.index(field.to_sym)
138
+ unless @object.columns.index(field.to_sym)
118
139
  DB.add_column @table_name, field, db_type, opts
119
140
 
120
141
  if opts[:array]
121
142
  default = type == :string ? "ARRAY[]::character varying[]" : "ARRAY[]::integer[]"
122
-
123
- self.class.transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} SET DEFAULT #{default};"
143
+ transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} SET DEFAULT #{default};"
124
144
  end
125
145
 
126
146
  puts " add_column #{field}, #{db_type}, #{opts.to_json}".green
127
147
  next
128
148
  end
129
149
 
130
- if current = obj.db_schema[field.to_sym]
150
+ if current = @object.db_schema[field]
131
151
  # unhandled db schema changes will not happen
132
152
  # ---
133
153
  # field - field name
@@ -136,22 +156,28 @@ class AutoMigrate
136
156
  # opts - new proposed types
137
157
 
138
158
  # if we have type set as array and in db it is not array, fix that
139
- if opts[:array] && !current[:db_type].include?('[]')
140
-
141
- self.class.transaction_do %[
142
- alter table #{@table_name} alter #{field} drop default;
143
- alter table #{@table_name} alter #{field} type #{current[:db_type]}[] using array[#{field}];
144
- alter table #{@table_name} alter #{field} set default '{}';
145
- ]
146
-
147
- puts " Coverted #{@table_name}.#{field} to array type".green
159
+ if opts[:array]
160
+ # covert to array unless is array
161
+ if !current[:db_type].include?('[]')
162
+ transaction_do %[
163
+ alter table #{@table_name} alter #{field} drop default;
164
+ alter table #{@table_name} alter #{field} type #{current[:db_type]}[] using array[#{field}];
165
+ alter table #{@table_name} alter #{field} set default '{}';
166
+ ]
167
+
168
+ puts " Coverted #{@table_name}.#{field} to array type".green
169
+ elsif !current[:default]
170
+ # force default for array to be present
171
+ default = type == :string ? "ARRAY[]::character varying[]" : "ARRAY[]::integer[]"
172
+ transaction_do %[alter table #{@table_name} alter #{field} set default #{default};]
173
+ end
148
174
  end
149
175
 
150
176
  # if we have array but scema says no array
151
177
  if !opts[:array] && current[:db_type].include?('[]')
152
178
  m = current[:type] == :integer ? "#{field}[0]" : "array_to_string(#{field}, ',')"
153
179
 
154
- self.class.transaction_do %[
180
+ transaction_do %[
155
181
  alter table #{@table_name} alter #{field} drop default;
156
182
  alter table #{@table_name} alter #{field} type #{current[:db_type].sub('[]','')} using #{m};
157
183
  ]
@@ -160,14 +186,14 @@ class AutoMigrate
160
186
  end
161
187
 
162
188
  # if varchar limit size has changed
163
- if type == :string && current[:max_length] != opts[:limit]
164
- self.class.transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} TYPE varchar(#{opts[:limit]});"
189
+ if type == :string && !opts[:array] && current[:max_length] != opts[:limit]
190
+ transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} TYPE varchar(#{opts[:limit]});"
165
191
  puts " #{field} limit, #{current[:max_length]}-> #{opts[:limit]}".green
166
192
  end
167
193
 
168
194
  # covert from varchar to text
169
195
  if type == :text && current[:max_length]
170
- self.class.transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} SET DATA TYPE text"
196
+ transaction_do "ALTER TABLE #{@table_name} ALTER COLUMN #{field} SET DATA TYPE text"
171
197
  puts " #{field} limit from #{current[:max_length]} to no limit (text type)".green
172
198
  end
173
199
 
@@ -221,7 +247,7 @@ class AutoMigrate
221
247
  end
222
248
 
223
249
  def rename field_old, field_new
224
- existing_fields = @table_name.to_s.classify.constantize.new.attributes.keys.map(&:to_sym)
250
+ existing_fields = @table_name.to_s.classify.constantize.new.columns
225
251
 
226
252
  if existing_fields.index(field_old.to_sym) && ! existing_fields.index(field_new.to_sym)
227
253
  DB.rename_column(@table_name, field_old, field_new)
@@ -236,11 +262,11 @@ class AutoMigrate
236
262
  opts = args[1] || {}
237
263
 
238
264
  if [:string, :integer, :text, :boolean, :datetime, :date, :jsonb].index(type)
239
- @fields[name] = [type, opts]
265
+ @fields[name.to_sym] = [type, opts]
240
266
  elsif [:decimal].index(type)
241
267
  opts[:precision] ||= 8
242
268
  opts[:scale] ||= 2
243
- @fields[name] = [:decimal, opts]
269
+ @fields[name.to_sym] = [:decimal, opts]
244
270
  elsif type == :timestamps
245
271
  opts[:null] ||= false
246
272
  @fields[:created_at] = [:datetime, opts]
data/bin/cli/assets CHANGED
@@ -37,5 +37,5 @@ puts "Asset precomlile done in #{speed}"
37
37
 
38
38
  if ARGV.last && ARGV.last[0,5] == 's3://'
39
39
  puts 'Copy to %s'.green % ARGV.last
40
- system 'aws s3 sync ./public %s --cache-control "max-age=31536000, no-transform, public"' % ARGV.last
40
+ system 'aws s3 sync ./public %s --cache-control "max-age=31536000, public"' % ARGV.last
41
41
  end
data/bin/cli/console CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ENV['LUX_VERBOSE'] ||= 'true'
4
-
5
3
  load_start = Time.now
6
4
 
7
5
  require 'awesome_print'
8
6
  require 'clipboard'
9
7
  require './config/application'
10
8
 
9
+ Lux.config.show_server_errors = true
10
+ Lux.config.log_to_stdout = true
11
+
11
12
  if File.exist?('./config/console.rb')
12
13
  puts '* loading ./config/console.rb'
13
14
  require './config/console'
data/bin/cli/eval CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  require './config/application'
4
4
 
5
- puts '* loading ./config/console.rb' if File.exist?('./config/console.rb')
5
+ if File.exist?('./config/console.rb')
6
+ puts '* loading ./config/console.rb'
7
+ load './config/console.rb'
8
+ end
6
9
 
7
10
  command = ARGV.join('; ')
8
11
 
@@ -12,4 +15,10 @@ data = eval command
12
15
  puts '-'
13
16
  puts 'Class : %s' % data.class
14
17
  puts '-'
15
- ap data
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 CHANGED
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  show = ARGV[0] ? ARGV[0].to_i : nil
21
21
 
22
- error_folders = Dir['%s/*' % ERROR_FOLDER].sort_by { |x| File.mtime(x) }
22
+ error_folders = Dir['%s/*' % ERROR_FOLDER].sort_by { |x| File.mtime(x) }.reverse
23
23
 
24
24
  if error_folders.length == 0
25
25
  puts 'Nothing found in %s'.light_blue % ERROR_FOLDER
data/bin/cli/generate CHANGED
@@ -80,3 +80,7 @@ for type in templates.keys
80
80
  end
81
81
  end
82
82
 
83
+ # if parse_templates.include?('m')
84
+ # sql = %[CREATE TABLE IF NOT EXISTS "public"."#{@objects}" ("id" serial, PRIMARY KEY ("id"));]
85
+ # LuxCli.run "psql -d %s -c '%s'" % [ENV.fetch('DB_NAME'), sql]
86
+ # end
data/bin/cli/render ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV['LUX_VERBOSE'] = 'true'
4
+
5
+ require './config/application'
6
+
7
+ unless ARGV[0]
8
+ Cli.die 'lux render GET /about'
9
+ end
10
+
11
+ path, http_method = ARGV.reverse
12
+ http_method ||= :get
13
+
14
+ data = Lux(path)
15
+
16
+ data[:body] = 'BODY lenght: %s kB' % (data[:body].length.to_f/1024).round(1)
17
+
18
+ ap data
data/bin/cli/routes CHANGED
@@ -5,8 +5,10 @@ ENV['LUX_PRINT_ROUTES'] = 'true'
5
5
  require 'awesome_print'
6
6
  require './config/application'
7
7
 
8
+ Lux.config.log_to_stdout = false
9
+
8
10
  path = ARGV[0] || '/print-routes'
9
11
 
10
12
  puts 'Routes for test route %s' % path.green
11
13
 
12
- Lux path
14
+ Lux.app.render path
data/bin/cli/server CHANGED
@@ -1 +1,4 @@
1
- LuxCli.run "LUX_VERBOSE=true puma -p %s" % @port
1
+ @flags ||= 'ALL'
2
+ @flags = @flags.upcase
3
+
4
+ LuxCli.run "LUX_FLAGS=%s puma -p %s" % [@flags, @port]
data/bin/lux CHANGED
@@ -29,6 +29,11 @@ Dotenv.load
29
29
  @port = 3000
30
30
  lux_root = File.expand_path '../..', __FILE__
31
31
 
32
+ if Dir.exists?('.git')
33
+ test_root = `bundle show lux-fw`.chomp
34
+ lux_root = test_root if test_root.include?('lux')
35
+ end
36
+
32
37
  puts 'Lux (%s, v%s)' % [lux_root, File.read('%s/.version' % lux_root)] unless ARGV[0]
33
38
 
34
39
  ARGV.options do |opts|
@@ -40,6 +45,9 @@ ARGV.options do |opts|
40
45
  opts.on("-p", "--port=val", "port (3000)", String) do |v|
41
46
  @port = v.to_i
42
47
  end
48
+ opts.on("-f", "--flags=val", "CRSL", String) do |v|
49
+ @flags = v
50
+ end
43
51
  end.parse!
44
52
 
45
53
  commands = {}
@@ -51,13 +59,14 @@ commands['eval'] = 'eval code or file'
51
59
  commands['exceptions'] = 'show stored exceptions, last created first'
52
60
  commands['generate'] = 'generates models and views based on templates'
53
61
  commands['get'] = 'get local URL'
54
- # commands['job_que'] = 'process job que with loaded enviroment'
55
62
  commands['nginx'] = 'parse and install config/nginx.conf'
56
63
  commands['production'] = 'run puma in production mode'
57
64
  commands['routes'] = 'list routes'
65
+ commands['render'] = 'render single page'
58
66
  commands['server'] = 'run puma development server'
59
67
  commands['systemd'] = 'parse and install config/systemd.conf'
60
68
  commands['stat'] = 'goaccess stat to public/goaccess.html'
69
+ # commands['job_que'] = 'process job que with loaded enviroment'
61
70
 
62
71
  command = ARGV.shift
63
72
 
data/bin/txt/nginx.conf CHANGED
@@ -1,29 +1,46 @@
1
- worker_processes 1;
2
-
3
- events {
4
- worker_connections 1024;
5
- }
1
+ # /etc/nginx/nginx.conf
2
+ # worker_processes 4; # one per proc "grep processor /proc/cpuinfo | wc -l"
3
+ # worker_connections 1024;
6
4
 
7
5
  server {
8
- listen 80; #default deferred;
9
- server_name .color-mont.com;
10
- root /home/deployer/apps/app/public;
11
- error_log /home/deployer/apps/app/log/nginx-error.log;
6
+ listen 80 default_server;
7
+ # server_name .novi-informator.hr;
8
+
9
+ root $ROOT/public;
10
+ error_log $ROOT/log/nginx-error.log;
12
11
 
13
12
  passenger_enabled on;
14
13
  passenger_friendly_error_pages on;
15
14
 
15
+ # (1024 * TOTAL_RAM * 0.75) / MB_PER_PROECESS
16
+ # passenger_max_pool_size 163;
17
+ # passenger_min_instances 163;
18
+
19
+ client_body_timeout 12;
20
+ client_body_in_file_only clean;
21
+ client_body_buffer_size 32K; # form POST
22
+ client_header_timeout 12;
23
+ client_max_body_size 50M;
24
+ keepalive_timeout 20;
25
+ send_timeout 10;
26
+ sendfile on;
27
+
28
+ gzip on;
29
+ gzip_comp_level 2;
30
+ gzip_min_length 1000;
31
+ gzip_proxied expired no-cache no-store private auth;
32
+ gzip_types text/plain application/x-javascript text/xml text/css application/xml;
33
+
34
+ access_log off;
35
+
16
36
  location = /favicon.ico {
17
- log_not_found off;
18
- access_log off;
37
+ log_not_found off;
38
+ access_log off;
19
39
  }
20
40
 
21
41
  location ^~ /assets/ {
22
- gzip_static on;
23
- expires max;
24
- add_header Cache-Control public;
42
+ gzip_static on;
43
+ expires max;
44
+ add_header Cache-Control public;
25
45
  }
26
-
27
- client_max_body_size 1G;
28
- keepalive_timeout 20;
29
- }
46
+ }
@@ -55,17 +55,17 @@ module ClassAttributes
55
55
 
56
56
  # defines class variable in current lux thread
57
57
  # User.current = @user
58
- def current klass, name
59
- klass.class.send(:define_method, name) do |*args|
60
- Thread.current[:lux] ||= {}
61
- Thread.current[:lux]['%s-%s' % [klass, name]]
62
- end
58
+ # def current klass, name
59
+ # klass.class.send(:define_method, name) do |*args|
60
+ # Thread.current[:lux] ||= {}
61
+ # Thread.current[:lux]['%s-%s' % [klass, name]]
62
+ # end
63
63
 
64
- klass.class.send(:define_method, '%s=' % name) do |value|
65
- Thread.current[:lux] ||= {}
66
- Thread.current[:lux]['%s-%s' % [klass, name]] = value
67
- end
68
- end
64
+ # klass.class.send(:define_method, '%s=' % name) do |value|
65
+ # Thread.current[:lux] ||= {}
66
+ # Thread.current[:lux]['%s-%s' % [klass, name]] = value
67
+ # end
68
+ # end
69
69
  end
70
70
 
71
71
  class Object