Skip to content

Commit

Permalink
FEATURE: Suggest the root URL of the local site when running watch
Browse files Browse the repository at this point in the history
…command (#47)
  • Loading branch information
CvX authored Apr 16, 2024
1 parent e6da314 commit 8300a9b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Suggest the root URL of the local site when running `watch` command

## [2.1.1] - 2024-03-25

### Added

- `--version` to CLI (#46)

## [2.1.0] - 2024-02-28
Expand Down
5 changes: 4 additions & 1 deletion lib/discourse_theme/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ def guess_url(settings)
end

if !url || @reset
url = normalize_url(UI.ask("What is the root URL of your Discourse site?", default: url))
url =
normalize_url(
UI.ask("What is the root URL of your Discourse site?", default: settings.possible_url),
)
url = "http://#{url}" unless url =~ %r{^https?://}

# maybe this is an HTTPS redirect
Expand Down
7 changes: 7 additions & 0 deletions lib/discourse_theme/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def url=(val)
set("url", val)
end

def possible_url
return safe_config["url"] if safe_config["url"]

first_config = @config.raw_config.values.find { |config| config["url"] }
first_config["url"] if first_config
end

def theme_id
safe_config["theme_id"].to_i
end
Expand Down
2 changes: 1 addition & 1 deletion lib/discourse_theme/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module DiscourseTheme
VERSION = "2.1.1"
VERSION = "2.1.2"
end

0 comments on commit 8300a9b

Please sign in to comment.