fixbraces 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +56 -0
- data/Rakefile +14 -0
- data/bin/fixbraces +36 -0
- data/features/cli.feature +13 -0
- data/features/fixbraces.feature +22 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/AppDelegate.h +13 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/AppDelegate.m +44 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default-568h@2x.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/Default@2x.png +0 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/DetailViewController.h +18 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/DetailViewController.m +49 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Info.plist +50 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/FixbracesTestProject-Prefix.pch +14 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/MasterViewController.h +12 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/MasterViewController.m +111 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/en.lproj/MainStoryboard.storyboard +103 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject/main.m +16 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProject.xcodeproj/project.pbxproj +468 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests-Info.plist +22 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests.h +11 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/FixbracesTestProjectTests.m +30 -0
- data/features/fixtures/FixbracesTestProject/FixbracesTestProjectTests/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/AppDelegate.h +13 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/AppDelegate.m +38 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default-568h@2x.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/Default@2x.png +0 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/DetailViewController.h +17 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/DetailViewController.m +45 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/FixbracesTestProject-Info.plist +50 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/FixbracesTestProject-Prefix.pch +14 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/MasterViewController.h +10 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/MasterViewController.m +99 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/en.lproj/InfoPlist.strings +2 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/en.lproj/MainStoryboard.storyboard +103 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/main.m +15 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject.xcodeproj/project.pbxproj +468 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests-Info.plist +22 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests.h +11 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/FixbracesTestProjectTests.m +27 -0
- data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProjectTests/en.lproj/InfoPlist.strings +2 -0
- data/features/step_definitions/cli_steps.rb +7 -0
- data/features/step_definitions/fixbraces_steps.rb +55 -0
- data/features/step_definitions/touch +0 -0
- data/features/support/env.rb +16 -0
- data/fixbraces.gemspec +28 -0
- data/lib/fixbraces/version.rb +3 -0
- data/lib/fixbraces.rb +25 -0
- data/spec/fixbraces_spec.rb +67 -0
- data/spec/fixtures/expected/AppDelegate.h +13 -0
- data/spec/fixtures/expected/AppDelegate.m +38 -0
- data/spec/fixtures/expected/MasterViewController.h +10 -0
- data/spec/fixtures/expected/MasterViewController.m +99 -0
- data/spec/fixtures/input/AppDelegate.h +13 -0
- data/spec/fixtures/input/AppDelegate.m +44 -0
- data/spec/fixtures/input/MasterViewController.h +12 -0
- data/spec/fixtures/input/MasterViewController.m +111 -0
- data/spec/fixtures/sample_text.rb +112 -0
- metadata +234 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleDisplayName</key>
|
8
|
+
<string>${PRODUCT_NAME}</string>
|
9
|
+
<key>CFBundleExecutable</key>
|
10
|
+
<string>${EXECUTABLE_NAME}</string>
|
11
|
+
<key>CFBundleIdentifier</key>
|
12
|
+
<string>com.junglecandy.${PRODUCT_NAME:rfc1034identifier}</string>
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
14
|
+
<string>6.0</string>
|
15
|
+
<key>CFBundleName</key>
|
16
|
+
<string>${PRODUCT_NAME}</string>
|
17
|
+
<key>CFBundlePackageType</key>
|
18
|
+
<string>APPL</string>
|
19
|
+
<key>CFBundleShortVersionString</key>
|
20
|
+
<string>1.0</string>
|
21
|
+
<key>CFBundleSignature</key>
|
22
|
+
<string>????</string>
|
23
|
+
<key>CFBundleVersion</key>
|
24
|
+
<string>1.0</string>
|
25
|
+
<key>LSRequiresIPhoneOS</key>
|
26
|
+
<true/>
|
27
|
+
<key>UIMainStoryboardFile</key>
|
28
|
+
<string>MainStoryboard</string>
|
29
|
+
<key>UIRequiredDeviceCapabilities</key>
|
30
|
+
<array>
|
31
|
+
<string>armv7</string>
|
32
|
+
</array>
|
33
|
+
<key>UIStatusBarTintParameters</key>
|
34
|
+
<dict>
|
35
|
+
<key>UINavigationBar</key>
|
36
|
+
<dict>
|
37
|
+
<key>Style</key>
|
38
|
+
<string>UIBarStyleDefault</string>
|
39
|
+
<key>Translucent</key>
|
40
|
+
<false/>
|
41
|
+
</dict>
|
42
|
+
</dict>
|
43
|
+
<key>UISupportedInterfaceOrientations</key>
|
44
|
+
<array>
|
45
|
+
<string>UIInterfaceOrientationPortrait</string>
|
46
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
47
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
48
|
+
</array>
|
49
|
+
</dict>
|
50
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//
|
2
|
+
// Prefix header for all source files of the 'FixbracesTestProject' target in the 'FixbracesTestProject' project
|
3
|
+
//
|
4
|
+
|
5
|
+
#import <Availability.h>
|
6
|
+
|
7
|
+
#ifndef __IPHONE_5_0
|
8
|
+
#warning "This project uses features only available in iOS SDK 5.0 and later."
|
9
|
+
#endif
|
10
|
+
|
11
|
+
#ifdef __OBJC__
|
12
|
+
#import <UIKit/UIKit.h>
|
13
|
+
#import <Foundation/Foundation.h>
|
14
|
+
#endif
|
data/features/fixtures/FixbracesTestProjectExpected/FixbracesTestProject/MasterViewController.m
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
//
|
2
|
+
// MasterViewController.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import "MasterViewController.h"
|
8
|
+
|
9
|
+
#import "DetailViewController.h"
|
10
|
+
|
11
|
+
@interface MasterViewController () {
|
12
|
+
NSMutableArray *_objects;
|
13
|
+
}
|
14
|
+
@end
|
15
|
+
|
16
|
+
@implementation MasterViewController
|
17
|
+
|
18
|
+
- (void)awakeFromNib {
|
19
|
+
[super awakeFromNib];
|
20
|
+
}
|
21
|
+
|
22
|
+
- (void)viewDidLoad {
|
23
|
+
[super viewDidLoad];
|
24
|
+
// Do any additional setup after loading the view, typically from a nib.
|
25
|
+
self.navigationItem.leftBarButtonItem = self.editButtonItem;
|
26
|
+
|
27
|
+
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
|
28
|
+
self.navigationItem.rightBarButtonItem = addButton;
|
29
|
+
}
|
30
|
+
|
31
|
+
- (void)didReceiveMemoryWarning {
|
32
|
+
[super didReceiveMemoryWarning];
|
33
|
+
// Dispose of any resources that can be recreated.
|
34
|
+
}
|
35
|
+
|
36
|
+
- (void)insertNewObject:(id)sender {
|
37
|
+
if (!_objects) {
|
38
|
+
_objects = [[NSMutableArray alloc] init];
|
39
|
+
}
|
40
|
+
[_objects insertObject:[NSDate date] atIndex:0];
|
41
|
+
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
|
42
|
+
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
43
|
+
}
|
44
|
+
|
45
|
+
#pragma mark - Table View
|
46
|
+
|
47
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
48
|
+
return 1;
|
49
|
+
}
|
50
|
+
|
51
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
52
|
+
return _objects.count;
|
53
|
+
}
|
54
|
+
|
55
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
56
|
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
57
|
+
|
58
|
+
NSDate *object = _objects[indexPath.row];
|
59
|
+
cell.textLabel.text = [object description];
|
60
|
+
return cell;
|
61
|
+
}
|
62
|
+
|
63
|
+
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
64
|
+
// Return NO if you do not want the specified item to be editable.
|
65
|
+
return YES;
|
66
|
+
}
|
67
|
+
|
68
|
+
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
69
|
+
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
70
|
+
[_objects removeObjectAtIndex:indexPath.row];
|
71
|
+
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
72
|
+
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
73
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
/*
|
78
|
+
// Override to support rearranging the table view.
|
79
|
+
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
80
|
+
}
|
81
|
+
*/
|
82
|
+
|
83
|
+
/*
|
84
|
+
// Override to support conditional rearranging of the table view.
|
85
|
+
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
86
|
+
// Return NO if you do not want the item to be re-orderable.
|
87
|
+
return YES;
|
88
|
+
}
|
89
|
+
*/
|
90
|
+
|
91
|
+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
92
|
+
if ([[segue identifier] isEqualToString:@"showDetail"]) {
|
93
|
+
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
|
94
|
+
NSDate *object = _objects[indexPath.row];
|
95
|
+
[[segue destinationViewController] setDetailItem:object];
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
@end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2524" systemVersion="12A217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
|
3
|
+
<dependencies>
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1863"/>
|
5
|
+
</dependencies>
|
6
|
+
<scenes>
|
7
|
+
<!--Navigation Controller-->
|
8
|
+
<scene sceneID="11">
|
9
|
+
<objects>
|
10
|
+
<navigationController id="3" sceneMemberID="viewController">
|
11
|
+
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="4">
|
12
|
+
<autoresizingMask key="autoresizingMask"/>
|
13
|
+
</navigationBar>
|
14
|
+
<connections>
|
15
|
+
<segue destination="12" kind="relationship" relationship="rootViewController" id="19"/>
|
16
|
+
</connections>
|
17
|
+
</navigationController>
|
18
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="10" sceneMemberID="firstResponder"/>
|
19
|
+
</objects>
|
20
|
+
<point key="canvasLocation" x="-1" y="64"/>
|
21
|
+
</scene>
|
22
|
+
<!--class Prefix:identifier Master View Controller - Master-->
|
23
|
+
<scene sceneID="18">
|
24
|
+
<objects>
|
25
|
+
<tableViewController storyboardIdentifier="" title="Master" id="12" customClass="MasterViewController" sceneMemberID="viewController">
|
26
|
+
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="13">
|
27
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
28
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
29
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
30
|
+
<prototypes>
|
31
|
+
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="phq-AM-6qj" style="IBUITableViewCellStyleDefault" id="lJ0-d7-vTF">
|
32
|
+
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
|
33
|
+
<autoresizingMask key="autoresizingMask"/>
|
34
|
+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
35
|
+
<rect key="frame" x="0.0" y="0.0" width="300" height="43"/>
|
36
|
+
<autoresizingMask key="autoresizingMask"/>
|
37
|
+
<subviews>
|
38
|
+
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" lineBreakMode="tailTruncation" autoshrinkMode="none" baselineAdjustment="alignBaselines" text="Title" adjustsFontSizeToFit="NO" id="phq-AM-6qj">
|
39
|
+
<rect key="frame" x="10" y="0.0" width="280" height="43"/>
|
40
|
+
<autoresizingMask key="autoresizingMask"/>
|
41
|
+
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
42
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
43
|
+
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
44
|
+
</label>
|
45
|
+
</subviews>
|
46
|
+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
47
|
+
</view>
|
48
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
49
|
+
<connections>
|
50
|
+
<segue destination="21" kind="push" identifier="showDetail" id="jZb-fq-zAk"/>
|
51
|
+
</connections>
|
52
|
+
</tableViewCell>
|
53
|
+
</prototypes>
|
54
|
+
<sections/>
|
55
|
+
<connections>
|
56
|
+
<outlet property="dataSource" destination="12" id="16"/>
|
57
|
+
<outlet property="delegate" destination="12" id="15"/>
|
58
|
+
</connections>
|
59
|
+
</tableView>
|
60
|
+
<navigationItem key="navigationItem" title="Master" id="36"/>
|
61
|
+
</tableViewController>
|
62
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="17" sceneMemberID="firstResponder"/>
|
63
|
+
</objects>
|
64
|
+
<point key="canvasLocation" x="459" y="64"/>
|
65
|
+
</scene>
|
66
|
+
<!--class Prefix:identifier Detail View Controller - Detail-->
|
67
|
+
<scene sceneID="24">
|
68
|
+
<objects>
|
69
|
+
<viewController storyboardIdentifier="" title="Detail" id="21" customClass="DetailViewController" sceneMemberID="viewController">
|
70
|
+
<view key="view" contentMode="scaleToFill" id="22">
|
71
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
72
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
73
|
+
<subviews>
|
74
|
+
<label translatesAutoresizingMaskIntoConstraints="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" lineBreakMode="tailTruncation" autoshrinkMode="none" minimumFontSize="10" text="Detail view content goes here" textAlignment="center" id="27">
|
75
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
76
|
+
<nil key="highlightedColor"/>
|
77
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
78
|
+
<fontDescription key="fontDescription" type="system" size="system"/>
|
79
|
+
</label>
|
80
|
+
</subviews>
|
81
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
82
|
+
<constraints>
|
83
|
+
<constraint firstItem="27" firstAttribute="centerY" secondItem="22" secondAttribute="centerY" type="default" id="7cE-gL-0wv"/>
|
84
|
+
<constraint firstItem="27" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="R0m-z7-TWk"/>
|
85
|
+
<constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="pRe-qY-58T"/>
|
86
|
+
</constraints>
|
87
|
+
</view>
|
88
|
+
<navigationItem key="navigationItem" title="Detail" id="26"/>
|
89
|
+
<connections>
|
90
|
+
<outlet property="detailDescriptionLabel" destination="27" id="28"/>
|
91
|
+
</connections>
|
92
|
+
</viewController>
|
93
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="23" sceneMemberID="firstResponder"/>
|
94
|
+
</objects>
|
95
|
+
<point key="canvasLocation" x="902" y="64"/>
|
96
|
+
</scene>
|
97
|
+
</scenes>
|
98
|
+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
99
|
+
<simulatedStatusBarMetrics key="statusBar"/>
|
100
|
+
<simulatedOrientationMetrics key="orientation"/>
|
101
|
+
<simulatedScreenMetrics key="destination" type="retina4"/>
|
102
|
+
</simulatedMetricsContainer>
|
103
|
+
</document>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// main.m
|
3
|
+
// FixbracesTestProject
|
4
|
+
//
|
5
|
+
//
|
6
|
+
|
7
|
+
#import <UIKit/UIKit.h>
|
8
|
+
|
9
|
+
#import "AppDelegate.h"
|
10
|
+
|
11
|
+
int main(int argc, char *argv[]) {
|
12
|
+
@autoreleasepool {
|
13
|
+
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
14
|
+
}
|
15
|
+
}
|