Project

grenouille

0.0
No commit activity in last 3 years
No release in over 3 years
Automatically detect Swift versions from source code.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.7
~> 10.0
 Project Readme

Grenouille

No Maintenance Intended Build Status Coverage Status Gem Version Code Climate

Grenouille uses Apple's swift-update tool to determine the version of Swift used in a set of files automatically.

Usage

You can use it on the commandline:

$ grenouille Stargate.swift 
1.2

or programmatically:

su = Grenouille::SwiftUpdate.new
su.determine_version('Stargate.swift')
# 1.2

You can also get more detailled output:

su.update_to_latest_swift('spec/fixtures/Blueprint.swift')
# {:report=>[{"file"=>"spec/fixtures/Blueprint.swift", "offset"=>740, "remove"=>2, "text"=>"as!"}, {"file"=>"spec/fixtures/Blueprint.swift", "offset"=>6758, "remove"=>2, "text"=>"as!"}, {"file"=>"spec/fixtures/Blueprint.swift", "offset"=>10613, "remove"=>2, "text"=>"as!"}], :output=>""}

The value for the :report key represents the result of swift-update, a list of changes to perform to transform the current code to the version of Swift supported by the used Xcode. The value for the :output key is the aggregate of stdout and stderr of swift-update, e.g. compilation errors.

Installation

Add this line to your application's Gemfile:

gem 'grenouille'

And then execute:

$ bundle

Or install it yourself as:

$ gem install grenouille

Note: The swift-update tool is a part of Xcode since 6.3, so it needs at least that version to function.

Contributing

  1. Fork it ( https://github.com/neonichu/grenouille/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request