Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ on:
push:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# No ruby-version input: setup-ruby reads .ruby-version.
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop

test:
runs-on: ubuntu-latest
steps:
Expand Down
25 changes: 25 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
inherit_gem:
rubocop-shopify: rubocop.yml

inherit_mode:
merge:
- Exclude

AllCops:
SuggestExtensions: false
Exclude:
# Polyglot sh/ruby bootstrap scripts (#!/bin/sh preamble re-execing via
# `ruby -x`); not parseable as plain Ruby.
- bin/**/*
- tmp/**/*

# dev's tests are written in the RSpock dialect: bare comparisons in
# Then/Expect blocks, block-name constants (Given/When/Then/Where), and
# Where-table rows (`a | b`, sometimes with identical operands) are rewritten
# by the AST transform, not evaluated for value.
Lint/Void:
Exclude:
- test/**/*
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- test/**/*
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ gem "rake"
gem "pry", "~> 0.14"
gem "pry-byebug", "~> 3.11"

# Style
gem "rubocop-shopify", "~> 3.0", require: false

# Sorbet: static + runtime type checking
gem "sorbet", group: :development
gem "tapioca", require: false, group: [:development, :test]
Expand Down
36 changes: 36 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ GEM
diff-lcs (2.0.0)
erubi (1.13.1)
io-console (0.8.2)
json (2.21.1)
language_server-protocol (3.17.0.6)
lint_roller (1.1.0)
logger (1.7.0)
method_source (1.1.0)
minitest (5.27.0)
Expand All @@ -47,6 +50,7 @@ GEM
byebug (~> 13.0)
pry (>= 0.13, < 0.17)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rbi (0.3.9)
prism (~> 1.0)
Expand All @@ -55,6 +59,7 @@ GEM
logger
prism (>= 1.3.0)
tsort
regexp_parser (2.12.0)
reline (0.6.3)
io-console (~> 0.5)
require-hooks (0.2.3)
Expand All @@ -65,6 +70,23 @@ GEM
mocha (>= 1.0)
parser (>= 3.0)
unparser (>= 0.6)
rubocop (1.88.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.50.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-shopify (3.0.1)
lint_roller
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sorbet (0.6.12971)
Expand Down Expand Up @@ -97,6 +119,9 @@ GEM
yard-sorbet
thor (1.5.0)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
unparser (0.8.2)
diff-lcs (>= 1.6, < 3)
parser (>= 3.3.0)
Expand All @@ -120,6 +145,7 @@ DEPENDENCIES
rake
rbs (~> 4.0.0.dev.5)
rspock (~> 2.3)
rubocop-shopify (~> 3.0)
sorbet
tapioca

Expand All @@ -136,6 +162,9 @@ CHECKSUMS
diff-lcs (2.0.0) sha256=708a5d52ec2945b50f8f53a181174aa1ef2c496edf81c05957fe956dabb363d5
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
json (2.21.1) sha256=13a43df75d95641443f5702dff350f237164a9d811ff0f2c2800d4d980220583
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
Expand All @@ -148,13 +177,18 @@ CHECKSUMS
pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
pry-byebug (3.12.0) sha256=594e094ae8a8390a7ad4c7b36ae36e13304ed02664c67417d108dc5f7213d1b7
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
rbi (0.3.9) sha256=d6a187bd0b376e999d3d82a5e5798a61178be98b894b7b35741c14162c9ea015
rbs (4.0.0.dev.5) sha256=273938e5a9c7f06b041be583588f2aa1976149bda2ce213e33e129c51534e174
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
require-hooks (0.2.3) sha256=224be5b4be0fd2a47cb73286c500da366704a54ec195b6627366380c950efac8
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspock (2.5.0) sha256=5bac4d22eab6f10a04523d9d5368f451b4c261c51cab092d8a8e868318f9b348
rubocop (1.88.2) sha256=8def251c90cd955feb4daa3edc0ab56893250c4ce90ef81e6c80c03f9a939bbf
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
rubocop-shopify (3.0.1) sha256=4adffa6313294bd9da2b0896ae44c5eb8e419336b2413de20c38b7691a7e6774
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
ruby2_keywords (0.0.5) sha256=ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef
sorbet (0.6.12971) sha256=2b22b9dc976ac4f3d5af27e0365c9b0235fca0244ec644f4f52f9e7bb6b67acc
Expand All @@ -167,6 +201,8 @@ CHECKSUMS
tapioca (0.17.10) sha256=880a682ca8314f798dd09e9f104134fbf1a713c13be51f7dd4741dd434e6471b
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
unparser (0.8.2) sha256=654af48a6cfa25baf145563e01f40c60ca7d5c7520ff506912d0bb2f1240fd00
yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f
yard-sorbet (0.9.0) sha256=03d1aa461b9e9c82b886919a13aa3e09fcf4d1852239d2967ed97e92723ffe21
Expand Down
3 changes: 3 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ commands:
test:
desc: Run this repo's tests
run: ./bin/test.rb
style:
desc: Run RuboCop
run: bundle exec rubocop
release:
desc: Release a new version (bump, tag, push, Homebrew formula)
run: ./bin/release.rb
Expand Down
76 changes: 38 additions & 38 deletions lib/dev/deps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,48 @@ module Dev
module Deps
@last_config = nil

def self.define(&block)
@last_config = Config.define(&block)
end
class << self
def define(&block)
@last_config = Config.define(&block)
end

# The most recently defined config (from the last call to .define).
# Useful for retrieving the config after loading a dependencies.rb file.
#
# @return [Config, nil]
def self.last_config
@last_config
end
# The most recently defined config (from the last call to .define).
# Useful for retrieving the config after loading a dependencies.rb file.
#
# @return [Config, nil]
attr_reader :last_config

# Clears the last defined config. Call before loading a dependencies.rb:
# a file that never calls .define (e.g. dev's own bootstrap-constants
# dependencies.rb) would otherwise leave a previously loaded project's
# config visible as if it were its own.
def self.reset!
@last_config = nil
end
# Clears the last defined config. Call before loading a dependencies.rb:
# a file that never calls .define (e.g. dev's own bootstrap-constants
# dependencies.rb) would otherwise leave a previously loaded project's
# config visible as if it were its own.
def reset!
@last_config = nil
end

# Detect the current environment (ci vs dev) from the CI variable alone.
#
# Deliberately NOT platform-based: a Linux workstation is "dev" and a Mac
# CI runner is "ci". The one caller that needed the old Linux-implies-CI
# clause (bin/install-build-deps.rb, which runs inside docker builds where
# no CI variable exists) now declares env: "ci" explicitly instead of
# detecting it — fix by declaration, not detection.
#
# @return [String] "ci" or "dev"
def self.detect_env
ENV["CI"].to_s =~ /\A(true|1)\z/i ? "ci" : "dev"
end
# Detect the current environment (ci vs dev) from the CI variable alone.
#
# Deliberately NOT platform-based: a Linux workstation is "dev" and a Mac
# CI runner is "ci". The one caller that needed the old Linux-implies-CI
# clause (bin/install-build-deps.rb, which runs inside docker builds where
# no CI variable exists) now declares env: "ci" explicitly instead of
# detecting it — fix by declaration, not detection.
#
# @return [String] "ci" or "dev"
def detect_env
ENV["CI"].to_s =~ /\A(true|1)\z/i ? "ci" : "dev"
end

# Detect the host OS for host-gated dependency filtering (the `host:`
# declaration axis). Matches the symbols the DSL accepts (:darwin, :linux).
#
# @return [String] "darwin", "linux", or "windows"
def self.detect_host
case RUBY_PLATFORM
when /darwin/ then "darwin"
when /linux/ then "linux"
else "windows"
# Detect the host OS for host-gated dependency filtering (the `host:`
# declaration axis). Matches the symbols the DSL accepts (:darwin, :linux).
#
# @return [String] "darwin", "linux", or "windows"
def detect_host
case RUBY_PLATFORM
when /darwin/ then "darwin"
when /linux/ then "linux"
else "windows"
end
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/dev/deps/accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def ficsit_path(name, platform)
)
unless @cache.exists?(key)
raise NotCachedError,
"#{name} (#{platform}) is not cached — run dev up to download it"
"#{name} (#{platform}) is not cached — run dev up to download it"
end

