Add CHANGELOG.md to lein new templates

`lein new` commands will create a CHANGELOG.md template.

Fixes #1982
This commit is contained in:
Daniel Compton 2015-09-12 23:44:51 +12:00
parent d40fdd4da3
commit 804d96190f
9 changed files with 120 additions and 10 deletions

View file

@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased][unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - {{date}}
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - {{date}}
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[unreleased]: https://github.com/your-name/{{name}}/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/{{name}}/compare/0.1.0...0.1.1

View file

@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased][unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - {{date}}
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - {{date}}
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[unreleased]: https://github.com/your-name/{{name}}/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/{{name}}/compare/0.1.0...0.1.1

View file

@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased][unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - {{date}}
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - {{date}}
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[unreleased]: https://github.com/your-name/{{name}}/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/{{name}}/compare/0.1.0...0.1.1

View file

@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased][unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - {{date}}
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - {{date}}
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[unreleased]: https://github.com/your-name/{{name}}/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/{{name}}/compare/0.1.0...0.1.1

View file

@ -1,6 +1,6 @@
(ns leiningen.new.app
"Generate a basic application project."
(:require [leiningen.new.templates :refer [renderer year project-name
(:require [leiningen.new.templates :refer [renderer year date project-name
->files sanitize-ns name-to-path
multi-segment]]
[leiningen.core.main :as main]))
@ -14,7 +14,8 @@
:name (project-name name)
:namespace main-ns
:nested-dirs (name-to-path main-ns)
:year (year)}]
:year (year)
:date (date)}]
(main/info "Generating a project called" name "based on the 'app' template.")
(->files data
["project.clj" (render "project.clj" data)]
@ -25,4 +26,5 @@
["src/{{nested-dirs}}.clj" (render "core.clj" data)]
["test/{{nested-dirs}}_test.clj" (render "test.clj" data)]
["LICENSE" (render "LICENSE" data)]
["CHANGELOG.md" (render "CHANGELOG.md" data)]
"resources")))

View file

@ -1,6 +1,6 @@
(ns leiningen.new.default
"Generate a library project."
(:require [leiningen.new.templates :refer [renderer year project-name
(:require [leiningen.new.templates :refer [renderer year date project-name
->files sanitize-ns name-to-path
multi-segment]]
[leiningen.core.main :as main]))
@ -16,7 +16,8 @@ Accepts a group id in the project name: `lein new foo.bar/baz`"
:name (project-name name)
:namespace main-ns
:nested-dirs (name-to-path main-ns)
:year (year)}]
:year (year)
:date (date)}]
(main/info "Generating a project called" name "based on the 'default' template.")
(main/info "The default template is intended for library projects, not applications.")
(main/info "To see other templates (app, plugin, etc), try `lein help new`.")
@ -29,4 +30,5 @@ Accepts a group id in the project name: `lein new foo.bar/baz`"
["src/{{nested-dirs}}.clj" (render "core.clj" data)]
["test/{{nested-dirs}}_test.clj" (render "test.clj" data)]
["LICENSE" (render "LICENSE" data)]
["CHANGELOG.md" (render "CHANGELOG.md" data)]
"resources")))

View file

@ -1,5 +1,5 @@
(ns leiningen.new.plugin
(:require [leiningen.new.templates :refer [renderer sanitize year ->files]]
(:require [leiningen.new.templates :refer [renderer sanitize year date ->files]]
[leiningen.core.main :as main]))
(defn plugin
@ -12,7 +12,8 @@
data {:name name
:unprefixed-name unprefixed
:sanitized (sanitize unprefixed)
:year (year)}]
:year (year)
:date (date)}]
(main/info (str "Generating a fresh Leiningen plugin called " name "."))
(->files data
["project.clj" (render "project.clj" data)]
@ -20,4 +21,5 @@
[".gitignore" (render "gitignore" data)]
[".hgignore" (render "hgignore" data)]
["src/leiningen/{{sanitized}}.clj" (render "name.clj" data)]
["LICENSE" (render "LICENSE" data)])))
["LICENSE" (render "LICENSE" data)]
["CHANGELOG.md" (render "CHANGELOG.md" data)])))

View file

@ -1,5 +1,5 @@
(ns leiningen.new.template
(:require [leiningen.new.templates :refer [renderer sanitize year ->files]]
(:require [leiningen.new.templates :refer [renderer sanitize year date ->files]]
[leiningen.core.main :as main]))
(defn template
@ -9,7 +9,8 @@
data {:name name
:sanitized (sanitize name)
:placeholder "{{sanitized}}"
:year (year)}]
:year (year)
:date (date)}]
(main/info "Generating fresh 'lein new' template project.")
(->files data
["README.md" (render "README.md" data)]
@ -18,4 +19,5 @@
[".hgignore" (render "hgignore" data)]
["src/leiningen/new/{{sanitized}}.clj" (render "temp.clj" data)]
["resources/leiningen/new/{{sanitized}}/foo.clj" (render "foo.clj")]
["LICENSE" (render "LICENSE" data)])))
["LICENSE" (render "LICENSE" data)]
["CHANGELOG.md" (render "CHANGELOG.md" data)])))

View file

@ -103,6 +103,12 @@
"Get the current year. Useful for setting copyright years and such."
[] (.get (Calendar/getInstance) Calendar/YEAR))
(defn date
"Get the current date as a string in ISO8601 format."
[]
(let [df (java.text.SimpleDateFormat. "yyyy-MM-dd")]
(.format df (java.util.Date.))))
;; It'd be silly to expect people to pull in stencil just to render a mustache
;; string. We can just provide this function instead. In doing so, it is much
;; less likely that template authors will have to pull in any external