Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --targets option for Periphery >= 3.0.0 #271

Merged
merged 1 commit into from
Jan 8, 2025
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
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ See `periphery scan -h` for available options.
Note that `build_args` option is a special option that does not exist in Periphery but the arguments are passed down to `periphery` after an argument terminator (`--`).

```ruby
# For Periphery >= 3.0.0
periphery.scan(
project: "Foo.xcodeproj",
schemes: ["foo", "bar"],
clean_build: true,
exclude_targets: ["bar"],
build_args: "-sdk iphonesimulator"
)

# For Periphery < 3.0.0
periphery.scan(
project: "Foo.xcodeproj",
schemes: ["foo", "bar"],
Expand Down Expand Up @@ -86,6 +96,16 @@ To enable this feature, you need to give `index_store_path` to the generated ind
```ruby
# Dangerfile

# For Periphery >= 3.0.0
periphery.scan(
project: "Foo.xcodeproj",
schemes: ["foo", "bar"],
skip_build: true,
exclude_targets: ["bar"],
index_store_path: 'DerivedData/Index.noindex/DataStore'
)

# For Periphery < 3.0.0
periphery.scan(
project: "Foo.xcodeproj",
schemes: "foo",
Expand Down
7 changes: 7 additions & 0 deletions lib/danger/danger_periphery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def scan(options = {})
end
end

# The version of underlying Periphery executable.
#
# @return [string]
def version
Periphery::Runner.new(binary_path).version
end

# Download and install Periphery executable binary.
#
# @param [String, Symbol] version The version of Periphery you want to install.
Expand Down
9 changes: 5 additions & 4 deletions spec/danger/danger_periphery_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
include_context 'when test.xcodeproj is indexed'

let(:dangerfile) { testing_dangerfile }
let(:periphery) { dangerfile.periphery }
let(:periphery) { dangerfile.periphery.tap { |p| p.binary_path = binary('periphery') } }
let(:added_files) { [] }
let(:modified_files) { [] }
let(:periphery_options) do
{
options = {
project: fixture('test.xcodeproj'),
targets: targets,
schemes: 'test',
skip_build: true,
index_store_path: index_store_path
}
# `--targets` option has disappeared since Periphery >= 3.0.0.
options[:targets] = targets if Gem::Version.new(periphery.version) < Gem::Version.new('3.0.0')
options
end
let(:targets) { 'test' }

before do
periphery.binary_path = binary('periphery')
next skip 'periphery is not installed' unless File.exist?(periphery.binary_path)

json = File.read(fixture('github_pr.json'))
Expand Down
Loading