├── .editorconfig ├── .eslintrc ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .npmrc ├── .travis.yml ├── .verb.md ├── LICENSE ├── README.md ├── docs └── README.tmpl.md ├── index.js ├── package.json └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org/ 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures": { 3 | "modules": true, 4 | "experimentalObjectRestSpread": true 5 | }, 6 | 7 | "env": { 8 | "browser": false, 9 | "es6": true, 10 | "node": true, 11 | "mocha": true 12 | }, 13 | 14 | "globals": { 15 | "document": false, 16 | "navigator": false, 17 | "window": false 18 | }, 19 | 20 | "rules": { 21 | "accessor-pairs": 2, 22 | "arrow-spacing": [2, { "before": true, "after": true }], 23 | "block-spacing": [2, "always"], 24 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 25 | "comma-dangle": [2, "never"], 26 | "comma-spacing": [2, { "before": false, "after": true }], 27 | "comma-style": [2, "last"], 28 | "constructor-super": 2, 29 | "curly": [2, "multi-line"], 30 | "dot-location": [2, "property"], 31 | "eol-last": 2, 32 | "eqeqeq": [2, "allow-null"], 33 | "generator-star-spacing": [2, { "before": true, "after": true }], 34 | "handle-callback-err": [2, "^(err|error)$" ], 35 | "indent": [2, 2, { "SwitchCase": 1 }], 36 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 37 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 38 | "new-parens": 2, 39 | "no-array-constructor": 2, 40 | "no-caller": 2, 41 | "no-class-assign": 2, 42 | "no-cond-assign": 2, 43 | "no-const-assign": 2, 44 | "no-control-regex": 2, 45 | "no-debugger": 2, 46 | "no-delete-var": 2, 47 | "no-dupe-args": 2, 48 | "no-dupe-class-members": 2, 49 | "no-dupe-keys": 2, 50 | "no-duplicate-case": 2, 51 | "no-empty-character-class": 2, 52 | "no-empty-label": 2, 53 | "no-eval": 2, 54 | "no-ex-assign": 2, 55 | "no-extend-native": 2, 56 | "no-extra-bind": 2, 57 | "no-extra-boolean-cast": 2, 58 | "no-extra-parens": [2, "functions"], 59 | "no-fallthrough": 2, 60 | "no-floating-decimal": 2, 61 | "no-func-assign": 2, 62 | "no-implied-eval": 2, 63 | "no-inner-declarations": [2, "functions"], 64 | "no-invalid-regexp": 2, 65 | "no-irregular-whitespace": 2, 66 | "no-iterator": 2, 67 | "no-label-var": 2, 68 | "no-labels": 2, 69 | "no-lone-blocks": 2, 70 | "no-mixed-spaces-and-tabs": 2, 71 | "no-multi-spaces": 2, 72 | "no-multi-str": 2, 73 | "no-multiple-empty-lines": [2, { "max": 1 }], 74 | "no-native-reassign": 2, 75 | "no-negated-in-lhs": 2, 76 | "no-new": 2, 77 | "no-new-func": 2, 78 | "no-new-object": 2, 79 | "no-new-require": 2, 80 | "no-new-wrappers": 2, 81 | "no-obj-calls": 2, 82 | "no-octal": 2, 83 | "no-octal-escape": 2, 84 | "no-proto": 0, 85 | "no-redeclare": 2, 86 | "no-regex-spaces": 2, 87 | "no-return-assign": 2, 88 | "no-self-compare": 2, 89 | "no-sequences": 2, 90 | "no-shadow-restricted-names": 2, 91 | "no-spaced-func": 2, 92 | "no-sparse-arrays": 2, 93 | "no-this-before-super": 2, 94 | "no-throw-literal": 2, 95 | "no-trailing-spaces": 0, 96 | "no-undef": 2, 97 | "no-undef-init": 2, 98 | "no-unexpected-multiline": 2, 99 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 100 | "no-unreachable": 2, 101 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 102 | "no-useless-call": 0, 103 | "no-with": 2, 104 | "one-var": [0, { "initialized": "never" }], 105 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 106 | "padded-blocks": [0, "never"], 107 | "quotes": [2, "single", "avoid-escape"], 108 | "radix": 2, 109 | "semi": [2, "always"], 110 | "semi-spacing": [2, { "before": false, "after": true }], 111 | "space-after-keywords": [2, "always"], 112 | "space-before-blocks": [2, "always"], 113 | "space-before-function-paren": [2, "never"], 114 | "space-before-keywords": [2, "always"], 115 | "space-in-parens": [2, "never"], 116 | "space-infix-ops": 2, 117 | "space-return-throw-case": 2, 118 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 119 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 120 | "use-isnan": 2, 121 | "valid-typeof": 2, 122 | "wrap-iife": [2, "any"], 123 | "yoda": [2, "never"] 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended" 4 | ], 5 | 6 | "env": { 7 | "browser": false, 8 | "es6": true, 9 | "node": true, 10 | "mocha": true 11 | }, 12 | 13 | "parserOptions":{ 14 | "ecmaVersion": 9, 15 | "sourceType": "module", 16 | "ecmaFeatures": { 17 | "modules": true, 18 | "experimentalObjectRestSpread": true 19 | } 20 | }, 21 | 22 | "globals": { 23 | "document": false, 24 | "navigator": false, 25 | "window": false 26 | }, 27 | 28 | "rules": { 29 | "accessor-pairs": 2, 30 | "arrow-spacing": [2, { "before": true, "after": true }], 31 | "block-spacing": [2, "always"], 32 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 33 | "comma-dangle": [2, "never"], 34 | "comma-spacing": [2, { "before": false, "after": true }], 35 | "comma-style": [2, "last"], 36 | "constructor-super": 2, 37 | "curly": [2, "multi-line"], 38 | "dot-location": [2, "property"], 39 | "eol-last": 2, 40 | "eqeqeq": [2, "allow-null"], 41 | "generator-star-spacing": [2, { "before": true, "after": true }], 42 | "handle-callback-err": [2, "^(err|error)$" ], 43 | "indent": [2, 2, { "SwitchCase": 1 }], 44 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 45 | "keyword-spacing": [2, { "before": true, "after": true }], 46 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 47 | "new-parens": 2, 48 | "no-array-constructor": 2, 49 | "no-caller": 2, 50 | "no-class-assign": 2, 51 | "no-cond-assign": 2, 52 | "no-const-assign": 2, 53 | "no-control-regex": 2, 54 | "no-debugger": 2, 55 | "no-delete-var": 2, 56 | "no-dupe-args": 2, 57 | "no-dupe-class-members": 2, 58 | "no-dupe-keys": 2, 59 | "no-duplicate-case": 2, 60 | "no-empty-character-class": 2, 61 | "no-eval": 2, 62 | "no-ex-assign": 2, 63 | "no-extend-native": 2, 64 | "no-extra-bind": 2, 65 | "no-extra-boolean-cast": 2, 66 | "no-extra-parens": [2, "functions"], 67 | "no-fallthrough": 2, 68 | "no-floating-decimal": 2, 69 | "no-func-assign": 2, 70 | "no-implied-eval": 2, 71 | "no-inner-declarations": [2, "functions"], 72 | "no-invalid-regexp": 2, 73 | "no-irregular-whitespace": 2, 74 | "no-iterator": 2, 75 | "no-label-var": 2, 76 | "no-labels": 2, 77 | "no-lone-blocks": 2, 78 | "no-mixed-spaces-and-tabs": 2, 79 | "no-multi-spaces": 2, 80 | "no-multi-str": 2, 81 | "no-multiple-empty-lines": [2, { "max": 1 }], 82 | "no-native-reassign": 0, 83 | "no-negated-in-lhs": 2, 84 | "no-new": 2, 85 | "no-new-func": 2, 86 | "no-new-object": 2, 87 | "no-new-require": 2, 88 | "no-new-wrappers": 2, 89 | "no-obj-calls": 2, 90 | "no-octal": 2, 91 | "no-octal-escape": 2, 92 | "no-proto": 0, 93 | "no-redeclare": 2, 94 | "no-regex-spaces": 2, 95 | "no-return-assign": 2, 96 | "no-self-compare": 2, 97 | "no-sequences": 2, 98 | "no-shadow-restricted-names": 2, 99 | "no-spaced-func": 2, 100 | "no-sparse-arrays": 2, 101 | "no-this-before-super": 2, 102 | "no-throw-literal": 2, 103 | "no-trailing-spaces": 0, 104 | "no-undef": 2, 105 | "no-undef-init": 2, 106 | "no-unexpected-multiline": 2, 107 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 108 | "no-unreachable": 2, 109 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 110 | "no-useless-call": 0, 111 | "no-with": 2, 112 | "one-var": [0, { "initialized": "never" }], 113 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 114 | "padded-blocks": [0, "never"], 115 | "quotes": [2, "single", "avoid-escape"], 116 | "radix": 2, 117 | "semi": [2, "always"], 118 | "semi-spacing": [2, { "before": false, "after": true }], 119 | "space-before-blocks": [2, "always"], 120 | "space-before-function-paren": [2, "never"], 121 | "space-in-parens": [2, "never"], 122 | "space-infix-ops": 2, 123 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 124 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 125 | "use-isnan": 2, 126 | "valid-typeof": 2, 127 | "wrap-iife": [2, "any"], 128 | "yoda": [2, "never"] 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Numerous always-ignore extensions 2 | *.DS_Store 3 | *.csv 4 | *.dat 5 | *.diff 6 | *.err 7 | *.gz 8 | *.log 9 | *.orig 10 | *.out 11 | *.pid 12 | *.rej 13 | *.seed 14 | *.swo 15 | *.swp 16 | *.vi 17 | *.yo-rc.json 18 | *.zip 19 | *~ 20 | .ruby-version 21 | lib-cov 22 | 23 | # OS or Editor folders 24 | *.esproj 25 | *.sublime-project 26 | *.sublime-workspace 27 | ._* 28 | .cache 29 | .DS_Store 30 | .idea 31 | .project 32 | .settings 33 | .tmproj 34 | nbproject 35 | Thumbs.db 36 | 37 | # Komodo 38 | *.komodoproject 39 | .komodotools 40 | 41 | # grunt-html-validation 42 | validation-status.json 43 | validation-report.json 44 | 45 | # Vendor packages 46 | node_modules 47 | bower_components 48 | vendor 49 | 50 | # General folders and files to ignore 51 | _gh_pages 52 | tmp 53 | temp 54 | TODO.md -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - linux 4 | - osx 5 | - windows 6 | language: node_js 7 | node_js: 8 | - node 9 | - '11' 10 | - '10' 11 | - '9' 12 | - '8' 13 | -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | ## Usage 2 | 3 | ```js 4 | var repoName = require('{%= name %}'); 5 | ``` 6 | 7 | By default `process.cwd()` is used, but you can alternatively specify a different directory as the first argument. 8 | 9 | **async** 10 | 11 | ```js 12 | repoName(function(err, name) { 13 | //=> 'git-repo-name' 14 | }); 15 | ``` 16 | 17 | **sync** 18 | 19 | ```js 20 | repoName.sync(); 21 | //=> 'git-repo-name' 22 | ``` 23 | 24 | ## cwd 25 | 26 | Optionally specify the directory to use. 27 | 28 | **async** 29 | 30 | ```js 31 | repoName('foo', function(err, name) { 32 | //=> 'repo-foo-name' 33 | }); 34 | ``` 35 | 36 | **sync** 37 | 38 | ```js 39 | repoName.sync('foo'); 40 | //=> 'repo-foo-name' 41 | ``` 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-present, Jon Schlinkert. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-repo-name [![NPM version](https://img.shields.io/npm/v/git-repo-name.svg?style=flat)](https://www.npmjs.com/package/git-repo-name) [![NPM downloads](https://img.shields.io/npm/dm/git-repo-name.svg?style=flat)](https://npmjs.org/package/git-repo-name) [![Build Status](https://img.shields.io/travis/jonschlinkert/git-repo-name.svg?style=flat)](https://travis-ci.org/jonschlinkert/git-repo-name) 2 | 3 | Get the repository name from the git remote origin URL. 4 | 5 | ## Install 6 | 7 | Install with [npm](https://www.npmjs.com/): 8 | 9 | ```sh 10 | $ npm install git-repo-name --save 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | var repoName = require('git-repo-name'); 17 | ``` 18 | 19 | By default `process.cwd()` is used, but you can alternatively specify a different directory as the first argument. 20 | 21 | **async** 22 | 23 | ```js 24 | repoName(function(err, name) { 25 | //=> 'git-repo-name' 26 | }); 27 | ``` 28 | 29 | **sync** 30 | 31 | ```js 32 | repoName.sync(); 33 | //=> 'git-repo-name' 34 | ``` 35 | 36 | ## cwd 37 | 38 | Optionally specify the directory to use. 39 | 40 | **async** 41 | 42 | ```js 43 | repoName('foo', function(err, name) { 44 | //=> 'repo-foo-name' 45 | }); 46 | ``` 47 | 48 | **sync** 49 | 50 | ```js 51 | repoName.sync('foo'); 52 | //=> 'repo-foo-name' 53 | ``` 54 | 55 | ## Related projects 56 | 57 | You might also be interested in these projects: 58 | 59 | * [git-user-email](https://www.npmjs.com/package/git-user-email): Get the email address of the current user from git config. | [homepage](https://github.com/jonschlinkert/git-user-email) 60 | * [git-username](https://www.npmjs.com/package/git-username): Get the username from a git remote origin URL. | [homepage](https://github.com/jonschlinkert/git-username) 61 | 62 | ## Contributing 63 | 64 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/git-repo-name/issues/new). 65 | 66 | ## Building docs 67 | 68 | Generate readme and API documentation with [verb](https://github.com/verbose/verb): 69 | 70 | ```sh 71 | $ npm install verb && npm run docs 72 | ``` 73 | 74 | Or, if [verb](https://github.com/verbose/verb) is installed globally: 75 | 76 | ```sh 77 | $ verb 78 | ``` 79 | 80 | ## Running tests 81 | 82 | Install dev dependencies: 83 | 84 | ```sh 85 | $ npm install -d && npm test 86 | ``` 87 | 88 | ## Author 89 | 90 | **Jon Schlinkert** 91 | 92 | * [github/jonschlinkert](https://github.com/jonschlinkert) 93 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 94 | 95 | ## License 96 | 97 | Copyright © 2016, [Jon Schlinkert](http://github.com/jonschlinkert). 98 | Released under the [MIT license](https://github.com/jonschlinkert/git-repo-name/blob/master/LICENSE). 99 | 100 | *** 101 | 102 | _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 03, 2016._ -------------------------------------------------------------------------------- /docs/README.tmpl.md: -------------------------------------------------------------------------------- 1 | # {%= name %} {%= badge("fury") %} 2 | 3 | > {%= description %} 4 | 5 | ## Install 6 | {%= include("install") %} 7 | 8 | ## Usage 9 | 10 | ```js 11 | var name = require('git-repo-name'); 12 | console.log(name); 13 | ``` 14 | 15 | ## Author 16 | {%= contrib("jon") %} 17 | 18 | ## License 19 | {%= copyright() %} 20 | {%= license() %} 21 | 22 | *** 23 | 24 | {%= include("footer") %} -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const url = require('url'); 4 | const path = require('path'); 5 | const origin = require('remote-origin-url'); 6 | 7 | const repo = (options, cb) => { 8 | if (typeof options === 'function') { 9 | cb = options; 10 | options = process.cwd(); 11 | } 12 | 13 | let promise = repo.promise(options); 14 | 15 | if (typeof cb === 'function') { 16 | promise.then(name => cb(null, name)).catch(cb); 17 | return; 18 | } 19 | 20 | return promise; 21 | }; 22 | 23 | repo.promise = (options = {}) => { 24 | if (typeof options === 'string') { 25 | options = { cwd: options }; 26 | } 27 | 28 | let opts = { cwd: process.cwd(), ...options }; 29 | if (!opts.path) { 30 | opts.path = path.resolve(opts.cwd, '.git/config'); 31 | } 32 | 33 | return new Promise((resolve, reject) => { 34 | origin(opts, (err, giturl) => { 35 | if (err) { 36 | reject(err); 37 | return; 38 | } 39 | 40 | if (!giturl) { 41 | reject(new Error('cannot find ".git/config"')); 42 | return; 43 | } 44 | 45 | let parsed = url.parse(giturl); 46 | let segments = parsed.pathname.split(path.sep); 47 | let filepath = segments.pop(); 48 | resolve(stem(filepath)); 49 | }); 50 | }); 51 | }; 52 | 53 | repo.sync = (options = {}) => { 54 | if (typeof options === 'string') options = { cwd: options }; 55 | let opts = { cwd: process.cwd(), ...options }; 56 | if (!opts.path) { 57 | opts.path = path.resolve(opts.cwd, '.git/config'); 58 | } 59 | 60 | let giturl = origin.sync(opts); 61 | if (!giturl) { 62 | throw new Error('cannot find ".git/config"'); 63 | } 64 | let parsed = url.parse(giturl); 65 | let segments = parsed.pathname.split(path.sep); 66 | return stem(segments.pop()); 67 | }; 68 | 69 | function stem(filepath) { 70 | const ext = path.extname(filepath); 71 | return ext === '.git' 72 | ? path.basename(filepath, ext) 73 | : path.basename(filepath); 74 | } 75 | 76 | module.exports = repo; 77 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git-repo-name", 3 | "description": "Get the repository name from the git remote origin URL.", 4 | "version": "1.0.1", 5 | "homepage": "https://github.com/jonschlinkert/git-repo-name", 6 | "author": "Jon Schlinkert (http://github.com/jonschlinkert)", 7 | "repository": "jonschlinkert/git-repo-name", 8 | "bugs": { 9 | "url": "https://github.com/jonschlinkert/git-repo-name/issues" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "index.js" 14 | ], 15 | "main": "index.js", 16 | "engines": { 17 | "node": ">=8" 18 | }, 19 | "scripts": { 20 | "test": "mocha" 21 | }, 22 | "dependencies": { 23 | "remote-origin-url": "^2.0.0" 24 | }, 25 | "devDependencies": { 26 | "gulp-format-md": "^2.0.0", 27 | "mocha": "^5.2.0" 28 | }, 29 | "keywords": [ 30 | "gh", 31 | "git", 32 | "git repo", 33 | "repo", 34 | "repo name", 35 | "repository" 36 | ], 37 | "verb": { 38 | "toc": false, 39 | "layout": "default", 40 | "tasks": [ 41 | "readme" 42 | ], 43 | "plugins": [ 44 | "gulp-format-md" 45 | ], 46 | "related": { 47 | "list": [ 48 | "git-user-email", 49 | "git-username" 50 | ] 51 | }, 52 | "lint": { 53 | "reflinks": true 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('mocha'); 4 | const assert = require('assert'); 5 | const repoName = require('./'); 6 | 7 | describe('git-repo-name', () => { 8 | describe('async', () => { 9 | it('should return a promise', async() => { 10 | assert.equal(await repoName(), 'git-repo-name'); 11 | }); 12 | 13 | it('should take a callback', cb => { 14 | repoName((err, res) => { 15 | if (err) return cb(err); 16 | assert.equal(res, 'git-repo-name'); 17 | cb(); 18 | }); 19 | }); 20 | 21 | it('should take cwd as a string', cb => { 22 | repoName(process.cwd(), (err, res) => { 23 | if (err) return cb(err); 24 | assert.equal(repoName.sync(), 'git-repo-name'); 25 | cb(); 26 | }); 27 | }); 28 | 29 | it('should error when .git folder does not exist', cb => { 30 | repoName('foo', (err, res) => { 31 | assert.equal(err.message, 'cannot find ".git/config"'); 32 | cb(); 33 | }); 34 | }); 35 | }); 36 | 37 | describe('sync', () => { 38 | it('should return the name from git config:', () => { 39 | assert.equal(repoName.sync(), 'git-repo-name'); 40 | }); 41 | 42 | it('should take cwd as a string', () => { 43 | assert.equal(repoName.sync('.'), 'git-repo-name'); 44 | }); 45 | }); 46 | }); 47 | --------------------------------------------------------------------------------