You've already forked hugo-extended
							
							
				mirror of
				https://github.com/jakejarvis/hugo-extended.git
				synced 2025-10-31 06:16:02 -04:00 
			
		
		
		
	Initial commit
This commit is contained in:
		
							
								
								
									
										12
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| # http://editorconfig.org | ||||
| root = true | ||||
|  | ||||
| [*] | ||||
| indent_style = space | ||||
| indent_size = 2 | ||||
| charset = utf-8 | ||||
| trim_trailing_whitespace = true | ||||
| insert_final_newline = true | ||||
|  | ||||
| [*.md] | ||||
| trim_trailing_whitespace = false | ||||
							
								
								
									
										36
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| # Logs | ||||
| logs | ||||
| *.log | ||||
| npm-debug.log* | ||||
|  | ||||
| # Runtime data | ||||
| pids | ||||
| *.pid | ||||
| *.seed | ||||
|  | ||||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||||
| lib-cov | ||||
|  | ||||
| # Coverage directory used by tools like istanbul | ||||
| coverage | ||||
|  | ||||
| # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||||
| .grunt | ||||
|  | ||||
| # node-waf configuration | ||||
| .lock-wscript | ||||
|  | ||||
| # Compiled binary addons (http://nodejs.org/api/addons.html) | ||||
| build/Release | ||||
|  | ||||
| # Dependency directory | ||||
| node_modules | ||||
|  | ||||
| # Optional npm cache directory | ||||
| .npm | ||||
|  | ||||
| # Optional REPL history | ||||
| .node_repl_history | ||||
|  | ||||
| # for binary install | ||||
| /vendor/ | ||||
							
								
								
									
										8
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| language: node_js | ||||
| os: | ||||
|   - linux | ||||
|   - osx | ||||
| node_js: | ||||
|   - '6' | ||||
|   - '5' | ||||
|   - '4' | ||||
							
								
								
									
										21
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| The MIT License (MIT) | ||||
|  | ||||
| Copyright (c) 2016 FennecLab | ||||
|  | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
|  | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
|  | ||||
| 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 OR COPYRIGHT HOLDERS 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. | ||||
							
								
								
									
										3
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| # hugo-bin [](https://travis-ci.org/fenneclab/hugo-bin) | ||||
|  | ||||
| Binary wrapper for [Hugo](https://github.com/spf13/hugo) | ||||
							
								
								
									
										13
									
								
								lib/binary.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								lib/binary.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| const path = require('path'); | ||||
| const BinWrapper = require('bin-wrapper'); | ||||
|  | ||||
| const getBinalyName = require('./getBinalyName'); | ||||
|  | ||||
| const HUGO_VERSION = '0.15'; | ||||
| const baseUrl = `https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/`; | ||||
| const binalyNames = getBinalyName(HUGO_VERSION); | ||||
|  | ||||
| module.exports = new BinWrapper() | ||||
|   .src(`${baseUrl}${binalyNames.binaryName}${binalyNames.comp}`) | ||||
|   .dest(path.join(__dirname, '../vendor')) | ||||
|   .use(`${binalyNames.binaryName}${binalyNames.exe}`); | ||||
							
								
								
									
										8
									
								
								lib/cli.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								lib/cli.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #!/usr/bin/env node | ||||
|  | ||||
| const spawn = require('child_process').spawn; | ||||
| const input = process.argv.slice(2); | ||||
| const bin = require('./'); | ||||
|  | ||||
| spawn(bin, input, {stdio: 'inherit'}) | ||||
|   .on('exit', process.exit); | ||||
							
								
								
									
										41
									
								
								lib/getBinalyName.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								lib/getBinalyName.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| const PLATFORMS = { | ||||
|   darwin: 'darwin', | ||||
|   freebsd: 'freebsd', | ||||
|   linux: 'linux', | ||||
|   // sunos: '', not supported | ||||
|   win32: 'windows' | ||||
| }; | ||||
|  | ||||
| const ARCHS = { | ||||
|   arm: 'arm', | ||||
|   ia32: '386', | ||||
|   x64: 'amd64' | ||||
| }; | ||||
|  | ||||
| const COMPS = { | ||||
|   darwin: '.zip', | ||||
|   freebsd: '.zip', | ||||
|   linux: '.tar.gz', | ||||
|   // sunos: '', not supported | ||||
|   win32: '.zip' | ||||
| }; | ||||
|  | ||||
| const EXES = { | ||||
|   darwin: '', | ||||
|   freebsd: '', | ||||
|   linux: '', | ||||
|   // sunos: '', not supported | ||||
|   win32: 'windows' | ||||
| }; | ||||
|  | ||||
| module.exports = version => { | ||||
|   const platform = PLATFORMS[process.platform]; | ||||
|   const arch = ARCHS[process.arch]; | ||||
|   const comp = COMPS[process.platform]; | ||||
|   const exe = EXES[process.platform]; | ||||
|   return { | ||||
|     binaryName: `hugo_${version}_${platform}_${arch}`, | ||||
|     comp, | ||||
|     exe | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										3
									
								
								lib/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lib/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| const bin = require('./binary'); | ||||
|  | ||||
| module.exports = bin.path(); | ||||
							
								
								
									
										11
									
								
								lib/install.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/install.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| const bin = require('./binary'); | ||||
| const log = require('logalot'); | ||||
|  | ||||
| bin.run(['version'], err => { | ||||
|   if (err) { | ||||
|     log.error(err.message); | ||||
|     log.error('Hugo binary installation failed'); | ||||
|     return; | ||||
|   } | ||||
|   log.success('Hugo binary is installed successfully'); | ||||
| }); | ||||
							
								
								
									
										42
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| { | ||||
|   "name": "hugo-bin", | ||||
|   "version": "0.1.0", | ||||
|   "description": "", | ||||
|   "main": "lib/index.js", | ||||
|   "scripts": { | ||||
|     "pretest": "rm -rf vendor && npm run postinstall", | ||||
|     "test": "eslint . && mocha", | ||||
|     "postinstall": "node lib/install" | ||||
|   }, | ||||
|   "repository": "fenneclab/hugo-bin", | ||||
|   "author": "satoshun00 <shun.sato@fenneclab.com>", | ||||
|   "license": "MIT", | ||||
|   "files": [ | ||||
|     "lib" | ||||
|   ], | ||||
|   "bin": { | ||||
|     "hugo": "lib/cli.js" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "bin-check": "3.0.0", | ||||
|     "eslint": "2.11.0", | ||||
|     "mocha": "2.5.3" | ||||
|   }, | ||||
|   "engines": { | ||||
|     "node": ">=5.0.0" | ||||
|   }, | ||||
|   "eslintConfig": { | ||||
|     "extends": "eslint:recommended", | ||||
|     "env": { | ||||
|       "node": true, | ||||
|       "mocha": true | ||||
|     }, | ||||
|     "parserOptions": { | ||||
|       "sourceType": "module" | ||||
|     } | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "bin-wrapper": "3.0.2", | ||||
|     "logalot": "2.1.0" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										11
									
								
								test/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| const assert = require('assert'); | ||||
| const binCheck = require('bin-check'); | ||||
| const hugoBin = require('../lib'); | ||||
|  | ||||
| describe('hugo-bin', () => { | ||||
|   it('should return path to binary and work', () => { | ||||
|     return binCheck(hugoBin, ['version']).then(works => { | ||||
|       assert(works); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user
	 Shun Sato
					Shun Sato