Skip to content

Commit

Permalink
Merge pull request #271 from manicmaniac/periphery-3.x
Browse files Browse the repository at this point in the history
Remove --targets option for Periphery >= 3.0.0
  • Loading branch information
manicmaniac authored Jan 8, 2025
2 parents b68da94 + 7f3afb1 commit c29fbf8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
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

0 comments on commit c29fbf8

Please sign in to comment.