Merge pull request #23 from kylef/kylef/swift-1.2

Support Swift 1.2
This commit is contained in:
Kyle Fuller
2015-06-29 16:36:41 -07:00
24 changed files with 218 additions and 218 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "PathKit"]
path = PathKit
url = https://github.com/kylef/PathKit

View File

@@ -1,10 +0,0 @@
language: objective-c
osx_image: xcode61
before_install:
- gem install cocoapods --pre
- gem install xcpretty
script:
- set -o pipefail
- xcodebuild -project Stencil.xcodeproj -scheme Stencil test | xcpretty -c
- xcodebuild -project Stencil.xcodeproj -scheme Stencil test -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
- pod lib lint --quick

View File

@@ -1,18 +0,0 @@
//
// UniversalFramework_Base.xcconfig
// Stencil
//
// Created by Marius Rackwitz on 29/11/14.
// Copyright (c) 2014 Marius Rackwitz. All rights reserved.
//
// Make it universal
SUPPORTED_PLATFORMS = iphonesimulator iphoneos macosx
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
VALID_ARCHS[sdk=iphonesimulator*] = arm64 armv7 armv7s
VALID_ARCHS[sdk=macosx*] = i386 x86_64
// Dynamic linking uses different default copy paths
LD_RUNPATH_SEARCH_PATHS[sdk=iphoneos*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LD_RUNPATH_SEARCH_PATHS[sdk=iphonesimulator*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'

View File

@@ -1,18 +0,0 @@
//
// UniversalFramework_Framework.xcconfig
// Stencil
//
// Created by Marius Rackwitz on 29/11/14.
// Copyright (c) 2014 Marius Rackwitz. All rights reserved.
//
#include "UniversalFramework_Base.xcconfig"
// iOS-specific default settings
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
TARGETED_DEVICE_FAMILY[sdk=iphonesimulator*] = 1,2
TARGETED_DEVICE_FAMILY[sdk=iphone*] = 1,2
// OSX-specific default settings
FRAMEWORK_VERSION[sdk=macosx*] = A
COMBINE_HIDPI_IMAGES[sdk=macosx*] = YES

View File

@@ -1,16 +0,0 @@
//
// UniversalFramework_Test.xcconfig
// Stencil
//
// Created by Marius Rackwitz on 29/11/14.
// Copyright (c) 2014 Marius Rackwitz. All rights reserved.
//
#include "UniversalFramework_Base.xcconfig"
FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*] = $(inherited) '$(SDKROOT)/Developer/Library/Frameworks'
FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*] = $(inherited) '$(SDKROOT)/Developer/Library/Frameworks'
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(inherited) '$(DEVELOPER_FRAMEWORKS_DIR)'
// Yep.
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks'

Submodule PathKit deleted from fe8fcbe836

10
Podfile Normal file
View File

@@ -0,0 +1,10 @@
use_frameworks!
target 'Stencil' do
podspec
end
target 'StencilTests' do
podspec
end

10
Podfile.lock Normal file
View File

@@ -0,0 +1,10 @@
PODS:
- PathKit (0.3.0)
DEPENDENCIES:
- PathKit (~> 0.3.0)
SPEC CHECKSUMS:
PathKit: 0f4d1becb7002e3cd62a1583ce8de964d57485ce
COCOAPODS: 0.37.2

View File

