pixelforce_recipes 4.0 → 4.0.3

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +237 -26
  3. data/app/controllers/admin/api/admin_base_controller.rb +28 -15
  4. data/app/controllers/admin/api/app_versions_controller.rb +26 -0
  5. data/app/controllers/admin/api/available_modules_controller.rb +20 -0
  6. data/app/controllers/api/v1/health_check_controller.rb +1 -0
  7. data/app/controllers/concerns/response_handler.rb +24 -4
  8. data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/elbas.rb +1 -1
  9. data/{recipes.rb → lib/pixelforce_recipes/recipes.rb} +1 -1
  10. data/lib/pixelforce_recipes/version.rb +1 -1
  11. data/pixelforce_recipes.gemspec +3 -1
  12. metadata +58 -31
  13. data/app/controllers/admin/api/v1/app_versions_controller.rb +0 -28
  14. data/app/controllers/admin/api/v1/available_modules_controller.rb +0 -22
  15. data/app/controllers/admin/api/v1/users_controller.rb +0 -66
  16. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/base.rb +0 -0
  17. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/logrotate.rb +0 -0
  18. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/puma.rb +0 -0
  19. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/resque.rb +0 -0
  20. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/resque_scheduler.rb +0 -0
  21. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/sidekiq.rb +0 -0
  22. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/supervisor.rb +0 -0
  23. /data/lib/{recipes → pixelforce_recipes/recipes}/capistrano_recipes/unicorn.rb +0 -0
  24. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/logrotate.erb +0 -0
  25. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/nginx_config.erb +0 -0
  26. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/nginx_puma_config.erb +0 -0
  27. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/puma.rb.erb +0 -0
  28. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/puma_systemd.erb +0 -0
  29. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/resque_init.erb +0 -0
  30. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/resque_scheduler_init.erb +0 -0
  31. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/resque_scheduler_supervisor.erb +0 -0
  32. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/resque_supervisor.erb +0 -0
  33. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/sidekiq_init.erb +0 -0
  34. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/sidekiq_supervisor.erb +0 -0
  35. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/sidekiq_systemd.erb +0 -0
  36. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/supervisor.erb +0 -0
  37. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/unicorn_init.erb +0 -0
  38. /data/lib/{recipes → pixelforce_recipes/recipes}/templates/unicorn_supervisor.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdb07c77204b3a75b2c73d4322c0d27fdfc2937cafe090283d190645d7616346
4
- data.tar.gz: b28395f2db9c1a2e049cb666a6fb54c4e5e099f15fcbdb81399c98c22678ac42
3
+ metadata.gz: 1c4622a9930f37bf7a6d4c838353530001d955274f227f0e39ae93bba1149310
4
+ data.tar.gz: '0948deb727cbbc63d7bd265e7f8592e499b56baae33dfb590897f0f9d4c65fea'
5
5
  SHA512:
6
- metadata.gz: c126f24f3eeec6f4426a21ae7cb0808607c6e37d5044e305ead5cf358232c4c024dbdc6edd70248f24ee7a66d4d1722cccc7b43086487edfd6b0c1a05175dc22
7
- data.tar.gz: e93d0a39728da785197ef83ebe7937061e5b35ac5f4b5e3df76ce5dffc44682b406587de2afe9541e24fcffdc85fd2218657c33fe068424b3735ab7323739386
6
+ metadata.gz: 1a84130e71ac22e81f44ff242ac44e51479f7e07ba56897c26c608afc278b141b1050b95ef89bc94c522a824785db712a8d90c08192d7beeb108fce58d3f6a42
7
+ data.tar.gz: 77f52f112dcea55cb8da6fa43485c476790357c7935b0b5dd1515b2bc806990e58989e5f2e924e7c9b6c59980920628c606ed70cb433cd6ff5e64c14ac708882
data/Gemfile.lock CHANGED
@@ -1,47 +1,242 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pixelforce_recipes (3.9.2)
5
- capistrano (> 2.0.0)
4
+ pixelforce_recipes (4.0.3)
5
+ capistrano (> 3.0.0)
6
+ devise
7
+ devise_token_auth
8
+ elbas
6
9
 
7
10
  GEM
8
11
  remote: https://rubygems.org/
9
12
  specs:
