From 76aa411ef68f16679ab94df7f606c298854b3ce0 Mon Sep 17 00:00:00 2001 From: Simone Vittori Date: Tue, 26 May 2020 10:37:35 +0100 Subject: [PATCH] Delete unnecessary files for Chocolatey release --- .travis.yml | 5 -- CONTRIBUTING.md | 28 ------ INSTALL.md | 45 ---------- LICENSE | 24 ------ Makefile | 19 ----- README.md | 111 ------------------------ bin/elm-new | 76 ----------------- elm-new-completion.bash | 1 - elm-new.fish | 7 -- elm-new.zsh | 12 --- index.js | 15 ---- install.bat | 35 -------- install.sh | 13 --- package.json | 27 ------ test.sh | 184 ---------------------------------------- 15 files changed, 602 deletions(-) delete mode 100644 .travis.yml delete mode 100644 CONTRIBUTING.md delete mode 100644 INSTALL.md delete mode 100644 LICENSE delete mode 100644 Makefile delete mode 100644 README.md delete mode 100755 bin/elm-new delete mode 100644 elm-new-completion.bash delete mode 100644 elm-new.fish delete mode 100644 elm-new.zsh delete mode 100755 index.js delete mode 100644 install.bat delete mode 100755 install.sh delete mode 100644 package.json delete mode 100755 test.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7dc0c01..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -os: - - linux - - osx - -script: make test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 678876e..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,28 +0,0 @@ -# Contributing - -If your idea is really big, maybe it's worth discussing before even starting to work on it. If that's the case, please just [open a new issue](https://github.com/simonewebdesign/elm-new/issues/new). - -## Development - -Getting started with development is really easy: there's no build step, just a Bash script. It is located under the `bin` folder. - -The other folder, `share`, contains the templates that the tool can generate. All the script really does is just copy these templates from that location to another. - -There is also a Makefile, it is used to install/uninstall and to run the tests: - - make test - -Before submitting a PR, just make sure the tests are still passing. You may also want to write new ones to test your feature. - -After you've opened a PR, Travis CI will run the tests for you. You can keep pushing more commits to your branch; Travis will keep testing your changes. - -Please be patient while waiting for your PR to be reviewed. We may suggest some changes or improvements or alternatives. - -### Testing on Windows - -Here's how it's currently tested on AppVeyor (PowerShell): - - cmd.exe /c 'install.bat' - bash -c "./test.sh ./elm-new" - -You don't have to run this. A new build will be triggered automatically when you'll open a pull request. diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 522c9f7..0000000 --- a/INSTALL.md +++ /dev/null @@ -1,45 +0,0 @@ -## Installing from source - -Have a look at [`install.sh`](https://github.com/simonewebdesign/elm-new/blob/master/install.sh), it contains all the steps to install elm-new in any Linux or OS X machine. - -Just open a terminal and run it: - - curl https://raw.githubusercontent.com/simonewebdesign/elm-new/master/install.sh | sh - -If it didn't work for you, please let me know by opening a [new issue](https://github.com/simonewebdesign/elm-new/issues/new?title=Installation+issue&body=Please+write+here+about+the+problem+you+are+having+and+the+steps+to+reproduce+it.)! - - -### Installing in a custom directory (staged install) - -elm-new would normally install itself in `/usr/local/bin/elm-new`. If you want to install to a different path, for example say `/tmp/elm`, you can do: - - make DESTDIR=/tmp/elm install - -You would then find elm-new under `/tmp/elm/usr/local/bin`. - -It is also possible to customize the prefix (`/usr/local` by default). For example: - - make PREFIX=~/opt install - -The above would install elm-new under `~/opt/bin`. - -In any case, if you wish to simply run `elm-new` without specifying the full path, you need to add the bin folder to `$PATH`. For example, if you're using bash: - - echo 'PATH=~/opt/bin:$PATH' >> ~/.bashrc - . ~/.bashrc - - -## Windows (cmd.exe, MinGW, Cygwin, PowerShell) - -You don't need to clone or download this repo. Just open cmd.exe and run: - - powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/simonewebdesign/elm-new/master/install.bat', '%temp%\install.bat')" - %temp%\install.bat - -It will install the tool under `C:\Tools\elm-new`. If you want to just call the tool without specifying the full path, you need to add that path in your PATH environment variable: here's a [guide](http://www.computerhope.com/issues/ch000549.htm). - -The tool will also just work on *MinGW*; it can be installed normally as described in the [README](https://github.com/simonewebdesign/elm-new#installation), or from source (see above). - -You should be able to install it on *Cygwin* too if you have `make`. Here's [how to get `make`](http://superuser.com/questions/154418/where-do-i-get-make-for-cygwin). - -If you're on Windows 10, whether you're using *PowerShell* or not, I'd highly recommend upgrading to the Anniversary Update: see [this page](https://msdn.microsoft.com/en-gb/commandline/wsl/about). diff --git a/LICENSE b/LICENSE deleted file mode 100644 index cf1ab25..0000000 --- a/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/Makefile b/Makefile deleted file mode 100644 index 68c2ddc..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -DIRS=bin share -INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null` -INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null` - -PREFIX?=/usr/local - -install: - for dir in $(INSTALL_DIRS); do mkdir -p $(DESTDIR)$(PREFIX)/$$dir; done - for file in $(INSTALL_FILES); do cp $$file $(DESTDIR)$(PREFIX)/$$file; done - -uninstall: - rm -Rf $(DESTDIR)$(PREFIX)/share/elm-new - rm -f $(DESTDIR)$(PREFIX)/share/man/man1/elm-new.1 - rm -f $(DESTDIR)$(PREFIX)/bin/elm-new - -test: - ./test.sh bin/elm-new - -.PHONY: install uninstall test diff --git a/README.md b/README.md deleted file mode 100644 index 8c89d92..0000000 --- a/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# elm-new - -[![Build Status](https://travis-ci.org/simonewebdesign/elm-new.svg?branch=master)](https://travis-ci.org/simonewebdesign/elm-new) [![Build Status](https://ci.appveyor.com/api/projects/status/5jqfyredn4l7rxtv?svg=true)](https://ci.appveyor.com/project/simone/elm-new) - -> Clojure has `lein new`, Elixir has `mix new` and now Elm has `elm new`! - -With `elm new` you can easily **start a new Elm project from the command line**. - -The idea is to be able to start coding right away instead of wasting time setting up the initial Elm architecture boilerplate. -This is especially useful if you do a lot of prototyping. - -## Features - -- **No dependencies** — all you need is a shell (like bash, zsh, fish, etc.) -- **Very simple** to install and use. Auto-completion included. -- **100% test covered**. It just works! - -Simply choose between: - -- [**sandbox**](https://package.elm-lang.org/packages/elm/browser/latest/Browser#sandbox) — good for learning about the Elm Architecture -- [**element**](https://package.elm-lang.org/packages/elm/browser/latest/Browser#element) — an Elm application embedded in an HTML element -- [**document**](https://package.elm-lang.org/packages/elm/browser/latest/Browser#document) — an application that has control over the full HTML document -- [**application**](https://package.elm-lang.org/packages/elm/browser/latest/Browser#application) — a single-page app - - -## Usage - -```bash -elm-new # Initialize a Browser.document in the current directory -elm-new my-project # Initialize a Browser.document in my-project/ -elm-new my-project --beginner # Initialize a Browser.sandbox in my-project/ -elm-new my-spa --navigation # Initialize a Browser.application in my-spa/ -elm-new hello --hello-world # Initialize a "Hello, world!" program in hello/ -elm-new --version # Prints the installed version -elm-new --help # Prints all possible commands -``` - -## Example - -``` -$ elm-new my-awesome-project - -my-awesome-project -├── .gitignore -├── README.md -├── elm.json -└── src - └── Main.elm - -1 directory, 4 files - -Your Elm program has been created successfully. -You can use "elm make" to compile it: - - cd my-awesome-project - elm make src/Main.elm - -Run "elm" for more commands. -``` - -## Installation - -**Linux**, **Mac OS X** and **Windows** are supported. - -### npm - - npm install -g elm-new - -### yarn - - yarn global add elm-new - -### Homebrew - - brew install simonewebdesign/tap/elm-new - -### Git - - git clone https://github.com/simonewebdesign/elm-new - cd elm-new && sudo make install - ---- - -See [here](https://github.com/simonewebdesign/elm-new/blob/master/INSTALL.md) for other installation options. - ---- - -### Support for older Elm versions - -Older versions of Elm are also supported: - -- Elm 0.19 => elm-new v2.0.0+ -- Elm 0.18 => elm-new v1.3.0 -- Elm 0.17 => elm-new v1.1.3 -- Elm 0.16 => elm-new v0.1.0 - -So, for example, if you're using Elm 0.18, you'll want to grab elm-new v1.3.0. You can either install it via `brew` or `npm`, or download it straight from the [releases](https://github.com/simonewebdesign/elm-new/releases) page. - -The choices also differ depending on the Elm version. For example, for Elm 0.18 you could choose between: - -- [`Html.program`](https://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-App#program) — the default. Run: `elm-new my-project-name` -- [`Html.beginnerProgram`](https://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-App#beginnerProgram) — good for learning. Run: `elm-new my-project --beginner` -- [`Navigation.program`](https://package.elm-lang.org/packages/elm-lang/navigation/2.1.0/Navigation#program) — SPA with routing. Run: `elm-new my-project --navigation` - ---- - -## Contributing - -Contributors are welcome! Just fork this repo and start hacking away. - -Make sure to check out [CONTRIBUTING.md](https://github.com/simonewebdesign/elm-new/blob/master/CONTRIBUTING.md) to get started. diff --git a/bin/elm-new b/bin/elm-new deleted file mode 100755 index 14fe605..0000000 --- a/bin/elm-new +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -choice=default -path=. -synopsis=' -Usage: elm-new [PATH] [OPTIONS] -Creates a new project with the specified options. The default is Browser.document. - -Options: - -b --beginner Create a Browser.sandbox - --hello-world Create a "Hello, world!" program - --navigation Create a Browser.application - -h --help Show this help text - -V --version Print version - -Examples: - elm-new Create a Browser.document in the current directory - elm-new my-project Create a Browser.document in my-project/ - elm-new my-project --beginner Create a Browser.sandbox in my-project/ - elm-new my-spa --navigation Create a Browser.application in my-spa/ - elm-new hello --hello-world Create a "Hello, world!" program in hello/ -' - -for arg in "$@"; do - case $arg in - - -h|--help) - echo "$synopsis" - exit - ;; - - -V|--version) - echo 2.0.0 - exit - ;; - - -b|--beginner) - choice=beginner - shift - ;; - - --hello-world) - choice=hello-world - shift - ;; - - --navigation) - choice=navigation - shift - ;; - - -*) - >&2 echo "elm-new: illegal option $arg" - echo "$synopsis" - exit 1 - ;; - - *) - path="$1" - shift - esac -done - -mkdir -p "$path" -cp -R "${0%/*}/../share/elm-new/$choice/". "$path" - -tree -a "$path" 2>/dev/null - -echo ' -Your Elm program has been created successfully. -You can use "elm make" to compile it: - - elm make src/Main.elm - -Run "elm" for more commands. -' diff --git a/elm-new-completion.bash b/elm-new-completion.bash deleted file mode 100644 index 7f57c68..0000000 --- a/elm-new-completion.bash +++ /dev/null @@ -1 +0,0 @@ -complete -W "--help --beginner --hello-world --navigation --version" elm-new diff --git a/elm-new.fish b/elm-new.fish deleted file mode 100644 index d21b82e..0000000 --- a/elm-new.fish +++ /dev/null @@ -1,7 +0,0 @@ -complete --command elm-new --no-files --arguments "--hello-world --navigation --help --version" - -complete --command elm-new --require-parameter --long-option beginner --short-option b --description 'Create a Browser.sandbox' -complete --command elm-new --require-parameter --long-option hello-world --description 'Create a "Hello, world!" program' -complete --command elm-new --require-parameter --long-option navigation --description 'Create a Browser.application' -complete --command elm-new --require-parameter --long-option 'help' --short-option h --description 'Print help text' -complete --command elm-new --require-parameter --long-option version --short-option V --description 'Print version' diff --git a/elm-new.zsh b/elm-new.zsh deleted file mode 100644 index a43fc84..0000000 --- a/elm-new.zsh +++ /dev/null @@ -1,12 +0,0 @@ -#compdef elm-new - -__elm_new() { - _arguments -s -S \ - "(- *)"{-h,--help}"[Print help text]" \ - "(- *)"{-V,--version}"[Print version]" \ - --hello-world"[Create a \"Hello, world!\" program]" \ - {-b,--beginner}"[Create a Browser.sandbox]" \ - --navigation"[Create a Browser.application]" -} - -__elm_new diff --git a/index.js b/index.js deleted file mode 100755 index fbcf660..0000000 --- a/index.js +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node - -spawn = require('child_process').spawnSync -cli = require('os').platform() === 'win32' ? __dirname + '/elm-new.bat' : __dirname + '/bin/elm-new' -cmd = spawn(cli, process.argv.slice(2)) - -// npm will rename .gitignore to .npmignore at publish time. See: https://github.com/npm/npm/issues/14216 -spawn('mv', [__dirname + '/share/elm-new/.npmignore', __dirname + '/share/elm-new/.gitignore']) - -stderr = cmd.stderr.toString() -stdout = cmd.stdout.toString() - -if (stderr !== '') console.error(stderr) -if (stdout !== '') console.log(stdout) -if (stderr !== '') process.exit(1) diff --git a/install.bat b/install.bat deleted file mode 100644 index ce673e7..0000000 --- a/install.bat +++ /dev/null @@ -1,35 +0,0 @@ -@echo off - -echo Initializing... -mkdir C:\Tools\elm-new - -echo Downloading... -powershell -Command "(New-Object Net.WebClient).DownloadFile('https://codeload.github.com/simonewebdesign/elm-new/zip/v2.0.0', 'C:\Tools\elm-new\elm-new.zip')" - -echo Extracting... -call :unzip "C:\Tools\elm-new" "C:\Tools\elm-new\elm-new.zip" - -echo Installing... -robocopy C:\Tools\elm-new\elm-new-2.0.0 C:\Tools\elm-new /e >nul 2>&1 - -echo Cleaning... -del C:\Tools\elm-new\elm-new.zip -rmdir /s /q C:\Tools\elm-new\elm-new-2.0.0 - -echo Done! -exit /b - -:unzip -set vbs="%temp%\_.vbs" -if exist %vbs% del /f /q %vbs% ->%vbs% echo Set fso = CreateObject("Scripting.FileSystemObject") ->>%vbs% echo If NOT fso.FolderExists(%1) Then ->>%vbs% echo fso.CreateFolder(%1) ->>%vbs% echo End If ->>%vbs% echo set objShell = CreateObject("Shell.Application") ->>%vbs% echo set FilesInZip=objShell.NameSpace(%2).items ->>%vbs% echo objShell.NameSpace(%1).CopyHere(FilesInZip) ->>%vbs% echo Set fso = Nothing ->>%vbs% echo Set objShell = Nothing -cscript //nologo %vbs% -if exist %vbs% del /f /q %vbs% diff --git a/install.sh b/install.sh deleted file mode 100755 index 32d1f60..0000000 --- a/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Download and unpack -curl https://codeload.github.com/simonewebdesign/elm-new/tar.gz/v2.0.0 > elm-new.tar.gz -tar -zxf elm-new.tar.gz - -# Install -cd elm-new-2.0.0 -sudo make install && echo 'elm-new installed successfully!' - -# Cleanup -cd .. -rm -R elm-new-2.0.0 elm-new.tar.gz diff --git a/package.json b/package.json deleted file mode 100644 index fdb27ff..0000000 --- a/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "elm-new", - "version": "2.0.0", - "description": "Generates a project scaffolding for rapid prototyping of Elm apps.", - "os": [ "darwin", "linux", "win32" ], - "main": "index.js", - "man": "./share/man/man1/elm-new.1", - "bin": { - "elm-new": "./index.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/simonewebdesign/elm-new.git" - }, - "keywords": [ - "elm", - "new", - "init", - "cli" - ], - "author": "Simone Vittori ", - "license": "MIT", - "bugs": { - "url": "https://github.com/simonewebdesign/elm-new/issues" - }, - "homepage": "https://github.com/simonewebdesign/elm-new#readme" -} diff --git a/test.sh b/test.sh deleted file mode 100755 index 982ae5c..0000000 --- a/test.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env bash - -cli=$1 - -function ok { - echo -e ' \033[32m✓\033[0m' -} - -function fail { - echo -e ' \033[31m✗\033[0m' - exit_status=1 -} - -# Print test title -function test { - echo -n "$1" -} - -# Print group of tests title -function group { - echo -e "\n\033[2m*** $1\033[0m" -} - -# Create a sandbox folder to run the tests in isolation -function sandbox { - mkdir sandbox ; cd sandbox -} - -# Cleanup the sandbox -function clean { - cd .. ; rm -R sandbox -} - - -echo Running test suite... - -test "prints help (-h)" -if [[ $($cli -h) =~ Usage: ]]; then ok; else fail; fi - -test "prints help (--help)" -if [[ $($cli --help) =~ Usage: ]]; then ok; else fail; fi - -test "prints version (-V)" -if [ "$($cli -V)" == 2.0.0 ]; then ok; else fail; fi - -test "prints version (--version)" -if [ "$($cli --version)" == 2.0.0 ]; then ok; else fail; fi - -echo When invalid arg provided, -test " prints to stderr" -if [[ "$($cli --badarg 2>&1)" =~ "elm-new: illegal option --badarg" ]]; then ok; else fail; fi - -test " prints synopsis to stdout" -if [[ "$($cli --badarg 2>/dev/null)" =~ Usage: ]]; then ok; else fail; fi - -test " exits with error" -if ! $cli --badarg >/dev/null 2>&1; then ok; else fail; fi - - -sandbox -group "Running $cli with no args..." -../$cli >/dev/null - -test "elm.json exists" -if [ -f elm.json ]; then ok; else fail; fi - -test "It's an application" -if grep --quiet application elm.json; then ok; else fail; fi - -test "README.md exists" -if [ -f README.md ]; then ok; else fail; fi - -test ".gitignore exists" -if [ -f .gitignore ]; then ok; else fail; fi - -test "src/ exists" -if [ -d src ]; then ok; else fail; fi - -test "src/Main.elm exists" -if [ -f src/Main.elm ]; then ok; else fail; fi - -test "It's a Browser.document" -if grep --quiet Browser.document src/Main.elm; then ok; else fail; fi - - -clean -sandbox -group "Running $cli --beginner..." -../$cli --beginner >/dev/null - -test "elm.json exists" -if [ -f elm.json ]; then ok; else fail; fi - -test "README.md exists" -if [ -f README.md ]; then ok; else fail; fi - -test ".gitignore exists" -if [ -f .gitignore ]; then ok; else fail; fi - -test "src/ exists" -if [ -d src ]; then ok; else fail; fi - -test "src/Main.elm exists" -if [ -f src/Main.elm ]; then ok; else fail; fi - -test "It's a Browser.sandbox" -if grep --quiet Browser.sandbox src/Main.elm; then ok; else fail; fi - - -clean -sandbox -group "Running $cli --hello-world..." -../$cli --hello-world >/dev/null - -test "elm.json exists" -if [ -f elm.json ]; then ok; else fail; fi - -test "README.md exists" -if [ -f README.md ]; then ok; else fail; fi - -test ".gitignore exists" -if [ -f .gitignore ]; then ok; else fail; fi - -test "src/ exists" -if [ -d src ]; then ok; else fail; fi - -test "src/Main.elm exists" -if [ -f src/Main.elm ]; then ok; else fail; fi - -test "It's a 'Hello world' program" -if grep --quiet "Hello, World!" src/Main.elm; then ok; else fail; fi - - -clean -sandbox -group "Running $cli somepath --hello-world --beginner..." -../$cli somepath --hello-world --beginner >/dev/null - -test "elm.json exists" -if [ -f somepath/elm.json ]; then ok; else fail; fi - -test "README.md exists" -if [ -f somepath/README.md ]; then ok; else fail; fi - -test ".gitignore exists" -if [ -f somepath/.gitignore ]; then ok; else fail; fi - -test "src/ exists" -if [ -d somepath/src ]; then ok; else fail; fi - -test "src/Main.elm exists" -if [ -f somepath/src/Main.elm ]; then ok; else fail; fi - -test "It's a Browser.sandbox" -if grep --quiet Browser.sandbox somepath/src/Main.elm; then ok; else fail; fi - - -clean -sandbox -group "Running $cli --navigation nav..." -../$cli --navigation nav >/dev/null - -test "elm.json exists" -if [ -f nav/elm.json ]; then ok; else fail; fi - -test "README.md exists" -if [ -f nav/README.md ]; then ok; else fail; fi - -test ".gitignore exists" -if [ -f nav/.gitignore ]; then ok; else fail; fi - -test "src/ exists" -if [ -d nav/src ]; then ok; else fail; fi - -test "src/Main.elm exists" -if [ -f nav/src/Main.elm ]; then ok; else fail; fi - -test "It's a Browser.application" -if grep --quiet Browser.application nav/src/Main.elm; then ok; else fail; fi - - -clean - -exit $exit_status