Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
truizlop committed Mar 25, 2019
2 parents 076f116 + 1c7fa1c commit 0c41ac0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion bin/nef-jekyll
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ makeStructure() {
local logPath="$1/$LOG_PATH" # parameter `project`
local sitePath="$2" # parameter `site`
local sidebarFolderPath="$2/$BASE_SIDEBAR"
local baseJekyllPath="$sitePath/$BASE_JEKYLL"

cleanStructure "$logPath"
cleanStructure "$sitePath"
cleanStructure "$baseJekyllPath"

mkdir -p "$logPath"
mkdir -p "$sidebarFolderPath"
mkdir -p "$baseJekyllPath"
}

cleanStructure() {
Expand Down
12 changes: 10 additions & 2 deletions bin/nefc
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,16 @@ buildPODS() {
# - Parameter `folder`: path to the project folder.
##
addPlaygroundReference() {
cd "$1"
playgroundForProjectPath "$1"
projectPath="$1"
cd "$projectPath"
playgroundForProjectPath "$projectPath"

local logPath="nef/log"
local pattern="<FileRef"

find . -name '*.pbxproj' -print0 | while IFS= read -r -d $'\0' project; do
workspace=$(workspaceForProjectPath "$1" "$project")
workspaceName=$(echo $workspace | rev | cut -d'/' -f 1 | rev | cut -d'.' -f 1)
workspaceContent="$workspace/contents.xcworkspacedata"
! [[ $workspace = .*".xcworkspace" ]] && continue
grep -q ".playground" "$workspaceContent"; [ $? -eq 0 ] && continue
Expand All @@ -200,6 +203,10 @@ addPlaygroundReference() {
playgroundScaped=$(echo "$playground" | sed 's/\//\\\//g')
sed -i '' "1,/<FileRef/s/<FileRef/<FileRef location = \"group:$playgroundScaped\"> <\/FileRef><FileRef/" "$workspaceContent"
done

tmp="$logPath/$workspaceName.tmp.xcworkspace"
awk '{ gsub("FileRef><FileRef", "FileRef>\n<FileRef") }1' "$workspaceContent" 1> "$tmp"
mv "$tmp" "$workspaceContent"
done
}

Expand All @@ -213,6 +220,7 @@ playgroundForProjectPath() {

playgroundForProjectPath=()
while read -r -d $'\0' playground; do
playground=$(echo "$playground" | sed 's/.\///g')
playgroundForProjectPath+=("$playground")
done < <(find . -name '*.playground' -print0)

Expand Down
2 changes: 1 addition & 1 deletion lib/Markup/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ typealias SubstringType = (ouput: String, range: NSRange)

extension String {
func substring(pattern: String) -> SubstringType? {
let range = NSRange(location: 0, length: self.utf8.count)
let range = NSRange(location: 0, length: self.count)
guard let regex = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive),
let match = regex.firstMatch(in: self, options: [], range: range) else { return nil }

Expand Down
4 changes: 2 additions & 2 deletions lib/MarkupTests/MarkupSyntaxTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ class MarkupSyntaxTests: XCTestCase {
let input = """
/*:
// nef:begin:hidden
This is a visible markup multiline
This is a visible 👀 markup multiline ©
// nef:end
*/
"""
let expected: [Node] = [.markup(description: .some(""), "This is a visible markup multiline\n")]
let expected: [Node] = [.markup(description: .some(""), "This is a visible 👀 markup multiline ©\n")]

let result = Markup.SyntaxAnalyzer.parse(content: input)

Expand Down

0 comments on commit 0c41ac0

Please sign in to comment.