10
- airbrussh (1.4.1)
13
+ actioncable (7.1.5.1)
14
+ actionpack (= 7.1.5.1)
15
+ activesupport (= 7.1.5.1)
16
+ nio4r (~> 2.0)
17
+ websocket-driver (>= 0.6.1)
18
+ zeitwerk (~> 2.6)
19
+ actionmailbox (7.1.5.1)
20
+ actionpack (= 7.1.5.1)
21
+ activejob (= 7.1.5.1)
22
+ activerecord (= 7.1.5.1)
23
+ activestorage (= 7.1.5.1)
24
+ activesupport (= 7.1.5.1)
25
+ mail (>= 2.7.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.1.5.1)
30
+ actionpack (= 7.1.5.1)
31
+ actionview (= 7.1.5.1)
32
+ activejob (= 7.1.5.1)
33
+ activesupport (= 7.1.5.1)
34
+ mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
38
+ rails-dom-testing (~> 2.2)
39
+ actionpack (7.1.5.1)
40
+ actionview (= 7.1.5.1)
41
+ activesupport (= 7.1.5.1)
42
+ nokogiri (>= 1.8.5)
43
+ racc
44
+ rack (>= 2.2.4)
45
+ rack-session (>= 1.0.1)
46
+ rack-test (>= 0.6.3)
47
+ rails-dom-testing (~> 2.2)
48
+ rails-html-sanitizer (~> 1.6)
49
+ actiontext (7.1.5.1)
50
+ actionpack (= 7.1.5.1)
51
+ activerecord (= 7.1.5.1)
52
+ activestorage (= 7.1.5.1)
53
+ activesupport (= 7.1.5.1)
54
+ globalid (>= 0.6.0)
55
+ nokogiri (>= 1.8.5)
56
+ actionview (7.1.5.1)
57
+ activesupport (= 7.1.5.1)
58
+ builder (~> 3.1)
59
+ erubi (~> 1.11)
60
+ rails-dom-testing (~> 2.2)
61
+ rails-html-sanitizer (~> 1.6)
62
+ activejob (7.1.5.1)
63
+ activesupport (= 7.1.5.1)
64
+ globalid (>= 0.3.6)
65
+ activemodel (7.1.5.1)
66
+ activesupport (= 7.1.5.1)
67
+ activerecord (7.1.5.1)
68
+ activemodel (= 7.1.5.1)
69
+ activesupport (= 7.1.5.1)
70
+ timeout (>= 0.4.0)
71
+ activestorage (7.1.5.1)
72
+ actionpack (= 7.1.5.1)
73
+ activejob (= 7.1.5.1)
74
+ activerecord (= 7.1.5.1)
75
+ activesupport (= 7.1.5.1)
76
+ marcel (~> 1.0)
77
+ activesupport (7.1.5.1)
78
+ base64
79
+ benchmark (>= 0.3)
80
+ bigdecimal
81
+ concurrent-ruby (~> 1.0, >= 1.0.2)
82
+ connection_pool (>= 2.2.5)
83
+ drb
84
+ i18n (>= 1.6, < 2)
85
+ logger (>= 1.4.2)
86
+ minitest (>= 5.1)
87
+ mutex_m
88
+ securerandom (>= 0.3)
89
+ tzinfo (~> 2.0)
90
+ airbrussh (1.5.3)
11
91
  sshkit (>= 1.6.1, != 1.7.0)
12
- aws-eventstream (1.2.0)
13
- aws-partitions (1.628.0)
14
- aws-sdk-autoscaling (1.80.0)
15
- aws-sdk-core (~> 3, >= 3.127.0)
16
- aws-sigv4 (~> 1.1)
17
- aws-sdk-core (3.145.0)
18
- aws-eventstream (~> 1, >= 1.0.2)
19
- aws-partitions (~> 1, >= 1.525.0)
20
- aws-sigv4 (~> 1.1)
92
+ aws-eventstream (1.4.0)
93
+ aws-partitions (1.1120.0)
94
+ aws-sdk-autoscaling (1.138.0)
95
+ aws-sdk-core (~> 3, >= 3.225.0)
96
+ aws-sigv4 (~> 1.5)
97
+ aws-sdk-core (3.226.1)
98
+ aws-eventstream (~> 1, >= 1.3.0)
99
+ aws-partitions (~> 1, >= 1.992.0)
100
+ aws-sigv4 (~> 1.9)
101
+ base64
21
102
  jmespath (~> 1, >= 1.6.1)
