panda-core 0.8.4 β 0.9.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.
- checksums.yaml +4 -4
- data/lib/panda/core/version.rb +1 -1
- data/lib/tasks/assets.rake +124 -64
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52d28416fc7360a3f5cc27ec2ad1f332a61426a8279853461dfe7398f180213a
|
|
4
|
+
data.tar.gz: f68cd0fbaf803d80a3549f67485328c80850e3d035d42f7c89eb1b15a80f6b64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d71325c49673982b5ae74107eb7e05cb0bd04b12bc64262284392df691b142953fb6f5a25385c4795d605ec243e972ac30cd8688fb4e7f95ebc43e360b7ba5e1
|
|
7
|
+
data.tar.gz: b0391beb484a72298375547b4d526e73ce47ea18a1d73864e6e2ef226e25fef961d83c268a5cdab12b5dbc1c08c984696f344bfe0e974d0e9c1a37badafdb035
|
data/lib/panda/core/version.rb
CHANGED
data/lib/tasks/assets.rake
CHANGED
|
@@ -1,98 +1,158 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
#
|
|
4
|
+
# Panda Core Asset Tasks
|
|
5
|
+
#
|
|
6
|
+
|
|
3
7
|
namespace :panda do
|
|
4
8
|
namespace :core do
|
|
5
9
|
namespace :assets do
|
|
6
|
-
|
|
10
|
+
# =========================================================
|
|
11
|
+
# 1) ENGINE CSS COMPILATION (unchanged, just cleaned)
|
|
12
|
+
# =========================================================
|
|
13
|
+
|
|
14
|
+
desc "Compile Panda Core CSS assets (development mode)"
|
|
7
15
|
task :compile do
|
|
8
|
-
puts "πΌ Compiling Panda Core assets..."
|
|
16
|
+
puts "πΌ Compiling Panda Core CSS assets..."
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
output_dir = Panda::Core::Engine.root.join("public", "panda-core-assets")
|
|
18
|
+
output_dir = panda_engine_root.join("public", "panda-core-assets")
|
|
12
19
|
FileUtils.mkdir_p(output_dir)
|
|
13
20
|
|
|
14
|
-
# Compile CSS using Tailwind CSS v4
|
|
15
21
|
compile_css_development(output_dir)
|
|
16
22
|
|
|
17
|
-
puts "π
|
|
18
|
-
puts "π Output directory: #{output_dir}"
|
|
19
|
-
puts ""
|
|
20
|
-
puts "π‘ CSS is served via Rack middleware from Core gem at /panda-core-assets/panda-core.css"
|
|
21
|
-
puts " No need to copy to CMS or other apps - they load it from Core automatically!"
|
|
23
|
+
puts "π CSS compiled β #{output_dir}"
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
desc "Compile and version Panda Core assets for release"
|
|
26
|
+
desc "Compile and version Panda Core CSS assets for release"
|
|
25
27
|
task :release do
|
|
26
|
-
|
|
28
|
+
require_relative "../../panda/core/version"
|
|
27
29
|
|
|
28
|
-
# Get version
|
|
29
|
-
require_relative "../panda/core/version"
|
|
30
30
|
version = Panda::Core::VERSION
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Create output directory
|
|
34
|
-
output_dir = Panda::Core::Engine.root.join("public", "panda-core-assets")
|
|
31
|
+
output_dir = panda_engine_root.join("public", "panda-core-assets")
|
|
35
32
|
FileUtils.mkdir_p(output_dir)
|
|
36
33
|
|
|
37
|
-
# Compile CSS with versioning
|
|
38
34
|
compile_css_release(output_dir, version)
|
|
39
35
|
|
|
40
|
-
puts "π Release
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
puts "π Release assets compiled"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# =========================================================
|
|
40
|
+
# CSS INTERNAL HELPERS
|
|
41
|
+
# =========================================================
|
|
42
|
+
|
|
43
|
+
def panda_engine_root
|
|
44
|
+
Panda::Core::Engine.root
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
def compile_css_development(output_dir)
|
|
47
|
-
|
|
48
|
+
input = panda_engine_root.join("app/assets/tailwind/application.css")
|
|
49
|
+
output = output_dir.join("panda-core.css")
|
|
50
|
+
|
|
51
|
+
content = Panda::Core::ModuleRegistry.tailwind_content_paths
|
|
52
|
+
flags = content.map { |p| "--content '#{p}'" }.join(" ")
|
|
53
|
+
|
|
54
|
+
cmd = "bundle exec tailwindcss -i #{input} -o #{output} #{flags} --minify"
|
|
55
|
+
abort("β CSS compile failed") unless system(cmd)
|
|
56
|
+
|
|
57
|
+
puts " β #{output.basename} (#{File.size(output)} bytes)"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def compile_css_release(output_dir, version)
|
|
61
|
+
input = panda_engine_root.join("app/assets/tailwind/application.css")
|
|
62
|
+
file = output_dir.join("panda-core-#{version}.css")
|
|
63
|
+
|
|
64
|
+
content = Panda::Core::ModuleRegistry.tailwind_content_paths
|
|
65
|
+
flags = content.map { |p| "--content '#{p}'" }.join(" ")
|
|
66
|
+
|
|
67
|
+
cmd = "bundle exec tailwindcss -i #{input} -o #{file} #{flags} --minify"
|
|
68
|
+
abort("β CSS release compile failed") unless system(cmd)
|
|
69
|
+
|
|
70
|
+
symlink = output_dir.join("panda-core.css")
|
|
71
|
+
FileUtils.rm_f(symlink)
|
|
72
|
+
FileUtils.ln_sf(file.basename, symlink)
|
|
73
|
+
|
|
74
|
+
puts " β Versioned file + symlink created"
|
|
75
|
+
end
|
|
48
76
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
# =========================================================
|
|
78
|
+
# 2) DUMMY APP PREP (FOR SYSTEM TESTS + CI)
|
|
79
|
+
# =========================================================
|
|
52
80
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
desc "Compile Panda Core + dummy app assets into spec/dummy/public/assets"
|
|
82
|
+
task compile_dummy: :environment do
|
|
83
|
+
dummy_root = find_dummy_root
|
|
84
|
+
assets_root = dummy_root.join("public/assets")
|
|
56
85
|
|
|
57
|
-
|
|
58
|
-
|
|
86
|
+
puts "π§ Compiling dummy assets..."
|
|
87
|
+
puts " β #{assets_root}"
|
|
88
|
+
FileUtils.mkdir_p(assets_root)
|
|
59
89
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
Dir.chdir(dummy_root) do
|
|
91
|
+
# IMPORTANT: this is now the correct task name
|
|
92
|
+
unless system("bundle exec rake panda:core:assets:compile")
|
|
93
|
+
abort("β panda:core:assets:compile failed in dummy app")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Propshaft (Rails 8)
|
|
97
|
+
abort("β assets:precompile failed") \
|
|
98
|
+
unless system("bundle exec rake assets:precompile RAILS_ENV=#{Rails.env}")
|
|
66
99
|
end
|
|
100
|
+
|
|
101
|
+
puts "β
Dummy assets compiled"
|
|
67
102
|
end
|
|
68
103
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
desc "Generate importmap.json for the dummy app"
|
|
105
|
+
task generate_dummy_importmap: :environment do
|
|
106
|
+
dummy_root = find_dummy_root
|
|
107
|
+
output = dummy_root.join("public/assets/importmap.json")
|
|
108
|
+
|
|
109
|
+
puts "πΊοΈ Generating importmap.json..."
|
|
110
|
+
FileUtils.mkdir_p(output.dirname)
|
|
111
|
+
|
|
112
|
+
Dir.chdir(dummy_root) do
|
|
113
|
+
json = Rails.application.importmap.to_json(
|
|
114
|
+
resolver: ActionController::Base.helpers
|
|
115
|
+
)
|
|
116
|
+
File.write(output, JSON.pretty_generate(json))
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
puts " β importmap.json written"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
desc "Verify dummy assets for CI (fail-fast)"
|
|
123
|
+
task verify_dummy: :environment do
|
|
124
|
+
dummy_root = find_dummy_root
|
|
125
|
+
assets = dummy_root.join("public/assets")
|
|
126
|
+
manifest = assets.join(".manifest.json")
|
|
127
|
+
importmap = assets.join("importmap.json")
|
|
128
|
+
|
|
129
|
+
abort("β Missing #{assets}") unless assets.exist?
|
|
130
|
+
abort("β Missing #{manifest}") unless manifest.exist?
|
|
131
|
+
abort("β Missing #{importmap}") unless importmap.exist?
|
|
132
|
+
|
|
133
|
+
begin
|
|
134
|
+
parsed = JSON.parse(File.read(manifest))
|
|
135
|
+
abort("β Empty .manifest.json") if parsed.empty?
|
|
136
|
+
rescue
|
|
137
|
+
abort("β Invalid .manifest.json")
|
|
95
138
|
end
|
|
139
|
+
|
|
140
|
+
puts "β
Dummy assets verified"
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# =========================================================
|
|
144
|
+
# INTERNAL UTILITIES
|
|
145
|
+
# =========================================================
|
|
146
|
+
|
|
147
|
+
def find_dummy_root
|
|
148
|
+
root = Rails.root
|
|
149
|
+
|
|
150
|
+
return root if root.basename.to_s == "dummy"
|
|
151
|
+
|
|
152
|
+
candidate = root.join("spec/dummy")
|
|
153
|
+
return candidate if candidate.exist?
|
|
154
|
+
|
|
155
|
+
abort("β Cannot find dummy root β expected #{candidate}")
|
|
96
156
|
end
|
|
97
157
|
end
|
|
98
158
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: panda-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Otaina Limited
|
|
8
8
|
- James Inman
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: image_processing
|
|
@@ -527,7 +526,6 @@ metadata:
|
|
|
527
526
|
homepage_uri: https://github.com/tastybamboo/panda-core
|
|
528
527
|
source_code_uri: https://github.com/tastybamboo/panda-core
|
|
529
528
|
changelog_uri: https://github.com/tastybamboo/panda-core/blob/main/CHANGELOG.md
|
|
530
|
-
post_install_message:
|
|
531
529
|
rdoc_options: []
|
|
532
530
|
require_paths:
|
|
533
531
|
- lib
|
|
@@ -542,8 +540,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
542
540
|
- !ruby/object:Gem::Version
|
|
543
541
|
version: '0'
|
|
544
542
|
requirements: []
|
|
545
|
-
rubygems_version: 3.
|
|
546
|
-
signing_key:
|
|
543
|
+
rubygems_version: 3.6.9
|
|
547
544
|
specification_version: 4
|
|
548
545
|
summary: Core libraries and development tools for Tasty Bamboo projects
|
|
549
546
|
test_files: []
|