diff --git a/.gitignore b/.gitignore index a9a99c6..a034915 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ book-output book-release* +### NODE.JS ### +node_modules* +npm-debug.log + ### OSX ### *.DS_Store ._* @@ -23,5 +27,8 @@ out # warn IDEA to ignore all files that won't be compiling due to educational examples !.idea/compiler.xml +# ignores local travis config folder +.travis + ### others ### .vscode diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..9cf9495 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..4dd27c6 --- /dev/null +++ b/.releaserc @@ -0,0 +1,12 @@ +{ + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + ["@semantic-release/git", { + "assets": ["package.json", "CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + }], + "@semantic-release/github" + ] +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 8908ac7..38f9cca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,45 @@ +language: ruby sudo: required -services: -- docker - env: -- COMPOSE_FILE=docker-compose.yml - -script: -- ls -lah -- docker-compose run --rm ebook + global: + secure: eXGVND48r4WyUCELydGxJ5NZURQ5iSaMYT6sLyPAdsjoio5NO+/eF17Fw61YqljrSgy+SuYTtHSeVLET4VOVMry2AH2474UD4DDAZ0Fo21s/u/+wQzIW7szO+gzg+PB/22zM67Yx+9ICo+xm10juHwJRyse9s5EFCgL40LtHPWXc5iTbSJtQFbc3YqPMmrvZZEeGYKAEX6uaqeoSi5PJdDrZfMAcienrbXMx9ASW1LlaJXEr3GKQLHxdfeiEsmVpppeYbfVSRcNRGIgFHS397D2eTVBbsTnxx72dqkR6eYC9z0sifai6baTPx34K3Us1lTx9/bR2DKYohNhea7jinYNSuJB2Lyrf3u4qfJPVLlnSgT+fJYPkmmjDuRepRUK6Kvs4M69YA7FdOhSKHpZlKUtIGjRVFe4CTvkoPAJt+lSaifVKWBD6Q18NqgCkCgijIq3Hn8tjtbWHe256fqZYjio4HBHwfifWG5oxK9ZTKxc9Z+wv2mASHhnmjWpHCtFvib8HMtIizqEVOndg58vMFXJNX1sisZxIV8+I7LSgHU7OBfi2A2Ik5Zeuo46Q7/V+2xl/nOOpC6M7Bgbe+c8gFc8PyJA/3w9+m6xUmRuE5F14D4ItXZvK1lR70oBTlFb0fXNQrEejsKAerXRw1ThbmaFZqcw7ppPQrOM+ZvFcQf0= -deploy: - provider: releases - api_key: - secure: ygR+ubsOCcsILpZ9ftQ7hYeYohHS4K4U8l1LSimNoNgvf+6xxu9Pjp/uTbiWWj/J4Jc9uQiITM3h5hRxZKNO+m7kQKprRcEXIaT/vDkQWmWB+4G72hon5fwqdhKW++i5IOOXUUPQrEqpXovccgBiwVdwfvMjtp9WIx2lGDNPHAu9rzWJhQF9qlHq+an61K+Ft65OI00qgr6C7Os/va3YZFsdK+0Y4WasX2pXJgvf5TQvyso74JtgNeA1mfcHGp3/bRivi30TOVMtHLnjTIFEVt1ekxnxeJAWkvONsC9+ZPnqF5+9/QdzRXQ9uVaQSwWB6uZQIu18i10UFP92/CM0KyOXvbr8FikjTCsQcc7RThu33eGNlU5CyPvyjweMLHFobaJqTarAd+R7B0VLY8pmAbpt0rLqYOVJvZ8fLzqIDkos+TuGYapBiKMHnnp2oNEgruIB88sxeaBgfbzx+Q36vVA4u79+BJZEA8C+DJYJ+s+NFvFqRvkxsJmQ3gmRtTKgUgQ7WP40/TFLwv3rBodkMBMygjcCAoOKVvYDuTi165vT8ABztgE8G5Z5lnOhPpezZ2dwLh64Do0BGOqMIsIC6Sx4XX8Pg7xnVXenfE+9AN2mCeZNq2tq0kTRqhclr+2T5IdUm9zB90I2VfK+6tuOPsb4DKhhJRtZsUZLMCIW4NA= - file_glob: true - file: book-release/* - skip_cleanup: true - on: - tags: true +jobs: + include: + - stage: "Semantic Release" + name: "Generate a new release and changelogs" + language: node_js + node_js: lts/* + os: + - linux + install: + - npm install + script: skip + deploy: + provider: script + api_key: "$GITHUB_TOKEN" + node_js: lts/* + skip_cleanup: true + script: npx semantic-release + on: + branch: master -notifications: - email: - - rcmoutinho@cyborgdeveloper.tech + - stage: "GitHub Release" + name: "Send the generated files to the new GitHub release" + services: + - docker + env: + - COMPOSE_FILE=docker-compose.yml + script: + - TRAVIS_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + - git shortlog -s | cut -f 2- > book/contributors.txt + - docker-compose run --rm ebook $TRAVIS_TAG + deploy: + provider: releases + api_key: "$GITHUB_TOKEN" + file_glob: true + file: book-release/* + skip_cleanup: true + on: + branch: master diff --git a/LICENSE.asc b/LICENSE.asc index f5f4e01..e4e5297 100644 --- a/LICENSE.asc +++ b/LICENSE.asc @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Rodrigo Moutinho +Copyright (c) 2019 Rinaldo Pitzer e Rodrigo Moutinho Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/book/contributors.asc b/book/contributors.asc new file mode 100644 index 0000000..39801d0 --- /dev/null +++ b/book/contributors.asc @@ -0,0 +1,11 @@ +[preface] +== Contribuidores + +Por ser um livro de código aberto, recebemos várias mudanças de conteúdo e erratas ao longo de seu desenvolvimento. Aqui estão todas as pessoas que contribuíram para a versão em português do livro como um projeto de código aberto. Obrigado a todos por ajudarem a tornar este livro melhor para todos. + +[source,tabsize=8] +---- +include::contributors.txt[] +---- + +Esse texto é praticamente o mesmo utilizado no *Pro Git 2*. Acesse o texto original https://raw.githubusercontent.com/progit/progit2/master/book/contributors.asc[aqui]. diff --git a/book/license.asc b/book/license.asc new file mode 100644 index 0000000..65322b2 --- /dev/null +++ b/book/license.asc @@ -0,0 +1,4 @@ +[preface] +== Licença + +include::../LICENSE.asc[] diff --git a/changelog.config.js b/changelog.config.js new file mode 100644 index 0000000..72ff44d --- /dev/null +++ b/changelog.config.js @@ -0,0 +1,88 @@ +module.exports = { + "disableEmoji": false, + "list": [ + "test", + "feat", + "fix", + "chore", + "docs", + "refactor", + "style", + "ci", + "perf" + ], + "maxMessageLength": 64, + "minMessageLength": 3, + "questions": [ + "type", + "scope", + "subject", + "body", + "breaking", + "issues", + "lerna" + ], + "scopes": [ + "", + "core", + "lang-enh", + "localization", + "lambda", + "streams", + "concurrency", + "file-io", + "collections" + ], + "types": { + "chore": { + "description": "Build process or auxiliary tool changes", + "emoji": "🤖", + "value": "chore" + }, + "ci": { + "description": "CI related changes", + "emoji": "🎡", + "value": "ci" + }, + "docs": { + "description": "Documentation only changes", + "emoji": "📓", + "value": "docs" + }, + "feat": { + "description": "A new feature", + "emoji": "🎸", + "value": "feat" + }, + "fix": { + "description": "A bug fix", + "emoji": "🐛", + "value": "fix" + }, + "perf": { + "description": "A code change that improves performance", + "emoji": "⚡️", + "value": "perf" + }, + "refactor": { + "description": "A code change that neither fixes a bug or adds a feature", + "emoji": "💡", + "value": "refactor" + }, + "release": { + "description": "Create a release commit", + "emoji": "🏹", + "value": "release" + }, + "style": { + "description": "Markup, white-space, formatting, missing semi-colons...", + "emoji": "💄", + "value": "style" + }, + "test": { + "description": "Adding missing tests", + "emoji": "💍", + "value": "test" + } + } +}; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 74f396b..8f0aa7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,5 +5,14 @@ services: image: asciidoctor/docker-asciidoctor volumes: - .:/documents/ - command: scripts/docker-startup.sh + entrypoint: scripts/docker-startup.sh + network_mode: bridge + + travis: + build: + context: . + dockerfile: ./docker/travis/Dockerfile + volumes: + - .:/app + - ./.travis:/root/.travis network_mode: bridge diff --git a/docker/travis/Dockerfile b/docker/travis/Dockerfile new file mode 100644 index 0000000..dd12676 --- /dev/null +++ b/docker/travis/Dockerfile @@ -0,0 +1,17 @@ +FROM ruby:alpine + +RUN apk --update add build-base git \ + && gem install travis \ + && apk del build-base \ + && rm -rf /var/cache/apk/* \ + && rm -rf /tmp/* \ + && mkdir app + +WORKDIR app +VOLUME ["/app"] + +LABEL maintainer="twitter.com/rcmoutinho" +LABEL description="Travis CLI in a docker container" + +ENTRYPOINT ["travis"] +CMD ["--help"] diff --git a/java6-to-java8.asc b/java6-to-java8.asc index e00d93f..e47d8bb 100644 --- a/java6-to-java8.asc +++ b/java6-to-java8.asc @@ -14,6 +14,10 @@ Rinaldo Pitzer; Rodrigo Moutinho ifdef::ebook-format[:leveloffset: -1] +include::book/license.asc[] + +include::book/contributors.asc[] + include::ch01-getting-started.asc[] include::ch02-language-enhancement.asc[] diff --git a/package.json b/package.json new file mode 100644 index 0000000..07416b0 --- /dev/null +++ b/package.json @@ -0,0 +1,59 @@ +{ + "author": "Rinaldo Pitzer e Rodrigo Moutinho", + "name": "java6-to-java8", + "description": "Guia para ajudar devs Java atualizarem sua certificação Java 6 para Java 8.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/duke-certification/java6-to-java8.git" + }, + "bugs": { + "url": "https://github.com/duke-certification/java6-to-java8/issues" + }, + "homepage": "https://github.com/duke-certification/java6-to-java8", + "keywords": [ + "java", + "java6", + "java8", + "certificate", + "developer", + "update", + "guide" + ], + "dependencies": {}, + "devDependencies": { + "@commitlint/cli": "^8.0.0", + "@commitlint/config-conventional": "^8.0.0", + "@commitlint/prompt": "^8.0.0", + "@semantic-release/changelog": "^3.0.4", + "@semantic-release/commit-analyzer": "^6.2.0", + "@semantic-release/git": "^7.0.16", + "@semantic-release/github": "^5.4.2", + "@semantic-release/release-notes-generator": "^7.2.1", + "commitizen": "^3.1.1", + "git-cz": "^3.0.1", + "husky": "^2.7.0", + "semantic-release": "^15.13.18", + "semantic-release-cli": "^5.1.1" + }, + "husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + }, + "scripts": { + "commit": "./node_modules/.bin/git-cz", + "semantic-release": "./node_modules/.bin/semantic-release", + "semantic-release-cli": "./node_modules/.bin/semantic-release-cli" + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "config": { + "commitizen": { + "path": "@commitlint/prompt" + } + } +} diff --git a/scripts/docker-startup.sh b/scripts/docker-startup.sh index ce558c2..4ba3672 100755 --- a/scripts/docker-startup.sh +++ b/scripts/docker-startup.sh @@ -2,10 +2,11 @@ output_folder=book-output release_folder=book-release -book_name=java6-to-java8.asc +book_name=java6-to-java8 +book_name_asc=$book_name.asc logs=$output_folder/ebook.log -version=0.1.0 +version=${1:-development} revdate=$(date '+%Y-%m-%d') params="--attribute revnumber=$version --attribute revdate=$revdate -D $release_folder" @@ -16,17 +17,17 @@ printf "\n--------------------------------------------------------\n" >> $logs printf "$(date '+%Y-%m-%d %H:%M:%S') ---------- Exporting book formats...\n" >> $logs printf "Converting to HTML...\n" -asciidoctor $params $book_name >> $logs -printf " -- HTML output at java6-to-java8.html\n" +asciidoctor $params $book_name_asc >> $logs +printf " -- HTML output at $book_name.html\n" printf "Converting to EPub...\n" -asciidoctor-epub3 $params $book_name >> $logs -printf " -- Epub output at java6-to-java8.epub\n" +asciidoctor-epub3 $params $book_name_asc >> $logs +printf " -- Epub output at $book_name.epub\n" printf "Converting to Mobi (kf8)...\n" -asciidoctor-epub3 $params -a ebook-format=kf8 $book_name >> $logs -printf " -- Mobi output at java6-to-java8.mobi\n" +asciidoctor-epub3 $params -a ebook-format=kf8 $book_name_asc >> $logs +printf " -- Mobi output at $book_name.mobi\n" printf "Converting to PDF... (this one takes a while)\n" -asciidoctor-pdf $params $book_name 2>/dev/null >> $logs -printf " -- PDF output at java6-to-java8.pdf\n" +asciidoctor-pdf $params $book_name_asc 2>/dev/null >> $logs +printf " -- PDF output at $book_name.pdf\n"