Giter VIP home page Giter VIP logo

apous's Introduction

 _______
|   _   .-----.-----.--.--.-----.
|.  1   |  _  |  _  |  |  |__ --|
|.  _   |   __|_____|_____|_____|
|:  |   |__|
|::.|:. |
`--- ---'

Apous GitHub license GitHub release

Apous is a simple tool that allows for easier authoring of Swift scripts.

Primary features:

  1. Allow the breaking up of scripts into multiple files.
  2. Dependency management through Carthage or CocoaPods.

How it Works

Apous works by first checking for a Cartfile or Podfile in your script's directory. If one is present, then carthage update or pod install --no-integrate will be run.

Next, all of your Swift files are compiled into a single .apousscript binary that will then be run automatically for you.

It's really that simple.

Getting Started

First, you need to install the latest build of Apous.

  1. Download the latest version of apous from "Releases".
  2. Copy it to a location in your path, such as /usr/local/bin/.

Homebrew support is pending: Homebrew/legacy-homebrew#41473

Creating Your First Script

  1. Create a new directory for your scripts, say mkdir demo

  2. Change to that directory: cd demo

  3. Create a new script file: touch demo.swift

  4. Change the contents of the file to:

    import Foundation
    
    print("Welcome to Apous!")
  5. Run the script: apous .

This will output:

Welcome to Apous!

You can see some other samples here: Samples.

Alternatively

Apous also supports running scripts with #!. Note that your entry point script must be named main.swift.

#!/usr/local/bin/apous

import Foundation

print("Welcome to Apous!")

Then run:

> chmod +x main.swift
> ./main.swift
Welcome to Apous!

FAQ

Q: What is Apous mean?

A: It's from the ancient Greek απους, meaning "without feet".

apous's People

Contributors

orta avatar owensd avatar rayfix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apous's Issues

Support for folder structure packages.

Add support for nest folders as packages and package dependencies.

main.swift
    io/
        path/
    sys/

Each of the folders could be packages and/or dependencies, and most importantly, not require and Xcode project to build.

Add caching support

A script that hasn't changed shouldn't need to be recompiled. Make sure this recompile isn't happening.

Add support for files without extensions, also for files not named main.swift

For example, if I were to create a file called main.swift and fill it with:

#!/usr/local/bin/apous
print("Hello, World!")

then executing the following:

$ chmod +x main.swift
$ ./main.swift

Would simply output

Hello, World!

However, if I were to rename it to just main, or main1.swift, it starts throwing errors:

$ ./main
<unknown>:0: error: no input files
$ ./main1.swift
Only a 'main.swift' file can be specified.

If I wanted to, for example, have a build script created through apous, calling the file main.swift would be sort of ridiculous, setup or install makes much more sense.

Just a few thoughts - I really like apous either way 👍

xcrun parameters missing?

I created the following script:

#!/usr/local/bin/apous

import Foundation
import CommonMark
import LiterateSwift

print("Hello")

And the following Podfile:

platform :osx, 10.9

plugin 'cocoapods-rome'

use_frameworks!

pod 'CommonMark'
pod 'LiterateSwift'

However, when I run it, I get the following error (regardless of whether I take the hasbang approach or compile everything).

<unknown>:0: error: cannot load underlying module for CoreGraphics
<unknown>:0: note: did you forget to set an SDK using -sdk or SDKROOT?
<unknown>:0: note: use "xcrun -sdk macosx swift" to select the default OS X SDK installed with Xcode

Support for nested directories.

It may be advantageous to be able to store scripts in nested folders.

main.swift
    /utils
        util1.swift
        util2.swift

Currently, these will be ignored. This will likely tie into issue #2 as we think about free-floating packages that are not tied to an Xcode project.

Add proper commanding

The CLI interface is a hack, needs to have proper support for commands:

apous update
apous help
apous run [path/to/scripts]
apous edit
apous init

etc...

Support running with multiple versions of Xcode/Swift

I think the only real consideration here is Xcode.app and Xcode-beta.app. Supporting arbitrary versions of Swift seems like something that wouldn't even be feasible.

Maybe mark scripts as requiring at least a particular version of Swift? Still problematic as Swift is still not source-compatible between versions yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.