├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ └── feature_request.md └── workflows │ ├── bump-formula.yml │ ├── deploy-docs.yml │ ├── nef-compile.yml │ ├── swift.yml │ └── xcode.yml ├── .gitignore ├── .mailmap ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Documentation.app ├── Contents │ ├── Info.plist │ ├── MacOS │ │ ├── Command-Line.playground │ │ │ ├── Pages │ │ │ │ ├── Compiling a nef Playground.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── Creating a Playground Book for iPad.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── Creating a nef Playground.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── Exporting Carbon code snippets.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── Generating a Markdown document.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ └── Generating content for Jekyll.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ ├── Sources │ │ │ │ ├── NefPlaygroundSupport.swift │ │ │ │ └── NefTest.swift │ │ │ ├── contents.xcplayground │ │ │ └── playground.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Documentation.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Documentation.xcscheme │ │ ├── Documentation.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Documentation │ │ │ └── Info.plist │ │ ├── First steps.playground │ │ │ ├── Pages │ │ │ │ ├── How to export my snippets?.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── How to use Carbon API?.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ ├── Playground Book with 3rd-party libraries.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ └── Xcode Playground → nef Playground.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ ├── Sources │ │ │ │ ├── NefPlaygroundSupport.swift │ │ │ │ └── NefTest.swift │ │ │ ├── contents.xcplayground │ │ │ └── playground.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Library.playground │ │ │ ├── Pages │ │ │ │ ├── APIs.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ └── How to use nef as a library?.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ ├── Sources │ │ │ │ ├── NefPlaygroundSupport.swift │ │ │ │ └── NefTest.swift │ │ │ ├── contents.xcplayground │ │ │ └── playground.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Podfile │ │ ├── Quick start.playground │ │ │ ├── Pages │ │ │ │ ├── Getting started.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ │ └── Resources.xcplaygroundpage │ │ │ │ │ └── Contents.swift │ │ │ ├── Sources │ │ │ │ ├── NefPlaygroundSupport.swift │ │ │ │ └── NefTest.swift │ │ │ ├── contents.xcplayground │ │ │ └── playground.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── launcher │ └── Resources │ │ ├── AppIcon.icns │ │ └── Assets.car └── jekyll │ └── Home.md ├── LICENSE ├── Makefile ├── Package.swift ├── README.md ├── assets ├── header-nef.png ├── nef-carbon-example.png └── nef-playground.png ├── docs ├── CNAME ├── Gemfile ├── _config.yml ├── _data │ ├── features.yml │ └── menu.yml ├── _includes │ ├── _doc.html │ ├── _dropdown.html │ ├── _footer.html │ ├── _head-docs.html │ ├── _head.html │ ├── _header.html │ ├── _main.html │ ├── _nav.html │ └── _sidebar.html ├── _layouts │ ├── docs.html │ └── home.html ├── _sass │ ├── base │ │ ├── _base.scss │ │ ├── _helpers.scss │ │ └── _reset.scss │ ├── components │ │ ├── _button.scss │ │ ├── _code.scss │ │ ├── _doc.scss │ │ ├── _footer.scss │ │ ├── _header.scss │ │ ├── _main.scss │ │ ├── _nav.scss │ │ ├── _sidebar-menu.scss │ │ ├── _sidebar.scss │ │ └── _table.scss │ ├── utils │ │ ├── _mixins.scss │ │ └── _variables.scss │ └── vendors │ │ └── highlight │ │ ├── atom-one-dark.scss │ │ └── dracula.scss ├── apple-app-site-association ├── assets │ ├── airdrop.png │ ├── myplayground.png │ ├── nef-library-example.png │ ├── nef-playground-view.png │ ├── nef-playground.png │ ├── nef-plugin-install.png │ ├── nef-tutorial-carbon-customsnippet.png │ ├── nef-tutorial-carbon-defaultsnippet.png │ ├── nef-xcode-library.png │ ├── package-playground-book.png │ └── tutorial-playgroundbook.jpeg ├── css │ ├── docs.scss │ └── styles.scss ├── extra │ ├── apple-jazzy-theme │ │ ├── assets │ │ │ ├── css │ │ │ │ ├── highlight.css.scss │ │ │ │ └── jazzy.css.scss │ │ │ ├── img │ │ │ │ ├── carat.png │ │ │ │ ├── dash.png │ │ │ │ └── gh.png │ │ │ └── js │ │ │ │ ├── jazzy.js │ │ │ │ └── jquery.min.js │ │ └── templates │ │ │ ├── doc.mustache │ │ │ ├── footer.mustache │ │ │ ├── header.mustache │ │ │ ├── nav.mustache │ │ │ ├── parameter.mustache │ │ │ ├── task.mustache │ │ │ └── tasks.mustache │ ├── mapbox-jazzy-theme │ │ ├── LICENSE │ │ ├── assets │ │ │ ├── css │ │ │ │ ├── highlight.css.scss │ │ │ │ └── jazzy.css.scss │ │ │ ├── fonts │ │ │ │ ├── opensans-bold.eot │ │ │ │ ├── opensans-bold.woff │ │ │ │ ├── opensans-regular.eot │ │ │ │ └── opensans-regular.woff │ │ │ ├── img │ │ │ │ ├── carat.png │ │ │ │ ├── dash.png │ │ │ │ ├── github.svg │ │ │ │ ├── link.svg │ │ │ │ ├── mapbox.svg │ │ │ │ ├── minus.svg │ │ │ │ └── plus.svg │ │ │ └── js │ │ │ │ ├── jazzy.js │ │ │ │ ├── jazzy.search.js │ │ │ │ ├── jquery.min.js │ │ │ │ ├── lunr.min.js │ │ │ │ └── typeahead.jquery.js │ │ └── templates │ │ │ ├── deprecation.mustache │ │ │ ├── doc.mustache │ │ │ ├── footer.mustache │ │ │ ├── header.mustache │ │ │ ├── nav.mustache │ │ │ ├── parameter.mustache │ │ │ ├── task.mustache │ │ │ └── tasks.mustache │ └── nef-jazzy-theme │ │ ├── LICENSE │ │ ├── assets │ │ ├── css │ │ │ ├── highlight.css │ │ │ └── jazzy.css.scss │ │ ├── fonts │ │ │ ├── opensans-bold.eot │ │ │ ├── opensans-bold.woff │ │ │ ├── opensans-regular.eot │ │ │ └── opensans-regular.woff │ │ ├── img │ │ │ ├── carat.png │ │ │ ├── dash.png │ │ │ ├── github.svg │ │ │ ├── link.svg │ │ │ ├── mapbox.svg │ │ │ ├── minus.svg │ │ │ ├── nef-logo.png │ │ │ └── plus.svg │ │ └── js │ │ │ ├── jazzy.js │ │ │ ├── jazzy.search.js │ │ │ ├── jquery.min.js │ │ │ ├── lunr.min.js │ │ │ └── typeahead.jquery.js │ │ └── templates │ │ ├── deprecation.mustache │ │ ├── doc.mustache │ │ ├── footer.mustache │ │ ├── header.mustache │ │ ├── nav.mustache │ │ ├── parameter.mustache │ │ ├── task.mustache │ │ └── tasks.mustache ├── img │ ├── arrow-down.svg │ ├── favicon.png │ ├── header-image.svg │ ├── main-image-primary.svg │ ├── main-image-quaternary.svg │ ├── main-image-secondary.svg │ ├── main-image-tertiary.svg │ ├── nav-brand-white.svg │ ├── nav-brand.svg │ ├── nav-icon-close.svg │ ├── nav-icon-open.svg │ ├── poster.png │ ├── sidebar-icon-close.svg │ └── sidebar-icon-open.svg ├── index.md └── js │ ├── docs.js │ └── main.js ├── project ├── Component │ ├── NefCarbon │ │ ├── App │ │ │ ├── Assets.swift │ │ │ ├── CarbonAppDelegate.swift │ │ │ ├── CarbonApplication.swift │ │ │ ├── CarbonAssembler.swift │ │ │ ├── CarbonSyncDownloader.swift │ │ │ ├── CarbonViewer.swift │ │ │ └── CarbonWKWebView.swift │ │ ├── Models │ │ │ └── RenderCarbonEnvironment.swift │ │ ├── NefCarbon.swift │ │ ├── Support Files │ │ │ ├── Info.plist │ │ │ └── NefCarbon.h │ │ ├── Utils │ │ │ ├── NSImage+Store.swift │ │ │ └── URLQuery.swift │ │ └── Views │ │ │ └── CarbonWebView.swift │ ├── NefClean │ │ ├── Clean.swift │ │ ├── Errors │ │ │ └── CleanError.swift │ │ ├── Models │ │ │ ├── CleanEnvironment.swift │ │ │ └── CleanEvent.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefClean.h │ ├── NefCommon │ │ ├── Algebras │ │ │ ├── FileSystem.swift │ │ │ ├── NefPlaygroundSystem.swift │ │ │ ├── RenderingPersistence.swift │ │ │ └── XcodePlaygroundSystem.swift │ │ ├── Errors │ │ │ ├── FileSystemError.swift │ │ │ ├── PlaygroundShellError.swift │ │ │ ├── RenderingOutput.swift │ │ │ ├── RenderingPersistenceError.swift │ │ │ └── XcodePlaygroundSystemError.swift │ │ ├── Models │ │ │ ├── HasProgressReport.swift │ │ │ ├── NefPlaygroundURL.swift │ │ │ └── RenderingURL.swift │ │ ├── Support Files │ │ │ ├── Info.plist │ │ │ └── NefCommon.h │ │ └── Utils │ │ │ ├── Array+Utils.swift │ │ │ ├── Effects+Extensions.swift │ │ │ ├── EnumeratedSequence+Extension.swift │ │ │ ├── Platform+Utils.swift │ │ │ ├── String+Path.swift │ │ │ └── String+Utils.swift │ ├── NefCompiler │ │ ├── Algebras │ │ │ ├── CompilerShell.swift │ │ │ └── CompilerSystem.swift │ │ ├── Errors │ │ │ ├── CompilerShellError.swift │ │ │ └── CompilerSystemError.swift │ │ ├── Extensions │ │ │ └── SwiftModule+IO.swift │ │ ├── Instances │ │ │ └── NefCompilerSystem.swift │ │ ├── Models │ │ │ ├── CompilerEvent.swift │ │ │ ├── CompilerSystemEnvironment.swift │ │ │ └── RenderCompilerEnvironment.swift │ │ ├── NefCompiler.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefCompiler.h │ ├── NefJekyll │ │ ├── Models │ │ │ ├── JekyllEvent.swift │ │ │ └── RenderJekyllEnvironment.swift │ │ ├── NefJekyll.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefJekyll.h │ ├── NefMarkdown │ │ ├── Models │ │ │ └── RenderMarkdownEnvironment.swift │ │ ├── NefMarkdown.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefMarkdown.h │ ├── NefModels │ │ ├── CarbonModel.swift │ │ ├── CarbonView.swift │ │ ├── CompilerOptions.swift │ │ ├── PlaygroundDependencies.swift │ │ ├── PlaygroundExcludeItem.swift │ │ ├── PlaygroundPlatform.swift │ │ ├── ProgressReport.swift │ │ ├── RenderedPage.swift │ │ ├── Support Files │ │ │ ├── Info.plist │ │ │ └── NefModels.h │ │ ├── SwiftModule.swift │ │ └── WorkspaceInfo.swift │ ├── NefPlayground │ │ ├── Errors │ │ │ └── PlaygroundError.swift │ │ ├── Models │ │ │ ├── PlaygroundEnvironment.swift │ │ │ └── PlaygroundEvent.swift │ │ ├── Playground.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefPlayground.h │ ├── NefRender │ │ ├── Errors │ │ │ └── MarkdownError.swift │ │ ├── Models │ │ │ ├── RenderEnvironment.swift │ │ │ └── RenderEvent.swift │ │ ├── Render.swift │ │ └── Support Files │ │ │ ├── Info.plist │ │ │ └── NefRender.h │ ├── NefSwiftPlayground │ │ ├── Algebras │ │ │ └── PackageShell.swift │ │ ├── Assets.swift │ │ ├── Assets │ │ │ └── ImageReference.swift │ │ ├── Errors │ │ │ ├── PackageShellError.swift │ │ │ ├── PlaygroundBookError.swift │ │ │ └── SwiftPlaygroundError.swift │ │ ├── Models │ │ │ ├── Module.swift │ │ │ ├── Package.swift │ │ │ ├── PlaygroundBookEvent.swift │ │ │ ├── PlaygroundBookResolutionPath.swift │ │ │ ├── PlaygroundBookTemplate.swift │ │ │ ├── PlaygroundEnvironment.swift │ │ │ ├── PlaygroundResolutionPath.swift │ │ │ ├── SwiftPackage.swift │ │ │ └── SwiftPackageProduct.swift │ │ ├── PlaygroundBook.swift │ │ ├── Support Files │ │ │ ├── Info.plist │ │ │ └── NefSwiftPlayground.h │ │ └── SwiftPlayground.swift │ └── nef │ │ ├── CarbonAPI.swift │ │ ├── CleanAPI.swift │ │ ├── CompilerAPI.swift │ │ ├── Instances │ │ ├── MacCompilerShell.swift │ │ ├── MacNefPlaygroundSystem.swift │ │ ├── UnixFileSystem.swift │ │ ├── UnixPackageShell.swift │ │ ├── UnixPlaygroundSystem.swift │ │ └── UnixRenderSystem.swift │ │ ├── JekyllAPI.swift │ │ ├── MarkdownAPI.swift │ │ ├── Models │ │ └── Error.swift │ │ ├── PlaygroundAPI.swift │ │ ├── Support Files │ │ ├── Info.plist │ │ ├── _Carbon.h │ │ ├── _Clean.h │ │ ├── _Common.h │ │ ├── _Compiler.h │ │ ├── _Core.h │ │ ├── _Jekyll.h │ │ ├── _Markdown.h │ │ ├── _Playground.h │ │ ├── _SwiftPlayground.h │ │ ├── module.modulemap │ │ └── nef.h │ │ ├── SwiftPlaygroundAPI.swift │ │ ├── Utils │ │ ├── BuildConfiguration.swift │ │ └── URL+PlaygroundPage.swift │ │ └── VersionAPI.swift ├── Core │ ├── Models │ │ ├── CoreEnvironments.swift │ │ ├── CoreRenderError.swift │ │ ├── Image.swift │ │ └── MarkupNode.swift │ ├── Parser │ │ ├── Lexical.swift │ │ └── Syntax.swift │ ├── Render │ │ ├── CoreCarbon.swift │ │ ├── CoreCode.swift │ │ ├── CoreJekyll.swift │ │ ├── CoreMarkdown.swift │ │ └── CoreRender.swift │ ├── Support Files │ │ ├── Info.plist │ │ └── NefCore.h │ └── Utils │ │ ├── Node+Render.swift │ │ └── String+Format.swift ├── Tests │ ├── CoreTestPlan.xctestplan │ └── CoreTests │ │ ├── JekyllTests.swift │ │ ├── MarkdownTests.swift │ │ ├── Support Files │ │ └── Info.plist │ │ ├── SyntaxTests.swift │ │ └── Utils │ │ └── CoreRender+Test.swift ├── UI │ ├── CLIKit │ │ ├── Array+Utils.swift │ │ ├── Collection+Utils.swift │ │ ├── CommandLineTool.swift │ │ ├── CommandOutcome.swift │ │ ├── ConsoleReport.swift │ │ ├── DispatchTimeInterval+Utils.swift │ │ ├── ExpressibleByArgument+Extension.swift │ │ ├── Kleisli+Extensions.swift │ │ ├── OutcomeReport.swift │ │ ├── PlaygroundUtils.swift │ │ ├── String+Colorize.swift │ │ └── Support Files │ │ │ ├── CLIKit.h │ │ │ └── Info.plist │ ├── Carbon │ │ ├── Carbon.swift │ │ └── main.swift │ ├── CarbonPage │ │ ├── CarbonPage.swift │ │ └── main.swift │ ├── Clean │ │ ├── Clean.swift │ │ └── main.swift │ ├── Compiler │ │ ├── Compiler.swift │ │ └── main.swift │ ├── Jekyll │ │ ├── Jekyll.swift │ │ └── main.swift │ ├── JekyllPage │ │ ├── JekyllPage.swift │ │ └── main.swift │ ├── Markdown │ │ ├── Markdown.swift │ │ └── main.swift │ ├── MarkdownPage │ │ ├── MarkdownPage.swift │ │ └── main.swift │ ├── Nef │ │ ├── Version.swift │ │ └── main.swift │ ├── Playground │ │ ├── Playground.swift │ │ ├── PlaygroundDependenciesError.swift │ │ └── main.swift │ └── PlaygroundBook │ │ ├── PlaygroundBook.swift │ │ └── main.swift └── nef.xcodeproj │ ├── JekyllMarkdown.xcworkspace │ └── contents.xcworkspacedata │ ├── project.pbxproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ ├── IDETemplateMacros.plist │ └── xcschemes │ ├── CLIKit.xcscheme │ ├── Carbon.xcscheme │ ├── CarbonPage.xcscheme │ ├── Clean.xcscheme │ ├── Compiler.xcscheme │ ├── CoreTests.xcscheme │ ├── Jekyll.xcscheme │ ├── JekyllPage.xcscheme │ ├── Markdown.xcscheme │ ├── MarkdownPage.xcscheme │ ├── NefCarbon.xcscheme │ ├── NefClean.xcscheme │ ├── NefCommon.xcscheme │ ├── NefCompiler.xcscheme │ ├── NefCore.xcscheme │ ├── NefJekyll.xcscheme │ ├── NefMarkdown.xcscheme │ ├── NefMenu.xcscheme │ ├── NefModels.xcscheme │ ├── NefPlayground.xcscheme │ ├── NefRender.xcscheme │ ├── NefSwiftPlayground.xcscheme │ ├── Playground.xcscheme │ ├── PlaygroundBook.xcscheme │ └── nef.xcscheme ├── scripts └── gen-docs.rb ├── setup ├── ConfigureNef.rb ├── ProjectManipulator.rb ├── TemplateConfigurator.rb └── nef.rb └── template ├── .gitignore ├── PROJECT.app └── Contents │ ├── Info.plist │ ├── MacOS │ └── launcher │ └── Resources │ ├── AppIcon.icns │ └── Assets.car ├── ios ├── carthage │ ├── PROJECT.playground │ │ ├── Pages │ │ │ └── page.xcplaygroundpage │ │ │ │ └── Contents.swift │ │ ├── Sources │ │ │ ├── NefPlaygroundSupport.swift │ │ │ └── NefTest.swift │ │ ├── contents.xcplayground │ │ └── playground.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── PROJECT.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ └── xcschemes │ │ └── PROJECT.xcscheme ├── cocoapods │ ├── PROJECT.playground │ │ ├── Pages │ │ │ └── page.xcplaygroundpage │ │ │ │ └── Contents.swift │ │ ├── Sources │ │ │ ├── NefPlaygroundSupport.swift │ │ │ └── NefTest.swift │ │ ├── contents.xcplayground │ │ └── playground.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── PROJECT.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── PROJECT.xcscheme │ ├── PROJECT │ │ └── Info.plist │ └── Podfile └── spm │ ├── PROJECT.playground │ ├── Pages │ │ └── page.xcplaygroundpage │ │ │ └── Contents.swift │ ├── Sources │ │ ├── NefPlaygroundSupport.swift │ │ └── NefTest.swift │ ├── contents.xcplayground │ └── playground.xcworkspace │ │ └── contents.xcworkspacedata │ ├── PROJECT.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── SwiftPackages.xcscheme │ └── PROJECT.xcworkspace │ └── contents.xcworkspacedata └── osx ├── carthage ├── PROJECT.playground │ ├── Pages │ │ └── page.xcplaygroundpage │ │ │ └── Contents.swift │ ├── Sources │ │ └── NefTest.swift │ ├── contents.xcplayground │ └── playground.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── PROJECT.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── PROJECT.xcscheme ├── cocoapods ├── PROJECT.playground │ ├── Pages │ │ └── page.xcplaygroundpage │ │ │ └── Contents.swift │ ├── Sources │ │ └── NefTest.swift │ ├── contents.xcplayground │ └── playground.xcworkspace │ │ └── contents.xcworkspacedata ├── PROJECT.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── PROJECT.xcscheme ├── PROJECT │ └── Info.plist └── Podfile └── spm ├── PROJECT.playground ├── Pages │ └── page.xcplaygroundpage │ │ └── Contents.swift ├── Sources │ └── NefTest.swift ├── contents.xcplayground └── playground.xcworkspace │ └── contents.xcworkspacedata ├── PROJECT.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── SwiftPackages.xcscheme └── PROJECT.xcworkspace └── contents.xcworkspacedata /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: Report malfunctioning of the library 4 | title: [Bug] 5 | labels: '' 6 | assignees: Maintainers 7 | 8 | --- 9 | 10 | ## Description 11 | 12 | *Explain the problem you are experiencing.* 13 | 14 | ## Expected outcome 15 | 16 | *Describe the result you should obtain.* 17 | 18 | ## Observed outcome 19 | 20 | *Describe the result you are obtaining instead.* 21 | 22 | ## Code to reproduce the Bug 23 | 24 | *Provide minimum code, together with imports, that we can execute to reproduce the bug.* 25 | 26 | ```swift 27 | // Your code here 28 | ``` 29 | 30 | ## nef modules, version, platform 31 | 32 | *Indicate which modules you are using from nef and which versions. If you are not using public releases, provide branch and commit hash, but we suggest you to only use published releases. Indicate which platform you are targetting (iOS, macOS, playground)* 33 | 34 | ## Tooling 35 | 36 | - Xcode version: 37 | 38 | ## Other 39 | 40 | *Include any other details that can help us fix this bug efficiently.* 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Request new functionality in nef 4 | title: [Request] 5 | labels: '' 6 | assignees: Maintainers 7 | 8 | --- 9 | 10 | ## Description 11 | 12 | *Describe your proposal for new functionality.* 13 | 14 | ## Sample usage 15 | 16 | *Provide sample code of how the new functionality should work.* 17 | 18 | ## Potential implementation 19 | 20 | *Provide an outline of how this functionality could be implemented.* 21 | 22 | ## Modules 23 | 24 | *List the modules that may be affected by this new functionality. Describe if any new modules will need to be created.* 25 | 26 | ## Breaking changes 27 | 28 | *Describe possible breaking changes that may happen if this functionality is included.* 29 | -------------------------------------------------------------------------------- /.github/workflows/bump-formula.yml: -------------------------------------------------------------------------------- 1 | name: Bump Homebrew nef formula 2 | 3 | on: 4 | push: 5 | tags: 6 | - "[0-9]+.[0-9]+.[0-9]+" 7 | 8 | jobs: 9 | homebrew: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | - name: Bump formulae 16 | uses: dawidd6/action-homebrew-bump-formula@v3 17 | with: 18 | token: ${{ secrets.HOMEBREW_NEF_TOKEN }} 19 | formula: nef 20 | -------------------------------------------------------------------------------- /.github/workflows/deploy-docs.yml: -------------------------------------------------------------------------------- 1 | name: Deploy docs 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: macos-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Generate microsite 15 | run: | 16 | brew install nef 17 | brew install sourcekitten 18 | gem install bundler -v 2.0.2 19 | gem install cocoapods -v 1.9.1 20 | ./scripts/gen-docs.rb 21 | - name: Deploy microsite 22 | uses: peaceiris/actions-gh-pages@v3 23 | with: 24 | deploy_key: ${{ secrets.DEPLOY_NEF_TOKEN }} 25 | publish_branch: gh-pages 26 | publish_dir: ./pub-dir 27 | enable_jekyll: true 28 | -------------------------------------------------------------------------------- /.github/workflows/nef-compile.yml: -------------------------------------------------------------------------------- 1 | name: nef verify documentation 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: macos-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Compile documentation 13 | run: | 14 | brew install nef 15 | gem install cocoapods -v 1.9.1 16 | nef compile --project Documentation.app 17 | -------------------------------------------------------------------------------- /.github/workflows/swift.yml: -------------------------------------------------------------------------------- 1 | name: Compile and test 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | macos: 7 | name: macos 8 | runs-on: macos-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Run tests 13 | run: swift test 14 | - name: Generate linux tests 15 | run: swift test --generate-linuxmain 16 | - name: Cached auto-generate linux tests 17 | uses: actions/upload-artifact@v1 18 | with: 19 | name: generate-linuxmain 20 | path: project/Tests 21 | 22 | linux: 23 | name: linux 24 | needs: macos 25 | runs-on: ubuntu-latest 26 | 27 | steps: 28 | - uses: actions/checkout@v2 29 | - name: Clean Tests 30 | run: rm -rf project/Tests 31 | - name: Get auto-generate linux tests 32 | uses: actions/download-artifact@v1 33 | with: 34 | name: generate-linuxmain 35 | path: project/Tests 36 | - name: Remove generated artifact 37 | uses: geekyeggo/delete-artifact@v1 38 | with: 39 | name: generate-linuxmain 40 | failOnError: false 41 | - name: Run tests 42 | run: swift test 43 | -------------------------------------------------------------------------------- /.github/workflows/xcode.yml: -------------------------------------------------------------------------------- 1 | name: Verify Xcode integrity 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: macos-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Compile project 13 | run: | 14 | set -o pipefail 15 | xcodebuild -project ./project/nef.xcodeproj -scheme nef | xcpretty -c 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## User files 2 | **/.DS_Store 3 | **/xcuserdata/ 4 | BowPlayground 5 | bin 6 | sha_*.txt 7 | /project/build 8 | Makefile~ 9 | 10 | ## SPM 11 | .build 12 | Package.resolved 13 | .swiftpm 14 | bin-cli 15 | swiftpm 16 | 17 | ## Jekyll 18 | _site 19 | .sass-cache 20 | .jekyll-metadata 21 | .jekyll-cache 22 | 23 | ## Ruby environment normalization: 24 | .bundle/ 25 | vendor/ 26 | /lib/bundler/man/ 27 | /docs/docs/* 28 | /docs/.bundle/ 29 | /docs/vendor/ 30 | 31 | ## Docs 32 | /pub-dir 33 | /gen-docs 34 | /json-files 35 | /docs/_data/sidebar.yml 36 | /docs/_data/versions.json 37 | /docs/Gemfile.lock 38 | 39 | ## nef 40 | /Documentation.app/nef 41 | /Documentation.app/Contents/MacOS/Pods 42 | /Documentation.app/Contents/MacOS/Podfile.lock 43 | 44 | ## linux 45 | **/LinuxMain.swift 46 | **/XCTestManifests.swift 47 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Miguel Ángel Díaz 2 | Miguel Ángel Díaz 3 | Miguel Ángel Díaz 4 | -------------------------------------------------------------------------------- /Documentation.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | launcher 9 | CFBundleIconFile 10 | AppIcon 11 | CFBundleIconName 12 | AppIcon 13 | CFBundleIdentifier 14 | com.fortysevendeg.nef 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleSupportedPlatforms 18 | 19 | MacOSX 20 | 21 | LSApplicationCategoryType 22 | public.app-category.developer-tools 23 | LSMinimumSystemVersion 24 | 10.14 25 | NSHumanReadableCopyright 26 | Copyright © 2019 The nef Authors. All rights reserved. 27 | 28 | 29 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/Pages/Compiling a nef Playground.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | // nef:begin:header 2 | /* 3 | layout: docs 4 | title: Compiling a nef Playground 5 | */ 6 | // nef:end 7 | 8 | /*: 9 | ## 🔨 Compiling a nef Playground 10 | 11 | Xcode lets you check for correctness of your Xcode Playground and run it. However, Apple does not provide us commands to compile an Xcode Playground, as they do for building Xcode projects. It is particularly useful in Continuous Integration when you want to verify that your playgrounds are not broken when the libraries you depend on are updated. `nef` has an option to compile a `nef Playground`. To do this, you can run the following command: 12 | 13 | ```bash 14 | ➜ nef compile --project 15 | ``` 16 | > If you need to transform your Xcode Playground into a nef Playground you can check [Creating a nef Playground](#-creating-a-nef-playground) section. 17 | 18 | Where `` is the path to `nef Playground` where your playgrounds are located. Also, you can use the following option with this command: 19 | 20 | - `--use-cache`: Use cached dependencies if it is possible; otherwise, it will download them. Example: 21 | 22 | ```bash 23 | ➜ nef compile --project --use-cache 24 | ``` 25 | 26 | You can also clean the result of the compilation: 27 | 28 | ```bash 29 | ➜ nef clean --project 30 | ``` 31 | */ 32 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/Pages/Generating a Markdown document.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | // nef:begin:header 2 | /* 3 | layout: docs 4 | title: Generating a Markdown document 5 | */ 6 | // nef:end 7 | 8 | // nef:begin:hidden 9 | import Bow 10 | Nef.Playground.needsIndefiniteExecution(false) 11 | // nef:end 12 | 13 | /*: 14 | ## 🔖 Generating a Markdown document 15 | Xcode Playgrounds let you write comments in Markdown format using the symbols `//:` for single line comments, or `/•: ... •/` for multiline comments. Inside this comments, you can use any Markdown syntax; an exmaple: 16 | 17 | ```swift 18 | /•: 19 | ‌‌ # This is a heading 1 20 | This is regular text. **This is bold text**. [This is a link](http://bow-swift.io). 21 | •/ 22 | 23 | protocol MyProtocol {} 24 | 25 | //:‌‌ ## This is a single line heading 2‌‌ 26 | ``` 27 | 28 | It makes Xcode Playgrounds the proper tool to write an article with compilable examples. The command provided by `nef` to generate the Markdown files is: 29 | 30 | ```bash 31 | ➜ nef markdown --project --output 32 | ``` 33 | 34 | Options: 35 | 36 | - `--project`: Path to the folder containing the Xcode project with Xcode Playgrounds. 37 | - `--output`: Path where the resulting Markdown project will be generated. 38 | 39 | */ 40 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Command-Line.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Documentation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Documentation.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Documentation.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Documentation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1.0 21 | NSHumanReadableCopyright 22 | Copyright © 2019. The nef authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/First steps.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/First steps.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/First steps.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/First steps.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Library.playground/Pages/How to use nef as a library?.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | // nef:begin:header 2 | /* 3 | layout: docs 4 | title: How to use nef as a library? 5 | */ 6 | // nef:end 7 | 8 | /*: 9 | ## How to use nef as a library? 10 | 11 | As you know, from Xcode 11, you can integrate package dependencies using Swift Package Manager (SPM) to share code between projects or even use third-party libraries. You can read more about it in Apple's article [Adding package dependencies to your app](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) 12 | 13 | Starting on `nef` [version 0.4](https://github.com/bow-swift/nef/releases/tag/0.4.0), we have modularized the core so that you can use nef as a library in your macOS projects. Taking advantage of the integration of SPM in Xcode, you can easily import `nef` in your project. 14 | 15 | Just choose as package repository `https://github.com/bow-swift/nef.git` and Xcode will do the rest. 16 | 17 | ![Add nef library to Xcode as a dependency](/assets/nef-xcode-library.png) 18 | 19 | Once Xcode resolves the dependencies, you can import nef wherever you need, as a native framework: 20 | ```swift 21 | import nef 22 | ``` 23 | That's all! The power of nef runs into your project. Cool! 24 | */ 25 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Library.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Library.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Library.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Library.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Podfile: -------------------------------------------------------------------------------- 1 | target 'Documentation' do 2 | platform :ios, 12.0 3 | use_frameworks! 4 | 5 | pod "Bow", "~> 0.7.0" 6 | pod "BowEffects", "~> 0.7.0" 7 | pod "BowRx", "~> 0.7.0" 8 | pod "BowOptics", "~> 0.7.0" 9 | pod "BowGeneric", "~> 0.7.0" 10 | pod "BowRecursionSchemes", "~> 0.7.0" 11 | pod "BowFree", "~> 0.7.0" 12 | end 13 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Quick start.playground/Pages/Resources.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | // nef:begin:header 2 | /* 3 | layout: docs 4 | title: Resources 5 | */ 6 | // nef:end 7 | /*: 8 | ## Resources 9 | 10 | In this section you can find a list of projects, libraries, presentations or blog posts that use nef: 11 | 12 | ### GitHub projects 13 | 14 | - [Bow Documentation](https://github.com/bow-swift/bow/tree/master/contents): This microsite documentation has been built using `nef`. You can see how it looks [here](https://bow-swift.io/docs) and read more about how it works in [this article](https://www.47deg.com/blog/nef-announcement/). 15 | 16 | ### Libraries 17 | 18 | - [nef plugin](https://github.com/bow-swift/nef-plugin): This Xcode extension enables you to make a code selection and export it to a snippets. Available on [Mac App Store](https://apps.apple.com/app/nef/id1479391704?mt=8). 19 | 20 | ### Presentations 21 | 22 | - [Hard drugs for Playgrounds: `nef`](https://altconf.miguelangel.me) by Miguel Ángel Díaz-López at AltConf Madrid. June 2019. 23 | - [Swift Playgrounds: to infinity... and beyond!](https://nscoder.miguelangel.me) by Miguel Ángel Díaz-López at NSCoder Night Madrid. December 2019. 24 | 25 | ### Blog posts 26 | 27 | Be the first one showing here! 28 | 29 | */ 30 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Quick start.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Quick start.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Quick start.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/Quick start.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation.app/Contents/MacOS/launcher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | workspace="Documentation.xcworkspace" 4 | workspacePath=$(echo "$0" | rev | cut -f2- -d '/' | rev) 5 | 6 | open "`pwd`/$workspacePath/$workspace" 7 | -------------------------------------------------------------------------------- /Documentation.app/Contents/Resources/AppIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/Documentation.app/Contents/Resources/AppIcon.icns -------------------------------------------------------------------------------- /Documentation.app/Contents/Resources/Assets.car: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/Documentation.app/Contents/Resources/Assets.car -------------------------------------------------------------------------------- /assets/header-nef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/assets/header-nef.png -------------------------------------------------------------------------------- /assets/nef-carbon-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/assets/nef-carbon-example.png -------------------------------------------------------------------------------- /assets/nef-playground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/assets/nef-playground.png -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | nef.bow-swift.io -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "jekyll", ">= 4.0.0" 4 | gem "jazzy", "~> 0.13.1" 5 | # Needed to support swift_versions param 6 | gem "cocoapods", "~> 1.9.1" 7 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | #------------------------- 2 | name: nef 3 | #------------------------- 4 | title: nef # To be used on meta tags mainly 5 | #------------------------- 6 | description: 💊 steroids for Xcode Playgrounds 7 | #------------------------- 8 | author: 47 Degrees 9 | keywords: functional-programming, monads, monad-transformers, functional-data-structure, swift, bow, xcode, xcode-playgrounds, playgrounds, fp-types, adt, free-monads, tagless-final, mtl, for-comprehension, category-theory 10 | #------------------------- 11 | github-owner: bow-swift 12 | github-repo: nef 13 | #------------------------- 14 | url: https://nef.bow-swift.io 15 | #------------------------- 16 | markdown: kramdown 17 | sass: 18 | sass_dir: _sass 19 | style: compressed 20 | sourcemap: never 21 | #------------------------- 22 | permalink: pretty 23 | #------------------------- 24 | exclude: ['config.ru', 'Gemfile', 'Gemfile.lock', 'vendor', 'Procfile', 'Rakefile'] 25 | #------------------------- 26 | -------------------------------------------------------------------------------- /docs/_data/features.yml: -------------------------------------------------------------------------------- 1 | content: 2 | - title: Verification 3 | description: Eases the creation of Playgrounds with support for 3rd-party libraries. 4 | icon: img/main-image-primary.svg 5 | 6 | - title: Compile 7 | description: Compiles Playgrounds with support for third party libraries from the command line. 8 | icon: img/main-image-secondary.svg 9 | 10 | - title: Generation 11 | description: Generates Playground Books from Swift packages and Markdown files from nef Playground. 12 | icon: img/main-image-tertiary.svg 13 | 14 | - title: Integration 15 | description: Integrates Playgrounds with Carbon to export code snippets, and Jekyll to create a microsite. 16 | icon: img/main-image-quaternary.svg 17 | -------------------------------------------------------------------------------- /docs/_data/menu.yml: -------------------------------------------------------------------------------- 1 | nav: 2 | - title: Documentation 3 | url: /docs 4 | 5 | - title: API Reference 6 | url: /api-docs 7 | 8 | - title: Github 9 | url: https://github.com/bow-swift/nef 10 | 11 | - title: License 12 | url: https://github.com/bow-swift/nef/blob/develop/LICENSE 13 | -------------------------------------------------------------------------------- /docs/_includes/_doc.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 15 | 16 | 32 |
33 |
34 | {{ content }} 35 |
36 |
37 | -------------------------------------------------------------------------------- /docs/_includes/_dropdown.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /docs/_includes/_footer.html: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /docs/_includes/_head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% if page.title %} 5 | {% assign pageTitle = site.title | append: ': ' | append: page.title %} 6 | {% else %} 7 | {% assign pageTitle = site.title %} 8 | {% endif %} 9 | 10 | {{ pageTitle }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/_includes/_header.html: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /docs/_includes/_main.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {% for item in site.data.features.content %} 5 |
6 | {{ item.title }} 7 |

{{ item.title }}

8 |

{{ item.description }}

9 |
10 | {% endfor %} 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /docs/_includes/_nav.html: -------------------------------------------------------------------------------- 1 | 33 | -------------------------------------------------------------------------------- /docs/_layouts/docs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include _head-docs.html %} 4 | 5 | {% include _sidebar.html %} 6 | {% include _doc.html %} 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/_layouts/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include _head.html %} 4 | 5 | {% include _nav.html %} 6 | {% include _header.html %} 7 | {% include _main.html %} 8 | {% include _footer.html %} 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/_sass/base/_helpers.scss: -------------------------------------------------------------------------------- 1 | // Helpers 2 | // ----------------------------------------------- 3 | // ----------------------------------------------- 4 | .wrapper { 5 | padding: 0 ($base-point-grid * 3); 6 | margin: 0 auto; 7 | box-sizing: border-box; 8 | max-width: $bp-xlarge; 9 | height: 100%; 10 | } 11 | -------------------------------------------------------------------------------- /docs/_sass/components/_button.scss: -------------------------------------------------------------------------------- 1 | // Buttons 2 | // ---------------------------------------------- 3 | // ---------------------------------------------- 4 | .button { 5 | font-family: $base-font-family; 6 | display: block; 7 | background: none; 8 | border: none; 9 | outline: none; 10 | text-decoration: none; 11 | 12 | &:hover { 13 | cursor: pointer; 14 | } 15 | 16 | > img { 17 | vertical-align: bottom; 18 | } 19 | 20 | &.link-like { 21 | font-size: 1rem; 22 | color: $link-color; 23 | font-weight: $font-regular; 24 | border: none; 25 | padding: 0 0 ($base-point-grid / 2) 0; 26 | margin: 27 | 0 28 | ($base-point-grid * 2) 29 | -5px 30 | 0; 31 | text-transform: none; 32 | 33 | &:hover, 34 | &:active, 35 | &:focus { 36 | text-decoration: none; 37 | box-shadow: 0 2px; 38 | background: none; 39 | 40 | &::after { 41 | background-position-y: 60%; 42 | } 43 | } 44 | } 45 | } 46 | 47 | .close { 48 | height: 28px; 49 | position: absolute; 50 | left: 0; 51 | top: 0; 52 | width: 32px; 53 | 54 | &::before, 55 | &::after { 56 | background-color: $white; 57 | content: " "; 58 | height: 100%; 59 | left: 98%; 60 | position: absolute; 61 | top: 36%; 62 | width: 2px; 63 | } 64 | 65 | &::before { 66 | transform: rotate(45deg); 67 | } 68 | 69 | &::after { 70 | transform: rotate(-45deg); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /docs/_sass/components/_code.scss: -------------------------------------------------------------------------------- 1 | // Code 2 | // ---------------------------------------------- 3 | // ---------------------------------------------- 4 | code { 5 | font-family: $code-font-family; 6 | } 7 | 8 | p code, 9 | ul code { 10 | padding: 2px $base-point-grid; 11 | background: rgba($gray-primary, 0.1); 12 | font-family: $code-font-family; 13 | border-radius: 2px; 14 | } 15 | 16 | .highlight pre { 17 | background: scale-color($brand-secondary, $lightness: -40%); 18 | padding: ($base-point-grid * 3); 19 | overflow: auto; 20 | margin-bottom: ($base-point-grid * 2); 21 | } 22 | -------------------------------------------------------------------------------- /docs/_sass/components/_main.scss: -------------------------------------------------------------------------------- 1 | // Features 2 | // ----------------------------------------------- 3 | // ----------------------------------------------- 4 | 5 | #site-main { 6 | flex: 1 0 auto; 7 | padding: ($base-point-grid * 10) 0; 8 | 9 | .main-flex { 10 | display: flex; 11 | justify-content: space-between; 12 | align-items: center; 13 | height: 100%; 14 | 15 | .main-item { 16 | width: $column-4; 17 | text-align: center; 18 | 19 | &:not(:last-child) { 20 | margin-right: $gutter-margin; 21 | } 22 | 23 | img { 24 | height: 64px; 25 | margin-bottom: $base-point-grid; 26 | } 27 | 28 | h2 { 29 | margin-bottom: $base-point-grid; 30 | font-size: 1.429rem; 31 | } 32 | } 33 | } 34 | } 35 | 36 | // Responsive 37 | // ----------------------------------------------- 38 | @include bp(medium) { 39 | #site-main { 40 | .main-flex { 41 | flex-direction: column; 42 | 43 | .main-item { 44 | width: $column-12; 45 | 46 | &:not(:last-child) { 47 | margin-right: 0; 48 | margin-bottom: ($base-point-grid * 8); 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /docs/_sass/components/_table.scss: -------------------------------------------------------------------------------- 1 | table { 2 | font-size: 1rem; 3 | text-align: left; 4 | overflow-x: auto; 5 | 6 | th { 7 | border-bottom: 3px solid rgba($brand-primary, 0.3); 8 | border-radius: 0; 9 | font-weight: $font-semibold; 10 | } 11 | 12 | tr { 13 | border-bottom: 1px solid rgba($brand-primary, 0.3); 14 | border-radius: 0; 15 | } 16 | 17 | th, 18 | td { 19 | padding: $base-point-grid $base-point-grid * 4; 20 | 21 | &:first-of-type { 22 | padding-left: $base-point-grid * 2; 23 | } 24 | 25 | &:last-of-type { 26 | padding-right: $base-point-grid * 2; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/_sass/utils/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // ----------------------------------------------- 3 | // ----------------------------------------------- 4 | 5 | // Hover 6 | //------------------------------------------------ 7 | @mixin links($link, $visited, $hover, $active) { 8 | & { 9 | color: $link; 10 | 11 | &:visited { 12 | color: $visited; 13 | } 14 | 15 | &:hover { 16 | color: $hover; 17 | } 18 | 19 | &:active, 20 | &:focus { 21 | color: $active; 22 | } 23 | } 24 | } 25 | 26 | // Breakpoint 27 | // ----------------------------------------------- 28 | // ----------------------------------------------- 29 | @mixin bp($point) { 30 | @if $point==xlarge { 31 | @media (max-width: $bp-xlarge) { 32 | @content; 33 | } 34 | } 35 | 36 | @if $point==large { 37 | @media (max-width: $bp-large) { 38 | @content; 39 | } 40 | } 41 | 42 | @if $point==medium { 43 | @media (max-width: $bp-medium) { 44 | @content; 45 | } 46 | } 47 | 48 | @if $point==small { 49 | @media (max-width: $bp-small) { 50 | @content; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /docs/apple-app-site-association: -------------------------------------------------------------------------------- 1 | { 2 | "applinks": { 3 | "apps": [], 4 | "details": [ 5 | { 6 | "appID": "P548S5LU96.com.47deg.nef-editor-client", 7 | "paths": ["/recipe"] 8 | } 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /docs/assets/airdrop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/airdrop.png -------------------------------------------------------------------------------- /docs/assets/myplayground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/myplayground.png -------------------------------------------------------------------------------- /docs/assets/nef-library-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-library-example.png -------------------------------------------------------------------------------- /docs/assets/nef-playground-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-playground-view.png -------------------------------------------------------------------------------- /docs/assets/nef-playground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-playground.png -------------------------------------------------------------------------------- /docs/assets/nef-plugin-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-plugin-install.png -------------------------------------------------------------------------------- /docs/assets/nef-tutorial-carbon-customsnippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-tutorial-carbon-customsnippet.png -------------------------------------------------------------------------------- /docs/assets/nef-tutorial-carbon-defaultsnippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-tutorial-carbon-defaultsnippet.png -------------------------------------------------------------------------------- /docs/assets/nef-xcode-library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/nef-xcode-library.png -------------------------------------------------------------------------------- /docs/assets/package-playground-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/package-playground-book.png -------------------------------------------------------------------------------- /docs/assets/tutorial-playgroundbook.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/assets/tutorial-playgroundbook.jpeg -------------------------------------------------------------------------------- /docs/css/docs.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | // Vendor 5 | @import "vendors/highlight/atom-one-dark"; 6 | 7 | // Utils 8 | @import "utils/variables"; 9 | @import "utils/mixins"; 10 | 11 | // Base 12 | @import "base/reset"; 13 | @import "base/base"; 14 | @import "base/helpers"; 15 | 16 | // Components 17 | @import "components/button"; 18 | @import "components/footer"; 19 | @import "components/sidebar"; 20 | @import "components/sidebar-menu"; 21 | @import "components/doc"; 22 | @import "components/code"; 23 | @import "components/table"; 24 | -------------------------------------------------------------------------------- /docs/css/styles.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | // Utils 5 | @import "utils/variables"; 6 | @import "utils/mixins"; 7 | 8 | 9 | // Base 10 | @import "base/reset"; 11 | @import "base/base"; 12 | @import "base/helpers"; 13 | 14 | // Components 15 | @import "components/button"; 16 | @import "components/nav"; 17 | @import "components/header"; 18 | @import "components/main"; 19 | @import "components/footer"; 20 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/assets/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/apple-jazzy-theme/assets/img/carat.png -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/assets/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/apple-jazzy-theme/assets/img/dash.png -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/assets/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/apple-jazzy-theme/assets/img/gh.png -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/assets/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var animationDuration = 300; 26 | var tokenOffset = "15px"; 27 | var original = link.css('marginLeft') == tokenOffset; 28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 29 | $content = link.parent().parent().next(); 30 | $content.slideToggle(animationDuration); 31 | 32 | // Keeps the document from jumping to the hash. 33 | var href = $(this).attr('href'); 34 | if (history.pushState) { 35 | history.pushState({}, '', href); 36 | } else { 37 | location.hash = href; 38 | } 39 | event.preventDefault(); 40 | }); 41 | 42 | // Dumb down quotes within code blocks that delimit strings instead of quotations 43 | // https://github.com/realm/jazzy/issues/714 44 | $("code q").replaceWith(function () { 45 | return ["\"", $(this).contents(), "\""]; 46 | }); 47 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/templates/footer.mustache: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/templates/header.mustache: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{module_name}} Docs{{#doc_coverage}} ({{doc_coverage}}% documented){{/doc_coverage}}

