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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7b8d105b14bd38cbfec08a6a7f0e77245dbfdcd4d311c9589aed4e039ba4e91
4
- data.tar.gz: d444c4ccf8343f5a7aeb3c6a5b6ab981108d12d71cdabc1a9604a30414c6be3f
3
+ metadata.gz: 68c1dcbe5e7c774cbbb6bf4268c42de7affe7dffd0a6b791ec8b076e6a5d5bc3
4
+ data.tar.gz: 4f7f97ac1fafcecdde6cc1826151df762862ae2cc0e02c24529b17906ac90c72
5
5
  SHA512:
6
- metadata.gz: 853e252824cb6274a18cf813bdd344065a8154704c6a25b9261c9fcb3f74e0394a64a6a2de8511d995dd8b5d2d7269b58af521aa4bf46544a4facf336ef84748
7
- data.tar.gz: 46857c696793e4c6be343f383e773698745d68ef34971147630e6f070c6c2c406fbd0cc57c44612abf7fb41d83d595be6912b6276a375f22ad3f6eda73ddaf00
6
+ metadata.gz: f9f48ed9a435b7d90c34d72859030fc6390af868a2360a540f392edf8dcbd57e6fa4ca85ced5f7b4596d96365dcd32d6e0f3586ba1acec0b7a459318ce22f2c5
7
+ data.tar.gz: 232478db3552a85345947b5156f10065b9e256316e16f5ffa116ee55ee7ad2efd5e06ac15b7f2eacd572702d58dc37fdc6780166461100c66b6dcaa7fc7d3946
@@ -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 = ["Sam Saffron"]
11
- spec.email = ["sam.saffron@gmail.com"]
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"
@@ -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
- FileUtils.mv(
43
- "javascripts/discourse/api-initializers/todo.js",
44
- "javascripts/discourse/api-initializers/#{encoded_name}.js",
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
- UI.info "Installing dependencies"
68
- if File.exist?("yarn.lock")
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 "No lock file found. Defaulting to pnpm."
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/how-to-develop-custom-themes/60848 for more information!"
80
+ puts "See https://meta.discourse.org/t/93648 for more information!"
80
81
  end
81
82
 
82
83
  private
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module DiscourseTheme
3
- VERSION = "2.1.4"
3
+ VERSION = "2.1.6"
4
4
  end
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
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
- - Sam Saffron
7
+ - Discourse Team
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-09 00:00:00.000000000 Z
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
- - sam.saffron@gmail.com
238
+ - team@discourse.org
239
239
  executables:
240
240
  - discourse_theme
241
241
  extensions: []