diff --git a/CHANGELOG.md b/CHANGELOG.md index 692476ebe..edf48c689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,9 @@ ##### Bug Fixes -* None. +* Fix crash when specifying empty Swift version. Now correctly uses the default + Swift version. + [JP Simard](https://github.com/jpsim) ## 0.9.2 diff --git a/lib/jazzy/config.rb b/lib/jazzy/config.rb index 9e44fe621..e666e2764 100644 --- a/lib/jazzy/config.rb +++ b/lib/jazzy/config.rb @@ -180,9 +180,12 @@ def expand_path(path) command_line: '--swift-version VERSION', default: nil, parse: ->(v) do - return nil if v.to_s.empty? - raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2 - v + if v.to_s.empty? + nil + else + raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2 + v + end end # ──────── Metadata ──────── diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 24b74c27e..94dc03130 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -210,8 +210,9 @@ def configure_cocoapods behaves_like cli_spec 'document_siesta', # Siesta already has Docs/ '--output api-docs', - # Use Swift 4.1 rather than the specified 3.0.2 - '--swift-version=4.1' + # Use the default Swift version rather than the + # specified 4.0 + '--swift-version=' end describe 'Creates docs for Swift project with a variety of contents' do diff --git a/spec/integration_specs b/spec/integration_specs index fb95556ef..0583493d8 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit fb95556ef2522cfe3171b490fa2542e9f9709c40 +Subproject commit 0583493d8ff2d89f5a27d304ec67ed69f9e27a99