rails_audit 1.0.3 → 1.0.4

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 (172) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +20 -165
  3. data/README.md +15 -6
  4. data/app/controllers/auditor/admin/approvals_controller.rb +44 -0
  5. data/app/controllers/auditor/admin/audits_controller.rb +11 -0
  6. data/app/controllers/auditor/admin/base_controller.rb +4 -0
  7. data/app/controllers/auditor/admin/verifications_controller.rb +61 -0
  8. data/app/controllers/auditor/admin/verifiers_controller.rb +69 -0
  9. data/app/controllers/auditor/controller/application.rb +32 -0
  10. data/app/models/auditor/approval.rb +5 -0
  11. data/app/models/auditor/audit.rb +5 -0
  12. data/app/models/auditor/ext/audited.rb +58 -0
  13. data/app/models/auditor/ext/verifiable.rb +10 -0
  14. data/app/models/auditor/ext/verified.rb +25 -0
  15. data/app/models/auditor/model/approval.rb +59 -0
  16. data/app/models/auditor/model/approving.rb +65 -0
  17. data/app/models/auditor/model/audit.rb +25 -0
  18. data/app/models/auditor/model/verification.rb +32 -0
  19. data/app/models/auditor/model/verifier.rb +20 -0
  20. data/app/models/auditor/verification.rb +5 -0
  21. data/app/models/auditor/verifier.rb +5 -0
  22. data/app/models/auditor.rb +11 -0
  23. data/app/views/auditor/_approvals.html.erb +14 -0
  24. data/app/views/{audit → auditor}/_checks.html.erb +0 -0
  25. data/app/views/auditor/admin/approvals/_filter.html.erb +7 -0
  26. data/app/views/auditor/admin/approvals/_form.html.erb +6 -0
  27. data/app/views/auditor/admin/approvals/_index.html.erb +10 -0
  28. data/app/views/auditor/admin/approvals/_show_table.html.erb +28 -0
  29. data/app/views/auditor/admin/approvals/_table.html.erb +28 -0
  30. data/app/views/auditor/admin/approvals/index.js.erb +3 -0
  31. data/{test/dummy/app/assets/javascripts/footer.js → app/views/auditor/admin/audits/_button.html.erb} +0 -0
  32. data/app/views/auditor/admin/audits/_index_tbody.html.erb +38 -0
  33. data/app/views/auditor/admin/audits/_index_thead.html.erb +4 -0
  34. data/app/views/auditor/admin/audits/index.html.erb +7 -0
  35. data/app/views/auditor/admin/verifications/_edit_form.html.erb +7 -0
  36. data/app/views/auditor/admin/verifications/_filter_form.html.erb +5 -0
  37. data/app/views/auditor/admin/verifications/_index_tbody.html.erb +4 -0
  38. data/app/views/auditor/admin/verifications/_index_thead.html.erb +5 -0
  39. data/app/views/auditor/admin/verifications/_new_form.html.erb +7 -0
  40. data/app/views/auditor/admin/verifications/_show_table.html.erb +16 -0
  41. data/app/views/auditor/admin/verifiers/_edit_form.html.erb +3 -0
  42. data/app/views/auditor/admin/verifiers/_filter_form.html.erb +9 -0
  43. data/app/views/auditor/admin/verifiers/_form.html.erb +5 -0
  44. data/app/views/auditor/admin/verifiers/_index_tbody.html.erb +3 -0
  45. data/app/views/auditor/admin/verifiers/_index_thead.html.erb +4 -0
  46. data/app/views/auditor/admin/verifiers/_member_field.html.erb +1 -0
  47. data/app/views/auditor/admin/verifiers/_new_form.html.erb +3 -0
  48. data/app/views/auditor/admin/verifiers/_show_table.html.erb +24 -0
  49. data/app/views/auditor/admin/verifiers/members.turbo_stream.erb +3 -0
  50. data/config/locales/zh.controller.yml +13 -0
  51. data/config/locales/zh.enum.yml +7 -0
  52. data/config/locales/zh.yml +16 -7
  53. data/config/routes.rb +21 -6
  54. data/lib/rails_audit/config.rb +3 -4
  55. data/lib/rails_audit/engine.rb +15 -5
  56. data/lib/rails_audit.rb +2 -2
  57. data/test/controllers/audit/admin/approvals_controller_test.rb +36 -0
  58. data/test/dummy/Gemfile +54 -0
  59. data/test/dummy/Gemfile.lock +382 -0
  60. data/test/dummy/README.md +4 -1
  61. data/test/dummy/app/assets/images/logo.png +0 -0
  62. data/test/dummy/app/assets/javascripts/admin/application.js +1 -0
  63. data/test/dummy/app/assets/javascripts/application.js +11 -2
  64. data/test/dummy/app/assets/javascripts/phone.js +5 -0
  65. data/test/dummy/app/assets/stylesheets/css.scss +4 -0
  66. data/test/dummy/app/controllers/active_storage/base_controller.rb +19 -0
  67. data/test/dummy/app/controllers/admin_controller.rb +0 -5
  68. data/test/dummy/app/controllers/application_controller.rb +10 -1
  69. data/test/dummy/app/controllers/me_controller.rb +4 -0
  70. data/test/dummy/app/controllers/my_controller.rb +1 -6
  71. data/test/dummy/app/models/auth/user.rb +7 -0
  72. data/test/dummy/app/views/home/index.css +3 -0
  73. data/test/dummy/bin/bundle +1 -1
  74. data/test/dummy/bin/setup +1 -1
  75. data/test/dummy/bin/vite +19 -0
  76. data/test/dummy/bin/yarn +11 -0
  77. data/test/dummy/config/application.rb +12 -6
  78. data/test/dummy/config/boot.rb +8 -4
  79. data/test/dummy/config/credentials/development.key +1 -0
  80. data/test/dummy/config/credentials/test.key +1 -0
  81. data/test/dummy/config/credentials.yml.enc +1 -1
  82. data/test/dummy/config/database.yml +7 -3
  83. data/test/dummy/config/environment.rb +0 -2
  84. data/test/dummy/config/environments/development.rb +18 -35
  85. data/test/dummy/config/environments/production.rb +1 -13
  86. data/test/dummy/config/environments/test.rb +3 -0
  87. data/test/dummy/config/initializers/mime_types.rb +0 -4
  88. data/test/dummy/config/initializers/new_framework_defaults.rb +0 -4
  89. data/test/dummy/config/locales/en.yml +1 -22
  90. data/test/dummy/config/master.key +1 -0
  91. data/test/dummy/config/puma.rb +28 -41
  92. data/test/dummy/config/routes.rb +9 -1
  93. data/test/dummy/config/storage.yml +8 -8
  94. data/test/dummy/config/vite/base.js +5 -0
  95. data/test/dummy/config/vite/development.js +12 -0
  96. data/test/dummy/config/vite/production.js +6 -0
  97. data/test/dummy/config.ru +2 -0
  98. data/test/dummy/lib/deploy.rb +115 -0
  99. data/test/dummy/package.json +23 -3
  100. data/test/dummy/postcss.config.js +11 -0
  101. data/test/dummy/yarn.lock +2139 -7
  102. data/test/factories/approvals.rb +7 -0
  103. data/test/factories/infos.rb +8 -0
  104. data/test/{the_audit_test.rb → rails_audit_test.rb} +3 -1
  105. data/test/test_helper.rb +9 -16
  106. metadata +133 -165
  107. data/app/controllers/audit/admin/audits_controller.rb +0 -12
  108. data/app/controllers/audit/admin/base_controller.rb +0 -7
  109. data/app/controllers/audit/admin/check_settings_controller.rb +0 -52
  110. data/app/controllers/audit/admin/checks_controller.rb +0 -65
  111. data/app/models/concerns/auditable.rb +0 -58
  112. data/app/models/concerns/check_machine.rb +0 -9
  113. data/app/models/rails_audit/audit.rb +0 -14
  114. data/app/models/rails_audit/check.rb +0 -15
  115. data/app/models/rails_audit/check_setting.rb +0 -4
  116. data/app/views/audit/admin/audits/_index.html.erb +0 -9
  117. data/app/views/audit/admin/audits/_table.html.erb +0 -61
  118. data/app/views/audit/admin/audits/index.html.erb +0 -3
  119. data/app/views/audit/admin/audits/index.js.erb +0 -8
  120. data/app/views/audit/admin/check_settings/_form.html.erb +0 -4
  121. data/app/views/audit/admin/check_settings/_search_form.html.erb +0 -7
  122. data/app/views/audit/admin/check_settings/edit.html.erb +0 -9
  123. data/app/views/audit/admin/check_settings/index.html.erb +0 -41
  124. data/app/views/audit/admin/check_settings/new.html.erb +0 -9
  125. data/app/views/audit/admin/check_settings/show.html.erb +0 -10
  126. data/app/views/audit/admin/checks/_new.html.erb +0 -17
  127. data/app/views/audit/admin/checks/_search_form.html.erb +0 -7
  128. data/app/views/audit/admin/checks/create.js.erb +0 -2
  129. data/app/views/audit/admin/checks/edit.html.erb +0 -16
  130. data/app/views/audit/admin/checks/index.html.erb +0 -49
  131. data/app/views/audit/admin/checks/new.html.erb +0 -9
  132. data/app/views/audit/admin/checks/new.js.erb +0 -4
  133. data/app/views/audit/admin/checks/show.html.erb +0 -26
  134. data/db/migrate/20170314035239_rails_audit_init.rb +0 -35
  135. data/lib/rails_audit/controller_helper.rb +0 -39
  136. data/lib/rails_audit/version.rb +0 -3
  137. data/test/dummy/app/assets/config/manifest.js +0 -10
  138. data/test/dummy/app/assets/javascripts/cable.js +0 -13
  139. data/test/dummy/app/assets/stylesheets/application.css +0 -5
  140. data/test/dummy/app/controllers/api_controller.rb +0 -3
  141. data/test/dummy/app/models/application_record.rb +0 -3
  142. data/test/dummy/app/models/user.rb +0 -4
  143. data/test/dummy/app/views/layouts/_footer.html.erb +0 -10
  144. data/test/dummy/app/views/layouts/_navbar.html.erb +0 -7
  145. data/test/dummy/app/views/layouts/application.html.erb +0 -19
  146. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  147. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  148. data/test/dummy/bin/update +0 -29
  149. data/test/dummy/config/database.yml.mysql +0 -14
  150. data/test/dummy/config/database.yml.sqlite3 +0 -12
  151. data/test/dummy/config/initializers/assets.rb +0 -10
  152. data/test/dummy/config/secrets.yml +0 -22
  153. data/test/dummy/db/migrate/20180525090830_create_active_storage_tables.active_storage.rb +0 -26
  154. data/test/dummy/db/migrate/20180916100159_create_users.rb +0 -11
  155. data/test/dummy/log/development.log +0 -2
  156. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/brand-icons.eot +0 -0
  157. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/brand-icons.svg +0 -1008
  158. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/brand-icons.ttf +0 -0
  159. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/brand-icons.woff +0 -0
  160. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  161. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.eot +0 -0
  162. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.otf +0 -0
  163. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.svg +0 -1518
  164. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.ttf +0 -0
  165. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.woff +0 -0
  166. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/icons.woff2 +0 -0
  167. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/outline-icons.eot +0 -0
  168. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/outline-icons.svg +0 -366
  169. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/outline-icons.ttf +0 -0
  170. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/outline-icons.woff +0 -0
  171. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  172. data/test/dummy/vendor/nondigest_assets/fonts/themes/default/assets/images/flags.png +0 -0
