diff --git a/README.md b/README.md index a34c5c5..657cb64 100644 --- a/README.md +++ b/README.md @@ -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"], @@ -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", diff --git a/lib/danger/danger_periphery.rb b/lib/danger/danger_periphery.rb index ecba7fb..7a64ebc 100644 --- a/lib/danger/danger_periphery.rb +++ b/lib/danger/danger_periphery.rb @@ -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. diff --git a/spec/danger/danger_periphery_integration_spec.rb b/spec/danger/danger_periphery_integration_spec.rb index 7635842..257c0da 100644 --- a/spec/danger/danger_periphery_integration_spec.rb +++ b/spec/danger/danger_periphery_integration_spec.rb @@ -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'))