deep-linking-sample/Apps/Wikipedia/scripts/watch_and_clang_format
Javier Cicchelli 9bcdaa697b [Setup] Basic project structure (#1)
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
2023-04-08 18:37:13 +00:00

34 lines
725 B
Ruby
Executable File

#!/usr/bin/env ruby
# watch the directory and run clang format when a file changes. not used currently
require 'listen'
wd = Dir.pwd
extensions_to_format = [".m", ".h", ".c"]
paths_for_listening = []
Dir.foreach(wd) { |sd|
if File.directory?(sd)
lower = sd.downcase
if lower != 'pods' && !lower.start_with?('.')
paths_for_listening << sd
end
end
}
listener = Listen.to(*paths_for_listening) do |modified, added, removed|
modified_and_added = modified + added
modified_and_added.each do |path|
extension = File.extname(path)
if extensions_to_format.include?(extension)
puts "Formatting #{path}"
`clang-format -style=file -i #{path}`
end
end
end
listener.start
sleep