@@ -1,5 +1,3 @@
1
- # Load the Rails application.
2
1
  require_relative 'application'
3
2
 
4
- # Initialize the Rails application.
5
3
  Rails.application.initialize!
@@ -1,58 +1,41 @@
1
1
  Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
2
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
3
  config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
4
  config.eager_load = false
11
-
12
- # Show full error reports.
13
5
  config.consider_all_requests_local = true
14
6
 
15
- # Enable/disable caching. By default caching is disabled.
7
+ #config.file_watcher = ActiveSupport::EventedFileUpdateChecker
8
+
9
+ config.hosts += [
10
+ '.lvh.me'
11
+ ]
12
+
16
13
  if Rails.root.join('tmp/caching-dev.txt').exist?
17
14
  config.action_controller.perform_caching = true
18
-
19
- config.cache_store = :memory_store
15
+ config.action_controller.enable_fragment_cache_logging = true
16
+ config.cache_store = :file_store, 'tmp/cache/store'
20
17
  config.public_file_server.headers = {
21
- 'Cache-Control' => 'public, max-age=172800'
18
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
22
19
  }
23
20
  else
24
21
  config.action_controller.perform_caching = false
25
-
26
22
  config.cache_store = :null_store
27
23
  end
28
24
 
29
- # Don't care if the mailer can't send.
30
- config.action_mailer.raise_delivery_errors = false
25
+ config.action_mailbox.ingress = :mailgun
31
26
 
