Skip to content

Commit

Permalink
fix: replace more things with native commands
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Aug 15, 2023
1 parent d261145 commit e507562
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
5 changes: 4 additions & 1 deletion template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met
apply "variants/backend-base/bin/template.rb"
apply "variants/backend-base/config/template.rb"
apply "variants/backend-base/doc/template.rb"
apply "variants/backend-base/lib/template.rb"
apply "variants/backend-base/public/template.rb"
apply "variants/backend-base/spec/template.rb"

Expand All @@ -122,6 +121,10 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met
after_bundle do
require_package_json_gem

apply "variants/backend-base/lib/template.rb"

template "variants/backend-base/bin/setup.tt", "bin/setup", force: true

# Remove the `test/` directory because we always use RSpec which creates
# its own `spec/` directory
remove_dir "test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def setup!
test "ruby -v" => ruby_version
run "gem install bundler --no-document --conservative"
run "bundle install"
run "yarn install" if File.exist?("yarn.lock")
run "<%= package_json.manager.native_install_command %>" if File.exist?("package.json")
run "bundle exec overcommit --install"
copy "example.env"
copy "config/secrets.example.yml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace :assets do
desc "Ensures that dependencies required to compile assets are installed"
task install_dependencies: :environment do
raise if File.exist?("yarn.lock") && !(system "yarn install --frozen-lockfile")
raise if File.exist?("package.json") && !(system "<%= package_json.manager.native_install_command(frozen: true) %>")
end
end

Expand Down
3 changes: 2 additions & 1 deletion variants/backend-base/lib/template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
copy_file "variants/backend-base/lib/tasks/coverage.rake", "lib/tasks/coverage.rake"
copy_file "variants/backend-base/lib/tasks/assets.rake", "lib/tasks/assets.rake"
copy_file "variants/backend-base/lib/tasks/app.rake", "lib/tasks/app.rake"
copy_file "variants/backend-base/lib/tasks/dev.rake", "lib/tasks/dev.rake"

template "variants/backend-base/lib/tasks/assets.rake.tt", "lib/tasks/assets.rake", force: true
4 changes: 3 additions & 1 deletion variants/frontend-base/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
remove_dir "app/assets/stylesheets"
remove_dir "app/assets/images"

# this will create a package.json for us
# shakapacker will create a more complete package.json
remove_file "package.json"

run "rails shakapacker:install"

# this is added by shakapacker:install, but we've already got one (with some extra tags)
Expand Down
10 changes: 5 additions & 5 deletions variants/github_actions_ci/workflows/ci.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
with:
node-version-file: ".node-version"
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: <%- package_json.manager.native_install_command(frozen: true) -%>
<%- if TEMPLATE_CONFIG.use_typescript? -%>
- run: yarn run typecheck
- run: <%- package_json.manager.native_run_command("install") -%>
<%- end -%>
- run: yarn run js-lint
- run: yarn run format-check
- run: <%- package_json.manager.native_run_command("js-lint") -%>
- run: <%- package_json.manager.native_run_command("format-check") -%>
ruby_based_checks:
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
with:
node-version-file: ".node-version"
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: <%- package_json.manager.native_install_command(frozen: true) -%>
- run: bundle exec rspec spec --format progress
- name: Archive spec outputs
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit e507562

Please sign in to comment.