Giter VIP home page Giter VIP logo

murray's Introduction

Murray

Murray is a CLI written in Swift for skeleton-based software development.

Skeleton-based software usually consists of code generated through lots of boilerplate that can't be abstracted and re-used through clever architecture.

For instance, a classic HTML website always consists of pages with same head and body, filled with custom data in repeating structures.

Murrays purpose is to standardize any development pipeline in order to speed-up development, reduce unsafe copy-pasting from/to different projects and help complex projects to keep a well-defined internal structure.

Key Features

  • Clone a skeleton project from a remote repository, customize it with your project name and custom properties and have it ready to run. Murray supports tags and branches for remote repositories (@develop or @1.0.0)

  • Develop your project with bones: template files you design that gets easily integrated in your project structure. If a adding a screen to your app requires 3 new files, you can design them with a template and have Murray resolve them for you and move the result in proper folders.

  • Install bones templates from any number of different repositories: share your file templates with your team.

  • Automatically add slices of code to already existing files when adding new bones (example: Add a custom xml tag for your new Activity at the end of the Android manifest.xml when creating an Activity from a custom bone).

  • Easily manage and check your bones environment: see what's available directly from CLI

  • Design your bones with Stencil

  • Integrate Murray functionalities in any Swift application through MurrayKit framework

Quick examples

Single-file template in Swift for iOS named listViewController in file BonesViewController (placeholder keyword in filename is Bone):

import UIKit
class {{ name|firstUppercase }}sViewController: UIViewController {

  // Not quite sure what this empty {{ name }} array should do in a real project , but it's here anyway to show how you can self-document your code with comments.
  let {{ name|firstLowercase }}s: [{{ name|firstUppercase }}] = []

  func viewDidLoad() {
    super.viewDidLoad()
  }
}

from terminal, execute

murray bone new listViewController Product

resulting in file ProductsViewController with contents:

import UIKit
class ProductsViewController: UIViewController {

  // Not quite sure what this empty Product array should do in a real project , but it's here anyway to show how you can self-document your code with comments.
  let products: [Product] = []

  func viewDidLoad() {
    super.viewDidLoad()
  }
}

automatically moved to predefined custom folder and also installed in XCode project.

See Wiki for more examples.

Working Demo

A very simple Murray project for iOS can be found here

You can automatically generate a project (named MurrayProject in this example) from this template by running

murray skeleton new MurrayProject https://github.com/stefanomondino/MurrayDemo@master

Important: please be sure to have Cocoapods v1.6.1 or higher installed on your system (thanks @bellots).

Installation

MacOS

Using Mint

mint install synesthesia-it/Murray

Note: please ensure you're using at least Mint v0.12 (Swift 5)

Compiling from source (latest version from master branch)

curl -fsSL https://raw.githubusercontent.com/synesthesia-it/Murray/master/install.sh | sh

Linux (experimental, tested on Ubuntu 18)

Install Swift compiler (guide here) then

sudo apt-get install libdispatch-dev
clone murray https://github.com/synesthesia-it/Murray/tree/develop
cd Murray
touch LinuxMain.swift
swift build -c release
copy .build/x86_64-unknow-linux/releas /opt/
alias murray='/opt/Murray/murray'

(credits to @beppenmk)

Usage

  • Create a new skeleton app by cloning any remote repository with a Skeletonspec.json file in its root folder.
$ murray skeleton new CoolApp <your_remote_repo>

Next commands should all be used inside your freshly created project's directory. (remind to cd CoolApp ;) )

Your Skeleton project must declare a Skeletonspec.json file in its root folder, containing a list of remote repositories containing Bones.

Example:

...
 remoteBones: ["https://github.com/synesthesia-it/Bones@develop"],
 ...

If you want to add Bones features to an already existing project, just create a Skeletonspec.json file in your root folder by using murray skeleton scaffold and edit it by adding one or more Bones repositories.

  • Setup your project with
$ murray bone setup

This will clone all bones repositories in a local folder. You can update them by calling same command again.

  • Install a Bone template into your current project
$ murray bone new viewSection Product

In this particular case, a viewSection bone is created in your project by copying all source file related to viewSection (one or more, depending on what you wrote in the Bonespec.json) by renaming each file replacing the bone placeholder with Product and by parsing internal text contents through Stencil. See the Bones wiki page for more details.

  • List all templates available for current project
$ murray bone list

Documentation

See Wiki pages

FAQ

I'm a Swift developer. Why shoud I use this instead of Sourcery?


Sourcery is a great software that somehow handles templates as well, but is meant to handle only Swift code and project by actually compiling templates in different scenarios. Murray doesn't compile or interpret your code, it doesn't even know what programming language you're actually using. It's aimed to project's structure and boilerplate reuse across projects through git repos

Why Murray? Who is Murray?


Because we're dealing with Skeleton apps and Bones and we miss Monkey Island a lot! :) We hope this tool is not as much annoying as its original counterpart!

Who's behind Murray?


Syn

Murray is entirely developed and open-sourced by Synesthesia

We're currently using it for iOS and Android projects.

murray's People

Contributors

bellots avatar stefanomondino avatar

Watchers

 avatar

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.