27
+ config.action_mailer.raise_delivery_errors = false
32
28
  config.action_mailer.perform_caching = false
33
29
 
34
- # Print deprecation notices to the Rails logger.
35
- config.active_support.deprecation = :log
36
-
37
- # Raise an error on page load if there are pending migrations.
38
30
  config.active_record.migration_error = :page_load
39
31
 
40
- # Debug mode disables concatenation and preprocessing of assets.
41
- # This option may cause significant delays in view rendering with a large
42
- # number of complex assets.
43
- config.assets.debug = true
44
-
45
- # Suppress logger output for asset requests.
46
- config.assets.quiet = true
32
+ config.active_storage.service = :local
47
33
 
48
- config.active_storage.service = :qiniu
49
-
50
- # Raises error for missing translations
51
- # config.action_view.raise_on_missing_translations = true
52
-
53
- # Use an evented file watcher to asynchronously detect changes in source code,
54
- # routes, locales, etc. This feature depends on the listen gem.
55
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
34
+ config.active_support.deprecation = :log
56
35
  end
57
36
 
58
- ENV['EDITOR'] = 'code --wait'
37
+ Rails.application.routes.default_url_options = {
38
+ protocol: 'http',
39
+ host: 'lvh.me',
40
+ port: 3000
41
+ }
@@ -16,19 +16,7 @@ Rails.application.configure do
16
16
 
