mailer-log 0.1.20 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2489638ab5e297c02635755811795cde996d467515668b69f7b815d78add11c6
4
- data.tar.gz: 39d8f135491aa8a9dfc22e6de1ff35e985717d8ba53a5773a09380288725f652
3
+ metadata.gz: 26775ff2d2392f342c9abeaefb88bdfb17eb4cf7474f7b7de2e8455196ccabce
4
+ data.tar.gz: 83ea69d74409c16c64df60899ba17e570f141e608326d54751e5e3603f4c0311
5
5
  SHA512:
6
- metadata.gz: eb39ea25f33078b0f64a86a55507e88ec65ce28ab702146637c370a7714a06078e6b74b81ecad33941760ea2681714edef71ba15cbc3d258ae775834a7628410
7
- data.tar.gz: 36b23844e1e6d8a004cd5228fd3ef1bed1b583e23a7972c31dcaeb320e0376db33e201331231a1bef02a271d2a2e2653e86ae095ca4e2e946de45ed4e3ef5d98
6
+ metadata.gz: 1cc55ff6f8f4f6a399534f201cc528a9ac09a6921e47078cedff710e960b71a0e76e25e0579d4cc1d5167af51b59fb28af070a89cee14652960030443904df7d
7
+ data.tar.gz: a3a234f111a2dcd6d613f44613c15d0222cfad244c87a7664750c694f48766c2eafd544327ea35c360af9fd96f537683b92577284fd8d23c1ecfdbe4075a7215
@@ -11,11 +11,16 @@
11
11
  <% end %>
12
12
  </head>
13
13
  <body class="bg-gray-100 min-h-screen">
14
+ <% header_partial = MailerLog.configuration.header_partial %>
14
15
  <script>
15
16
  window.MAILER_LOG_CONFIG = {
16
- mountPath: '<%= request.script_name %>'
17
+ mountPath: '<%= request.script_name %>',
18
+ hideNavbar: <%= header_partial.present? %>
17
19
  };
18
20
  </script>
21
+ <% if header_partial %>
22
+ <%= render partial: header_partial %>
23
+ <% end %>
19
24
  <div id="app"></div>
20
25
  <% if (js = mailer_log_js_entry) %>
21
26
  <script type="module" src="<%= request.script_name %>/<%= js %>"></script>
@@ -6,7 +6,8 @@ module MailerLog
6
6
  :webhook_signing_key,
7
7
  :capture_call_stack,
8
8
  :call_stack_depth,
9
- :per_page
9
+ :per_page,
10
+ :header_partial
10
11
 
11
12
  attr_reader :authenticate_with_proc, :resolve_accountable_proc
12
13
 
@@ -16,6 +17,7 @@ module MailerLog
16
17
  @capture_call_stack = true
17
18
  @call_stack_depth = 20
18
19
  @per_page = 25
20
+ @header_partial = nil # e.g., 'shared/admin_navbar'
19
21
  @authenticate_with_proc = nil
20
22
  @resolve_accountable_proc = nil
21
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailerLog
4
- VERSION = '0.1.20'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -1,75 +1,43 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :mailer_log do
4
- desc 'Build MailerLog Vue.js frontend (set MAILER_LOG_OVERRIDES_PATH to customize components)'
5
- task :build_frontend do
6
- frontend_dir = MailerLog::Engine.root.join('frontend')
7
-
8
- unless frontend_dir.exist?
9
- puts <<~MSG
10
- ERROR: Frontend source not available.
11
-
12
- This task is for gem development only. When using mailer-log from RubyGems,
13
- the frontend is pre-built and included in public/mailer_log/.
4
+ desc 'Copy MailerLog assets to public/'
5
+ task install_assets: :environment do
6
+ source = MailerLog::Engine.root.join('public', 'mailer_log')
7
+ destination = Rails.root.join('public', 'mailer_log')
14
8
 
