Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1200ea8
Introduce SpecificationHandlers::Theme
Nov 8, 2022
312daac
Get rid of root and templates folders differentiation
Nov 8, 2022
5017859
Ignore superfluous folders
Nov 8, 2022
66e8918
Ask user to confirm cwd
Nov 8, 2022
79460f5
Move code into RootHelper, rename theme_specification_handler variable
Nov 8, 2022
956a899
Fix Rubocop offenses
Nov 8, 2022
8b4625f
Use real files in unit tests
Nov 8, 2022
056bdd3
Split theme_directory?, avoid interruption during unit tests
Nov 9, 2022
a10cdcb
Add theme directory check to serve command
Nov 9, 2022
ccbe295
Add theme directory check to push command
Nov 9, 2022
652ebde
Add theme/empty directory check to pull command
Nov 9, 2022
74bad58
Add --force flag to all commands
Nov 9, 2022
a6b99a9
Use project_context instead of Dir.chdir
Nov 9, 2022
34e3834
return false if @ctx.testing?
Nov 9, 2022
81b4083
Rename test, use FileUtils instead of Dir
Nov 9, 2022
8c6c771
Update CHANGELOG.md
Nov 9, 2022
a490f24
Add --force flag to help messages
Nov 9, 2022
0ed7366
Simplify logic by getting rid of missing_folders
Nov 10, 2022
eaaae91
Make logic more readable, introduce invalid_theme_directory? and exis…
Nov 10, 2022
7c81632
invalid_theme_directory? –> valid_theme_directory?
Nov 10, 2022
9f703db
ensure that specified_root is rmdir'ed
Nov 10, 2022
8ada024
Get rid of project_context("theme") in pull_test
Nov 10, 2022
b9eb985
Get rid of project_context("theme") in push_test
Nov 10, 2022
1d72a40
Get rid of project_context("theme") in serve_test
Nov 10, 2022
e1afbbd
Get rid of project_context("theme") in share_test
Nov 10, 2022
01859f4
Hide --force flag in docs
Nov 10, 2022
c3feed5
Raise error, instead of returning false, if current_directory_confirm…
Nov 11, 2022
c5a6c21
Use @ root, instead of attr_accessor
Nov 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add theme directory check to serve command
  • Loading branch information
Julien Poitrin committed Nov 9, 2022
commit a10cdcbe7eee527f1e05934f4283dd0677e3e00c
2 changes: 2 additions & 0 deletions lib/project_types/theme/commands/serve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def call(_args, name)
valid_authentication_method!

root = root_value(options, name)
return unless theme_directory?(root) || current_directory_confirmed?

flags = options.flags.dup
host = flags[:host] || DEFAULT_HTTP_HOST

Expand Down
7 changes: 5 additions & 2 deletions test/project_types/theme/commands/serve_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ServeTest < MiniTest::Test

def setup
super
Dir.chdir(ShopifyCLI::ROOT + "/test/fixtures/theme")
@ctx = ShopifyCLI::Context.new
end

Expand Down Expand Up @@ -65,10 +66,12 @@ def test_can_specify_editor_sync
end

def test_can_specify_root
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about why this kind of tests could be deleted.

specified_root = ShopifyCLI::ROOT + "/test/fixtures/theme"

ShopifyCLI::Theme::DevServer.expects(:start)
.with(@ctx, "dist", host: Theme::Command::Serve::DEFAULT_HTTP_HOST)
.with(@ctx, specified_root, host: Theme::Command::Serve::DEFAULT_HTTP_HOST)

run_serve_command(["dist"])
run_serve_command([specified_root])
end

def test_can_specify_theme
Expand Down