17
17
  # Disable serving static files from the `/public` folder by default since
18
18
  # Apache or NGINX already handles this.
19
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20
-
21
- # Compress JavaScripts and CSS.
22
- config.assets.js_compressor = :uglifier
23
- # config.assets.css_compressor = :sass
24
-
25
- # Do not fallback to assets pipeline if a precompiled asset is missed.
26
- config.assets.compile = false
27
-
28
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
29
-
30
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
31
- # config.action_controller.asset_host = 'http://assets.example.com'
19
+ config.public_file_server.enabled = ENV.fetch('RAILS_SERVE_STATIC_FILES') { true }
32
20
 
33
21
  # Specifies the header that your server uses for sending files.
34
22
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
@@ -42,3 +42,6 @@ Rails.application.configure do
42
42
  # Raises error for missing translations
43
43
  # config.action_view.raise_on_missing_translations = true
44
44
  end
45
+ Rails.application.routes.default_url_options = {
46
+ host: 'localhost:3000'
47
+ }
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
@@ -12,7 +12,3 @@ Rails.application.config.active_record.belongs_to_required_by_default = true
12
12
 
13
13
  # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
14
14
  Rails.application.config.ssl_options = { hsts: { subdomains: true } }
15
-
16
- if defined?(FactoryBot)
17
- #FactoryBot.definition_file_paths << RailsLog::Engine.root.join('test/factories')
18
- end
@@ -1,23 +1,2 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
1
  en:
23
- hello: "Hello world"
2
+ site_name: Rails App
@@ -0,0 +1 @@
1
+ e02c7f0fe029fdfaa1e2ecf15306cf56
@@ -1,47 +1,34 @@
1
- # Puma can serve each request in a thread from an internal thread pool.
2
- # The `threads` method setting takes two numbers a minimum and maximum.
3
- # Any libraries that use thread pools should be configured to match
4
- # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
- # and maximum, this matches the default thread size of Active Record.
6
- #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
8
- threads threads_count, threads_count
1
+ max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 1 }
2
+ min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
3
+ dir = @config.options[:app].root.to_s
9
4
 
10
- # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
11
- #
12
- port ENV.fetch("PORT") { 3000 }
5
+ #workers 1
6
+ threads min_threads_count, max_threads_count
7
+ worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
8
+ port ENV.fetch('PORT') { 3000 }
9
+ environment ENV.fetch('RAILS_ENV') { 'development' }
10
+ pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
13
11
 
14
- # Specifies the `environment` that Puma will run in.
15
- #
16
- environment ENV.fetch("RAILS_ENV") { "development" }
12
+ #state_path "#{File.expand_path('tmp/sockets/puma.state', dir)}"
13
+ #prune_bundler true
14
+ #early_hints true
15
+ #bind "unix://#{File.expand_path('tmp/sockets/puma.sock', dir)}"
16
+ state_path 'tmp/sockets/puma.state'
17
+ activate_control_app "unix://#{File.expand_path('tmp/sockets/pumactl.sock', dir)}"
17
18
 
18
- # Specifies the number of `workers` to boot in clustered mode.
19
- # Workers are forked webserver processes. If using threads and workers together
20
- # the concurrency of the application would be max `threads` * `workers`.
21
- # Workers do not work on JRuby or Windows (both of which do not support
22
- # processes).
23
- #
24
- # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
19
+ before_fork do
20
+ ActiveRecord::Base.connection_pool.disconnect!
21
+ end
22
+ on_worker_boot do
23
+ ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
24
+ end
25
25
 
26
- # Use the `preload_app!` method when specifying a `workers` number.
27
- # This directive tells Puma to first boot the application and load code
28
- # before forking the application. This takes advantage of Copy On Write
29
- # process behavior so workers use less memory. If you use this option
30
- # you need to make sure to reconnect any threads in the `on_worker_boot`
31
- # block.
32
- #
33
- # preload_app!
26
+ on_restart do
27
+ puts "\n-----> On restart"
28
+ puts "env: #{@options[:environment]}"
29
+ puts "pidfile: #{@options[:pidfile]}"
30
+ puts "binds: #{@options[:binds]}"
31
+ puts "control_url: #{@options[:control_url]}"
32
+ end
34
33
 
35
- # The code in the `on_worker_boot` will be called if you are using
36
- # clustered mode by specifying a number of `workers`. After each worker
37
- # process is booted this block will be run, if you are using `preload_app!`
38
- # option you will want to use this block to reconnect to any threads
39
- # or connections that may have been created at application boot, Ruby
40
- # cannot share connections between processes.
41
- #
42
- # on_worker_boot do
43
- # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
44
- # end
45
-
46
- # Allow puma to be restarted by `rails restart` command.
47
34
  plugin :tmp_restart