22
- aws-sdk-ec2 (1.331.0)
23
- aws-sdk-core (~> 3, >= 3.127.0)
24
- aws-sigv4 (~> 1.1)
25
- aws-sigv4 (1.5.1)
103
+ logger
104
+ aws-sdk-ec2 (1.532.0)
105
+ aws-sdk-core (~> 3, >= 3.225.0)
106
+ aws-sigv4 (~> 1.5)
107
+ aws-sigv4 (1.12.1)
26
108
  aws-eventstream (~> 1, >= 1.0.2)
27
- capistrano (3.17.1)
109
+ base64 (0.3.0)
110
+ bcrypt (3.1.20)
111
+ benchmark (0.4.1)
112
+ bigdecimal (3.2.2)
113
+ builder (3.3.0)
114
+ capistrano (3.19.2)
28
115
  airbrussh (>= 1.0.0)
29
116
  i18n
30
117
  rake (>= 10.0.0)
31
118
  sshkit (>= 1.9.0)
32
- concurrent-ruby (1.1.10)
119
+ cgi (0.5.0)
120
+ concurrent-ruby (1.3.5)
121
+ connection_pool (2.5.3)
122
+ crass (1.0.6)
123
+ date (3.4.1)
124
+ devise (4.9.4)
125
+ bcrypt (~> 3.0)
126
+ orm_adapter (~> 0.1)
127
+ railties (>= 4.1.0)
128
+ responders
129
+ warden (~> 1.2.3)
130
+ devise_token_auth (1.2.5)
131
+ bcrypt (~> 3.0)
132
+ devise (> 3.5.2, < 5)
133
+ rails (>= 4.2.0, < 8.1)
33
134
  diff-lcs (1.2.5)
135
+ drb (2.2.3)
34
136
  elbas (3.0.4)
35
137
  aws-sdk-autoscaling (~> 1)
36
138
  aws-sdk-ec2 (~> 1)
37
139
  capistrano (> 3)
38
- i18n (1.12.0)
140
+ erb (4.0.4)
141
+ cgi (>= 0.3.3)
142
+ erubi (1.13.1)
143
+ globalid (1.2.1)
144
+ activesupport (>= 6.1)
145
+ i18n (1.14.7)
39
146
  concurrent-ruby (~> 1.0)
40
- jmespath (1.6.1)
41
- net-scp (1.2.1)
42
- net-ssh (>= 2.6.5)
43
- net-ssh (7.0.1)
147
+ io-console (0.8.0)
148
+ irb (1.15.2)
149
+ pp (>= 0.6.0)
150
+ rdoc (>= 4.0.0)
151
+ reline (>= 0.4.2)
152
+ jmespath (1.6.2)
153
+ logger (1.7.0)
154
+ loofah (2.24.1)
155
+ crass (~> 1.0.2)
156
+ nokogiri (>= 1.12.0)
157
+ mail (2.8.1)
158
+ mini_mime (>= 0.1.1)
159
+ net-imap
160
+ net-pop
161
+ net-smtp
162
+ marcel (1.0.4)
163
+ mini_mime (1.1.5)
164
+ mini_portile2 (2.8.9)
165
+ minitest (5.25.5)
166
+ mutex_m (0.3.0)
167
+ net-imap (0.4.22)
168
+ date
169
+ net-protocol
170
+ net-pop (0.1.2)
171
+ net-protocol
172
+ net-protocol (0.2.2)
173
+ timeout
174
+ net-scp (4.1.0)
175
+ net-ssh (>= 2.6.5, < 8.0.0)
176
+ net-sftp (4.0.0)
177
+ net-ssh (>= 5.0.0, < 8.0.0)
178
+ net-smtp (0.5.1)
179
+ net-protocol
180
+ net-ssh (7.3.0)
181
+ nio4r (2.7.4)
182
+ nokogiri (1.17.2)
183
+ mini_portile2 (~> 2.8.2)
184
+ racc (~> 1.4)
185
+ orm_adapter (0.5.0)
186
+ ostruct (0.6.2)
187
+ pp (0.6.2)
188
+ prettyprint
189
+ prettyprint (0.2.0)
190
+ psych (5.2.6)
191
+ date
192
+ stringio
193
+ racc (1.8.1)
194
+ rack (3.1.16)
195
+ rack-session (2.1.1)
196
+ base64 (>= 0.1.0)
197
+ rack (>= 3.0.0)
198
+ rack-test (2.2.0)
199
+ rack (>= 1.3)
200
+ rackup (2.2.1)
201
+ rack (>= 3)
202
+ rails (7.1.5.1)
203
+ actioncable (= 7.1.5.1)
204
+ actionmailbox (= 7.1.5.1)
205
+ actionmailer (= 7.1.5.1)
206
+ actionpack (= 7.1.5.1)
207
+ actiontext (= 7.1.5.1)
208
+ actionview (= 7.1.5.1)
209
+ activejob (= 7.1.5.1)
210
+ activemodel (= 7.1.5.1)
211
+ activerecord (= 7.1.5.1)
212
+ activestorage (= 7.1.5.1)
213
+ activesupport (= 7.1.5.1)
214
+ bundler (>= 1.15.0)
215
+ railties (= 7.1.5.1)
216
+ rails-dom-testing (2.3.0)
217
+ activesupport (>= 5.0.0)
218
+ minitest
219
+ nokogiri (>= 1.6)
220
+ rails-html-sanitizer (1.6.2)
221
+ loofah (~> 2.21)
222
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
223
+ railties (7.1.5.1)
224
+ actionpack (= 7.1.5.1)
225
+ activesupport (= 7.1.5.1)
226
+ irb
227
+ rackup (>= 1.0.0)
228
+ rake (>= 12.2)
229
+ thor (~> 1.0, >= 1.2.2)
230
+ zeitwerk (~> 2.6)
44
231
  rake (13.0.1)
232
+ rdoc (6.14.1)
233
+ erb
234
+ psych (>= 4.0.0)
235
+ reline (0.6.1)
236
+ io-console (~> 0.5)
237
+ responders (3.1.1)
238
+ actionpack (>= 5.2)
239
+ railties (>= 5.2)
45
240
  rspec (3.5.0)
46
241
  rspec-core (~> 3.5.0)
47
242
  rspec-expectations (~> 3.5.0)
@@ -55,19 +250,35 @@ GEM
55
250
  diff-lcs (>= 1.2.0, < 2.0)
56
251
  rspec-support (~> 3.5.0)
57
252
  rspec-support (3.5.0)
58
- sshkit (1.21.3)
253
+ securerandom (0.3.2)
254
+ sshkit (1.24.0)
255
+ base64
256
+ logger
59
257
  net-scp (>= 1.1.2)
258
+ net-sftp (>= 2.1.2)
60
259
  net-ssh (>= 2.8.0)
260
+ ostruct
261
+ stringio (3.1.7)
262
+ thor (1.3.2)
263
+ timeout (0.4.3)
264
+ tzinfo (2.0.6)
265
+ concurrent-ruby (~> 1.0)
266
+ warden (1.2.9)
267
+ rack (>= 2.0.9)
268
+ websocket-driver (0.8.0)
269
+ base64
270
+ websocket-extensions (>= 0.1.0)
271
+ websocket-extensions (0.1.5)
272
+ zeitwerk (2.6.18)
61
273
 
62
274
  PLATFORMS
63
275
  ruby
64
276
 
65
277
  DEPENDENCIES
66
278
  bundler (~> 2.1)
67
- elbas
68
279
  pixelforce_recipes!
69
280
  rake (~> 13.0)
70
281
  rspec (~> 3.0)
71
282
 
72
283
  BUNDLED WITH
73
- 2.2.10
284
+ 2.2.33
@@ -6,32 +6,45 @@ module Admin
6
6
  include RequestHeaderHandler
7
7
  include ExceptionHandler
8
8
 
9
+ layout false
10
+
9
11
  before_action :authenticate_admin_user!
10
12
  before_action :format_params
11
13
  before_action :prepare_pagination_params
14
+ after_action :track_admin_request
12
15
 
13
16
  def authenticate_admin_user!
14
- authenticate_admin_api_v1_admin_user!
17
+ authenticate_admin_api_admin_user!
15
18
  end
16
19
 
17
- private
20
+ def current_admin_user
21
+ current_admin_api_admin_user
22
+ end
18
23
 
19
- def render_error(status, message, validation_errors = nil)
20
- errors = {}
21
- errors['root'] = { 'serverError': message } if message.present?
22
- if validation_errors.is_a?(ActiveModel::Errors)
23
- data = {}
24
- validation_errors.to_hash.each do |key, value|
25
- data[key] = value.join(', ')
26
- end
24
+ def log_target
25
+ @log_target
26
+ end
27
27
 
