50 lines
2.2 KiB
Ruby
50 lines
2.2 KiB
Ruby
class Swiftgen < Formula
|
|
desc "Collection of Swift tools to generate Swift code"
|
|
homepage "https://github.com/AliSoftware/SwiftGen"
|
|
url "https://github.com/AliSoftware/SwiftGen/archive/0.8.0.tar.gz"
|
|
sha256 "fd95c0c1e8504df0cfa708a75e77343e2e89944aa4815e644d11b6e4e82f4dd0"
|
|
head "https://github.com/AliSoftware/SwiftGen.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "e9f2dd908c5abc8f37c2438a5806d67d82b745c8a97817beb2cd9c31bfc65f15" => :el_capitan
|
|
sha256 "e17b9b0a0d46de2ba2aa897285d9cf59102d5b589274aff53c4dcecd20e1cc66" => :yosemite
|
|
end
|
|
|
|
depends_on :xcode => "7.0"
|
|
|
|
def install
|
|
rake "install[#{bin},#{lib},#{pkgshare}/templates]"
|
|
|
|
fixtures = %w[
|
|
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
|
|
]
|
|
(pkgshare/"fixtures").install fixtures
|
|
end
|
|
|
|
test do
|
|
system bin/"swiftgen", "--version"
|
|
|
|
fixtures = pkgshare/"fixtures"
|
|
|
|
output = shell_output("#{bin}/swiftgen images --templatePath #{pkgshare/"templates/images-default.stencil"} #{fixtures}/Images.xcassets").strip
|
|
assert_equal output, (fixtures/"Images-File-Defaults.swift.out").read.strip, "swiftgen images failed"
|
|
|
|
output = shell_output("#{bin}/swiftgen colors --templatePath #{pkgshare/"templates/colors-default.stencil"} #{fixtures}/colors.txt").strip
|
|
assert_equal output, (fixtures/"Colors-File-Defaults.swift.out").read.strip, "swiftgen colors failed"
|
|
|
|
output = shell_output("#{bin}/swiftgen strings --templatePath #{pkgshare/"templates/strings-default.stencil"} #{fixtures}/Localizable.strings").strip
|
|
assert_equal output, (fixtures/"Strings-File-Defaults.swift.out").read.strip, "swiftgen strings failed"
|
|
|
|
output = shell_output("#{bin}/swiftgen storyboards --templatePath #{pkgshare/"templates/storyboards-default.stencil"} #{fixtures}/Message.storyboard").strip
|
|
assert_equal output, (fixtures/"Storyboards-Message-Defaults.swift.out").read.strip, "swiftgen storyboards failed"
|
|
end
|
|
end
|