4 | {{#github_url}} 5 |

View on GitHub

6 | {{/github_url}} 7 | {{#dash_url}} 8 |

Install in Dash

9 | {{/dash_url}} 10 |
11 |
12 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/templates/nav.mustache: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/templates/parameter.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{name}} 5 | 6 | 7 | 8 |
9 | {{{discussion}}} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/extra/apple-jazzy-theme/templates/tasks.mustache: -------------------------------------------------------------------------------- 1 | {{#tasks.count}} 2 |
3 | {{#tasks}} 4 | {{> task}} 5 | {{/tasks}} 6 |
7 | {{/tasks.count}} 8 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mapbox 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-bold.eot -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-bold.woff -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-regular.eot -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/fonts/opensans-regular.woff -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/img/carat.png -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/mapbox-jazzy-theme/assets/img/dash.png -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/img/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/assets/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var linkIcon = link.find('.token-icon'); 26 | var animationDuration = 300; 27 | var tokenOffset = "0px"; 28 | var original = link.css('marginLeft') == tokenOffset; 29 | linkIcon.toggleClass('token-icon-minus'); 30 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 31 | $content = link.parent().parent().next(); 32 | $content.slideToggle(animationDuration); 33 | 34 | // Keeps the document from jumping to the hash. 35 | var href = $(this).attr('href'); 36 | if (history.pushState) { 37 | history.pushState({}, '', href); 38 | } else { 39 | location.hash = href; 40 | } 41 | event.preventDefault(); 42 | }); 43 | 44 | // Dumb down quotes within code blocks that delimit strings instead of quotations. 45 | $("code q").replaceWith(function () { 46 | return ["\"", $(this).contents(), "\""]; 47 | }); 48 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/templates/deprecation.mustache: -------------------------------------------------------------------------------- 1 | {{#deprecation_message}} 2 |
3 |

Deprecated

4 | {{{deprecation_message}}} 5 |
6 | {{/deprecation_message}} 7 | {{#unavailable_message}} 8 |
9 |

Unavailable

10 | {{{unavailable_message}}} 11 |
12 | {{/unavailable_message}} -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/templates/footer.mustache: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/templates/nav.mustache: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/templates/parameter.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{name}} 5 | 6 | 7 | 8 |
9 | {{{discussion}}} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/extra/mapbox-jazzy-theme/templates/tasks.mustache: -------------------------------------------------------------------------------- 1 | {{#tasks.count}} 2 |
3 |
4 | {{#tasks}} 5 | {{> task}} 6 | {{/tasks}} 7 |
8 |
9 | {{/tasks.count}} 10 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mapbox 4 | Copyright (c) 2019 The Bow Authors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/fonts/opensans-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/fonts/opensans-bold.eot -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/fonts/opensans-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/fonts/opensans-bold.woff -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/fonts/opensans-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/fonts/opensans-regular.eot -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/fonts/opensans-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/fonts/opensans-regular.woff -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/img/carat.png -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/img/dash.png -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/img/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/img/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.15, written by Peter Selinger 2001-2017 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/img/nef-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/extra/nef-jazzy-theme/assets/img/nef-logo.png -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/assets/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = { docset: false }; 2 | if (typeof window.dash != "undefined") { 3 | document.documentElement.className += " dash"; 4 | window.jazzy.docset = true; 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += " xcode"; 8 | window.jazzy.docset = true; 9 | } 10 | 11 | // On token click, toggle its discussion and animate token.marginLeft 12 | $(".token").click(function(event) { 13 | if (window.jazzy.docset) { 14 | return; 15 | } 16 | // Keeps the document from jumping to the hash. 17 | event.preventDefault(); 18 | var link = $(this); 19 | var linkIcon = link.find(".token-icon"); 20 | var animationDuration = 200; 21 | linkIcon.toggleClass("token-icon-plus"); 22 | $content = link 23 | .parent() 24 | .parent() 25 | .next(); 26 | $content.slideToggle(animationDuration); 27 | 28 | // Avoid polluting the history with hash navigation 29 | var href = $(this).attr("href"); 30 | history.replaceState(undefined, undefined, href); 31 | }); 32 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/templates/deprecation.mustache: -------------------------------------------------------------------------------- 1 | {{#deprecation_message}} 2 |
3 |

Deprecated

4 | {{{deprecation_message}}} 5 |
6 | {{/deprecation_message}} 7 | {{#unavailable_message}} 8 |
9 |

Unavailable

10 | {{{unavailable_message}}} 11 |
12 | {{/unavailable_message}} -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/templates/footer.mustache: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/templates/nav.mustache: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/templates/parameter.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{name}} 5 | 6 | 7 | 8 |
9 | {{{discussion}}} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/extra/nef-jazzy-theme/templates/tasks.mustache: -------------------------------------------------------------------------------- 1 | {{#tasks.count}} 2 |
3 |
4 | {{#tasks}} 5 | {{> task}} 6 | {{/tasks}} 7 |
8 |
9 | {{/tasks.count}} 10 | -------------------------------------------------------------------------------- /docs/img/arrow-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | arrow-down 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/img/favicon.png -------------------------------------------------------------------------------- /docs/img/main-image-primary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | feature-image-1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/main-image-quaternary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | main-image-quaternary 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/main-image-secondary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | feature-image-2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/main-image-tertiary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | feature-image-3 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/nav-brand-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | navbar-brand 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/nav-brand.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | navbar-brand 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/nav-icon-close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | nav-icon-close 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/img/nav-icon-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | nav-icon-open 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/img/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/docs/img/poster.png -------------------------------------------------------------------------------- /docs/img/sidebar-icon-close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | sidebar-icon-close 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/img/sidebar-icon-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | sidebar-icon-open 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | --- 4 | -------------------------------------------------------------------------------- /docs/js/main.js: -------------------------------------------------------------------------------- 1 | // This initialization requires that this script is loaded with `defer` 2 | const navElement = document.querySelector("#site-nav"); 3 | 4 | /** 5 | * Toggle an specific class to the received DOM element. 6 | * @param {string} elemSelector The query selector specifying the target element. 7 | * @param {string} [activeClass='active'] The class to be applied/removed. 8 | */ 9 | function toggleClass(elemSelector, activeClass = "active") { 10 | const elem = document.querySelector(elemSelector); 11 | if (elem) { 12 | elem.classList.toggle(activeClass); 13 | } 14 | } 15 | 16 | // Navigation element modification through scrolling 17 | function scrollFunction() { 18 | if (document.documentElement.scrollTop > 0) { 19 | navElement.classList.add("nav-scroll"); 20 | } else { 21 | navElement.classList.remove("nav-scroll"); 22 | } 23 | } 24 | 25 | // Init call 26 | function loadEvent() { 27 | document.addEventListener("scroll", scrollFunction); 28 | } 29 | 30 | // Attach the functions to each event they are interested in 31 | window.addEventListener("load", loadEvent); 32 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/App/CarbonAppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import AppKit 4 | 5 | class CarbonAppDelegate: NSObject, NSApplicationDelegate { 6 | private let main: () -> Void 7 | private let queue: DispatchQueue 8 | 9 | init(main: @escaping () -> Void) { 10 | self.main = main 11 | self.queue = DispatchQueue(label: String(describing: CarbonAppDelegate.self), qos: .userInitiated) 12 | super.init() 13 | } 14 | 15 | func applicationDidFinishLaunching(_ notification: Notification) { 16 | queue.async { 17 | self.main() 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/App/CarbonApplication.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import AppKit 4 | 5 | public class CarbonApplication { 6 | private static let app = NSApplication.shared 7 | private let appDelegate: CarbonAppDelegate 8 | private let assembler = CarbonAssembler() 9 | 10 | public init(main: @escaping () -> Void) { 11 | appDelegate = CarbonAppDelegate(main: main) 12 | CarbonApplication.app.delegate = appDelegate 13 | CarbonApplication.app.run() 14 | } 15 | 16 | static public func terminate() { 17 | DispatchQueue.main.async { 18 | CarbonApplication.app.terminate(nil) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/App/CarbonAssembler.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import AppKit 4 | import NefCore 5 | 6 | class CarbonAssembler { 7 | 8 | func resolveCarbonDownloader() -> CarbonDownloader { 9 | let window = resolveWindow() 10 | let view = window.contentView! 11 | let carbonView = CarbonWKWebView(frame: window.frame) 12 | view.addSubview(carbonView) // retain window 13 | return CarbonSyncDownloader(view: carbonView) 14 | } 15 | 16 | private func resolveWindow() -> NSWindow { 17 | NSWindow(contentRect: CarbonScreen.bounds, 18 | styleMask: [.titled, .closable, .miniaturizable, .resizable], 19 | backing: .buffered, 20 | defer: true, 21 | screen: CarbonScreen()) 22 | } 23 | } 24 | 25 | // MARK: private classes 26 | private class CarbonScreen: NSScreen { 27 | static let bounds = NSRect(x: 0, y: 0, width: 5000, height: 15000) 28 | 29 | override var frame: NSRect { return CarbonScreen.bounds } 30 | override var visibleFrame: NSRect { return CarbonScreen.bounds } 31 | } 32 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/App/CarbonSyncDownloader.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import NefCore 5 | import NefModels 6 | import Bow 7 | import BowEffects 8 | 9 | class CarbonSyncDownloader: CarbonDownloader { 10 | private let view: CarbonView 11 | 12 | init(view: CarbonView) { 13 | self.view = view 14 | } 15 | 16 | // MARK: delegate 17 | func carbon(configuration: CarbonModel) -> IO { 18 | let image = IO.var() 19 | 20 | return binding( 21 | continueOn(.main), 22 | image <- self.load(carbon: configuration), 23 | yield: image.get)^ 24 | } 25 | 26 | // MARK: private 27 | private func load(carbon: CarbonModel) -> IO { 28 | IO.async { callback in 29 | self.view.load(carbon: carbon, callback: callback) 30 | }^ 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/Models/RenderCarbonEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import AppKit 4 | import NefCommon 5 | import NefModels 6 | import NefCore 7 | import NefRender 8 | import BowEffects 9 | 10 | public struct RenderCarbonEnvironment { 11 | public let persistence: RenderingPersistence 12 | public let render: Render 13 | public let renderEnvironment: RenderEnvironment 14 | 15 | internal var fileSystem: FileSystem { renderEnvironment.fileSystem } 16 | 17 | public init( 18 | progressReport: ProgressReport, 19 | fileSystem: FileSystem, 20 | persistence: RenderingPersistence, 21 | xcodePlaygroundSystem: XcodePlaygroundSystem, 22 | style: CarbonStyle, 23 | carbonPrinter: @escaping (_ content: String) -> EnvIO>) { 24 | 25 | func environment(style: CarbonStyle) -> CoreCarbonEnvironment { 26 | .init(downloader: CarbonAssembler().resolveCarbonDownloader(), 27 | style: style) 28 | } 29 | 30 | self.persistence = persistence 31 | self.render = Render() 32 | self.renderEnvironment = RenderEnvironment( 33 | progressReport: progressReport, 34 | fileSystem: fileSystem, 35 | xcodePlaygroundSystem: xcodePlaygroundSystem, 36 | nodePrinter: { content in carbonPrinter(content).provide(environment(style: style)).env() }) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/Support Files/NefCarbon.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefCarbon. 6 | FOUNDATION_EXPORT double NefCarbonVersionNumber; 7 | 8 | //! Project version string for NefCarbon. 9 | FOUNDATION_EXPORT const unsigned char NefCarbonVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | -------------------------------------------------------------------------------- /project/Component/NefCarbon/Utils/URLQuery.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | // MARK: Constants 6 | extension URLRequest { 7 | static let urlLengthAllowed = 2500 8 | } 9 | 10 | // MARK: URL Query 11 | extension String { 12 | 13 | var urlEncoding: String { 14 | return replacingOccurrences(of: "+", with: "%2B") 15 | } 16 | 17 | func length(limit: Int) -> String { 18 | guard count > limit else { return self } 19 | let sliced = compactMap { $0 }[0.. EnvIO { 13 | EnvIO { (env: CleanEnvironment) in 14 | let step = CleanEvent.cleaningPlayground(nefPlayground.name) 15 | return binding( 16 | |<-env.progressReport.inProgress(step), 17 | |<-env.shell.clean(playground: nefPlayground).provide(env.fileSystem).mapError { e in .clean(info: e) }, 18 | yield: ())^ 19 | .step(step, reportCompleted: env.progressReport) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /project/Component/NefClean/Errors/CleanError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public enum CleanError: Error { 7 | case clean(info: (Error & CustomStringConvertible)? = nil) 8 | } 9 | 10 | extension CleanError: CustomStringConvertible { 11 | public var description: String { 12 | switch self { 13 | case .clean(let e): 14 | return "clean nef playground structure".appending(error: e) 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /project/Component/NefClean/Models/CleanEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import NefModels 6 | 7 | public struct CleanEnvironment { 8 | public let progressReport: ProgressReport 9 | public let fileSystem: FileSystem 10 | public let shell: NefPlaygroundSystem 11 | 12 | public init(progressReport: ProgressReport, fileSystem: FileSystem, shell: NefPlaygroundSystem) { 13 | self.progressReport = progressReport 14 | self.fileSystem = fileSystem 15 | self.shell = shell 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /project/Component/NefClean/Models/CleanEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum CleanEvent { 4 | case cleaningPlayground(String) 5 | } 6 | 7 | extension CleanEvent: CustomProgressDescription { 8 | public var progressDescription: String { 9 | switch self { 10 | case let .cleaningPlayground(name): 11 | return "\t• Cleaning playground '\(name)'..." 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /project/Component/NefClean/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2020 47 Degrees. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefClean/Support Files/NefClean.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefClean. 6 | FOUNDATION_EXPORT double NefCleanVersionNumber; 7 | 8 | //! Project version string for NefClean. 9 | FOUNDATION_EXPORT const unsigned char NefCleanVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | 13 | 14 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Algebras/NefPlaygroundSystem.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | import Bow 6 | import BowEffects 7 | 8 | public protocol NefPlaygroundSystem { 9 | func installTemplate(into output: URL, name: String, platform: Platform) -> EnvIO 10 | func linkPlaygrounds(_ playgrounds: NEA, xcworkspace: URL) -> EnvIO 11 | func clean(playground: NefPlaygroundURL) -> EnvIO 12 | func setSPM(playground: NefPlaygroundURL) -> EnvIO 13 | func setCocoapods(playground: NefPlaygroundURL, platform: Platform, target: String, customPodfile: URL?) -> EnvIO 14 | func setCarthage(playground: NefPlaygroundURL, xcodeproj: URL, customCartfile: URL?) -> EnvIO 15 | func setBow(dependency: PlaygroundDependencies.Bow, playground: NefPlaygroundURL) -> EnvIO 16 | } 17 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Algebras/RenderingPersistence.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | public struct RenderingPersistence { 8 | public let writePage: (_ page: RenderingOutput, _ file: URL) -> EnvIO 9 | 10 | public init(writePage: @escaping (_ page: RenderingOutput, _ file: URL) -> EnvIO) { 11 | self.writePage = writePage 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Algebras/XcodePlaygroundSystem.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | public protocol XcodePlaygroundSystem { 8 | func xcodeprojs(at folder: URL) -> EnvIO> 9 | func xcworkspaces(at folder: URL) -> EnvIO> 10 | func linkedPlaygrounds(at folder: URL) -> EnvIO> 11 | func playgrounds(at folder: URL) -> EnvIO> 12 | func pages(in playground: URL) -> EnvIO> 13 | } 14 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Errors/FileSystemError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum FileSystemError: Error { 6 | case create(item: String) 7 | case copy(from: String, to: String) 8 | case remove(item: String) 9 | case move(from: String, to: String) 10 | case get(from: String) 11 | case read(file: String) 12 | case write(file: String) 13 | case exist(itemPath: String) 14 | } 15 | 16 | extension FileSystemError: CustomStringConvertible { 17 | public var description: String { 18 | switch self { 19 | case .create(let item): 20 | return "cannot create item '\(item)'" 21 | case .copy(let from, let to): 22 | return "cannot copy item at '\(from)' to '\(to)'" 23 | case .remove(let item): 24 | return "cannot remove item at '\(item)'" 25 | case .move(let from, let to): 26 | return "cannot move item from '\(from)' to '\(to)'" 27 | case .get(let from): 28 | return "cannot get items from '\(from)'" 29 | case .read(let file): 30 | return "cannot read content of file '\(file)'" 31 | case .write(let file): 32 | return "cannot write in file '\(file)'" 33 | case .exist(let itemPath): 34 | return "not found item at '\(itemPath)'" 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Errors/PlaygroundShellError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum NefPlaygroundSystemError: Error { 6 | case template(info: String = "") 7 | case dependencies(info: String = "") 8 | case linking(info: String = "") 9 | case clean(info: String = "") 10 | } 11 | 12 | extension NefPlaygroundSystemError: CustomStringConvertible { 13 | public var description: String { 14 | switch self { 15 | case .template(let info): 16 | return "creating nef playground template".appending(error: info) 17 | case .dependencies(let info): 18 | return "resolving nef playground dependencies".appending(error: info) 19 | case .linking(let info): 20 | return "linking playground into workspace".appending(error: info) 21 | case .clean(let info): 22 | return "clean up nef playground".appending(error: info) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Errors/RenderingOutput.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | import Bow 6 | 7 | public struct RenderingOutput { 8 | public let ast: String 9 | public let output: NEA 10 | 11 | public init(ast: String, output: NEA) { 12 | self.ast = ast 13 | self.output = output 14 | } 15 | } 16 | 17 | public typealias PlaygroundOutput = NEA<(page: RenderingURL, platform: Platform, output: RenderingOutput)> 18 | public typealias PlaygroundsOutput = NEA<(playground: RenderingURL, output: PlaygroundOutput)> 19 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Errors/RenderingPersistenceError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum RenderingPersistenceError: Error { 6 | case persist(item: URL) 7 | case structure(folder: URL) 8 | } 9 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Errors/XcodePlaygroundSystemError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum XcodePlaygroundSystemError: Error { 6 | case xcworkspaces(information: String = "") 7 | case playgrounds(information: String = "") 8 | case pages(information: String = "") 9 | } 10 | 11 | extension XcodePlaygroundSystemError: CustomStringConvertible { 12 | public var description: String { 13 | switch self { 14 | case .xcworkspaces(let info): 15 | return "workspaces operation".appending(error: info) 16 | case .playgrounds(let info): 17 | return "playgrounds operation".appending(error: info) 18 | case .pages(let info): 19 | return "pages operation".appending(error: info) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Models/HasProgressReport.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | 6 | public protocol HasProgressReport { 7 | var progressReport: ProgressReport { get } 8 | } 9 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Models/RenderingURL.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | public struct RenderingURL { 8 | public let url: URL 9 | public let title: String 10 | 11 | public var escapedTitle: String { 12 | String(title.lowercased().unicodeScalars.filter { $0.isAlphanumeric || $0 == " " || $0 == "-" }) 13 | .replacingOccurrences(of: " ", with: "-") 14 | } 15 | 16 | public init(url: URL, title: String) { 17 | self.url = url 18 | self.title = title 19 | } 20 | } 21 | 22 | extension Unicode.Scalar { 23 | var isAlphanumeric: Bool { 24 | CharacterSet.alphanumerics.contains(self) 25 | } 26 | } 27 | 28 | // MARK: - public 29 | extension RenderingURL: CustomStringConvertible { 30 | public var description: String { title } 31 | } 32 | 33 | extension RenderingURL { 34 | public func io() -> IO { 35 | IO.pure(self)^ 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Support Files/NefCommon.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefCommon. 6 | FOUNDATION_EXPORT double NefCommonVersionNumber; 7 | 8 | //! Project version string for NefCommon. 9 | FOUNDATION_EXPORT const unsigned char NefCommonVersionString[]; 10 | 11 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Utils/Array+Utils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public extension Array { 6 | func appending(contentsOf newElements: S) -> [Element] where Element == S.Element { 7 | self + newElements 8 | } 9 | } 10 | 11 | public extension Array where Element: Hashable { 12 | func unique() -> [Element] { 13 | NSOrderedSet(array: self).array as! [Element] 14 | } 15 | } 16 | 17 | public extension ArraySlice { 18 | func dropLast(while f: (Iterator.Element) -> Bool, include: Bool = true) -> ArraySlice { 19 | guard let index = lastIndex(where: { !f($0) }) else { return [] } 20 | let lastIndex = count - (index + (include ? 1 : 0)) 21 | return lastIndex < count ? dropLast(lastIndex) : self 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Utils/Effects+Extensions.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Bow 4 | import BowEffects 5 | import NefModels 6 | 7 | public extension IO { 8 | func foldMTap(_ f: @escaping (E) -> IO, 9 | _ g: @escaping (A) -> IO) -> IO { 10 | flatTap(g).handleErrorWith { e in 11 | f(e).followedBy(.raiseError(e)) 12 | }^ 13 | } 14 | 15 | func step( 16 | _ step: B, 17 | reportCompleted progressReport: ProgressReport 18 | ) -> IO { 19 | 20 | self.foldMTap({ e in progressReport.failed(step) }, 21 | { _ in progressReport.succeeded(step) }) 22 | } 23 | } 24 | 25 | public extension EnvIO where D: HasProgressReport { 26 | func step(_ step: B) -> EnvIO where F == IOPartial { 27 | EnvIO { env in 28 | self.provide(env).step(step, reportCompleted: env.progressReport) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Utils/EnumeratedSequence+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | public extension EnumeratedSequence { 8 | func traverse(_ f: @escaping (_ offset: Int, _ element: Base.Element) -> Kind) -> Kind { 9 | map(f).sequence() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Utils/Platform+Utils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | 6 | public extension Platform { 7 | var sdk: String { 8 | switch self { 9 | case .ios: return "iphoneos" 10 | case .macos: return "macosx" 11 | case .tvos: return "tvos" 12 | case .watchos: return "watchos" 13 | } 14 | } 15 | 16 | var framework: String { 17 | switch self { 18 | case .ios: return "iPhoneOS" 19 | case .macos: return "MacOSX" 20 | case .tvos: return "AppleTVOS" 21 | case .watchos: return "WatchOS" 22 | } 23 | } 24 | 25 | func target(bundleVersion: String, isM1: Bool) -> String? { 26 | switch self { 27 | case .ios: return "arm64-apple-ios\(bundleVersion)" 28 | case .macos: return isM1 ? "arm64-apple-macosx\(bundleVersion)" : "x86_64-macosx\(bundleVersion)" 29 | default: return nil 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /project/Component/NefCommon/Utils/String+Path.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public extension String { 6 | 7 | var pathComponents: [String] { 8 | (self as NSString).pathComponents 9 | } 10 | 11 | var filename: String { 12 | pathComponents.last ?? "" 13 | } 14 | 15 | var removeExtension: String { 16 | removeLastComponent(separatedBy: ".") 17 | } 18 | 19 | var `extension`: String { 20 | components(separatedBy: ".").last ?? "" 21 | } 22 | 23 | var expandingTildeInPath: String { 24 | NSString(string: self).expandingTildeInPath 25 | } 26 | 27 | var parentPath: String { 28 | removeLastComponent(separatedBy: "/") 29 | } 30 | 31 | var trimmingEmptyCharacters: String { 32 | trimmingCharacters(in: ["\n", " " ]) 33 | } 34 | 35 | var trimmingQuotes: String { 36 | trimmingCharacters(in: ["\"", "'" ]) 37 | } 38 | 39 | private func removeLastComponent(separatedBy separator: String) -> String { 40 | var pathComponents = components(separatedBy: separator) 41 | pathComponents.removeLast() 42 | return pathComponents.count > 0 ? pathComponents.joined(separator: separator) : self 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Algebras/CompilerShell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import NefModels 6 | import Bow 7 | import BowEffects 8 | 9 | public protocol CompilerShell { 10 | func podinstall(project: URL, platform: Platform, cached: Bool) -> IO 11 | func carthage(project: URL, platform: Platform, cached: Bool) -> EnvIO 12 | func build(xcworkspace: URL, scheme: String, platform: Platform, derivedData: URL, log: URL) -> IO 13 | func dependencies(platform: Platform) -> IO 14 | func libraries(platform: Platform) -> IO 15 | func compile(file: URL, options: CompilerOptions, output: URL, log: URL) -> IO 16 | } 17 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Algebras/CompilerSystem.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | import NefCommon 6 | import BowEffects 7 | 8 | public protocol CompilerSystem { 9 | func compile(xcworkspace: URL, atNefPlayground: NefPlaygroundURL, platform: Platform, cached: Bool) -> EnvIO 10 | func compile(page: String, filename: String, inPlayground: URL, atNefPlayground: NefPlaygroundURL, workspace: WorkspaceInfo) -> EnvIO 11 | } 12 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Errors/CompilerShellError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public enum CompilerShellError: Error { 7 | case notFound(command: String, info: String = "") 8 | case failed(command: String, info: String = "") 9 | } 10 | 11 | extension CompilerShellError: CustomStringConvertible { 12 | public var description: String { 13 | switch self { 14 | case .notFound(let command, let info): 15 | return "command '\(command)' not found".appending(error: info) 16 | 17 | case .failed(let command, let info): 18 | return "command '\(command)' failed".appending(error: info) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Errors/CompilerSystemError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public enum CompilerSystemError: Error { 7 | case code(String) 8 | case dependencies(URL? = nil, info: String = "") 9 | case build(URL? = nil, info: String = "") 10 | } 11 | 12 | extension CompilerSystemError: CustomStringConvertible { 13 | public var description: String { 14 | switch self { 15 | case .code(_): 16 | return "compiling code" 17 | case .dependencies(let url, let info): 18 | return "resolving dependencies \(url?.path ?? "")".appending(error: info) 19 | case .build(let url, let info): 20 | return "building \(url?.path ?? "file")".appending(error: info) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Extensions/SwiftModule+IO.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import NefModels 6 | import Bow 7 | import BowEffects 8 | 9 | extension Array where Element == String { 10 | func swiftModules() -> EnvIO { 11 | parTraverse { module in module.swiftModule() } 12 | .map { modules in modules.compactMap(\.orNil) }^ 13 | } 14 | } 15 | 16 | private extension String { 17 | func swiftModule() -> EnvIO> { 18 | EnvIO { fileSystem in 19 | guard let swiftModule = SwiftModule(name: self.filename.removeExtension, at: self.parentPath), 20 | fileSystem.exist(itemPath: swiftModule.module.path), 21 | fileSystem.exist(itemPath: swiftModule.binary.path) else { return IO.pure(.none())^ } 22 | 23 | return IO.pure(.some(swiftModule))^ 24 | }^ 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Models/CompilerEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum CompilerEvent { 4 | case buildingWorkspace(String) 5 | case buildingPlayground(String) 6 | case compilingPage(String) 7 | } 8 | 9 | extension CompilerEvent: CustomProgressDescription { 10 | 11 | public var progressDescription: String { 12 | switch self { 13 | 14 | case let .buildingWorkspace(name): 15 | return "Building workspace '\(name)'" 16 | 17 | case let .buildingPlayground(name): 18 | return "Building playground '\(name)'" 19 | 20 | case let .compilingPage(name): 21 | return "\t• Compiling page '\(name)'" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Models/CompilerSystemEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public struct CompilerSystemEnvironment { 7 | public let shell: CompilerShell 8 | public let fileSystem: FileSystem 9 | public let nefPlaygroundSystem: NefPlaygroundSystem 10 | } 11 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2020 47 Degrees. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefCompiler/Support Files/NefCompiler.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefCompiler. 6 | FOUNDATION_EXPORT double NefCompilerVersionNumber; 7 | 8 | //! Project version string for NefCompiler. 9 | FOUNDATION_EXPORT const unsigned char NefCompilerVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | 13 | 14 | -------------------------------------------------------------------------------- /project/Component/NefJekyll/Models/JekyllEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum JekyllEvent { 4 | case buildingMainPage(String) 5 | case buildingSidebar(String) 6 | } 7 | 8 | extension JekyllEvent: CustomProgressDescription { 9 | public var progressDescription: String { 10 | switch self { 11 | case let .buildingMainPage(name): 12 | return "Building main page '\(name)'" 13 | case let .buildingSidebar(name): 14 | return "Building sidebar '\(name)'" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /project/Component/NefJekyll/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefJekyll/Support Files/NefJekyll.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefJekyll. 6 | FOUNDATION_EXPORT double NefJekyllVersionNumber; 7 | 8 | //! Project version string for NefJekyll. 9 | FOUNDATION_EXPORT const unsigned char NefJekyllVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | -------------------------------------------------------------------------------- /project/Component/NefMarkdown/Models/RenderMarkdownEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import NefCommon 4 | import NefModels 5 | import NefCore 6 | import NefRender 7 | import BowEffects 8 | 9 | public struct RenderMarkdownEnvironment { 10 | public let persistence: RenderingPersistence 11 | public let render: Render 12 | public let renderEnvironment: RenderEnvironment 13 | 14 | internal var fileSystem: FileSystem { renderEnvironment.fileSystem } 15 | 16 | public init(progressReport: ProgressReport, 17 | fileSystem: FileSystem, 18 | persistence: RenderingPersistence, 19 | xcodePlaygroundSystem: XcodePlaygroundSystem, 20 | markdownPrinter: @escaping (_ content: String) -> EnvIO>) { 21 | 22 | self.persistence = persistence 23 | self.render = Render() 24 | self.renderEnvironment = RenderEnvironment( 25 | progressReport: progressReport, 26 | fileSystem: fileSystem, 27 | xcodePlaygroundSystem: xcodePlaygroundSystem, 28 | nodePrinter: { content in markdownPrinter(content).provide(.init()).env() }) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /project/Component/NefMarkdown/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefMarkdown/Support Files/NefMarkdown.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefMarkdown. 6 | FOUNDATION_EXPORT double NefMarkdownVersionNumber; 7 | 8 | //! Project version string for NefMarkdown. 9 | FOUNDATION_EXPORT const unsigned char NefMarkdownVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | -------------------------------------------------------------------------------- /project/Component/NefModels/CarbonView.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import AppKit 4 | 5 | /// Describes a Carbon loading view. 6 | public protocol CarbonLoadingView: NSView { 7 | 8 | /// Shows the loading view. 9 | func show() 10 | 11 | /// Hides the loading view. 12 | func hide() 13 | } 14 | 15 | /// Describes a Carbon view. 16 | public protocol CarbonView: NSView { 17 | 18 | /// Associated Carbon loading view. 19 | var loadingView: CarbonLoadingView? { get set } 20 | 21 | /// Need to reload the Carbon style. 22 | func update(state: CarbonStyle) 23 | } 24 | -------------------------------------------------------------------------------- /project/Component/NefModels/CompilerOptions.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Swift compiler options 6 | public struct CompilerOptions { 7 | /// Source files to compile. 8 | public let sources: [URL] 9 | /// Workspace options. 10 | public let workspace: WorkspaceInfo 11 | 12 | /// Initializes `CompilerOptions` 13 | /// 14 | /// - Parameters: 15 | /// - sources: Source files to compile. 16 | /// - workspace: Workspace information. 17 | public init(sources: [URL], workspace: WorkspaceInfo) { 18 | self.sources = sources 19 | self.workspace = workspace 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /project/Component/NefModels/PlaygroundDependencies.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Models the supported `nef Playground` dependencies. 6 | public enum PlaygroundDependencies { 7 | /// Describes the bow dependencies. 8 | case bow(Bow) 9 | 10 | /// Project uses Swift Packages Manager. 11 | case spm 12 | 13 | /// Project uses CocoaPods. 14 | case cocoapods(podfile: URL?) 15 | 16 | /// Project uses Carthage. 17 | case carthage(cartfile: URL?) 18 | 19 | /// Models the `Bow` dependencies. 20 | public enum Bow { 21 | /// Represents the version number `x.y.z` 22 | case version(String = "") 23 | 24 | /// Represents the branch of the repo. 25 | case branch(String) 26 | 27 | /// Represents the tag of the repo. 28 | case tag(String) 29 | 30 | /// Represents the commit hash of the repo. 31 | case commit(String) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /project/Component/NefModels/PlaygroundExcludeItem.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Models a dependency to exclude from `Swift Package`. 6 | public enum PlaygroundExcludeItem: Equatable { 7 | /// The module to exclude from dependencies. 8 | case module(name: String) 9 | 10 | /// The filename to exclude from dependencies. 11 | case file(name: String, module: String) 12 | } 13 | -------------------------------------------------------------------------------- /project/Component/NefModels/PlaygroundPlatform.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Models the different platforms in the Apple ecosystem. 6 | public enum Platform: String { 7 | /// Represents the iOS platform. 8 | case ios 9 | 10 | /// Represents the macOS platform. 11 | case macos 12 | 13 | /// Represents the tvOS platform. 14 | case tvos 15 | 16 | /// Represents the watchOS platform. 17 | case watchos 18 | 19 | /// Initializes a `Platform` 20 | /// 21 | /// - Parameter platform: A textual `Platform`. 22 | public init?(platform: String) { 23 | guard let platform = Platform(rawValue: platform) else { return nil } 24 | self = platform 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Component/NefModels/RenderedPage.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Describes the output of a rendered page. 6 | public struct RenderedPage { 7 | /// Describes nef syntax tree. 8 | public let ast: String 9 | /// Rendered output. 10 | public let rendered: RenderedOutput 11 | 12 | /// Initializes `RenderedPage` 13 | /// 14 | /// - Parameters: 15 | /// - ast: nef syntax-tree. 16 | /// - rendered: Rendered output. 17 | public init(ast: String, rendered: RenderedOutput) { 18 | self.ast = ast 19 | self.rendered = rendered 20 | } 21 | } 22 | 23 | /// Describes rendered value. 24 | public enum RenderedOutput { 25 | /// Specifies the output file path. 26 | case url(URL) 27 | /// Rendered value. 28 | case value(String) 29 | } 30 | 31 | public extension RenderedOutput { 32 | /// Extract content of the rendered page. 33 | var content: String { 34 | switch self { 35 | case .url(let url): 36 | return (try? String(contentsOf: url)) ?? "" 37 | case .value(let value): 38 | return value 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /project/Component/NefModels/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefModels/Support Files/NefModels.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefModels. 6 | FOUNDATION_EXPORT double NefModelsVersionNumber; 7 | 8 | //! Project version string for NefModels. 9 | FOUNDATION_EXPORT const unsigned char NefModelsVersionString[]; 10 | -------------------------------------------------------------------------------- /project/Component/NefModels/SwiftModule.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Swift module description 6 | public struct SwiftModule { 7 | /// Specifies the Swift module name. 8 | let name: String 9 | /// Specifies the Swift module directory. 10 | let url: URL 11 | /// Specifies path to Swift module. 12 | public var module: URL { 13 | url.appendingPathComponent(name).appendingPathExtension("swiftmodule") 14 | } 15 | /// Specifies path to Swift module object. 16 | public var binary: URL { 17 | url.appendingPathComponent(name).appendingPathExtension("o") 18 | } 19 | 20 | /// Initializes `SwiftModule` 21 | /// 22 | /// - Parameters: 23 | /// - name: Swift module name. 24 | /// - path: Swift module directory. 25 | public init?(name: String, at path: String) { 26 | guard let url = URL(string: path) else { return nil } 27 | self.name = name 28 | self.url = url 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /project/Component/NefModels/WorkspaceInfo.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | /// Workspace dependencies 6 | public struct WorkspaceInfo { 7 | /// Set SDK for the given platform. 8 | public let platform: Platform 9 | /// Specifies frameworks directories to search path. 10 | public let frameworks: [URL] 11 | /// Specifies swift modules directories to search path. 12 | public let modules: [URL] 13 | /// Specifies binaries for the swiftmodules 14 | public let binaries: [URL] 15 | /// Specifies sources which should be passed to the linker. 16 | public let linkers: [URL] 17 | /// Specifies directories to library link search path. 18 | public let libs: [URL] 19 | 20 | /// Initializes `WorkspaceInfo` 21 | /// 22 | /// - Parameters: 23 | /// - platform: Set SDK for the given platform. 24 | /// - frameworks: List of the frameworks. 25 | /// - modules: List of the modules. 26 | /// - binaries: List of the binaries. 27 | /// - linkers: List of the sources which should be passed to the linker. 28 | /// - libs: List of the libraries. 29 | public init(platform: Platform, frameworks: [URL], modules: [URL], binaries: [URL], linkers: [URL], libs: [URL]) { 30 | self.platform = platform 31 | self.frameworks = frameworks 32 | self.modules = modules 33 | self.binaries = binaries 34 | self.linkers = linkers 35 | self.libs = libs 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /project/Component/NefPlayground/Errors/PlaygroundError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public enum PlaygroundError: Error { 7 | case structure(info: (Error & CustomStringConvertible)? = nil) 8 | case template(info: (Error & CustomStringConvertible)? = nil) 9 | case dependencies(info: (Error & CustomStringConvertible)? = nil) 10 | case operation(operation: String, info: (Error & CustomStringConvertible)? = nil) 11 | } 12 | 13 | extension PlaygroundError: CustomStringConvertible { 14 | public var description: String { 15 | switch self { 16 | case .structure(let e): 17 | return "creating the nef playground structure".appending(error: e) 18 | case .template(let e): 19 | return "download playground template".appending(error: e) 20 | case .dependencies(let e): 21 | return "set nef playground dependencies".appending(error: e) 22 | case .operation(let operation, let e): 23 | return "could not \(operation) successfully".appending(error: e) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Component/NefPlayground/Models/PlaygroundEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import NefModels 6 | 7 | public struct PlaygroundEnvironment { 8 | public let progressReport: ProgressReport 9 | public let fileSystem: FileSystem 10 | public let nefPlaygroundSystem: NefPlaygroundSystem 11 | public let xcodePlaygroundSystem: XcodePlaygroundSystem 12 | 13 | public init( 14 | progressReport: ProgressReport, 15 | fileSystem: FileSystem, 16 | nefPlaygroundSystem: NefPlaygroundSystem, 17 | xcodePlaygroundSystem: XcodePlaygroundSystem) { 18 | 19 | self.progressReport = progressReport 20 | self.fileSystem = fileSystem 21 | self.nefPlaygroundSystem = nefPlaygroundSystem 22 | self.xcodePlaygroundSystem = xcodePlaygroundSystem 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /project/Component/NefPlayground/Models/PlaygroundEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum PlaygroundEvent { 4 | case downloadingTemplate(String) 5 | case resolvingDependencies(String) 6 | case linkingPlaygrounds(String) 7 | } 8 | 9 | extension PlaygroundEvent: CustomProgressDescription { 10 | public var progressDescription: String { 11 | switch self { 12 | case let .downloadingTemplate(output): 13 | return "Downloading playground template '\(output)'" 14 | 15 | case let .resolvingDependencies(name): 16 | return "Resolving dependencies '\(name)'" 17 | 18 | case let .linkingPlaygrounds(name): 19 | return "Linking playgrounds '\(name)'" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /project/Component/NefPlayground/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2020 47 Degrees. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefPlayground/Support Files/NefPlayground.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefPlayground. 6 | FOUNDATION_EXPORT double NefPlaygroundVersionNumber; 7 | 8 | //! Project version string for NefPlayground. 9 | FOUNDATION_EXPORT const unsigned char NefPlaygroundVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | 13 | 14 | -------------------------------------------------------------------------------- /project/Component/NefRender/Models/RenderEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import NefCommon 4 | import NefModels 5 | import NefCore 6 | import BowEffects 7 | 8 | public struct RenderEnvironment { 9 | public typealias NodePrinter = (_ content: String) -> EnvIO> 10 | 11 | public let progressReport: ProgressReport 12 | public let fileSystem: FileSystem 13 | public let xcodePlaygroundSystem: XcodePlaygroundSystem 14 | public let nodePrinter: NodePrinter 15 | 16 | public init(progressReport: ProgressReport, 17 | fileSystem: FileSystem, 18 | xcodePlaygroundSystem: XcodePlaygroundSystem, 19 | nodePrinter: @escaping NodePrinter) { 20 | self.progressReport = progressReport 21 | self.fileSystem = fileSystem 22 | self.xcodePlaygroundSystem = xcodePlaygroundSystem 23 | self.nodePrinter = nodePrinter 24 | } 25 | } 26 | 27 | public enum RenderEnvironmentInfo { 28 | case info(playground: RenderingURL, page: RenderingURL) 29 | case empty 30 | 31 | public var pathComponent: String { 32 | guard let data = data else { return "" } 33 | return "\(data.playground.escapedTitle)/\(data.page.escapedTitle)" 34 | } 35 | 36 | var data: (playground: RenderingURL, page: RenderingURL)? { 37 | switch self { 38 | case let .info(playground, page): 39 | return (playground, page) 40 | default: 41 | return nil 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /project/Component/NefRender/Models/RenderEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum RenderEvent { 4 | case processingPage(String) 5 | case gettingPagesFromPlayground(String) 6 | case gettingPlaygrounds(String) 7 | } 8 | 9 | extension RenderEvent: CustomProgressDescription { 10 | public var progressDescription: String { 11 | switch self { 12 | 13 | case let .processingPage(name): 14 | return "\t• Processing page \(name)" 15 | 16 | case let .gettingPagesFromPlayground(name): 17 | return "Getting pages in playground \(name)" 18 | 19 | case let .gettingPlaygrounds(name): 20 | return "Getting playgrounds in \(name)" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /project/Component/NefRender/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2020 47 Degrees. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefRender/Support Files/NefRender.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefRender. 6 | FOUNDATION_EXPORT double NefRenderVersionNumber; 7 | 8 | //! Project version string for NefRender. 9 | FOUNDATION_EXPORT const unsigned char NefRenderVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | 13 | 14 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Algebras/PackageShell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import BowEffects 6 | 7 | public protocol PackageShell { 8 | func dumpPackage(packagePath: String) -> EnvIO 9 | func resolve(packagePath: String, buildPath: String) -> EnvIO 10 | func describe(repositoryPath: String) -> EnvIO 11 | func linkPath(itemPath: String, parentPath: String) -> EnvIO 12 | } 13 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Assets.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | enum AssetsBase64 {} 6 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Errors/PackageShellError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum PackageShellError: Error { 6 | case empty(directory: String) 7 | case dumpPackage(package: String, information: String) 8 | case dependencies(package: String, information: String) 9 | case describe(repository: String) 10 | case linkPath(item: String) 11 | } 12 | 13 | extension PackageShellError: CustomStringConvertible { 14 | public var description: String { 15 | switch self { 16 | case .empty(let directory): 17 | return "directory '\(directory)' is empty" 18 | case let .dependencies(package, info): 19 | return info.isEmpty ? "could not resolve dependencies in the package: '\(package)'" : info.lowercased() 20 | case .describe(let repository): 21 | return "could not get information from repository '\(repository)'" 22 | case .linkPath(let item): 23 | return "could not follow symbolic links to item '\(item)'" 24 | case .dumpPackage(let package, let info): 25 | return info.isEmpty ? "could not get swift package description: '\(package)'" : info.lowercased() 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Errors/PlaygroundBookError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | enum PlaygroundBookError: Error, CustomStringConvertible { 6 | case manifest(path: String) 7 | case page(path: String) 8 | case resource(name: String) 9 | case invalidModule(name: String) 10 | case sources(module: String) 11 | 12 | var description: String { 13 | switch self { 14 | case .manifest(let path): 15 | return "manifiest in '\(path)'" 16 | case .page(let path): 17 | return "page at '\(path)'" 18 | case .resource(let name): 19 | return "resource '\(name)'" 20 | case .invalidModule(let name): 21 | return "module '\(name)'" 22 | case .sources(let module): 23 | return "copy sources to module '\(module)'" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Errors/SwiftPlaygroundError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum SwiftPlaygroundError: Error { 6 | case clean(item: String) 7 | case structure 8 | case package(packagePath: String) 9 | case checkout(info: String) 10 | case modules(_ paths: [String]) 11 | case dumpPackage(info: Error) 12 | case playgroundBook(info: String) 13 | case ioError(info: String = "") 14 | 15 | public var information: String { 16 | switch self { 17 | case .clean(let item): 18 | return "could not clean item at '\(item)'" 19 | case .structure: 20 | return "could not create project structure" 21 | case .package(let path): 22 | return "could not build project 'Package.swift' :: \(path)" 23 | case .checkout(let info): 24 | return "command checkout failed: \(info)" 25 | case .modules(let paths): 26 | let packages = paths.map { $0.filename }.joined(separator: ", ") 27 | return "could not find any module for products in your Package.swift: \(packages)" 28 | case .dumpPackage(let error): 29 | return error.localizedDescription.isEmpty ? "could not read the Package.swift file" : error.localizedDescription 30 | case .playgroundBook(let info): 31 | return "could not create Playground Book: \(info)" 32 | case .ioError(let info): 33 | return "failure running IO \(info.isEmpty ? "" : ": \(info)")" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/Module.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import BowOptics 5 | 6 | struct Module: Codable, AutoLens { 7 | var name: String 8 | var path: String 9 | let type: Type 10 | let moduleType: ModuleType 11 | var sources: [String] 12 | 13 | enum ModuleType: String, Codable { 14 | case swift = "SwiftTarget" 15 | case clang = "ClangTarget" 16 | } 17 | 18 | enum `Type`: String, Codable { 19 | case test 20 | case library 21 | case executable 22 | } 23 | 24 | private enum CodingKeys: String, CodingKey { 25 | case name 26 | case path 27 | case type 28 | case moduleType = "module_type" 29 | case sources 30 | } 31 | } 32 | 33 | extension Module: CustomStringConvertible { 34 | var description: String { name } 35 | } 36 | 37 | extension Module { 38 | static let sourcesLens = Module.lens(for: \.sources) 39 | static let moduleNameAndSourcesTraversal = [Module].traversal + Module.lens(for: \.name).merge(Module.lens(for: \.sources)) 40 | } 41 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/Package.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | struct Package: Codable { 6 | let name: String 7 | let path: String 8 | let targets: [Module] 9 | } 10 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/PlaygroundBookEvent.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | 3 | public enum PlaygroundBookEvent { 4 | case cleanup 5 | case creatingStructure(String) 6 | case downloadingDependencies 7 | case gettingModules 8 | case buildingPlayground 9 | } 10 | 11 | extension PlaygroundBookEvent: CustomProgressDescription { 12 | public var progressDescription: String { 13 | switch self { 14 | case .cleanup: 15 | return "Cleaning up generated files for building" 16 | case .creatingStructure(let name): 17 | return "Creating swift playground structure (\(name))" 18 | case .downloadingDependencies: 19 | return "Downloading dependencies..." 20 | case .gettingModules: 21 | return "Getting modules from repositories..." 22 | case .buildingPlayground: 23 | return "Building Swift Playground..." 24 | } 25 | } 26 | 27 | public var currentStep: UInt { 28 | switch self { 29 | case .cleanup: 30 | return 1 31 | case .creatingStructure: 32 | return 2 33 | case .downloadingDependencies: 34 | return 3 35 | case .gettingModules: 36 | return 4 37 | case .buildingPlayground: 38 | return 5 39 | } 40 | } 41 | 42 | public var totalSteps: UInt { 5 } 43 | } 44 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/PlaygroundBookResolutionPath.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | struct PlaygroundBookResolutionPath { 6 | let name: String 7 | let path: String 8 | 9 | let pageName: String 10 | let imageReferenceName: String 11 | let contentsPath: String 12 | let chapterPath: String 13 | let pagePath: String 14 | let templatePagePath: String 15 | let resourcesPath: String 16 | let modulesPath: String 17 | 18 | init(name: String, path: String) { 19 | self.name = name 20 | self.path = path 21 | 22 | pageName = name 23 | imageReferenceName = "nef-playground.png" 24 | contentsPath = "\(path)/Contents" 25 | chapterPath = "\(contentsPath)/Chapters/Chapter \(name).playgroundchapter" 26 | pagePath = "\(chapterPath)/Pages/\(pageName).playgroundpage" 27 | templatePagePath = "\(chapterPath)/Pages/Template.playgroundpage" 28 | resourcesPath = "\(contentsPath)/PrivateResources" 29 | modulesPath = "\(path)/Contents/UserModules" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/PlaygroundEnvironment.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | import NefModels 6 | 7 | public struct PlaygroundEnvironment: HasProgressReport { 8 | public let progressReport: ProgressReport 9 | public let shell: PackageShell 10 | public let system: FileSystem 11 | 12 | public init( 13 | progressReport: ProgressReport, 14 | shell: PackageShell, 15 | system: FileSystem) { 16 | 17 | self.progressReport = progressReport 18 | self.shell = shell 19 | self.system = system 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/PlaygroundResolutionPath.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | private enum Constants { 6 | static let nefFolder = "nef" 7 | } 8 | 9 | struct PlaygroundResolutionPath { 10 | let projectName: String 11 | let outputPath: String 12 | 13 | private let projectPath: String 14 | let playgroundPath: String 15 | let packagePath: String 16 | let packageFilePath: String 17 | let packageResolvedPath: String 18 | let buildPath: String 19 | let checkoutPath: String 20 | 21 | init(projectName: String, outputPath: String) { 22 | self.projectName = projectName 23 | self.outputPath = outputPath 24 | 25 | projectPath = "\(outputPath)/\(projectName)" 26 | playgroundPath = "\(projectPath)/\(projectName).playgroundbook" 27 | packagePath = "\(projectPath)/\(Constants.nefFolder)" 28 | packageFilePath = "\(packagePath)/Package.swift" 29 | packageResolvedPath = "\(packagePath)/Package.resolved" 30 | buildPath = "\(packagePath)/build" 31 | checkoutPath = "\(packagePath)/build/checkouts" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Models/SwiftPackageProduct.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | 6 | public struct SwiftPackageProduct { 7 | let name: String 8 | let dependencies: [String] 9 | } 10 | 11 | public extension Array where Element == SwiftPackageProduct { 12 | func names() -> [String] { 13 | (map(\.name) + flatMap(\.dependencies)).unique() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 47 Degrees. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/NefSwiftPlayground/Support Files/NefSwiftPlayground.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefSwiftPlayground. 6 | FOUNDATION_EXPORT double NefSwiftPlaygroundVersionNumber; 7 | 8 | //! Project version string for NefSwiftPlayground. 9 | FOUNDATION_EXPORT const unsigned char NefSwiftPlaygroundVersionString[]; 10 | -------------------------------------------------------------------------------- /project/Component/nef/CleanAPI.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefCommon 5 | @_exported import NefModels 6 | import NefClean 7 | import Bow 8 | import BowEffects 9 | 10 | /// Describes the API for `Clean` 11 | public protocol CleanAPI { 12 | /// Cleans a nef Playground. 13 | /// 14 | /// - Parameters: 15 | /// - nefPlayground: Folder where to search for Xcode Playgrounds - it must be a nef Playground structure. 16 | /// - Returns: An `EnvIO` to perform IO operations that produce errors of type `nef.Error`, having access to an immutable environment of type `ProgressReport`. 17 | static func clean(nefPlayground: URL) -> EnvIO 18 | } 19 | 20 | /// Instance of the Clean API 21 | public enum Clean: CleanAPI { 22 | public static func clean(nefPlayground: URL) -> EnvIO { 23 | NefClean.Clean() 24 | .nefPlayground(.init(project: nefPlayground)) 25 | .contramap { progressReport in 26 | CleanEnvironment( 27 | progressReport: progressReport, 28 | fileSystem: UnixFileSystem(), 29 | shell: MacNefPlaygroundSystem()) } 30 | .mapError { e in nef.Error.compiler(info: "clean: \(e)") } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Carbon.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefCarbon.h" 5 | 6 | FOUNDATION_EXPORT double CarbonVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char CarbonVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Clean.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefClean.h" 5 | 6 | FOUNDATION_EXPORT double CleanVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char CleanVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Common.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefCore.h" 5 | 6 | //! Project version number for Markup. 7 | FOUNDATION_EXPORT double NefCoreVersionNumber; 8 | 9 | //! Project version string for Markup. 10 | FOUNDATION_EXPORT const unsigned char NefCoreVersionString[]; 11 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Compiler.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefCompiler.h" 5 | 6 | FOUNDATION_EXPORT double CompilerVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char CompilerVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Core.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefCore.h" 5 | 6 | FOUNDATION_EXPORT double CoreVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char CoreVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Jekyll.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefJekyll.h" 5 | 6 | FOUNDATION_EXPORT double JekyllVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char JekyllVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Markdown.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefMarkdown.h" 5 | 6 | FOUNDATION_EXPORT double MarkdownVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char MarkdownVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_Playground.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefPlayground.h" 5 | 6 | FOUNDATION_EXPORT double PlaygroundVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char PlaygroundVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/_SwiftPlayground.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefSwiftPlayground.h" 5 | 6 | FOUNDATION_EXPORT double SwiftPlaygroundAPIVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char SwiftPlaygroundAPIVersionString[]; 8 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module nef { 2 | umbrella header "nef.h" 3 | export * 4 | 5 | explicit module Core { 6 | header "_Core.h" 7 | export * 8 | } 9 | 10 | explicit module Compiler { 11 | header "_Compiler.h" 12 | export Core 13 | export * 14 | } 15 | 16 | explicit module Clean { 17 | header "_Clean.h" 18 | export Core 19 | export * 20 | } 21 | 22 | explicit module Markdown { 23 | header "_Markdown.h" 24 | export Core 25 | export * 26 | } 27 | 28 | explicit module Jekyll { 29 | header "_Jekyll.h" 30 | export Core 31 | export * 32 | } 33 | 34 | explicit module Carbon { 35 | header "_Carbon.h" 36 | export Core 37 | export * 38 | } 39 | 40 | explicit module Playground { 41 | header "_Playground.h" 42 | export Core 43 | export * 44 | } 45 | 46 | explicit module SwiftPlayground { 47 | header "_SwiftPlayground.h" 48 | export Core 49 | export * 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /project/Component/nef/Support Files/nef.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | #import "NefCommon.h" 5 | #import "NefModels.h" 6 | 7 | FOUNDATION_EXPORT double NefVersionNumber; 8 | FOUNDATION_EXPORT const unsigned char NefVersionString[]; 9 | -------------------------------------------------------------------------------- /project/Component/nef/Utils/BuildConfiguration.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | internal enum BuildConfiguration { 6 | static let buildVersion = "0.7.1" 7 | static let templateVersion = "0.7.1" 8 | } 9 | -------------------------------------------------------------------------------- /project/Component/nef/Utils/URL+PlaygroundPage.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | internal extension URL { 6 | var playgroundPage: URL { 7 | path.contains("Contents.swift") ? self : appendingPathComponent("Contents.swift") 8 | } 9 | 10 | var contentPage: String? { 11 | try? String(contentsOfFile: playgroundPage.path) 12 | } 13 | 14 | var pageName: String { 15 | playgroundPage.deletingLastPathComponent().lastPathComponent.removeExtension 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /project/Component/nef/VersionAPI.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | /// Describes the API for `Version` 8 | public protocol VersionAPI { 9 | /// Gets nef build version number. 10 | /// 11 | /// - Returns: An IO that never produce errors and returns the build version number. 12 | static func info() -> UIO 13 | } 14 | 15 | /// Instance of the Version API 16 | public enum Version: VersionAPI { 17 | public static func info() -> UIO { 18 | IO.pure(BuildConfiguration.buildVersion)^ 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /project/Core/Models/CoreEnvironments.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import NefModels 5 | 6 | public struct CoreJekyllEnvironment { 7 | let permalink: String 8 | 9 | public init(permalink: String) { 10 | self.permalink = permalink 11 | } 12 | } 13 | 14 | public struct CoreMarkdownEnvironment { 15 | public init() {} 16 | } 17 | 18 | public struct CoreCarbonEnvironment { 19 | let downloader: CarbonDownloader 20 | let style: CarbonStyle 21 | 22 | public init(downloader: CarbonDownloader, style: CarbonStyle) { 23 | self.downloader = downloader 24 | self.style = style 25 | } 26 | } 27 | 28 | public struct CoreCodeEnvironment { 29 | public init() {} 30 | } 31 | -------------------------------------------------------------------------------- /project/Core/Models/CoreRenderError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum CoreRenderError: Error, Equatable { 6 | case ast 7 | case renderNode(String) 8 | case renderEmpty 9 | } 10 | 11 | extension CoreRenderError: CustomStringConvertible { 12 | public var description: String { 13 | switch self { 14 | case .ast: 15 | return """ 16 | Syntax analysis failed. Possible issues: 17 | - File is empty. 18 | - Check all the begin/end delimiters are balanced. 19 | """ 20 | case .renderNode(let node): 21 | return "Could not render node: \n\(node)\n" 22 | case .renderEmpty: 23 | return "Render result was empty. Review the page and nef hidden blocks." 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Core/Models/Image.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum Image { 6 | case data(Data) 7 | case empty 8 | 9 | var isEmpty: Bool { 10 | switch self { 11 | case .empty: return true 12 | default: return false 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /project/Core/Render/CoreCode.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import Bow 5 | import BowEffects 6 | 7 | extension NodeProcessor where D == CoreCodeEnvironment, A == String { 8 | static var code: NodeProcessor { 9 | func render(node: Node) -> EnvIO { 10 | node.code().env() 11 | } 12 | 13 | func merge(nodes: [A]) -> EnvIO> { 14 | let data = nodes.combineAll() 15 | return EnvIO.pure(NEA.of(data))^ 16 | } 17 | 18 | return .init(render: render, merge: merge) 19 | } 20 | } 21 | 22 | 23 | // MARK: - node definition 24 | extension Node { 25 | func code() -> IO { 26 | switch self { 27 | case let .block(nodes): 28 | let code = nodes.map { $0.code }.joined() 29 | return IO.pure(code)^ 30 | 31 | case let .nef(command, nodes): 32 | guard command == .hidden else { return IO.pure("")^ } 33 | return nodes.traverse { node in node.code() } 34 | .map { values in values.joined() }^ 35 | 36 | case let .raw(value): 37 | return IO.pure(value)^ 38 | 39 | default: 40 | return IO.pure("")^ 41 | } 42 | } 43 | } 44 | 45 | extension Node.Code { 46 | var code: String { 47 | switch self { 48 | case let .code(code): return code 49 | default: return "" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /project/Core/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019-2021 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/Core/Support Files/NefCore.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for NefCore. 6 | FOUNDATION_EXPORT double NefCoreVersionNumber; 7 | 8 | //! Project version string for NefCore. 9 | FOUNDATION_EXPORT const unsigned char NefCoreVersionString[]; 10 | -------------------------------------------------------------------------------- /project/Core/Utils/Node+Render.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | extension Node { 6 | 7 | var isHidden: Bool { 8 | switch self { 9 | case let .nef(command, _): return command == .hidden 10 | default: return false 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project/Core/Utils/String+Format.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | typealias SubstringType = (ouput: String, range: NSRange) 6 | 7 | extension String { 8 | func substring(pattern: String) -> SubstringType? { 9 | let range = NSRange(location: 0, length: self.count) 10 | guard let regex = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive), 11 | let match = regex.firstMatch(in: self, options: [], range: range) else { return nil } 12 | 13 | let output = NSString(string: self).substring(with: match.range) as String 14 | 15 | return (output, match.range) 16 | } 17 | 18 | func advance(_ offset: Int) -> String { 19 | return NSString(string: self).substring(from: offset) as String 20 | } 21 | 22 | func clean(_ ocurrences: String...) -> String { 23 | return ocurrences.reduce(self) { (output, ocurrence) in 24 | output.replacingOccurrences(of: ocurrence, with: "") 25 | } 26 | } 27 | 28 | var trimmingWhitespaces: String { 29 | return trimmingCharacters(in: .whitespaces) 30 | } 31 | 32 | var trimmingLeftWhitespaces: String { 33 | return String(drop { $0 == " " }) 34 | } 35 | 36 | var trimmingNewLines: String { 37 | return trimmingCharacters(in: .newlines) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /project/Tests/CoreTestPlan.xctestplan: -------------------------------------------------------------------------------- 1 | { 2 | "configurations" : [ 3 | { 4 | "id" : "4480A092-53B4-4D84-979A-4441A8AD5145", 5 | "name" : "Configuration 1", 6 | "options" : { 7 | 8 | } 9 | } 10 | ], 11 | "defaultOptions" : { 12 | 13 | }, 14 | "testTargets" : [ 15 | { 16 | "target" : { 17 | "containerPath" : "container:nef.xcodeproj", 18 | "identifier" : "8B6B119B22CB9FDE0060177F", 19 | "name" : "CoreTests" 20 | } 21 | } 22 | ], 23 | "version" : 1 24 | } 25 | -------------------------------------------------------------------------------- /project/Tests/CoreTests/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /project/UI/CLIKit/Array+Utils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public extension Array { 6 | subscript(safe index: Int) -> Element? { 7 | index < count ? self[index] : nil 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /project/UI/CLIKit/Collection+Utils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | extension Collection where Element: Equatable & Hashable { 6 | func containsAll(_ array: [Element]) -> Bool { 7 | array.contains(where: { element in self.contains(element) }) 8 | } 9 | 10 | func containsAny(_ array: [Element]) -> Bool { 11 | array.first { element in self.contains(element) } != nil 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project/UI/CLIKit/CommandLineTool.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import ArgumentParser 5 | import NefCarbon 6 | import Bow 7 | import BowEffects 8 | 9 | public struct CommandLineTool { 10 | public static func main() { 11 | _ = CarbonApplication { T.main() } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project/UI/CLIKit/CommandOutcome.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | import nef 3 | 4 | public enum CommandOutcome { 5 | case successful(String) 6 | case failed(String, error: nef.Error) 7 | } 8 | 9 | extension CommandOutcome { 10 | public var progressDescription: String { 11 | switch self { 12 | case .successful(let info): 13 | return info 14 | 15 | case let .failed(info, error: error): 16 | return "\(info) failed with error: \(error)" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /project/UI/CLIKit/ConsoleReport.swift: -------------------------------------------------------------------------------- 1 | import NefModels 2 | import BowEffects 3 | import nef 4 | import Foundation 5 | 6 | public struct ConsoleReport { 7 | public init() {} 8 | } 9 | 10 | extension ConsoleReport: ProgressReport { 11 | public func notify(_ event: ProgressEvent) -> IO { 12 | switch event.status { 13 | 14 | case .inProgress: 15 | return ConsoleIO.print(event.step.progressDescription, terminator: " ") 16 | 17 | case .successful: 18 | return ConsoleIO.print("✓ ".bold.green) 19 | 20 | case .failed: 21 | return ConsoleIO.print("✗ ".bold.red) 22 | } 23 | } 24 | } 25 | 26 | extension ConsoleReport: OutcomeReport { 27 | public func notify(_ outcome: String) -> IO { 28 | ConsoleIO.print(outcome) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /project/UI/CLIKit/DispatchTimeInterval+Utils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | 5 | extension DispatchTimeInterval { 6 | var double: Double? { 7 | switch self { 8 | case .seconds(let value): return Double(value) 9 | case .milliseconds(let value): return Double(value) * 0.001 10 | case .microseconds(let value): return Double(value) * 0.000_001 11 | case .nanoseconds(let value): return Double(value) * 0.000_000_001 12 | case .never: return nil 13 | @unknown default: return nil 14 | } 15 | } 16 | } 17 | 18 | extension DispatchTimeInterval: Comparable { 19 | public static func < (lhs: DispatchTimeInterval, rhs: DispatchTimeInterval) -> Bool { 20 | let now = DispatchTime.now() 21 | return (now + lhs) < (now + rhs) 22 | } 23 | } 24 | 25 | func -(lhs: DispatchTime, rhs: DispatchTime) -> DispatchTimeInterval { 26 | let l = Int(lhs.rawValue) 27 | let r = Int(rhs.rawValue) 28 | return .nanoseconds(Int(l - r)) 29 | } 30 | -------------------------------------------------------------------------------- /project/UI/CLIKit/ExpressibleByArgument+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import ArgumentParser 5 | import NefModels 6 | 7 | extension Platform: ExpressibleByArgument {} 8 | extension CarbonStyle.Size: ExpressibleByArgument {} 9 | extension CarbonStyle.Theme: ExpressibleByArgument {} 10 | extension CarbonStyle.Font: ExpressibleByArgument {} 11 | 12 | // MARK: - Models 13 | public struct ArgumentPath: Codable, ExpressibleByArgument, CustomStringConvertible { 14 | public let url: URL 15 | public let path: String 16 | public let description: String 17 | 18 | public init(argument: String) { 19 | self.description = argument 20 | self.path = argument.trimmingEmptyCharacters.expandingTildeInPath 21 | self.url = URL(fileURLWithPath: self.path) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /project/UI/CLIKit/Kleisli+Extensions.swift: -------------------------------------------------------------------------------- 1 | import Bow 2 | import BowEffects 3 | import nef 4 | import Foundation 5 | 6 | public extension Kleisli where D: OutcomeReport, F == IOPartial { 7 | 8 | func reportOutcome( 9 | success: @escaping (A) -> String, 10 | failure: @escaping (nef.Error) -> String 11 | ) -> EnvIO { 12 | self.foldM( 13 | { e in 14 | EnvIO { outcomeReport in 15 | outcomeReport.failure(failure(e), error: e) 16 | } 17 | }, 18 | { a in 19 | EnvIO { outcomeReport in 20 | outcomeReport.success(success(a)) 21 | } 22 | }) 23 | } 24 | } 25 | 26 | public extension Kleisli where D == ProgressReport { 27 | func outcomeScope() -> Kleisli { 28 | self.contramap(id) 29 | } 30 | } 31 | 32 | public extension Kleisli { 33 | func finish() -> EnvIO where F == IOPartial { 34 | self.foldM( 35 | { _ in 36 | EnvIO.invoke { _ in Darwin.exit(-1) } 37 | }, 38 | { _ in 39 | EnvIO.invoke { _ in Darwin.exit(0) } 40 | }) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /project/UI/CLIKit/OutcomeReport.swift: -------------------------------------------------------------------------------- 1 | import BowEffects 2 | 3 | public protocol OutcomeReport { 4 | func notify(_ outcome: String) -> IO 5 | } 6 | 7 | public extension OutcomeReport { 8 | func success(_ info: String) -> IO { 9 | self.notify("🙌 \(info)") 10 | } 11 | 12 | func failure(_ info: String, error: E) -> IO { 13 | self.notify("☠️ \(info) failed with error:\n\(error)").flatMap { .raiseError(error) }^ 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /project/UI/CLIKit/PlaygroundUtils.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import Foundation 4 | import nef 5 | 6 | public struct PlaygroundUtils { 7 | 8 | private static let defaultName = "page-default" 9 | 10 | /// Get the filename from a playground's page 11 | /// 12 | /// - Parameter page: the paht to playground's page 13 | /// - Returns: the filename 14 | public static func playgroundName(fromPage page: String) -> String { 15 | guard !page.isEmpty else { return PlaygroundUtils.defaultName } 16 | 17 | return page.pathComponents 18 | .first(where: { $0.contains(".xcplaygroundpage") })? 19 | .removeExtension 20 | ?? PlaygroundUtils.defaultName 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /project/UI/CLIKit/Support Files/CLIKit.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | #import 4 | 5 | //! Project version number for CLI. 6 | FOUNDATION_EXPORT double CLIVersionNumber; 7 | 8 | //! Project version string for CLI. 9 | FOUNDATION_EXPORT const unsigned char CLIVersionString[]; 10 | -------------------------------------------------------------------------------- /project/UI/CLIKit/Support Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2019 The nef Authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /project/UI/Carbon/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import CLIKit 4 | import NefCarbon 5 | 6 | // #: - MAIN 7 | CommandLineTool.main() 8 | -------------------------------------------------------------------------------- /project/UI/CarbonPage/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import CLIKit 4 | import NefCarbon 5 | 6 | // #: - MAIN 7 | CommandLineTool.main() 8 | -------------------------------------------------------------------------------- /project/UI/Clean/Clean.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import CLIKit 5 | import ArgumentParser 6 | import nef 7 | import Bow 8 | import BowEffects 9 | 10 | public struct CleanCommand: ParsableCommand { 11 | public static var commandName: String = "nef-clean" 12 | public static var configuration = 13 | CommandConfiguration( 14 | commandName: commandName, 15 | abstract: "Clean up nef Playground") 16 | 17 | public init() {} 18 | 19 | @ArgumentParser.Option(help: ArgumentHelp("Path to nef Playground to clean up", valueName: "nef Playground")) 20 | private var project: ArgumentPath 21 | 22 | 23 | public func run() throws { 24 | try run().provide(ConsoleReport())^.unsafeRunSync() 25 | } 26 | 27 | func run() -> EnvIO { 28 | nef.Clean.clean(nefPlayground: project.url) 29 | .outcomeScope() 30 | .reportOutcome( 31 | success: { _ in 32 | "'\(self.project.url.lastPathComponent)' clean up successfully" 33 | }, 34 | failure: { _ in 35 | "clean up nef Playground '\(self.project.url.lastPathComponent)'" 36 | }) 37 | .finish() 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /project/UI/Clean/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/Compiler/Compiler.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import CLIKit 5 | import ArgumentParser 6 | import nef 7 | import Bow 8 | import BowEffects 9 | 10 | public struct CompilerCommand: ParsableCommand { 11 | public static var commandName: String = "nefc" 12 | public static var configuration = CommandConfiguration( 13 | commandName: commandName, 14 | abstract: "Compile nef Playground") 15 | 16 | public init() {} 17 | 18 | @ArgumentParser.Option(help: ArgumentHelp("Path to nef Playground to compile", valueName: "nef playground")) 19 | var project: ArgumentPath 20 | 21 | @ArgumentParser.Flag(name: .customLong("use-cache"), help: "Use cached dependencies if it is possible") 22 | var cached: Bool = false 23 | 24 | 25 | public func run() throws { 26 | try run().provide(ConsoleReport())^.unsafeRunSync() 27 | } 28 | 29 | func run() -> EnvIO { 30 | nef.Compiler.compile(nefPlayground: project.url, cached: cached) 31 | .outcomeScope() 32 | .reportOutcome( 33 | success: { _ in 34 | "'\(self.project.url.path)' compiled successfully" 35 | }, 36 | failure: { _ in 37 | "compiling Xcode Playgrounds from '\(self.project.url.path)'" 38 | }) 39 | .finish() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /project/UI/Compiler/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/Jekyll/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/JekyllPage/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/Markdown/Markdown.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import CLIKit 5 | import ArgumentParser 6 | import nef 7 | import Bow 8 | import BowEffects 9 | 10 | public struct MarkdownCommand: ParsableCommand { 11 | public static var commandName: String = "nef-markdown" 12 | public static var configuration = CommandConfiguration( 13 | commandName: commandName, 14 | abstract: "Render Markdown files for a given Xcode Playgrounds") 15 | 16 | public init() {} 17 | 18 | @ArgumentParser.Option(help: ArgumentHelp("Path to nef Playground to render", valueName: "nef playground")) 19 | private var project: ArgumentPath 20 | 21 | @ArgumentParser.Option(help: "Path where the resulting Markdown files will be generated") 22 | private var output: ArgumentPath 23 | 24 | 25 | public func run() throws { 26 | try run().provide(ConsoleReport())^.unsafeRunSync() 27 | } 28 | 29 | func run() -> EnvIO { 30 | nef.Markdown.render(playgroundsAt: self.project.url, into: self.output.url) 31 | .outcomeScope() 32 | .reportOutcome( 33 | success: { _ in 34 | "rendered Xcode Playgrounds in '\(self.output.path)'" 35 | }, 36 | failure: { _ in 37 | "rendering Xcode playgrounds from '\(self.project.path)'" 38 | }) 39 | .finish() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /project/UI/Markdown/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/MarkdownPage/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/Nef/Version.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import CLIKit 5 | import ArgumentParser 6 | import nef 7 | import NefModels 8 | import Bow 9 | import BowEffects 10 | import AppKit 11 | 12 | public struct VersionCommand: ParsableCommand { 13 | public static var commandName: String = "version" 14 | public static var configuration = CommandConfiguration( 15 | commandName: commandName, 16 | abstract: "Get the build version number" 17 | ) 18 | 19 | public init() {} 20 | 21 | 22 | public func run() throws { 23 | try run().provide(ConsoleReport())^.unsafeRunSync() 24 | } 25 | 26 | func run() -> EnvIO { 27 | EnvIO { progressReport in 28 | nef.Version.info() 29 | .flatMap { version in 30 | progressReport.oneShot(VersionEvent.version(version)) 31 | } 32 | }^.finish() 33 | } 34 | } 35 | 36 | public enum VersionEvent { 37 | case version(String) 38 | } 39 | 40 | extension VersionEvent: CustomProgressDescription { 41 | public var progressDescription: String { 42 | switch self { 43 | case let .version(version): 44 | return "Build version number: \(version)" 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /project/UI/Nef/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | import CLIKit 5 | import ArgumentParser 6 | import Bow 7 | import BowEffects 8 | 9 | struct NefCommand: ParsableCommand { 10 | static var configuration = CommandConfiguration(commandName: "nef", 11 | abstract: "💊 steroids for Xcode Playgrounds", 12 | subcommands: [VersionCommand.self, 13 | CompilerCommand.self, 14 | CleanCommand.self, 15 | PlaygroundCommand.self, 16 | PlaygroundBookCommand.self, 17 | MarkdownCommand.self, 18 | JekyllCommand.self, 19 | CarbonCommand.self]) 20 | } 21 | 22 | // MARK: Configuration 23 | CompilerCommand.commandName = "compile" 24 | CleanCommand.commandName = "clean" 25 | PlaygroundCommand.commandName = "playground" 26 | PlaygroundBookCommand.commandName = "ipad" 27 | MarkdownCommand.commandName = "markdown" 28 | JekyllCommand.commandName = "jekyll" 29 | CarbonCommand.commandName = "carbon" 30 | 31 | // #: - MAIN 32 | CommandLineTool.main() 33 | -------------------------------------------------------------------------------- /project/UI/Playground/PlaygroundDependenciesError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import Foundation 4 | 5 | public enum PlaygroundDependenciesError: Error { 6 | case notFound 7 | case invalid 8 | } 9 | -------------------------------------------------------------------------------- /project/UI/Playground/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/UI/PlaygroundBook/main.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 The nef Authors. 2 | 3 | import CLIKit 4 | 5 | // #: - MAIN 6 | CommandLineTool.main() 7 | -------------------------------------------------------------------------------- /project/nef.xcodeproj/JekyllMarkdown.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /project/nef.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /project/nef.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /project/nef.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /project/nef.xcodeproj/xcshareddata/IDETemplateMacros.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FILEHEADER 6 | Copyright © ___YEAR___ The nef Authors. 7 | 8 | 9 | -------------------------------------------------------------------------------- /setup/ConfigureNef.rb: -------------------------------------------------------------------------------- 1 | module Nef 2 | 3 | class ConfigureNef 4 | attr_reader :configurator 5 | 6 | def self.perform(options) 7 | new(options).perform 8 | end 9 | 10 | def initialize(options) 11 | @configurator = options.fetch(:configurator) 12 | end 13 | 14 | def perform 15 | performProject("cocoapods") 16 | performProject("carthage") 17 | performProject("spm") 18 | 19 | `mv ./template/* ./` 20 | `mv template/.gitignore ./` 21 | end 22 | 23 | def performProject(dependency_manager) 24 | Nef::ProjectManipulator.new({ 25 | :configurator => @configurator, 26 | :xcodeproj_path => "template/osx/"+dependency_manager+"/PROJECT.xcodeproj", 27 | :platform => :osx, 28 | :prefix => '' 29 | }).run 30 | 31 | Nef::ProjectManipulator.new({ 32 | :configurator => @configurator, 33 | :xcodeproj_path => "template/ios/"+dependency_manager+"/PROJECT.xcodeproj", 34 | :platform => :ios, 35 | :prefix => '' 36 | }).run 37 | end 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /setup/nef.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | $:.unshift File.dirname(__FILE__) 3 | 4 | require 'TemplateConfigurator' 5 | require 'ConfigureNef' 6 | require 'ProjectManipulator' 7 | 8 | #: - MAIN 9 | if ARGV.length != 2 10 | puts "nef.rb " 11 | exit 1 12 | end 13 | 14 | Dir.chdir ARGV[0] 15 | Nef::TemplateConfigurator.new(ARGV[1]).run 16 | -------------------------------------------------------------------------------- /template/.gitignore: -------------------------------------------------------------------------------- 1 | ## gitignore nef files 2 | **/build/ 3 | **/nef/ 4 | LICENSE 5 | 6 | ## User data 7 | **/xcuserdata/ 8 | podfile.lock 9 | **.DS_Store 10 | 11 | ## Obj-C/Swift specific 12 | *.hmap 13 | *.ipa 14 | *.dSYM.zip 15 | *.dSYM 16 | 17 | ## CocoaPods 18 | **Pods** 19 | 20 | ## Carthage 21 | **Carthage** 22 | 23 | ## SPM 24 | .build 25 | .swiftpm 26 | swiftpm 27 | -------------------------------------------------------------------------------- /template/PROJECT.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | launcher 9 | CFBundleIconFile 10 | AppIcon 11 | CFBundleIconName 12 | AppIcon 13 | CFBundleIdentifier 14 | com.fortysevendeg.nef 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleSupportedPlatforms 18 | 19 | MacOSX 20 | 21 | LSApplicationCategoryType 22 | public.app-category.developer-tools 23 | LSMinimumSystemVersion 24 | 10.14 25 | NSHumanReadableCopyright 26 | Copyright © 2019 The nef Authors. All rights reserved. 27 | 28 | 29 | -------------------------------------------------------------------------------- /template/PROJECT.app/Contents/MacOS/launcher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | workspace="{{nef}}.xcworkspace" 4 | workspacePath=$(echo "$0" | rev | cut -f2- -d '/' | rev) 5 | 6 | open "`pwd`/$workspacePath/$workspace" 7 | -------------------------------------------------------------------------------- /template/PROJECT.app/Contents/Resources/AppIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/template/PROJECT.app/Contents/Resources/AppIcon.icns -------------------------------------------------------------------------------- /template/PROJECT.app/Contents/Resources/Assets.car: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bow-swift/nef/517340f71e4e38eee24ac698d88a913a52d49b9e/template/PROJECT.app/Contents/Resources/Assets.car -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/carthage/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/cocoapods/PROJECT/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1.0 21 | NSHumanReadableCopyright 22 | Copyright © 2019. The nef authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /template/ios/cocoapods/Podfile: -------------------------------------------------------------------------------- 1 | target '${POD_NAME}' do 2 | platform :ios, 12.0 3 | use_frameworks! 4 | 5 | pod "Bow", "~> 0.0.0" 6 | pod "BowEffects", "~> 0.0.0" 7 | pod "BowRx", "~> 0.0.0" 8 | pod "BowOptics", "~> 0.0.0" 9 | pod "BowGeneric", "~> 0.0.0" 10 | pod "BowRecursionSchemes", "~> 0.0.0" 11 | pod "BowFree", "~> 0.0.0" 12 | end 13 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.playground/Sources/NefPlaygroundSupport.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | public protocol NefPlaygroundLiveViewable {} 4 | extension UIView: NefPlaygroundLiveViewable {} 5 | extension UIViewController: NefPlaygroundLiveViewable {} 6 | 7 | #if NOT_IN_PLAYGROUND 8 | public enum Nef { 9 | public enum Playground { 10 | public static func liveView(_ view: NefPlaygroundLiveViewable) {} 11 | public static func needsIndefiniteExecution(_ state: Bool) {} 12 | } 13 | } 14 | 15 | #else 16 | import PlaygroundSupport 17 | 18 | public enum Nef { 19 | public enum Playground { 20 | public static func liveView(_ view: NefPlaygroundLiveViewable) { 21 | PlaygroundPage.current.liveView = (view as! PlaygroundLiveViewable) 22 | } 23 | 24 | public static func needsIndefiniteExecution(_ state: Bool) { 25 | PlaygroundPage.current.needsIndefiniteExecution = state 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.playground/Sources/NefTest.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | public extension Nef { 5 | 6 | static func run(testCase class: T.Type) { 7 | startTestObserver() 8 | T.defaultTestSuite.run() 9 | } 10 | 11 | static private func startTestObserver() { 12 | _ = testObserverInstalled 13 | } 14 | 15 | static private var testObserverInstalled = { () -> NefTestFailObserver in 16 | let testObserver = NefTestFailObserver() 17 | XCTestObservationCenter.shared.addTestObserver(testObserver) 18 | return testObserver 19 | }() 20 | } 21 | 22 | // MARK: enrich the output for XCTest 23 | fileprivate class NefTestFailObserver: NSObject, XCTestObservation { 24 | 25 | private var numberOfFailedTests = 0 26 | 27 | func testSuiteWillStart(_ testSuite: XCTestSuite) { 28 | numberOfFailedTests = 0 29 | } 30 | 31 | func testSuiteDidFinish(_ testSuite: XCTestSuite) { 32 | if numberOfFailedTests > 0 { 33 | print("💢 Test Suite '\(testSuite.name)' finished with \(numberOfFailedTests) failed \(numberOfFailedTests > 1 ? "tests" : "test").") 34 | } else { 35 | print("🔅 Test Suite '\(testSuite.name)' finished successfully.") 36 | } 37 | } 38 | 39 | func testCase(_ testCase: XCTestCase, 40 | didFailWithDescription description: String, 41 | inFile filePath: String?, 42 | atLine lineNumber: Int) { 43 | 44 | numberOfFailedTests += 1 45 | print("❗️Test Fail '\(testCase.name)':\(UInt(lineNumber)): \(description.description)") 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/ios/spm/PROJECT.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/carthage/PROJECT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/osx/cocoapods/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/osx/cocoapods/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/osx/cocoapods/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/cocoapods/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/cocoapods/PROJECT/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1.0 21 | NSHumanReadableCopyright 22 | Copyright © 2019. The nef authors. 23 | 24 | 25 | -------------------------------------------------------------------------------- /template/osx/cocoapods/Podfile: -------------------------------------------------------------------------------- 1 | target '${POD_NAME}' do 2 | platform :osx, 10.14 3 | use_frameworks! 4 | 5 | pod "Bow", "~> 0.0.0" 6 | pod "BowEffects", "~> 0.0.0" 7 | pod "BowRx", "~> 0.0.0" 8 | pod "BowOptics", "~> 0.0.0" 9 | pod "BowGeneric", "~> 0.0.0" 10 | pod "BowRecursionSchemes", "~> 0.0.0" 11 | pod "BowFree", "~> 0.0.0" 12 | end 13 | -------------------------------------------------------------------------------- /template/osx/spm/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/osx/spm/PROJECT.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/osx/spm/PROJECT.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/spm/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/osx/spm/PROJECT.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | --------------------------------------------------------------------------------