28
- errors.merge!(data) if data.present?
28
+ def admin_action_on_user_id
29
+ @admin_action_on_user_id = if log_target.present?
30
+ if log_target.is_a?(User)
31
+ log_target.id
32
+ else
33
+ log_target.user_id
34
+ end
29
35
  end
36
+ end
30
37
 
31
- response = {
32
- errors:
33
- }
34
- render status:, json: response
38
+ private
39
+
40
+ def track_admin_request
41
+ unless params[:action] == 'index' || params[:action] == 'show'
42
+ ahoy.track 'AdminLog', {
43
+ params: request.filtered_parameters,
44
+ url: request.original_url,
45
+ response: response.status
46
+ }
47
+ end
35
48
  end
36
49
 
37
50
  def set_response_format
@@ -0,0 +1,26 @@
1
+ module Admin
2
+ module Api
3
+ class AppVersionsController < Admin::Api::AdminBaseController
4
+ def show
5
+ app_version = AppVersion.last
6
+ app_version ||= AppVersion.create!
7
+ render json: app_version.as_json(only: %i[id ios_minimum_version_number android_minimum_version_number])
8
+ end
9
+
10
+ def update
11
+ app_version = AppVersion.find(params[:id])
12
+ if app_version.update(app_version_params)
13
+ render json: app_version.as_json(only: %i[id ios_minimum_version_number android_minimum_version_number])
14
+ else
15
+ render_error(400, nil, app_version.errors)
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def app_version_params
22
+ params.permit(:ios_minimum_version_number, :android_minimum_version_number)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ module Admin
2
+ module Api
3
+ class AvailableModulesController < AdminBaseController
4
+ def index
5
+ render json: [
6
+ {
7
+ "id": 1,
8
+ "name": 'Dashboard',
9
+ "path": '/dashboard'
10
+ },
11
+ {
12
+ "id": 2,
13
+ "name": 'Users',
14
+ "path": '/users'
15
+ }
16
+ ]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,6 +1,7 @@
1
1
  module Api
2
2
  module V1
3
3
  class HealthCheckController < Api::BaseController
4
+ skip_after_action :track_request
4
5
  skip_before_action :authenticate_user!
5
6
 
6
7
  def index
@@ -3,6 +3,7 @@ module ResponseHandler
3
3
 
4
4
  included do
5
5
  before_action :config_default_response_settings
6
+ layout false
6
7
  end
7
8
 
8
9
  def config_default_response_settings
@@ -10,7 +11,10 @@ module ResponseHandler
10
11
  end
11
12
 
12
13
  def set_response_format
13
- self.content_type = 'application/json'
14
+ if request.format.to_s != 'text/csv'
15
+ request.format = :json
16
+ self.content_type = 'application/json'
17
+ end
14
18
  end
15
19
 
16
20
  def render_success
@@ -21,11 +25,27 @@ module ResponseHandler
21
25
  render json: {}, status: :no_content
22
26
  end
23
27
 
24
- def render_error(status, message, data = nil)
28
+ def render_error(status, message, errors = nil, source: nil, meta: {})
25
29
  response = {
26
- errors: [message]
30
+ 'status' => status.to_s,
31
+ 'source' => source,
32
+ 'errors' => {},
33
+ 'meta' => meta
27
34
  }
28
- response = response.merge(data) if data
35
+
36
+ if errors.is_a?(ActiveModel::Errors)
37
+ errors.each do |error|
38
+ attribute = error.attribute.to_s
39
+ error_message = error.message
40
+ response['errors'][attribute] ||= []
41
+ response['errors'][attribute] << error_message
42
+ end
43
+ elsif errors.is_a?(Hash)
44
+ response['errors'] = errors
45
+ else
46
+ response['errors'] = { 'server' => message }
47
+ end
48
+
29
49
  render json: response, status: status
30
50
  end
31
51
  end
@@ -1,7 +1,7 @@
1
1
  namespace :elbas do
2
2
  desc 'Sync files before creating AMI'
3
3
  task :sync do
4
- on roles(:app) do
4
+ on release_roles(:all) do
5
5
  execute "sync"
6
6
  end
7
7
  end
@@ -1,4 +1,4 @@
1
1
  require "pixelforce_recipes/version"
2
2
  require "capistrano"
3
3
 
