Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
env:
DANGER_GITHUB_BEARER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bundle exec danger --verbose
bin/danger --verbose
10 changes: 5 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
sleep 15 # let the DB warm up a little
- name: Prepare Database
run: |
docker compose run --rm web bundle exec rails db:migrate
docker compose run --rm web bundle exec i18n export
docker compose run --rm web bundle exec rails assets:precompile
docker compose run --rm web bin/rails db:migrate
docker compose run --rm web bin/i18n export
docker compose run --rm web bin/rails assets:precompile
docker compose run --rm web osmosis --rx docker/null-island.osm.xml --wd host=db database=openstreetmap user=openstreetmap password=openstreetmap validateSchemaVersion=no
- name: Test Basic Website
run: |
Expand All @@ -40,5 +40,5 @@ jobs:
curl -siL http://127.0.0.1:3000/api/0.6/node/1 | grep 'Null Island'
- name: Test Complete Suite
run: |
docker compose run --rm web bundle exec rails db:test:prepare
docker compose run --rm web bundle exec rails test:all
docker compose run --rm web bin/rails db:test:prepare
docker compose run --rm web bin/rails test:all
28 changes: 14 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
rubygems: 3.4.10
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop --format fuubar
run: bin/rubocop --format fuubar
erblint:
name: ERB Lint
runs-on: ubuntu-latest
Expand All @@ -39,7 +39,7 @@ jobs:
rubygems: 3.4.10
bundler-cache: true
- name: Run erblint
run: bundle exec erb_lint .
run: bin/erb_lint .
herb:
name: Herb
runs-on: ubuntu-latest
Expand All @@ -54,17 +54,17 @@ jobs:
rubygems: 3.4.10
bundler-cache: true
- name: Run herb parser
run: bundle exec herb analyze app/ --no-log-file --non-interactive
run: bin/herb analyze app/ --no-log-file --non-interactive
- name: Cache node modules
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
cache: yarn
- name: Install node modules
run: bundle exec bin/yarn install
run: bin/yarn install
- name: Create dummy database configuration
run: cp config/example.database.yml config/database.yml
- name: Run herb linter
run: bundle exec bin/yarn run herb-lint
run: bin/yarn run herb-lint
eslint:
name: ESLint
runs-on: ubuntu-latest
Expand All @@ -83,11 +83,11 @@ jobs:
with:
cache: yarn
- name: Install node modules
run: bundle exec bin/yarn install
run: bin/yarn install
- name: Create dummy database configuration
run: cp config/example.database.yml config/database.yml
- name: Run eslint
run: bundle exec rails eslint
run: bin/rails eslint
brakeman:
name: Brakeman
runs-on: ubuntu-latest
Expand All @@ -102,7 +102,7 @@ jobs:
rubygems: 3.4.10
bundler-cache: true
- name: Run brakeman
run: bundle exec brakeman -q
run: bin/brakeman -q
annotate_models:
env:
RAILS_ENV: test
Expand All @@ -127,15 +127,15 @@ jobs:
with:
cache: yarn
- name: Install node modules
run: bundle exec bin/yarn install
run: bin/yarn install
- name: Setup database
run: |
sudo systemctl start postgresql
sudo -u postgres createuser -s $(id -un)
createdb openstreetmap
bundle exec rails db:schema:load
bin/rails db:schema:load
- name: Run Annotate Models
run: bundle exec annotaterb models
run: bin/annotaterb models
- name: Fail if model annotations are out of date
run: git diff --exit-code
database_consistency:
Expand All @@ -162,12 +162,12 @@ jobs:
with:
cache: yarn
- name: Install node modules
run: bundle exec bin/yarn install
run: bin/yarn install
- name: Setup database
run: |
sudo systemctl start postgresql
sudo -u postgres createuser -s $(id -un)
createdb openstreetmap
bundle exec rails db:schema:load
bin/rails db:schema:load
- name: Run Database Consistency
run: bundle exec database_consistency
run: bin/database_consistency
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,29 @@ jobs:
cp config/example.storage.yml config/storage.yml
touch config/settings.local.yml
- name: Install node modules
run: bundle exec bin/yarn install
run: bin/yarn install
- name: Populate database
run: |
sed -f script/normalise-structure db/structure.sql > db/structure.expected
rm -f db/structure.sql
bundle exec rails db:migrate
bin/rails db:migrate
sed -f script/normalise-structure db/structure.sql > db/structure.actual
diff -uw db/structure.expected db/structure.actual
- name: Export javascript strings
run: bundle exec i18n export
run: bin/i18n export
- name: Compile assets
run: bundle exec rails assets:precompile
run: bin/rails assets:precompile
timeout-minutes: 10
- name: Create tmp/pids directory
run: mkdir -p tmp/pids
- name: Enable virtual display
run: Xvfb :99 -screen 0 1024x768x24 &
- name: Run tests
run: bundle exec rails test:all
run: bin/rails test:all
env:
DISPLAY: ":99"
- name: Run javascript tests
run: bundle exec teaspoon
run: bin/teaspoon
env:
DISPLAY: ":99"
- name: Upload screenshots
Expand Down
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,27 @@ Here's the typical contribution workflow:
We use [Rubocop](https://github.com/rubocop-hq/rubocop) (for ruby files), [ESLint](https://eslint.org/) (for javascript files), and [ERB Lint](https://github.com/Shopify/erb-lint) (for erb templates) to help maintain consistency in our code. You can run these utilities during development to check that your code matches our guidelines:

```bash
bundle exec rubocop
bundle exec rails eslint
bundle exec erb_lint .
bin/rubocop
bin/rails eslint
bin/erb_lint .
```

You can automatically fix many linting issues with:

```bash
bundle exec rubocop -a
bundle exec rails eslint:fix
bundle exec erb_lint . --autocorrect
bin/rubocop -a
bin/rails eslint:fix
bin/erb_lint . --autocorrect
```

> [!NOTE]
> Use `bundle exec rails eslint:fix` instead of the standard `eslint --fix` option, which is silently ignored in this Rails project.
> Use `bin/rails eslint:fix` instead of the standard `eslint --fix` option, which is silently ignored in this Rails project.

> [!TIP]
> You can also install hooks to have git run checks automatically when you commit using [overcommit](https://github.com/sds/overcommit) with:
>
> ```bash
> bundle exec overcommit --install
> bin/overcommit --install
> ```

### Testing
Expand All @@ -135,13 +135,13 @@ When contributing, you should:
You can run the existing test suite with:

```bash
bundle exec rails test:all
bin/rails test:all
```

You can run javascript tests with:

```bash
RAILS_ENV=test bundle exec teaspoon
RAILS_ENV=test bin/teaspoon
```

You can view test coverage statistics by browsing the `coverage` directory.
Expand All @@ -160,7 +160,7 @@ The tests are automatically run on Pull Requests and other commits via github ac
We also perform static analysis of our code. You can run the analysis yourself with:

```bash
bundle exec brakeman -q
bin/brakeman -q
```

### Comments
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ RUN bundle install
# Install NodeJS packages using yarn
COPY package.json yarn.lock /app/
COPY bin/yarn /app/bin/
RUN bundle exec bin/yarn install
RUN bin/yarn install

# Copy and set entrypoint
COPY docker/entrypoint.sh /entrypoint.sh
Expand Down
27 changes: 27 additions & 0 deletions bin/annotaterb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'annotaterb' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("annotaterb", "annotaterb")
5 changes: 0 additions & 5 deletions bin/bundle

This file was deleted.

27 changes: 27 additions & 0 deletions bin/danger
Copy link
Copy Markdown
Member

@Firefishy Firefishy Mar 11, 2026

Choose a reason for hiding this comment

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

Isn't this file generated by bundler or by the gem? Isn't there a risk that it changes in the future?

bundle exec might not be the most elegant, but for me it has been the most reliable way to execute the gem bin across different developer setups.

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.

Theoretically all of them could change. However they are only a layer of boilerplate, the same for all (all that require Bundler), and only the last line is important.

The binstubs are generated by Bundler, rather than the individual applications. If it changes, it should change for all of them at the same time and... er... oh, what do you know, I just checked now, it changed recently and we are on an old version 😅 Looks like all that noisy check for the bundle executable was removed at ruby/rubygems#8345 Also reminds me that we are on an old version of Bundler...

As for the possibility of this being less reliable than bundle exec:

  • Theoretically, it should work better because it removes a layer of indirection.
  • But I understand that things work in mysterious ways so I cannot guarantee it. Just for a data point: have you had bad experiences running bin/rails or similar?

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'danger' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("danger", "danger")
27 changes: 27 additions & 0 deletions bin/database_consistency
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'database_consistency' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("database_consistency", "database_consistency")
27 changes: 27 additions & 0 deletions bin/erb_lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'erb_lint' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("erb_lint", "erb_lint")
27 changes: 27 additions & 0 deletions bin/erblint
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'erblint' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("erb_lint", "erblint")
Loading
Loading