2015-08-15 23:02:16 +00:00
|
|
|
class Swiftgen < Formula
|
|
|
|
desc "Collection of Swift tools to generate Swift code"
|
|
|
|
homepage "https://github.com/AliSoftware/SwiftGen"
|
2015-10-25 18:49:00 +00:00
|
|
|
url "https://github.com/AliSoftware/SwiftGen/archive/0.6.0.tar.gz"
|
|
|
|
sha256 "4adf379c5d41b360c7fed32e21ba3476dc5e311b5e8a14cb755b0a6addd68e90"
|
2015-08-15 23:02:16 +00:00
|
|
|
head "https://github.com/AliSoftware/SwiftGen.git"
|
|
|
|
|
2015-09-21 01:22:44 +00:00
|
|
|
bottle do
|
2015-10-15 10:02:51 +00:00
|
|
|
cellar :any
|
2015-10-25 19:15:31 +00:00
|
|
|
sha256 "ece8ddf9ea6f4448f057c177d05c302e4a305cb104a7f826751d460453091841" => :el_capitan
|
|
|
|
sha256 "0a3fb5ebfefb37a2ec033048e423e2af3f18a8655a27205270ab64c383c1f8b1" => :yosemite
|
2015-09-21 01:22:44 +00:00
|
|
|
end
|
|
|
|
|
2015-08-15 23:02:16 +00:00
|
|
|
depends_on :xcode => "7.0"
|
|
|
|
|
|
|
|
def install
|
2015-10-25 18:49:00 +00:00
|
|
|
rake "install[#{bin},#{lib},#{pkgshare}/templates]"
|
2015-08-15 23:02:16 +00:00
|
|
|
|
2015-09-30 17:56:36 +00:00
|
|
|
fixtures = %w[
|
2015-10-14 21:45:08 +00:00
|
|
|
UnitTests/fixtures/Images.xcassets
|
|
|
|
UnitTests/fixtures/colors.txt
|
|
|
|
UnitTests/fixtures/Localizable.strings
|
|
|
|
UnitTests/fixtures/Message.storyboard
|
|
|
|
UnitTests/expected/Images-File-Defaults.swift.out
|
|
|
|
UnitTests/expected/Colors-File-Defaults.swift.out
|
|
|
|
UnitTests/expected/Strings-File-Defaults.swift.out
|
|
|
|
UnitTests/expected/Storyboards-Message-Defaults.swift.out
|
2015-09-30 17:56:36 +00:00
|
|
|
]
|
2015-10-25 18:49:00 +00:00
|
|
|
(pkgshare/"fixtures").install fixtures
|
2015-08-15 23:02:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2015-10-15 21:30:42 +00:00
|
|
|
system bin/"swiftgen", "--version"
|
2015-08-15 23:02:16 +00:00
|
|
|
|
2015-10-25 18:49:00 +00:00
|
|
|
fixtures = pkgshare/"fixtures"
|
2015-08-15 23:02:16 +00:00
|
|
|
|
2015-10-25 18:49:00 +00:00
|
|
|
output = shell_output("#{bin}/swiftgen images #{fixtures}/Images.xcassets").strip
|
|
|
|
assert_equal output, (fixtures/"Images-File-Defaults.swift.out").read.strip, "swiftgen images failed"
|
2015-08-15 23:02:16 +00:00
|
|
|
|
2015-10-25 18:49:00 +00:00
|
|
|
output = shell_output("#{bin}/swiftgen colors #{fixtures}/colors.txt").strip
|
|
|
|
assert_equal output, (fixtures/"Colors-File-Defaults.swift.out").read.strip, "swiftgen colors failed"
|
2015-10-14 21:45:08 +00:00
|
|
|
|
2015-10-25 18:49:00 +00:00
|
|
|
output = shell_output("#{bin}/swiftgen strings #{fixtures}/Localizable.strings").strip
|
|
|
|
assert_equal output, (fixtures/"Strings-File-Defaults.swift.out").read.strip, "swiftgen strings failed"
|
|
|
|
|
|
|
|
output = shell_output("#{bin}/swiftgen storyboards #{fixtures}/Message.storyboard").strip
|
|
|
|
assert_equal output, (fixtures/"Storyboards-Message-Defaults.swift.out").read.strip, "swiftgen storyboards failed"
|
2015-08-15 23:02:16 +00:00
|
|
|
end
|
|
|
|
end
|