@@ -1,14 +1,12 @@
Stencil Stencil
======= =======
[![Build Status](http://img.shields.io/travis/kylef/Stencil/master.svg?style=flat)](https://travis-ci.org/kylef/Stencil) [![Build Status](http://img.shields.io/circleci/project/kylef/Stencil/master.svg](https://circleci.com/gh/kylef/Stencil)
Stencil is a simple and powerful template language for Swift. It provides a Stencil is a simple and powerful template language for Swift. It provides a
syntax similar to Django and Mustache. If you're familiar with these, you will syntax similar to Django and Mustache. If you're familiar with these, you will
feel right at home with Stencil. feel right at home with Stencil.
*NOTE: Stencil requires Xcode 6.1.*
### Example ### Example
```html+django ```html+django
@@ -40,16 +38,12 @@ switch result {
## Installation ## Installation
Installation with CocoaPods is recommended using CocoaPods 0.36. Installation with CocoaPods is recommended.
```ruby ```ruby
pod 'Stencil' pod 'Stencil'
``` ```
### Sub-projects
Alternatively, you can clone Stencil via git or as a submodule and include `Stencil.xcodeproj` inside your project and add `Stencil.framework` as a target dependency.
## Philosophy ## Philosophy
Stencil follows the same philosophy of Django: Stencil follows the same philosophy of Django:

View File

@@ -7,8 +7,10 @@ Pod::Spec.new do |spec|
spec.author = { 'Kyle Fuller' => 'inbox@kylefuller.co.uk' } spec.author = { 'Kyle Fuller' => 'inbox@kylefuller.co.uk' }
spec.social_media_url = 'http://twitter.com/kylefuller' spec.social_media_url = 'http://twitter.com/kylefuller'
spec.source = { :git => 'https://github.com/kylef/Stencil.git', :tag => "#{spec.version}" } spec.source = { :git => 'https://github.com/kylef/Stencil.git', :tag => "#{spec.version}" }
spec.source_files = 'Stencil/*.{h,swift}' spec.source_files = 'Stencil/*.swift', 'Stencil/TemplateLoader/*.swift'
spec.ios.deployment_target = '8.0'
spec.osx.deployment_target = '10.9'
spec.requires_arc = true spec.requires_arc = true
spec.dependency 'PathKit' spec.dependency 'PathKit', '~> 0.3.0'
end end

View File

@@ -7,14 +7,13 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1474245D3CE34A8BC76F8D20 /* Pods_StencilTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E4E61A4F4EA12FE3FA6E39 /* Pods_StencilTests.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
27CE0ADE1A50BEC3004A105B /* TemplateLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0ADD1A50BEC3004A105B /* TemplateLoader.swift */; }; 27CE0ADE1A50BEC3004A105B /* TemplateLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0ADD1A50BEC3004A105B /* TemplateLoader.swift */; };
27CE0AE01A50BF05004A105B /* TemplateLoaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0ADF1A50BF05004A105B /* TemplateLoaderTests.swift */; }; 27CE0AE01A50BF05004A105B /* TemplateLoaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0ADF1A50BF05004A105B /* TemplateLoaderTests.swift */; };
27CE0AFA1A50C963004A105B /* test.html in Resources */ = {isa = PBXBuildFile; fileRef = 27CE0AF91A50C963004A105B /* test.html */; }; 27CE0AFA1A50C963004A105B /* test.html in Resources */ = {isa = PBXBuildFile; fileRef = 27CE0AF91A50C963004A105B /* test.html */; };
27CE0B011A50CBD1004A105B /* Include.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0B001A50CBD1004A105B /* Include.swift */; }; 27CE0B011A50CBD1004A105B /* Include.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0B001A50CBD1004A105B /* Include.swift */; };
27CE0B041A50CBEA004A105B /* IncludeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0B031A50CBEA004A105B /* IncludeTests.swift */; }; 27CE0B041A50CBEA004A105B /* IncludeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27CE0B031A50CBEA004A105B /* IncludeTests.swift */; };
27E2138D1A4CD5F50073E063 /* UniversalFramework_Base.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 27E2138A1A4CD5F50073E063 /* UniversalFramework_Base.xcconfig */; }; 32C6976B95F3D42995990054 /* Pods_Stencil.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A574F1600267822AA34CB00 /* Pods_Stencil.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
27E2138E1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 27E2138B1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig */; };
27E2138F1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 27E2138C1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig */; };
71CE4C0A19FD29D000B9E0C5 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CE4C0919FD29D000B9E0C5 /* Result.swift */; }; 71CE4C0A19FD29D000B9E0C5 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CE4C0919FD29D000B9E0C5 /* Result.swift */; };
7725B3CB19F92B4F002CF74B /* VariableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7725B3CA19F92B4F002CF74B /* VariableTests.swift */; }; 7725B3CB19F92B4F002CF74B /* VariableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7725B3CA19F92B4F002CF74B /* VariableTests.swift */; };
7725B3CD19F92B61002CF74B /* Variable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7725B3CC19F92B61002CF74B /* Variable.swift */; }; 7725B3CD19F92B61002CF74B /* Variable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7725B3CC19F92B61002CF74B /* Variable.swift */; };
@@ -35,27 +34,6 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
27CE0AE61A50BFAF004A105B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 77DCBACA1A1E2A750054C841;
remoteInfo = PathKit;
};
27CE0AE81A50BFAF004A105B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 77DCBAD51A1E2A750054C841;
remoteInfo = PathKitTests;
};
27CE0AEA1A50BFBF004A105B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 77DCBAC91A1E2A750054C841;
remoteInfo = PathKit;
};
27CE0AF51A50C292004A105B /* PBXContainerItemProxy */ = { 27CE0AF51A50C292004A105B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 77FAAE4919F91E480029DC5E /* Project object */; containerPortal = 77FAAE4919F91E480029DC5E /* Project object */;
@@ -63,25 +41,17 @@
remoteGlobalIDString = 77FAAE5119F91E480029DC5E; remoteGlobalIDString = 77FAAE5119F91E480029DC5E;
remoteInfo = Stencil; remoteInfo = Stencil;
}; };
27CE0AF71A50C299004A105B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 77DCBAC91A1E2A750054C841;
remoteInfo = PathKit;
};
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
216AE96E764D5BD92D11049B /* Pods-Stencil.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stencil.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Stencil/Pods-Stencil.debug.xcconfig"; sourceTree = "<group>"; };
27CE0ADD1A50BEC3004A105B /* TemplateLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateLoader.swift; sourceTree = "<group>"; }; 27CE0ADD1A50BEC3004A105B /* TemplateLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateLoader.swift; sourceTree = "<group>"; };
27CE0ADF1A50BF05004A105B /* TemplateLoaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateLoaderTests.swift; sourceTree = "<group>"; }; 27CE0ADF1A50BF05004A105B /* TemplateLoaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateLoaderTests.swift; sourceTree = "<group>"; };
27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PathKit.xcodeproj; path = PathKit/PathKit.xcodeproj; sourceTree = "<group>"; };
27CE0AF91A50C963004A105B /* test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = test.html; sourceTree = "<group>"; }; 27CE0AF91A50C963004A105B /* test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = test.html; sourceTree = "<group>"; };
27CE0B001A50CBD1004A105B /* Include.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Include.swift; sourceTree = "<group>"; }; 27CE0B001A50CBD1004A105B /* Include.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Include.swift; sourceTree = "<group>"; };
27CE0B031A50CBEA004A105B /* IncludeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IncludeTests.swift; sourceTree = "<group>"; }; 27CE0B031A50CBEA004A105B /* IncludeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IncludeTests.swift; sourceTree = "<group>"; };
27E2138A1A4CD5F50073E063 /* UniversalFramework_Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = UniversalFramework_Base.xcconfig; sourceTree = "<group>"; }; 40E4E61A4F4EA12FE3FA6E39 /* Pods_StencilTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_StencilTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
27E2138B1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = UniversalFramework_Framework.xcconfig; sourceTree = "<group>"; }; 604897C26D7C87809187940C /* Pods-StencilTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StencilTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-StencilTests/Pods-StencilTests.release.xcconfig"; sourceTree = "<group>"; };
27E2138C1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = UniversalFramework_Test.xcconfig; sourceTree = "<group>"; };
71CE4C0919FD29D000B9E0C5 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = "<group>"; }; 71CE4C0919FD29D000B9E0C5 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = "<group>"; };
7725B3CA19F92B4F002CF74B /* VariableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VariableTests.swift; sourceTree = "<group>"; }; 7725B3CA19F92B4F002CF74B /* VariableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VariableTests.swift; sourceTree = "<group>"; };
7725B3CC19F92B61002CF74B /* Variable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Variable.swift; sourceTree = "<group>"; }; 7725B3CC19F92B61002CF74B /* Variable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Variable.swift; sourceTree = "<group>"; };
@@ -102,6 +72,9 @@
77FAAE6419F91E480029DC5E /* StencilTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StencilTests.swift; sourceTree = "<group>"; }; 77FAAE6419F91E480029DC5E /* StencilTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StencilTests.swift; sourceTree = "<group>"; };
77FAAE6E19F920750029DC5E /* Context.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Context.swift; sourceTree = "<group>"; }; 77FAAE6E19F920750029DC5E /* Context.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Context.swift; sourceTree = "<group>"; };
77FAAE7019F9208C0029DC5E /* ContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextTests.swift; sourceTree = "<group>"; }; 77FAAE7019F9208C0029DC5E /* ContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextTests.swift; sourceTree = "<group>"; };
7A574F1600267822AA34CB00 /* Pods_Stencil.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Stencil.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A4451BEDB5F71116FF3216CC /* Pods-Stencil.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stencil.release.xcconfig"; path = "Pods/Target Support Files/Pods-Stencil/Pods-Stencil.release.xcconfig"; sourceTree = "<group>"; };
AB71617F99ED5A669D83419F /* Pods-StencilTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StencilTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-StencilTests/Pods-StencilTests.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@@ -109,6 +82,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
32C6976B95F3D42995990054 /* Pods_Stencil.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -117,21 +91,13 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
77FAAE5E19F91E480029DC5E /* Stencil.framework in Frameworks */, 77FAAE5E19F91E480029DC5E /* Stencil.framework in Frameworks */,
1474245D3CE34A8BC76F8D20 /* Pods_StencilTests.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
27CE0AE21A50BFAF004A105B /* Products */ = {
isa = PBXGroup;
children = (
27CE0AE71A50BFAF004A105B /* PathKit.framework */,
27CE0AE91A50BFAF004A105B /* PathKitTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
27CE0AFF1A50CBBF004A105B /* TemplateLoader */ = { 27CE0AFF1A50CBBF004A105B /* TemplateLoader */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -148,24 +114,14 @@
path = TemplateLoader; path = TemplateLoader;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
27E213891A4CD5F50073E063 /* Configurations */ = {
isa = PBXGroup;
children = (
27E2138A1A4CD5F50073E063 /* UniversalFramework_Base.xcconfig */,
27E2138B1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig */,
27E2138C1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig */,
);
path = Configurations;
sourceTree = SOURCE_ROOT;
};
77FAAE4819F91E480029DC5E = { 77FAAE4819F91E480029DC5E = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */,
77FAAE5419F91E480029DC5E /* Stencil */, 77FAAE5419F91E480029DC5E /* Stencil */,
77FAAE6119F91E480029DC5E /* StencilTests */, 77FAAE6119F91E480029DC5E /* StencilTests */,
27E213891A4CD5F50073E063 /* Configurations */,
77FAAE5319F91E480029DC5E /* Products */, 77FAAE5319F91E480029DC5E /* Products */,
F0837D60120FB15CC00B9EBD /* Pods */,
BE2E2DF8F488C4669126E920 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@@ -231,6 +187,26 @@
name = "Supporting Files"; name = "Supporting Files";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
BE2E2DF8F488C4669126E920 /* Frameworks */ = {
isa = PBXGroup;
children = (
7A574F1600267822AA34CB00 /* Pods_Stencil.framework */,
40E4E61A4F4EA12FE3FA6E39 /* Pods_StencilTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
F0837D60120FB15CC00B9EBD /* Pods */ = {
isa = PBXGroup;
children = (
216AE96E764D5BD92D11049B /* Pods-Stencil.debug.xcconfig */,
A4451BEDB5F71116FF3216CC /* Pods-Stencil.release.xcconfig */,
AB71617F99ED5A669D83419F /* Pods-StencilTests.debug.xcconfig */,
604897C26D7C87809187940C /* Pods-StencilTests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */ /* Begin PBXHeadersBuildPhase section */
@@ -249,15 +225,16 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 77FAAE6819F91E480029DC5E /* Build configuration list for PBXNativeTarget "Stencil" */; buildConfigurationList = 77FAAE6819F91E480029DC5E /* Build configuration list for PBXNativeTarget "Stencil" */;
buildPhases = ( buildPhases = (
2F5F764C3F2D9B507C32F902 /* Check Pods Manifest.lock */,
77FAAE4D19F91E480029DC5E /* Sources */, 77FAAE4D19F91E480029DC5E /* Sources */,
77FAAE4E19F91E480029DC5E /* Frameworks */, 77FAAE4E19F91E480029DC5E /* Frameworks */,
77FAAE4F19F91E480029DC5E /* Headers */, 77FAAE4F19F91E480029DC5E /* Headers */,
77FAAE5019F91E480029DC5E /* Resources */, 77FAAE5019F91E480029DC5E /* Resources */,
99E82E6639BC7C1A0E1E28DC /* Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
27CE0AEB1A50BFBF004A105B /* PBXTargetDependency */,
); );
name = Stencil; name = Stencil;
productName = Stencil; productName = Stencil;
@@ -268,14 +245,16 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 77FAAE6B19F91E480029DC5E /* Build configuration list for PBXNativeTarget "StencilTests" */; buildConfigurationList = 77FAAE6B19F91E480029DC5E /* Build configuration list for PBXNativeTarget "StencilTests" */;
buildPhases = ( buildPhases = (
2D3D90E839235D400843A900 /* Check Pods Manifest.lock */,
77FAAE5919F91E480029DC5E /* Sources */, 77FAAE5919F91E480029DC5E /* Sources */,
77FAAE5A19F91E480029DC5E /* Frameworks */, 77FAAE5A19F91E480029DC5E /* Frameworks */,
77FAAE5B19F91E480029DC5E /* Resources */, 77FAAE5B19F91E480029DC5E /* Resources */,
A3AAD60B3C344DD6993AE800 /* Embed Pods Frameworks */,
BD3457ACA3F28092E2EBD7C4 /* Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
27CE0AF81A50C299004A105B /* PBXTargetDependency */,
27CE0AF61A50C292004A105B /* PBXTargetDependency */, 27CE0AF61A50C292004A105B /* PBXTargetDependency */,
); );
name = StencilTests; name = StencilTests;
@@ -289,7 +268,7 @@
77FAAE4919F91E480029DC5E /* Project object */ = { 77FAAE4919F91E480029DC5E /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0600; LastUpgradeCheck = 0630;
ORGANIZATIONNAME = Cocode; ORGANIZATIONNAME = Cocode;
TargetAttributes = { TargetAttributes = {
77FAAE5119F91E480029DC5E = { 77FAAE5119F91E480029DC5E = {
@@ -310,12 +289,6 @@
mainGroup = 77FAAE4819F91E480029DC5E; mainGroup = 77FAAE4819F91E480029DC5E;
productRefGroup = 77FAAE5319F91E480029DC5E /* Products */; productRefGroup = 77FAAE5319F91E480029DC5E /* Products */;
projectDirPath = ""; projectDirPath = "";
projectReferences = (
{
ProductGroup = 27CE0AE21A50BFAF004A105B /* Products */;
ProjectRef = 27CE0AE11A50BFAF004A105B /* PathKit.xcodeproj */;
},
);
projectRoot = ""; projectRoot = "";
targets = ( targets = (
77FAAE5119F91E480029DC5E /* Stencil */, 77FAAE5119F91E480029DC5E /* Stencil */,
@@ -324,31 +297,11 @@
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */
27CE0AE71A50BFAF004A105B /* PathKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = PathKit.framework;
remoteRef = 27CE0AE61A50BFAF004A105B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
27CE0AE91A50BFAF004A105B /* PathKitTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = PathKitTests.xctest;
remoteRef = 27CE0AE81A50BFAF004A105B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
77FAAE5019F91E480029DC5E /* Resources */ = { 77FAAE5019F91E480029DC5E /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
27E2138F1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig in Resources */,
27E2138E1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig in Resources */,
27E2138D1A4CD5F50073E063 /* UniversalFramework_Base.xcconfig in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -362,6 +315,84 @@
}; };
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
2D3D90E839235D400843A900 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
2F5F764C3F2D9B507C32F902 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
99E82E6639BC7C1A0E1E28DC /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Stencil/Pods-Stencil-resources.sh\"\n";
showEnvVarsInLog = 0;
};
A3AAD60B3C344DD6993AE800 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-StencilTests/Pods-StencilTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BD3457ACA3F28092E2EBD7C4 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-StencilTests/Pods-StencilTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
77FAAE4D19F91E480029DC5E /* Sources */ = { 77FAAE4D19F91E480029DC5E /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
@@ -399,21 +430,11 @@
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */ /* Begin PBXTargetDependency section */
27CE0AEB1A50BFBF004A105B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = PathKit;
targetProxy = 27CE0AEA1A50BFBF004A105B /* PBXContainerItemProxy */;
};
27CE0AF61A50C292004A105B /* PBXTargetDependency */ = { 27CE0AF61A50C292004A105B /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = 77FAAE5119F91E480029DC5E /* Stencil */; target = 77FAAE5119F91E480029DC5E /* Stencil */;
targetProxy = 27CE0AF51A50C292004A105B /* PBXContainerItemProxy */; targetProxy = 27CE0AF51A50C292004A105B /* PBXContainerItemProxy */;
}; };
27CE0AF81A50C299004A105B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = PathKit;
targetProxy = 27CE0AF71A50C299004A105B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@@ -500,7 +521,7 @@
}; };
77FAAE6919F91E480029DC5E /* Debug */ = { 77FAAE6919F91E480029DC5E /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 27E2138B1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig */; baseConfigurationReference = 216AE96E764D5BD92D11049B /* Pods-Stencil.debug.xcconfig */;
buildSettings = { buildSettings = {
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
@@ -511,6 +532,7 @@
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Stencil/Info.plist; INFOPLIST_FILE = Stencil/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -519,7 +541,7 @@
}; };
77FAAE6A19F91E480029DC5E /* Release */ = { 77FAAE6A19F91E480029DC5E /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 27E2138B1A4CD5F50073E063 /* UniversalFramework_Framework.xcconfig */; baseConfigurationReference = A4451BEDB5F71116FF3216CC /* Pods-Stencil.release.xcconfig */;
buildSettings = { buildSettings = {
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
@@ -530,6 +552,7 @@
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Stencil/Info.plist; INFOPLIST_FILE = Stencil/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
@@ -537,24 +560,34 @@
}; };
77FAAE6C19F91E480029DC5E /* Debug */ = { 77FAAE6C19F91E480029DC5E /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 27E2138C1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig */; baseConfigurationReference = AB71617F99ED5A669D83419F /* Pods-StencilTests.debug.xcconfig */;
buildSettings = { buildSettings = {
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
"$(inherited)", "$(inherited)",
); );
INFOPLIST_FILE = StencilTests/Info.plist; INFOPLIST_FILE = StencilTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Debug; name = Debug;
}; };
77FAAE6D19F91E480029DC5E /* Release */ = { 77FAAE6D19F91E480029DC5E /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 27E2138C1A4CD5F50073E063 /* UniversalFramework_Test.xcconfig */; baseConfigurationReference = 604897C26D7C87809187940C /* Pods-StencilTests.release.xcconfig */;
buildSettings = { buildSettings = {
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
INFOPLIST_FILE = StencilTests/Info.plist; INFOPLIST_FILE = StencilTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Release; name = Release;

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0610" LastUpgradeVersion = "0630"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Stencil.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -31,7 +31,7 @@ public struct Lexer {
var tokens = [Token]() var tokens = [Token]()
let range = NSMakeRange(0, countElements(templateString)) let range = NSMakeRange(0, count(templateString))
var lastIndex = 0 var lastIndex = 0
let nsTemplateString = templateString as NSString let nsTemplateString = templateString as NSString
let options = NSMatchingOptions(0) let options = NSMatchingOptions(0)
@@ -47,7 +47,7 @@ public struct Lexer {
lastIndex = result.range.location + result.range.length lastIndex = result.range.location + result.range.length
} }
if lastIndex < countElements(templateString) { if lastIndex < count(templateString) {
let substring = (templateString as NSString).substringFromIndex(lastIndex) let substring = (templateString as NSString).substringFromIndex(lastIndex)
tokens.append(Token.Text(value: substring)) tokens.append(Token.Text(value: substring))
} }

View File

@@ -148,9 +148,8 @@ public class ForNode : Node {
public class func parse(parser:TokenParser, token:Token) -> TokenParser.Result { public class func parse(parser:TokenParser, token:Token) -> TokenParser.Result {
let components = token.components() let components = token.components()
let count = countElements(components)
if count == 4 && components[2] == "in" { if count(components) == 4 && components[2] == "in" {
let loopVariable = components[1] let loopVariable = components[1]
let variable = components[3] let variable = components[3]
@@ -161,7 +160,7 @@ public class ForNode : Node {
case .Success(let nodes): case .Success(let nodes):
forNodes = nodes forNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
if let token = parser.nextToken() { if let token = parser.nextToken() {
@@ -170,7 +169,7 @@ public class ForNode : Node {
case .Success(let nodes): case .Success(let nodes):
emptyNodes = nodes emptyNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
parser.nextToken() parser.nextToken()
@@ -229,7 +228,7 @@ public class IfNode : Node {
case .Success(let nodes): case .Success(let nodes):
trueNodes = nodes trueNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
if let token = parser.nextToken() { if let token = parser.nextToken() {
@@ -238,7 +237,7 @@ public class IfNode : Node {
case .Success(let nodes): case .Success(let nodes):
falseNodes = nodes falseNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
parser.nextToken() parser.nextToken()
} }
@@ -258,7 +257,7 @@ public class IfNode : Node {
case .Success(let nodes): case .Success(let nodes):
falseNodes = nodes falseNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
if let token = parser.nextToken() { if let token = parser.nextToken() {
@@ -267,7 +266,7 @@ public class IfNode : Node {
case .Success(let nodes): case .Success(let nodes):
trueNodes = nodes trueNodes = nodes
case .Error(let error): case .Error(let error):
return .Error(error) return .Error(error: error)
} }
parser.nextToken() parser.nextToken()
} }

View File

@@ -32,11 +32,11 @@ public class TokenParser {
public init(tokens:[Token]) { public init(tokens:[Token]) {
self.tokens = tokens self.tokens = tokens
registerTag("for", ForNode.parse) registerTag("for", parser: ForNode.parse)
registerTag("if", IfNode.parse) registerTag("if", parser: IfNode.parse)
registerTag("ifnot", IfNode.parse_ifnot) registerTag("ifnot", parser: IfNode.parse_ifnot)
registerTag("now", NowNode.parse) registerTag("now", parser: NowNode.parse)
registerTag("include", IncludeNode.parse) registerTag("include", parser: IncludeNode.parse)
} }
/// Registers a new template tag /// Registers a new template tag

View File

@@ -28,7 +28,7 @@ public class Template {
var error:NSError? var error:NSError?
let maybeTemplateString = NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding, error: &error) let maybeTemplateString = NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding, error: &error)
if let templateString = maybeTemplateString { if let templateString = maybeTemplateString {
self.init(templateString:templateString) self.init(templateString:templateString as String)
} else { } else {
self.init(templateString:"") self.init(templateString:"")
return nil return nil

View File

@@ -35,7 +35,7 @@ public struct Variable : Equatable {
} else if bit == "last" { } else if bit == "last" {
current = array.last current = array.last
} else if bit == "count" { } else if bit == "count" {
current = countElements(array) current = count(array)
} }
} else if let object = current as? NSObject { } else if let object = current as? NSObject {
current = object.valueForKey(bit) current = object.valueForKey(bit)

View File

@@ -10,14 +10,14 @@ class ContextTests: XCTestCase {
} }
func testItAllowsYouToRetrieveAValue() { func testItAllowsYouToRetrieveAValue() {
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Kyle") XCTAssertEqual(name, "Kyle")
} }
func testItAllowsYouToSetValue() { func testItAllowsYouToSetValue() {
context["name"] = "Katie" context["name"] = "Katie"
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Katie") XCTAssertEqual(name, "Katie")
} }
@@ -29,7 +29,7 @@ class ContextTests: XCTestCase {
func testItAllowsYouToRetrieveAValueFromParent() { func testItAllowsYouToRetrieveAValueFromParent() {
context.push() context.push()
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Kyle") XCTAssertEqual(name, "Kyle")
} }
@@ -37,7 +37,7 @@ class ContextTests: XCTestCase {
context.push() context.push()
context["name"] = "Katie" context["name"] = "Katie"
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Katie") XCTAssertEqual(name, "Katie")
} }
@@ -46,20 +46,20 @@ class ContextTests: XCTestCase {
context["name"] = "Katie" context["name"] = "Katie"
context.pop() context.pop()
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Kyle") XCTAssertEqual(name, "Kyle")
} }
func testItAllowsYouToPushADictionaryToTheStack() { func testItAllowsYouToPushADictionaryToTheStack() {
context.push(["name": "Katie"]) context.push(["name": "Katie"])
let name = context["name"] as String! let name = context["name"] as! String
XCTAssertEqual(name, "Katie") XCTAssertEqual(name, "Katie")
} }
func testItAllowsYouToCompareTwoContextsForEquality() { func testItAllowsYouToCompareTwoContextsForEquality() {
let otherContext = Context(dictionary: ["name": "Kyle"]) let otherContext = Context(dictionary: ["name": "Kyle"])
XCTAssertEqual(otherContext, context ) XCTAssertEqual(otherContext, context)
} }
} }

View File

@@ -119,9 +119,9 @@ class IfNodeTests: NodeTests {
let parser = TokenParser(tokens: tokens) let parser = TokenParser(tokens: tokens)
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first! as IfNode let node = nodes.first as! IfNode
let trueNode = node.trueNodes.first! as TextNode let trueNode = node.trueNodes.first as! TextNode
let falseNode = node.falseNodes.first! as TextNode let falseNode = node.falseNodes.first as! TextNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.variable.variable, "value") XCTAssertEqual(node.variable.variable, "value")
@@ -143,9 +143,9 @@ class IfNodeTests: NodeTests {
let parser = TokenParser(tokens: tokens) let parser = TokenParser(tokens: tokens)
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first! as IfNode let node = nodes.first as! IfNode
let trueNode = node.trueNodes.first! as TextNode let trueNode = node.trueNodes.first as! TextNode
let falseNode = node.falseNodes.first! as TextNode let falseNode = node.falseNodes.first as! TextNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.variable.variable, "value") XCTAssertEqual(node.variable.variable, "value")
@@ -211,7 +211,7 @@ class NowNodeTests: NodeTests {
let parser = TokenParser(tokens: tokens) let parser = TokenParser(tokens: tokens)
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first! as NowNode let node = nodes.first as! NowNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.format.variable, "\"yyyy-MM-dd 'at' HH:mm\"") XCTAssertEqual(node.format.variable, "\"yyyy-MM-dd 'at' HH:mm\"")
} }
@@ -222,7 +222,7 @@ class NowNodeTests: NodeTests {
let parser = TokenParser(tokens: tokens) let parser = TokenParser(tokens: tokens)
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first! as NowNode let node = nodes.first as! NowNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.format.variable, "\"HH:mm\"") XCTAssertEqual(node.format.variable, "\"HH:mm\"")
} }

View File

@@ -9,7 +9,7 @@ class TokenParserTests: XCTestCase {
]) ])
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first as TextNode! let node = nodes.first as! TextNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.text, "Hello World") XCTAssertEqual(node.text, "Hello World")
} }
@@ -21,7 +21,7 @@ class TokenParserTests: XCTestCase {
]) ])
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first as VariableNode! let node = nodes.first as! VariableNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.variable, Variable("name")) XCTAssertEqual(node.variable, Variable("name"))
} }

View File

@@ -28,7 +28,7 @@ class IncludeTests: NodeTests {
let parser = TokenParser(tokens: tokens) let parser = TokenParser(tokens: tokens)
assertSuccess(parser.parse()) { nodes in assertSuccess(parser.parse()) { nodes in
let node = nodes.first! as IncludeNode let node = nodes.first as! IncludeNode
XCTAssertEqual(nodes.count, 1) XCTAssertEqual(nodes.count, 1)
XCTAssertEqual(node.templateName, "test.html") XCTAssertEqual(node.templateName, "test.html")
} }

View File

@@ -20,43 +20,43 @@ class VariableTests: XCTestCase {
func testResolvingStringLiteral() { func testResolvingStringLiteral() {
let variable = Variable("\"name\"") let variable = Variable("\"name\"")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "name") XCTAssertEqual(result, "name")
} }
func testResolvingVariable() { func testResolvingVariable() {
let variable = Variable("name") let variable = Variable("name")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "Kyle") XCTAssertEqual(result, "Kyle")
} }
func testResolvingItemFromDictionary() { func testResolvingItemFromDictionary() {
let variable = Variable("profiles.github") let variable = Variable("profiles.github")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "kylef") XCTAssertEqual(result, "kylef")
} }
func testResolvingItemFromArrayWithIndex() { func testResolvingItemFromArrayWithIndex() {
let variable = Variable("contacts.0") let variable = Variable("contacts.0")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "Katie") XCTAssertEqual(result, "Katie")
} }
func testResolvingFirstItemFromArray() { func testResolvingFirstItemFromArray() {
let variable = Variable("contacts.first") let variable = Variable("contacts.first")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "Katie") XCTAssertEqual(result, "Katie")
} }
func testResolvingLastItemFromArray() { func testResolvingLastItemFromArray() {
let variable = Variable("contacts.last") let variable = Variable("contacts.last")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "Orta") XCTAssertEqual(result, "Orta")
} }
func testResolvingValueViaKVO() { func testResolvingValueViaKVO() {
let variable = Variable("object.title") let variable = Variable("object.title")
let result = variable.resolve(context) as String! let result = variable.resolve(context) as! String
XCTAssertEqual(result, "Hello World") XCTAssertEqual(result, "Hello World")
} }
} }

8
circle.yml Normal file
View File

@@ -0,0 +1,8 @@
machine:
xcode:
version: "6.3.1"
test:
override:
- set -o pipefail && xcodebuild -workspace Stencil.xcworkspace -scheme Stencil test | tee $CIRCLE_ARTIFACTS/xcode_raw_ios.log | xcpretty -c
- pod lib lint