4
- Dir[File.expand_path("#{File.dirname(__FILE__)}/recipes/capistrano_recipes/*.rb")].each {|file| require file }
4
+ Dir[File.expand_path("#{File.dirname(__FILE__)}/recipes/capistrano_recipes/*.rb")].each {|file| require file }
@@ -1,3 +1,3 @@
1
1
  module PixelforceRecipes
2
- VERSION = '4.0'
2
+ VERSION = '4.0.3'
3
3
  end
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "bundler", "~> 2.1"
23
23
  spec.add_development_dependency "rake", "~> 13.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
- spec.add_development_dependency "elbas"
25
+ spec.add_dependency "elbas"
26
+ spec.add_dependency 'devise'
27
+ spec.add_dependency 'devise_token_auth'
26
28
  spec.add_dependency(%q<capistrano>, ["> 3.0.0"])
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixelforce_recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: '4.0'
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-07 00:00:00.000000000 Z
11
+ date: 2025-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,7 +59,35 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- type: :development
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: devise
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: devise_token_auth
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
@@ -95,9 +123,8 @@ files:
95
123
  - README.md
96
124
  - Rakefile
97
125
  - app/controllers/admin/api/admin_base_controller.rb
98
- - app/controllers/admin/api/v1/app_versions_controller.rb
99
- - app/controllers/admin/api/v1/available_modules_controller.rb
100
- - app/controllers/admin/api/v1/users_controller.rb
126
+ - app/controllers/admin/api/app_versions_controller.rb
127
+ - app/controllers/admin/api/available_modules_controller.rb
101
128
  - app/controllers/api/base_controller.rb
102
129
  - app/controllers/api/v1/health_check_controller.rb
103
130
  - app/controllers/application_controller.rb
@@ -113,33 +140,33 @@ files:
113
140
  - lib/pixelforce_recipes.rb
114
141
  - lib/pixelforce_recipes/engine.rb
115
142
  - lib/pixelforce_recipes/railtie.rb
143
+ - lib/pixelforce_recipes/recipes.rb
144
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/base.rb
145
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/elbas.rb
146
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/logrotate.rb
147
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/puma.rb
148
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/resque.rb
149
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/resque_scheduler.rb
150
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/sidekiq.rb
151
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/supervisor.rb
152
+ - lib/pixelforce_recipes/recipes/capistrano_recipes/unicorn.rb
153
+ - lib/pixelforce_recipes/recipes/templates/logrotate.erb
154
+ - lib/pixelforce_recipes/recipes/templates/nginx_config.erb
155
+ - lib/pixelforce_recipes/recipes/templates/nginx_puma_config.erb
156
+ - lib/pixelforce_recipes/recipes/templates/puma.rb.erb
157
+ - lib/pixelforce_recipes/recipes/templates/puma_systemd.erb
158
+ - lib/pixelforce_recipes/recipes/templates/resque_init.erb
159
+ - lib/pixelforce_recipes/recipes/templates/resque_scheduler_init.erb
160
+ - lib/pixelforce_recipes/recipes/templates/resque_scheduler_supervisor.erb
161
+ - lib/pixelforce_recipes/recipes/templates/resque_supervisor.erb
162
+ - lib/pixelforce_recipes/recipes/templates/sidekiq_init.erb
163
+ - lib/pixelforce_recipes/recipes/templates/sidekiq_supervisor.erb
164
+ - lib/pixelforce_recipes/recipes/templates/sidekiq_systemd.erb
165
+ - lib/pixelforce_recipes/recipes/templates/supervisor.erb
166
+ - lib/pixelforce_recipes/recipes/templates/unicorn_init.erb
167
+ - lib/pixelforce_recipes/recipes/templates/unicorn_supervisor.erb
116
168
  - lib/pixelforce_recipes/version.rb
