Skip to content

Commit

Permalink
Fix asset pipeline in development (#330)
Browse files Browse the repository at this point in the history
**This PR:**
- Fixes a local development issue caused by attempting to fix CI with a symlink in [PR 326](#326)
  - Moves `package.json` to `/` and removes the symlink in `.circleci/config.yml`
- Adds tips section to `bin/setup` 

Co-authored-by: Sally Hall <[email protected]>
  • Loading branch information
louis-antonopoulos and sallyhall authored Aug 23, 2024
1 parent 689d3ab commit b157151
Show file tree
Hide file tree
Showing 6 changed files with 827 additions and 827 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ jobs:

steps:
- checkout
- run:
name: Create symlink for package.json
command: ln -s ./spec/example_app/package.json ./package.json
- restore_cache:
keys:
- yuriita-bundle-{{ checksum "Gemfile.lock" }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/_yardoc/
/coverage/
/doc/
/node_modules/
/pkg/
/spec/reports/
/tmp/
Expand Down
24 changes: 15 additions & 9 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
require 'fileutils'
require "fileutils"

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

def system!(*args)
system(*args, exception: true)
Expand All @@ -13,21 +13,27 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file.

puts '== Installing ruby dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "== Installing ruby dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

puts '== Installing JS dependencies =='
system('bin/yarn')
puts "== Installing JS dependencies =="
system("bin/yarn")

puts "\n== Copying sample files =="
unless File.exist?(".env")
FileUtils.cp ".sample.env", ".env"
end

puts "\n== Preparing database =="
system! 'bin/rails db:drop db:create db:migrate'
system! "bin/rails db:drop db:create db:migrate"

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

puts "\n== Tips =="
puts "- To seed the database, run `rails db:seed`. You must have the TMDB_API_KEY environment variable set."
puts "- To run the example_app server, run `rails s`."

puts
end
2 changes: 1 addition & 1 deletion spec/example_app/package.json → package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"webpack-cli": "^5.1.4"
},
"scripts": {
"build": "webpack --config spec/example_app/config/webpack/webpack.config.js"
"build": "webpack --config ./spec/example_app/config/webpack/webpack.config.js"
}
}
Loading

0 comments on commit b157151

Please sign in to comment.