discourse_theme 0.6.0 → 0.7.2
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/.github/workflows/ci.yml +7 -9
- data/README.md +5 -1
- data/lib/discourse_theme/cli.rb +30 -4
- data/lib/discourse_theme/client.rb +5 -3
- data/lib/discourse_theme/scaffold.rb +5 -1
- data/lib/discourse_theme/uploader.rb +0 -3
- data/lib/discourse_theme/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffe67e68e2ee480c68cb8ce8031c9a09bfdd16025a01ba873eebca2228c821fe
|
4
|
+
data.tar.gz: 5094e13dc147c656a15b9b0d9ad790daf54c8f8ff2501f81f540cd0cfb2d95d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4afb46c9e254275d537990d9e91240aa4269def484c0c5be5db1963092643b5e2b24bef42bd5cd1ace7dd3d402b84fb36e6e98e2addc37d3eda281fbb32d9d54
|
7
|
+
data.tar.gz: 5894640522c7c3491a2fb7d7bab2dc55e334f70e445bd06198ae5628d748a87d99c1033f5df0b369ac29ad694f490752ded9ccc3208853c4fd107db40f1bc790
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,7 +4,6 @@ on:
|
|
4
4
|
pull_request:
|
5
5
|
push:
|
6
6
|
branches:
|
7
|
-
- master
|
8
7
|
- main
|
9
8
|
|
10
9
|
jobs:
|
@@ -14,13 +13,12 @@ jobs:
|
|
14
13
|
strategy:
|
15
14
|
matrix:
|
16
15
|
ruby:
|
17
|
-
- 2.
|
18
|
-
-
|
19
|
-
-
|
20
|
-
- 3.0
|
16
|
+
- "2.7"
|
17
|
+
- "3.0"
|
18
|
+
- "3.1"
|
21
19
|
|
22
20
|
steps:
|
23
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v3
|
24
22
|
|
25
23
|
- name: Setup ruby
|
26
24
|
uses: ruby/setup-ruby@v1
|
@@ -35,15 +33,15 @@ jobs:
|
|
35
33
|
run: bundle exec rake test
|
36
34
|
|
37
35
|
publish:
|
38
|
-
if: github.event_name == 'push' &&
|
36
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
39
37
|
needs: build
|
40
38
|
runs-on: ubuntu-latest
|
41
39
|
|
42
40
|
steps:
|
43
|
-
- uses: actions/checkout@
|
41
|
+
- uses: actions/checkout@v3
|
44
42
|
|
45
43
|
- name: Release Gem
|
46
|
-
uses: discourse/publish-rubygems-action@v2
|
44
|
+
uses: discourse/publish-rubygems-action@v2
|
47
45
|
env:
|
48
46
|
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
49
47
|
GIT_EMAIL: team@discourse.org
|
data/README.md
CHANGED
@@ -32,6 +32,10 @@ Downloads a theme from the server and stores in the designated directory.
|
|
32
32
|
|
33
33
|
Monitors a theme or component for changes. When changed the program will synchronize the theme or component to your Discourse of choice.
|
34
34
|
|
35
|
+
### `discourse_theme upload PATH`
|
36
|
+
|
37
|
+
Uploads a theme to the server. Requires the theme to have been previously synchronized via `watch`.
|
38
|
+
|
35
39
|
## Contributing
|
36
40
|
|
37
41
|
Bug reports and pull requests are welcome at [Meta Discourse](https://meta.discourse.org). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -42,4 +46,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
42
46
|
|
43
47
|
## Code of Conduct
|
44
48
|
|
45
|
-
Everyone interacting in the DiscourseTheme project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
49
|
+
Everyone interacting in the DiscourseTheme project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/discourse/discourse_theme/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/discourse_theme/cli.rb
CHANGED
@@ -8,6 +8,7 @@ module DiscourseTheme
|
|
8
8
|
puts
|
9
9
|
puts "discourse_theme new DIR - Creates a new theme in the designated directory"
|
10
10
|
puts "discourse_theme download DIR - Downloads a theme from the server and stores in the designated directory"
|
11
|
+
puts "discourse_theme upload DIR - Uploads the theme directory to Discourse"
|
11
12
|
puts "discourse_theme watch DIR - Watches the theme directory and synchronizes with Discourse"
|
12
13
|
puts
|
13
14
|
puts "Use --reset to change the configuration for a directory"
|
@@ -79,14 +80,17 @@ module DiscourseTheme
|
|
79
80
|
settings.theme_id = theme_id = uploader.upload_full_theme
|
80
81
|
|
81
82
|
UI.success "Theme uploaded (id:#{theme_id})"
|
82
|
-
UI.info "Preview: #{client.
|
83
|
+
UI.info "Preview: #{client.url}/?preview_theme_id=#{theme_id}"
|
84
|
+
|
83
85
|
if client.is_theme_creator
|
84
|
-
UI.info "Manage: #{client.
|
86
|
+
UI.info "Manage: #{client.url}/my/themes"
|
85
87
|
else
|
86
|
-
UI.info "Manage: #{client.
|
88
|
+
UI.info "Manage: #{client.url}/admin/customize/themes/#{theme_id}"
|
87
89
|
end
|
88
|
-
watcher = DiscourseTheme::Watcher.new(dir: dir, uploader: uploader)
|
89
90
|
|
91
|
+
UI.info "Tests: #{client.url}/theme-qunit?id=#{theme_id}"
|
92
|
+
|
93
|
+
watcher = DiscourseTheme::Watcher.new(dir: dir, uploader: uploader)
|
90
94
|
UI.progress "Watching for changes in #{dir}..."
|
91
95
|
watcher.watch
|
92
96
|
elsif command == "download"
|
@@ -110,6 +114,28 @@ module DiscourseTheme
|
|
110
114
|
UI.success "Theme downloaded"
|
111
115
|
|
112
116
|
watch_theme?(args)
|
117
|
+
elsif command == "upload"
|
118
|
+
raise DiscourseTheme::ThemeError.new "'#{dir} does not exist" unless Dir.exists?(dir)
|
119
|
+
raise DiscourseTheme::ThemeError.new "No theme_id is set, please sync via the 'watch' command initially" if theme_id == 0
|
120
|
+
client = DiscourseTheme::Client.new(dir, settings, reset: reset)
|
121
|
+
|
122
|
+
theme_list = client.get_themes_list
|
123
|
+
|
124
|
+
theme = theme_list.find { |t| t["id"] == theme_id }
|
125
|
+
raise DiscourseTheme::ThemeError.new "theme_id is set, but the theme does not exist in Discourse" unless theme
|
126
|
+
|
127
|
+
uploader = DiscourseTheme::Uploader.new(dir: dir, client: client, theme_id: theme_id, components: components)
|
128
|
+
|
129
|
+
UI.progress "Uploading theme (id:#{theme_id}) from #{dir} "
|
130
|
+
settings.theme_id = theme_id = uploader.upload_full_theme
|
131
|
+
|
132
|
+
UI.success "Theme uploaded (id:#{theme_id})"
|
133
|
+
UI.info "Preview: #{client.root}/?preview_theme_id=#{theme_id}"
|
134
|
+
if client.is_theme_creator
|
135
|
+
UI.info "Manage: #{client.root}/my/themes"
|
136
|
+
else
|
137
|
+
UI.info "Manage: #{client.root}/admin/customize/themes/#{theme_id}"
|
138
|
+
end
|
113
139
|
else
|
114
140
|
usage
|
115
141
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module DiscourseTheme
|
3
3
|
class Client
|
4
|
-
THEME_CREATOR_REGEX = /^https:\/\/theme-creator
|
4
|
+
THEME_CREATOR_REGEX = /^https:\/\/(theme-creator\.discourse\.org|discourse\.theme-creator\.io)$/i
|
5
|
+
|
6
|
+
attr_reader :url
|
5
7
|
|
6
8
|
def initialize(dir, settings, reset:)
|
7
9
|
@reset = reset
|
@@ -19,7 +21,7 @@ module DiscourseTheme
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
# From https://github.com/discourse/discourse/blob/
|
24
|
+
# From https://github.com/discourse/discourse/blob/main/lib/version.rb
|
23
25
|
def self.has_needed_version?(current, needed)
|
24
26
|
current_split = current.split('.')
|
25
27
|
needed_split = needed.split('.')
|
@@ -105,7 +107,7 @@ module DiscourseTheme
|
|
105
107
|
end
|
106
108
|
|
107
109
|
def root
|
108
|
-
URI.parse(@url)
|
110
|
+
URI.parse(@url)
|
109
111
|
end
|
110
112
|
|
111
113
|
def is_theme_creator
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitar
|