Coder Social home page Coder Social logo

np's Introduction

np

Simple utility for creating new projects in Sbt

Steps it took to get this project started

$ touch build.sbt
$ mkdir -p src/{main,test}/scala
$ e build.sbt # fill in the basics (name, organization, version)
$ touch README.md && e README.md
$ sbt
# start coding

Desired steps to take to start this project

$ sbt
$ np name:np
# start coding

^ No context switching ^.

Already have a project and want a sub project? No problem.

$ sbt
$ np name:my-sub-project dir:sub-project-dir

This will create a new sbt project source tree for a project named my-sub-project under the directory named sub-project-dir relative you your projects base directory. From your main build configuration you can use this as a stub and reference it as.

lazy val sub = Project("my-sub-project", file("sub-project-dir"))

Or remove the generated stub build.sbt and just use the generate source tree

Requirements

  • Simple Build Tool
  • The burning desire to start your projects quickly

Installation

In most cases a global installation will make the most sense as the target usage for this plugin is the creation of new projects

For sbt 0.12 or lower

For global installation, if you have a ~/.sbt directory created, in a ~/.sbt/plugins/build.sbt file add the following

For local installation, if you have a ~/project directory created, in a ~/project/build.sbt file add the following

addSbtPlugin("me.lessis" % "np" % "0.2.0")

resolvers += Resolver.url("sbt-plugin-releases",
  url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(
    Resolver.ivyStylePatterns)

Or if you prefer, you can call depend on the project reference as a git repository.

import sbt._

object Plugins extends Build {
  lazy val root = Project("root", file(".")) dependsOn(
    uri("git://github.com/softprops/np.git#0.2.0")
  )
}

Be sure to explicitly mix np's settings into your build definition.

seq(npSettings: _*)

Doing this in a global .sbt file under ~/.sbt (e.g. ~/.sbt/np.sbt) will make np's setting available to all of your sbt projects.

For sbt 0.13+

If you don't already have one, create an ~/.sbt/0.13/plugins directory. And inside of it, create an np.sbt ( it doesn't matter what you call it ) file containing the line

addSbtPlugin("me.lessis" % "np" % "0.2.0")

This will make npSettings globally visible to your project definitions.

If you wish to globally mix in npSettings, create a file under ~/.sbt/0.13 called np.sbt ( it doesn't matter what you call this either ) containing the line

seq(npSettings: _*)

Customization

If you have a lot of projects that use the same ivy organization id (your own) or you always start projects with the same version conventions (a SNAPSHOT), you may want to define your own custom global overrides.

To do so, in a ~/.sbt/np.sbt file in sbt 0.12, or ~/.sbt/0.13/np.sbt file in 0.13, add the following.

seq(npSettings:_*)

(NpKeys.defaults in (Compile, NpKeys.np)) ~= {
  _.copy(org="me.lessis", version="0.1.0-SNAPSHOT")
}

See the np option reference section below for all available options

Settings

np               # generates a new project given a set of options
scout(for np)    # detects potential conflicts with generating a project, recommended before np
usage(for np)    # displays usage options
defaults(for np) # default values for options

In sbt 0.13 you can resolve the scoped settings using ::

np::scout
np::usage
np::defaults

np option reference

np generates sbt projects given key:value options. Below is a list of current options

org     Project organization. Defaults to defaults key sbt built-in default
name    Project name. Defaults to defaults key or sbt built-in default
version Project version. Defaults to defaults key or sbt built-in default
plugin  Boolean indicator of whether the project is a plugin project. Defaults to defaults key or false
dir     Path to dir where np should generate project. Defaults to defaults key or '.'

Contributing / Issues

Please post any issues or ideas you have to np's issues

If you like rolling up your sleeves, feel free to fork and create a feature branch

Doug Tangren (softprops) 2011-12

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.