@@ -1,6 +1,14 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  root to: 'home#index'
4
- #mount RailsCom::Engine, at: '/'
4
+ namespace :board, defaults: { namespace: 'board' } do
5
+ root 'home#index'
6
+ end
7
+ namespace :panel, defaults: { namespace: 'panel' } do
8
+ root 'home#index'
9
+ end
10
+ namespace :my, defaults: { namespace: 'my' } do
11
+ root 'home#index'
12
+ end
5
13
 
6
14
  end
@@ -1,11 +1,11 @@
1
+ acme:
2
+ service: Disc
3
+ root: <%= Rails.root.join('acme') %>
4
+
1
5
  local_test:
2
6
  service: Disk
3
- root: <%= Rails.root.join('tmp/storage') %>
7
+ root: <%= Rails.root.join('tmp/storage_test') %>
4
8
 
5
- qiniu:
6
- service: Qiniu
7
- host: assets-yigenongfu.one.work
8
- access_key: <%= Rails.application.credentials.dig(:qiniu, :access_key) %>
9
- secret_key: <%= Rails.application.credentials.dig(:qiniu, :secret_key) %>
10
- bucket: yigenongfu
11
- protocol: http
9
+ local:
10
+ service: Disk
11
+ root: <%= Rails.root.join('tmp/storage') %>
@@ -0,0 +1,5 @@
1
+ const { viteConfig } = require('vite_rails')
2
+
3
+ module.exports = {
4
+ ...viteConfig
5
+ }
@@ -0,0 +1,12 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+ process.env.RAILS_ENV = process.env.NODE_ENV
3
+
4
+ const viteConfig = require('./base')
5
+
6
+ module.exports = {
7
+ define: {
8
+ 'process.env': {},
9
+ __dirname: {}
10
+ },
11
+ ...viteConfig
12
+ }
@@ -0,0 +1,6 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2
+ process.env.RAILS_ENV = process.env.NODE_ENV
3
+
4
+ const viteConfig = require('./base')
5
+
6
+ module.exports = viteConfig
data/test/dummy/config.ru CHANGED
@@ -3,3 +3,5 @@
3
3
  require_relative 'config/environment'
4
4
 
5
5
  run Rails.application
