Skip to content

Commit

Permalink
Add commands to easily setup and start dummy app
Browse files Browse the repository at this point in the history
Use

    bin/setup

to setup local dev env and

    bin/start

to start the dummy app for local testing.
  • Loading branch information
tvdeyen committed Jun 5, 2023
1 parent c3825ad commit a396363
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ If you want to contribute to Alchemy ([and we encourage you to do so](CONTRIBUTI
First of all you need to clone your fork to your local development machine. Then you need to install the dependencies with bundler.

```bash
$ bundle install
$ bin/setup
```

To prepare the tests of your Alchemy fork please make sure to run the preparation task:
Expand Down Expand Up @@ -332,9 +332,7 @@ $ bundle exec rake
You can even start the dummy app and use it to manually test your changes with:

```bash
$ cd spec/dummy
$ bin/setup
$ bin/dev
$ bin/start
```


Expand Down
36 changes: 36 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env ruby
require "fileutils"

# path to dummy application root.
APP_ROOT = File.expand_path("../spec/dummy", __dir__)

# path to alchemy gem
GEM_ROOT = File.expand_path("../", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

FileUtils.chdir GEM_ROOT do
puts "\n== Linking Admin JS package =="
system! "yarn link"
puts "== Installing dependencies =="
system! "yarn install"
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
end

FileUtils.chdir APP_ROOT do
puts "\n== Installing Node dependencies =="
system! "yarn link @alchemy_cms/admin"
system! "yarn install"

puts "\n== Preparing database =="
system! "bin/rails db:prepare"

puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
end

puts "\n== Alchemy is ready 🎉 =="
puts "Start server by typing:\n\n bin/start"
17 changes: 17 additions & 0 deletions bin/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env ruby
require "fileutils"

# path to dummy application root.
APP_ROOT = File.expand_path("../spec/dummy", __dir__)

# path to alchemy gem
GEM_ROOT = File.expand_path("../", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

FileUtils.chdir APP_ROOT do
puts "\n== Starting dummy app =="
system! "bin/dev"
end

0 comments on commit a396363

Please sign in to comment.