117
- - lib/recipes/capistrano_recipes/base.rb
118
- - lib/recipes/capistrano_recipes/elbas.rb
119
- - lib/recipes/capistrano_recipes/logrotate.rb
120
- - lib/recipes/capistrano_recipes/puma.rb
121
- - lib/recipes/capistrano_recipes/resque.rb
122
- - lib/recipes/capistrano_recipes/resque_scheduler.rb
123
- - lib/recipes/capistrano_recipes/sidekiq.rb
124
- - lib/recipes/capistrano_recipes/supervisor.rb
125
- - lib/recipes/capistrano_recipes/unicorn.rb
126
- - lib/recipes/templates/logrotate.erb
127
- - lib/recipes/templates/nginx_config.erb
128
- - lib/recipes/templates/nginx_puma_config.erb
129
- - lib/recipes/templates/puma.rb.erb
130
- - lib/recipes/templates/puma_systemd.erb
131
- - lib/recipes/templates/resque_init.erb
132
- - lib/recipes/templates/resque_scheduler_init.erb
133
- - lib/recipes/templates/resque_scheduler_supervisor.erb
134
- - lib/recipes/templates/resque_supervisor.erb
135
- - lib/recipes/templates/sidekiq_init.erb
136
- - lib/recipes/templates/sidekiq_supervisor.erb
137
- - lib/recipes/templates/sidekiq_systemd.erb
138
- - lib/recipes/templates/supervisor.erb
139
- - lib/recipes/templates/unicorn_init.erb
140
- - lib/recipes/templates/unicorn_supervisor.erb
141
169
  - pixelforce_recipes.gemspec
142
- - recipes.rb
143
170
  homepage: https://github.com/BenZhang/pixelforce_recipes
144
171
  licenses:
145
172
  - MIT
@@ -1,28 +0,0 @@
1
- module Admin
2
- module Api
3
- module V1
4
- class AppVersionsController < Admin::Api::AdminBaseController
5
- def show
6
- app_version = AppVersion.last
7
- app_version ||= AppVersion.create!
8
- render json: app_version.as_json(only: %i[id ios_minimum_version_number android_minimum_version_number])
9
- end
10
-
11
- def update
12
- app_version = AppVersion.find(params[:id])
13
- if app_version.update(app_version_params)
14
- render json: app_version.as_json(only: %i[id ios_minimum_version_number android_minimum_version_number])
15
- else
16
- render_error(400, nil, app_version.errors)
17
- end
18
- end
19
-
20
- private
21
-
22
- def app_version_params
23
- params.permit(:ios_minimum_version_number, :android_minimum_version_number)
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,22 +0,0 @@
1
- module Admin
2
- module Api
3
- module V1
4
- class AvailableModulesController < AdminBaseController
5
- def index
6
- render json: [
7
- {
8
- "id": 1,
9
- "name": 'Dashboard',
10
- "path": '/dashboard'
11
- },
12
- {
13
- "id": 2,
14
- "name": 'Users',
15
- "path": '/users'
16
- }
17
- ]
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,66 +0,0 @@
1
- module Admin
2
- module Api
3
- module V1
4
- class UsersController < Admin::Api::AdminBaseController
5
- def index
6
- users = User.all.order(id: :desc).page(params[:page]).per(params[:perPage] || default_per_page)
7
- if keywords.present?
8
- users = users.where('first_name ILIKE ANY ( array[?] ) OR last_name ILIKE ANY ( array[?] ) OR email ILIKE ANY ( array[?] ) or id = ?', @keywords, @keywords, @keywords, @keywords.first.delete('%').to_i)
9
- end
10
- pagination_headers(users, 'users')
11
-
12
- respond_to do |format|
13
- format.json do
14
- render json: users.as_json(only: %i[id first_name last_name email], methods: :status, for_admin: true)
15
- end
16
- format.csv do
17
- export_resource_csv(users, %w[id first_name last_name status email])
18
- end
19
- end
20
- end
21
-
22
- def create
23
- user = User.new user_params
24
- if user.save
25
- render json: user.as_json(only: %i[id first_name last_name email dob gender])
26
- else
27
- render_error(400, nil, user.errors)
28
- end
29
- end
30
-
31
- def show
32
- @user = User.find(params[:id])
33
- render json: @user.as_json(only: %i[id first_name last_name email dob gender])
34
- end
35
-
36
- def update
37
- user = User.find(params[:id])
38
- if user.update(user_params)
39
- render json: user.as_json(only: %i[id], for_admin: true)
40
- else
41
- render_error(400, nil, user.errors)
42
- end
43
- end
44
-
45
- def destroy
46
- user = User.find(params[:id])
47
- user.destroy
48
-
49
- render_success
50
- end
51
-
52
- def genders
53
- pagination_headers_for_dropdown('genders')
54
- render json: User.genders.keys.map { |k| { id: k, name: k } }
55
- end
56
-
57
- private
58
-
59
- def user_params
60
- permitted = params.permit(:first_name, :last_name, :dob, :email, :gender, :password)
61
- permitted.presence || raise(ActionController::ParameterMissing, 'Parameters missing')
62
- end
63
- end
64
- end
65
- end
66
- end