@cache.path(key)
Expand All @@ -92,8 +92,8 @@ def xcode_developer_dir
developer_dir = Pathname(XcodeIntegration.developer_dir(dep.version, root: @xcode_install_root))
unless developer_dir.directory?
raise NotInstalledError,
"xcode #{dep.version} is not installed at " \
"#{XcodeIntegration.app_path(dep.version, root: @xcode_install_root)} — run dev up"
"xcode #{dep.version} is not installed at " \
"#{XcodeIntegration.app_path(dep.version, root: @xcode_install_root)} — run dev up"
end

developer_dir
Expand All @@ -118,7 +118,7 @@ def locked_platform(dep, platform)
unless target
available = platforms.keys.join(", ")
raise PlatformNotLockedError,
"#{dep.name} has no locked #{platform} platform (locked: #{available})"
"#{dep.name} has no locked #{platform} platform (locked: #{available})"
end

target
Expand Down
2 changes: 1 addition & 1 deletion lib/dev/deps/bundler_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def fetch(id)
name = id["name"]
pin = pins.fetch(name) do
raise MissingGemError,
"gem #{name.inspect} is not in #{LOCKFILE} — run `dev update-deps`"
"gem #{name.inspect} is not in #{LOCKFILE} — run `dev update-deps`"
end

Dependency.new(
Expand Down
Loading
Loading