Giter Club home page Giter Club logo

rizla's Introduction

Rizla builds, runs and monitors your Go Applications with ease.

Travis Widget Release Widget Report Widget License Widget Chat Widget

Installation

The only requirement is the Go Programming Language, at least 1.7.

$ go get -u github.com/kataras/rizla

Getting Started

$ rizla main.go #single project monitoring
$ rizla C:/myprojects/project1/main.go C:/myprojects/project2/main.go #multi projects monitoring
$ rizla -walk main.go #prepend '-walk' only when the default file changes scanning method doesn't works for you.

Want to use it from your project's source code? easy

$ cat from_code_simple.go
package main

import (
	"github.com/kataras/rizla/rizla"
)

func main() {
  // Build, run & start monitoring the projects
  rizla.Run("C:/iris-project/main.go", "C:/otherproject/main.go")
	// rizla.RunWith(rizla.WatcherFromFlag("-walk"), "./main.go")
}
$ cat from_code_pro.go
package main

import (
	"github.com/kataras/rizla/rizla"
	"path/filepath"
	"runtime"
	"time"
	"os"
)

func main() {
  // Create a new project by the main source file
  project := rizla.NewProject("C:/myproject/main.go")

  // The below are optional

  // Optional, set the messages/logs output destination of our app project,
  // let's set them to their defaults
  project.Out = rizla.NewPrinter(os.Stdout)
  project.Err = rizla.NewPrinter(os.Stderr)

  project.Name = "My super project"
  // Allow reload every 3 seconds or more no less
  project.AllowReloadAfter = time.Duration(3) * time.Second
  // Custom subdirectory matcher, for the watcher, return true to include this folder to the watcher
  // the default is:
  project.Watcher = func(absolutePath string) bool {
     	base := filepath.Base(abs)
		return !(base == ".git" || base == "node_modules" || base == "vendor")
  }
  // Custom file matcher on runtime (file change), return true to reload when a file with this file name changed
  // the default is:
  project.Matcher = func(filename string) bool {
		isWindows = runtime.GOOS == "windows"
		goExt     = ".go"
		return (filepath.Ext(fullname) == goExt) ||
		(!isWindows && strings.Contains(fullname, goExt))
  }
  // Add arguments, these will be used from the executable file
  project.Args = []string{"-myargument","the value","-otherargument","a value"}
  // Custom callback before reload, the default is:
  project.OnReload = func(string) {
		fromproject := ""
		if p.Name != "" {
			fromproject = "From project '" + project.Name + "': "
		}
		project.Out.Infof("\n%sA change has been detected, reloading now...", fromproject)
   }
   // Custom callback after reload, the default is:
   project.OnReloaded = func(string) {
 		project.Out.Successf("ready!\n")
   }

  // End of optional

  // Add the project to the rizla container
  rizla.Add(project)
  //  Build, run & start monitoring the project(s)
  rizla.Run()
}

That's all!

FAQ

Ask questions and get real-time answers from the Chat.

Features

  • Super easy - is created for everyone.
  • You can use it either as command line tool either as part of your project's source code!
  • Multi-Monitoring - Supports monitoring of unlimited projects.
  • Rizla, by-default, uses the operating system's signals to fire a change because it is the fastest way and it consumes the minimal CPU.
    • You 're still able to change the watcher to use the filepath.Walk too with -walk flag.

People

If you'd like to discuss this package, or ask questions about it, feel free to Chat.

The author of rizla is @kataras.

Versioning

Current: v0.0.7

HISTORY file is your best friend!

Read more about Semantic Versioning 2.0.0

Todo

  • Tests
  • Provide full examples.

Third-Party Licenses

Third-Party Licenses can be found here

License

This project is licensed under the MIT License.

License can be found here.

rizla's People

Contributors

blunt1337 avatar kataras avatar

Watchers

 avatar  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.