discourse_theme 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0626e7865ec3b7d06ae9e198351dfd51f111897393bf393aa7da26b52c19777
4
- data.tar.gz: 77856b459abd70854c9350960d98eb0887420222732390a22f4f52b69fbcd691
3
+ metadata.gz: 97aee15a1f43095bc2c3ceb628dc56490f089b0e0aec4d30e724e2467d0ac7fa
4
+ data.tar.gz: 045d1945d862aa40a3f365552f9b4fccfa1e8164a263946414c6b12fb25af487
5
5
  SHA512:
6
- metadata.gz: adf9a56c7ffb98ea9b14df04220096105c0b2e63074e4dc789984a1c9c01e6162b7118651cb9e1b95ed8a8c64740d97358d5c3fa7fb7614c3ca8416126c8d1dc
7
- data.tar.gz: 1550d47250f811999035af55efc28dd3a081a22a5f9961a9e2fdfe9ee522a688de402064ed9df339a6c67395bf41ba6eb76b9db812d8bde4470f8dba8e178e40
6
+ metadata.gz: f429459aaab31d0a3110552a50dcf9b804e9ff6e42dd2c18481882c238fe9b459744e206abcb6553b0df4c1241b0bd1b94282c0456a9c99ca994eaac8beb2a34
7
+ data.tar.gz: 45cda79f27c1415fe6f3671f42547432fc105ac911ebd9be9f90b4781459a303fe7f41f740cf05e5c22d75ddd84f7840fa28c00f208a9fc37a3e5d35932e2dad
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.
@@ -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"
@@ -110,6 +111,28 @@ module DiscourseTheme
110
111
  UI.success "Theme downloaded"
111
112
 
112
113
  watch_theme?(args)
114
+ elsif command == "upload"
115
+ raise DiscourseTheme::ThemeError.new "'#{dir} does not exist" unless Dir.exists?(dir)
116
+ raise DiscourseTheme::ThemeError.new "No theme_id is set, please sync via the 'watch' command initially" if theme_id == 0
117
+ client = DiscourseTheme::Client.new(dir, settings, reset: reset)
118
+
119
+ theme_list = client.get_themes_list
120
+
121
+ theme = theme_list.find { |t| t["id"] == theme_id }
122
+ raise DiscourseTheme::ThemeError.new "theme_id is set, but the theme does not exist in Discourse" unless theme
123
+
124
+ uploader = DiscourseTheme::Uploader.new(dir: dir, client: client, theme_id: theme_id, components: components)
125
+
126
+ UI.progress "Uploading theme (id:#{theme_id}) from #{dir} "
127
+ settings.theme_id = theme_id = uploader.upload_full_theme
128
+
129
+ UI.success "Theme uploaded (id:#{theme_id})"
130
+ UI.info "Preview: #{client.root}/?preview_theme_id=#{theme_id}"
131
+ if client.is_theme_creator
132
+ UI.info "Manage: #{client.root}/my/themes"
133
+ else
134
+ UI.info "Manage: #{client.root}/admin/customize/themes/#{theme_id}"
135
+ end
113
136
  else
114
137
  usage
115
138
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module DiscourseTheme
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-23 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitar