-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eject 0.1.12 (new formula) #6893
Conversation
end | ||
|
||
test do | ||
system "#{bin}/eject" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware that this is a pretty weak test. Right now the tool only prints out usage instructions or requires a xib which would be a lot of lines to embed for a test. If you think that's reasonable or there's a better way, let me know and I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the smallest possible xib
that can be created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I can create one that's 16 lines long, which doesn't seem that bad:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</objects>
</document>
When run through eject, it creates the following output:
// Create Views
let view = UIView()
view.frame = CGRect(x: 0, y: 0, width: 375, height: 667)
view.autoresizingMask = [.flexibleHeight, .flexibleWidth]
view.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I created a better test. Let me know what you think!
xcodebuild | ||
bin.install "build/Release/eject.app/Contents/MacOS/eject" | ||
frameworks_path = "build/Release/eject.app/Contents/Frameworks" | ||
mv(frameworks_path, frameworks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the parentheses here.
The build failed as well as the audit:
|
Oh, I see it's failing on the repository not being popular enough. I guess I'll do a tab instead. Sorry! |
@edwardloveall Leave this open, we might include it anyway. |
Sure thing. I can also squash the commits if there's nothing else to change before it's merged. Let me know. |
SWIFT | ||
|
||
system "eject --file view.xib > view.swift" | ||
File.read("view.swift") == swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use assert_equal swift, shell_output("#{bin}/eject --file view.xib")
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
test do | ||
xib = File.open "view.xib", "a+" do |file| | ||
file.write <<-XML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use EOS.undent
here and then you can indent the line below (and all others) two characters more than before file.write
XML | ||
end | ||
|
||
swift = <<-SWIFT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly use EOS.undent
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
end | ||
|
||
test do | ||
xib = File.open "view.xib", "a+" do |file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need the xib
assignment here and use (testpath/"view.xib").write
instead of the block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
url "https://github.com/Raizlabs/Eject/archive/0.1.12.tar.gz" | ||
sha256 "a4dae3d37f780d274f53ed25d9dc1a27d5245289f9b8cbaaf8be71bc9334de18" | ||
|
||
depends_on :xcode => :build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing on Yosemite so may need scoped to e.g. Xcode 8: https://bot.brew.sh/job/Homebrew%20Core/11454/version=yosemite/testReport/junit/brew-test-bot/yosemite/install_eject/
Because this was failing on builds of yosemite
`/` is a method on pathname that merges two paths together. So something like (testpath/"view.xib") will create a path to a view.xib file in the testing directory. Calling `write` on a pathname will write content to the file specified by the path.
Thanks for your contribution to Homebrew! Without people like you submitting PRs we couldn't run this project. You rock! |
Closes Homebrew#6893. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?