This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
26 lines
733 B
Ruby
Executable File
26 lines
733 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# runs clang format against the git diff
|
|
|
|
file_types = {h: true, m: true, cpp: true, c: true}
|
|
|
|
made_changes = false
|
|
|
|
`git status --porcelain`.split('\n').each do |line|
|
|
components = line.split(' ')
|
|
next if components.count < 2
|
|
code = components[0]
|
|
next if code == 'D'
|
|
file = components[1]
|
|
extension = file.split('.').last
|
|
next if !file_types[extension.downcase.to_sym]
|
|
replacements = `/usr/local/bin/clang-format -style=file -output-replacements-xml #{file}`
|
|
if replacements.match(/^<replacement /)
|
|
made_changes = true
|
|
`/usr/local/bin/clang-format -style=file -i #{file}`
|
|
end
|
|
end
|
|
|
|
if made_changes
|
|
puts "clang-format made formatting changes - verify them and re-commit."
|
|
abort()
|
|
end |