6
+
7
+ Rails.application.load_server
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+ require 'optparse'
5
+ require 'pathname'
6
+ require 'logger'
7
+
8
+ module Deploy
9
+ MOVED_DIRS = [
10
+ 'log',
11
+ 'tmp',
12
+ 'storage',
13
+ 'node_modules'
14
+ ]
15
+ SHARED_DIRS = [
16
+ 'public/packs',
17
+ 'vendor/bundle'
18
+ ].freeze
19
+ SHARED_FILES = [
20
+ 'config/database.yml',
21
+ 'config/credentials/staging.key',
22
+ 'config/credentials/production.key'
23
+ ].freeze
24
+ INIT_DIRS = [
25
+ 'tmp/sockets',
26
+ 'tmp/pids',
27
+ 'config/credentials'
28
+ ].freeze
29
+ extend self
30
+
31
+ def restart
32
+ exec_cmd('bundle exec pumactl restart')
33
+ end
34
+
35
+ def github_hmac(data)
36
+ OpenSSL::HMAC.hexdigest('sha1', RailsCom.config.github_hmac_key, data)
37
+ end
38
+
39
+ def init(root = Pathname.pwd)
40
+ dirs = []
41
+ shared = root.join('../shared')
42
+ dirs += MOVED_DIRS.map { |dir| shared.join(dir) }
43
+ dirs += SHARED_DIRS.map { |dir| shared.join(dir) }
44
+ dirs += INIT_DIRS.map { |dir| shared.join(dir) }
45
+ FileUtils.mkdir_p dirs
46
+
47
+ SHARED_FILES.map do |path|
48
+ `touch #{shared.join(path)}`
49
+ end
50
+ ln_shared_paths(root)
51
+ end
52
+
53
+ def ln_shared_paths(root = Pathname.pwd)
54
+ cmds = []
55
+ cmds << 'bundle config set --local deployment true'
56
+ cmds << 'bundle config set --local path vendor/bundle'
57
+ cmds << 'bundle config set --local without development test'
58
+ cmds += MOVED_DIRS.map do |path|
59
+ "rm -rf #{root.join(path)}"
60
+ end
61
+ cmds += (MOVED_DIRS + SHARED_DIRS).map do |path|
62
+ "ln -Tsfv #{root.join('../shared', path)} #{root.join(path)}"
63
+ end
64
+ cmds += SHARED_FILES.map do |path|
65
+ "ln -Tsfv #{root.join('../shared', path)} #{root.join(path)}"
66
+ end
67
+ cmds.each do |cmd|
68
+ exec_cmd(cmd)
69
+ end
70
+ end
71
+
72
+ def exec_cmds(env, added_cmds: [], **options)
73
+ cmds = []
74
+ cmds << 'git pull'
75
+ cmds << 'bundle install'
76
+ cmds << "RAILS_ENV=#{env} bundle exec rake db:migrate"
77
+ cmds << 'bundle exec pumactl restart'
78
+ cmds += Array(added_cmds)
79
+ cmds.each do |cmd|
80
+ exec_cmd(cmd)
81
+ end
82
+ end
83
+
84
+ def exec_cmd(cmd)
85
+ Open3.popen2e(cmd) do |_, output, thread|
86
+ logger.debug "=====> #{cmd} (PID: #{thread.pid})"
87
+ output.each_line do |line|
88
+ logger.debug line
89
+ end
90
+ end
91
+ end
92
+
93
+ def logger
94
+ if defined? Rails
95
+ Rails.logger
96
+ else
97
+ Logger.new $stdout
98
+ end
99
+ end
100
+
101
+ end
102
+
103
+ options = { env: 'production' }
104
+ OptionParser.new do |opts|
105
+ opts.on('-e ENV') do |v|
106
+ options[:env] = v
107
+ end
108
+ opts.on('-C') do |v|
109
+ puts "--------->#{v}"
110
+ end
111
+ end.parse!
112
+
113
+ if $0 == __FILE__
114
+ Deploy.exec_cmds(options[:env], added_cmds: 'systemctl --user restart sidekiq_dummy')
115
+ end
@@ -1,7 +1,27 @@
1
1
  {
2
+ "name": "dummy",
3
+ "private": true,
2
4
  "dependencies": {
3
- "jquery": "^3.3.1",
4
- "turbolinks": "^5.2.0",
5
- "yougexiangfa_ui": "https://github.com/yougexiangfa/yougexiangfa.github.io.git"
5
+ "@fortawesome/fontawesome-free": "^5.14.0",
6
+ "@rails/actioncable": "^6.1.4",
7
+ "@rails/activestorage": "^6.1.4",
8
+ "bulma": "^0.9.2",
9
+ "choices.js": "^9.0.1",
10
+ "core-js": "^3.6.5",
11
+ "cssnano": "^4.1.10",
12
+ "moment": "^2.27.0",
13
+ "sortablejs": "^1.10.2",
14
+ "stickybits": "^3.7.7",
15
+ "vite_rails": "^0.0.2",
16
+ "vue": "^3.1.5",
17
+ "weui": "^2.4.4",
18
+ "weui.js": "^1.2.2"
19
+ },
20
+ "devDependencies": {
21
+ "@vitejs/plugin-vue": "^1.4.0",
22
+ "@vue/compiler-sfc": "^3.1.5",
23
+ "postcss-import": "^14.0.2",
24
+ "postcss-preset-env": "^6.7.0",
25
+ "sass": "^1.30.0"
6
26
  }
7
27
  }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('postcss-preset-env')({
5
+ autoprefixer: {
6
+ flexbox: 'no-2009'
7
+ },
8
+ stage: 3
9
+ })
10
+ ]
11
+ }