15
- To customize the frontend with overrides:
16
- 1. Clone the gem repository: git clone https://github.com/trafficrunners/mailer-log.git
17
- 2. cd mailer-log/frontend
18
- 3. MAILER_LOG_OVERRIDES_PATH=/path/to/your/overrides npm run build
19
- 4. Copy public/mailer_log/ to your app
20
- MSG
9
+ unless source.exist?
10
+ puts "ERROR: MailerLog assets not found at #{source}"
21
11
  exit 1
22
12
  end
23
13
 
24
- overrides_path = ENV['MAILER_LOG_OVERRIDES_PATH']
25
-
26
- puts 'Installing npm dependencies...'
27
- system('npm install', chdir: frontend_dir.to_s) || raise('npm install failed')
28
-
29
- if overrides_path
30
- puts "Building frontend with overrides from: #{overrides_path}"
31
- else
32
- puts 'Building frontend (no overrides)...'
33
- puts 'Tip: Set MAILER_LOG_OVERRIDES_PATH to customize navbar and other components'
34
- end
35
-
36
- env = overrides_path ? { 'MAILER_LOG_OVERRIDES_PATH' => overrides_path } : {}
37
- system(env, 'npm run build', chdir: frontend_dir.to_s) || raise('npm build failed')
38
-
39
- puts 'Frontend built successfully!'
14
+ FileUtils.rm_rf(destination) if destination.exist?
15
+ FileUtils.cp_r(source, destination)
16
+ puts "MailerLog assets copied to #{destination}"
40
17
  end
41
18
 
42
- desc 'Start Vite development server for MailerLog frontend'
43
- task :dev_server do
19
+ desc 'Build MailerLog Vue.js frontend (for gem development only)'
20
+ task :build_frontend do
44
21
  frontend_dir = MailerLog::Engine.root.join('frontend')
45
22
 
46
23
  unless frontend_dir.exist?
47
- puts <<~MSG
48
- ERROR: Frontend source not available.
49
-
50
- This task is for gem development only. When using mailer-log from RubyGems,
51
- the frontend is pre-built and served automatically.
52
-
53
- To develop the frontend with hot-reload:
54
- 1. Clone the gem repository: git clone https://github.com/trafficrunners/mailer-log.git
55
- 2. cd mailer-log/frontend
56
- 3. npm install
57
- 4. MAILER_LOG_OVERRIDES_PATH=/path/to/your/overrides npm run dev
58
- MSG
24
+ puts 'ERROR: Frontend source not available (only in gem source, not RubyGems)'
59
25
  exit 1
60
26
  end
61
27
 
62
- overrides_path = ENV['MAILER_LOG_OVERRIDES_PATH']
28
+ puts 'Installing npm dependencies...'
29
+ system('npm install', chdir: frontend_dir.to_s) || raise('npm install failed')
63
30
 
64
- puts 'Starting Vite dev server...'
65
- puts 'Frontend will be available at http://localhost:5173'
66
- puts 'Make sure Rails is running on http://localhost:3000'
31
+ puts 'Building frontend...'
32
+ system('npm run build', chdir: frontend_dir.to_s) || raise('npm build failed')
67
33
 
68
- if overrides_path
69
- puts "Using overrides from: #{overrides_path}"
70
- end
34
+ puts 'Frontend built successfully!'
35
+ end
36
+ end
71
37
 
72
- env = overrides_path ? { 'MAILER_LOG_OVERRIDES_PATH' => overrides_path } : {}
73
- exec(env, 'npm run dev', chdir: frontend_dir.to_s)
38
+ # Hook into assets:precompile to copy MailerLog assets
39
+ if Rake::Task.task_defined?('assets:precompile')
40
+ Rake::Task['assets:precompile'].enhance do
41
+ Rake::Task['mailer_log:install_assets'].invoke
74
42
  end
75
43
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "index.html": {
3
- "file": "assets/mailer_log-CzkGXWPn.js",
3
+ "file": "assets/mailer_log-zD1d7Bvi.js",
4
4
  "name": "index",
5
5
  "src": "index.html",
6
6
  "isEntry": true,