discourse_theme 2.1.4 → 2.1.6
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/discourse_theme.gemspec +2 -2
- data/lib/discourse_theme/cli.rb +5 -17
- data/lib/discourse_theme/scaffold.rb +12 -11
- data/lib/discourse_theme/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c1dcbe5e7c774cbbb6bf4268c42de7affe7dffd0a6b791ec8b076e6a5d5bc3
|
4
|
+
data.tar.gz: 4f7f97ac1fafcecdde6cc1826151df762862ae2cc0e02c24529b17906ac90c72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f48ed9a435b7d90c34d72859030fc6390af868a2360a540f392edf8dcbd57e6fa4ca85ced5f7b4596d96365dcd32d6e0f3586ba1acec0b7a459318ce22f2c5
|
7
|
+
data.tar.gz: 232478db3552a85345947b5156f10065b9e256316e16f5ffa116ee55ee7ad2efd5e06ac15b7f2eacd572702d58dc37fdc6780166461100c66b6dcaa7fc7d3946
|
data/discourse_theme.gemspec
CHANGED
@@ -7,8 +7,8 @@ require "discourse_theme/version"
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "discourse_theme"
|
9
9
|
spec.version = DiscourseTheme::VERSION
|
10
|
-
spec.authors = ["
|
11
|
-
spec.email = ["
|
10
|
+
spec.authors = ["Discourse Team"]
|
11
|
+
spec.email = ["team@discourse.org"]
|
12
12
|
|
13
13
|
spec.summary = "CLI helper for creating Discourse themes"
|
14
14
|
spec.description = "CLI helper for creating Discourse themes"
|
data/lib/discourse_theme/cli.rb
CHANGED
@@ -13,6 +13,10 @@ module DiscourseTheme
|
|
13
13
|
@@cli_settings_filename = filename
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.command?(cmd)
|
17
|
+
system "which", cmd, out: File::NULL, err: File::NULL
|
18
|
+
end
|
19
|
+
|
16
20
|
def usage
|
17
21
|
puts <<~USAGE
|
18
22
|
Usage: discourse_theme COMMAND [DIR] [OPTIONS]
|
@@ -59,9 +63,7 @@ module DiscourseTheme
|
|
59
63
|
if Dir.exist?(dir) && !Dir.empty?(dir)
|
60
64
|
raise DiscourseTheme::ThemeError.new "'#{dir}' is not empty"
|
61
65
|
end
|
62
|
-
raise DiscourseTheme::ThemeError.new "git is not installed" if !command?("git")
|
63
|
-
raise DiscourseTheme::ThemeError.new "yarn is not installed" if !command?("yarn")
|
64
|
-
raise DiscourseTheme::ThemeError.new "pnpm is not installed" if !command?("pnpm")
|
66
|
+
raise DiscourseTheme::ThemeError.new "git is not installed" if !Cli.command?("git")
|
65
67
|
|
66
68
|
DiscourseTheme::Scaffold.generate(dir, name: args[1])
|
67
69
|
watch_theme?(args)
|
@@ -249,20 +251,6 @@ module DiscourseTheme
|
|
249
251
|
end
|
250
252
|
end
|
251
253
|
|
252
|
-
def command?(cmd)
|
253
|
-
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
|
254
|
-
ENV["PATH"]
|
255
|
-
.split(File::PATH_SEPARATOR)
|
256
|
-
.each do |path|
|
257
|
-
exts.each do |ext|
|
258
|
-
exe = File.join(path, "#{cmd}#{ext}")
|
259
|
-
return true if File.executable?(exe) && !File.directory?(exe)
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
false
|
264
|
-
end
|
265
|
-
|
266
254
|
def watch_theme?(args)
|
267
255
|
if UI.yes?("Would you like to start 'watching' this theme?")
|
268
256
|
args[0] = "watch"
|
@@ -39,10 +39,14 @@ module DiscourseTheme
|
|
39
39
|
File.write("README.md", readme)
|
40
40
|
|
41
41
|
encoded_name = name.downcase.gsub(/[^a-zA-Z0-9_-]+/, "-")
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
|
43
|
+
todo_initializer = "javascripts/discourse/api-initializers/todo.js"
|
44
|
+
if File.exist?(todo_initializer)
|
45
|
+
FileUtils.mv(
|
46
|
+
"javascripts/discourse/api-initializers/todo.js",
|
47
|
+
"javascripts/discourse/api-initializers/#{encoded_name}.gjs",
|
48
|
+
)
|
49
|
+
end
|
46
50
|
|
47
51
|
i18n = YAML.safe_load(File.read("locales/en.yml"))
|
48
52
|
i18n["en"]["theme_metadata"]["description"] = description
|
@@ -64,19 +68,16 @@ module DiscourseTheme
|
|
64
68
|
"--quiet",
|
65
69
|
exception: true
|
66
70
|
|
67
|
-
|
68
|
-
|
69
|
-
system "yarn", exception: true
|
70
|
-
elsif File.exist?("pnpm-lock.yaml")
|
71
|
+
if Cli.command?("pnpm")
|
72
|
+
UI.info "Installing dependencies"
|
71
73
|
system "pnpm", "install", exception: true
|
72
74
|
else
|
73
|
-
UI.warn "
|
74
|
-
system "pnpm", "install", exception: true
|
75
|
+
UI.warn "`pnpm` is not installed, skipping installation of linting dependencies"
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
79
|
puts "✅ Done!"
|
79
|
-
puts "See https://meta.discourse.org/t/
|
80
|
+
puts "See https://meta.discourse.org/t/93648 for more information!"
|
80
81
|
end
|
81
82
|
|
82
83
|
private
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Discourse Team
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: minitar
|
@@ -235,7 +235,7 @@ dependencies:
|
|
235
235
|
version: '0'
|
236
236
|
description: CLI helper for creating Discourse themes
|
237
237
|
email:
|
238
|
-
-
|
238
|
+
- team@discourse.org
|
239
239
|
executables:
|
240
240
|
- discourse_theme
|
241
241
|
extensions: []
|