├── test ├── fixtures │ ├── require.coffee │ ├── require.js │ ├── bower.json │ ├── composer.json │ ├── package.json │ ├── require.coffee.html │ ├── require.js.html │ ├── bower.json.html │ └── composer.json.html ├── test_setup.js ├── test_require_coffee_remote.js ├── test_require_coffee_local.js ├── test_utils.js ├── test_manifest_bower_remote.js ├── test_manifest_bower_local.js ├── test_manifest_composer_remote.js ├── test_manifest_composer_local.js ├── test_manifest_package_remote.js ├── test_manifest_package_local.js ├── test_require_remote.js └── test_require_local.js ├── .gitignore ├── .travis.yml ├── .editorconfig ├── .jshintrc ├── index.js ├── .jscs.json ├── README.md ├── lib ├── utils.js ├── manifest.js ├── require.js └── link_builder.js ├── package.json └── gulpfile.js /test/fixtures/require.coffee: -------------------------------------------------------------------------------- 1 | require "path" 2 | lodash = require("lodash") -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | temp/ 3 | coverage/ 4 | npm-debug.log 5 | .DS_Store 6 | .idea 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | after_script: 5 | - npm run coveralls 6 | -------------------------------------------------------------------------------- /test/test_setup.js: -------------------------------------------------------------------------------- 1 | var registries = require('github-linker-registries'); 2 | 3 | before(function() { 4 | registries.npm = { 5 | lodash: 'https://github.com/lodash/lodash' 6 | }; 7 | }); 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true, 14 | "expr": true, 15 | "globals": { 16 | "describe" : false, 17 | "it" : false, 18 | "before" : false, 19 | "beforeEach" : false, 20 | "after" : false, 21 | "afterEach" : false, 22 | "window" : false 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * github-linker-core 3 | * https://github.com/stefanbuck/github-linker 4 | * 5 | * Copyright (c) 2014 Stefan Buck 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | var utils = require('./lib/utils'); 12 | var manifest = require('./lib/manifest'); 13 | var reqr = require('./lib/require'); 14 | 15 | module.exports = function($, url, cb) { 16 | 17 | if ($('.github-linker').length > 0) { 18 | return cb(null); 19 | } 20 | 21 | if (utils.manifestType(url)) { 22 | manifest($, url, cb); 23 | } else if (utils.requireType(url)) { 24 | reqr($, url, cb); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /test/fixtures/require.js: -------------------------------------------------------------------------------- 1 | 2 | require('path'); 3 | require('lodash'); 4 | require('unknown-package-name'); 5 | require('./file.js'); 6 | require('./folder/file.js'); 7 | require('./file-or-folder'); 8 | require('../file.js'); 9 | require('../folder/file.js'); 10 | require('../file-or-folder'); 11 | require('../../file.js'); 12 | require('../../folder/file.js'); 13 | require('../../file-or-folder'); 14 | require('./'); 15 | require('..'); 16 | require('../'); 17 | require('../..'); 18 | require('../../'); 19 | require('.'); 20 | require('...'); 21 | require('/'); 22 | require('matthewmueller/uid'); 23 | require('component/tip@master'); 24 | require('yields/shortcuts@0.0.1:/index.js'); 25 | -------------------------------------------------------------------------------- /.jscs.json: -------------------------------------------------------------------------------- 1 | { 2 | "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], 3 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], 4 | "disallowSpaceBeforeBinaryOperators": [",", ":"], 5 | "disallowSpaceAfterBinaryOperators": ["!"], 6 | "requireSpaceBeforeBinaryOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], 7 | "requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], 8 | "disallowImplicitTypeConversion": ["string"], 9 | "disallowKeywords": ["with"], 10 | "disallowMultipleLineBreaks": true, 11 | "disallowKeywordsOnNewLine": ["else"], 12 | "disallowTrailingWhitespace": true, 13 | "requireLineFeedAtFileEnd": true, 14 | "validateIndentation": 2, 15 | "validateQuoteMarks": "'", 16 | "validateJSDoc": { 17 | "checkParamNames": true, 18 | "requireParamTypes": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/fixtures/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-repo", 3 | "description": "My personal playground", 4 | "version": "0.0.1", 5 | "main": "index.js", 6 | "license": "MIT", 7 | "ignore": "", 8 | "keywords": [], 9 | "author": [ 10 | "Stefan Buck (http://stefanbuck.com)" 11 | ], 12 | "homepage": "https://github.com/stefanbuck/playground-repo", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/stefanbuck/playground-repo" 16 | }, 17 | "dependencies": { 18 | "lodash": "2.4.1", 19 | "modernizr": "Modernizr/Modernizr", 20 | "backbone": "jashkenas/backbone#master", 21 | "jquery": "jquery/jquery#1.x-master", 22 | "unknown-package-name": "latest" 23 | }, 24 | "devDependencies": { 25 | "chai": "^1.9.1", 26 | "should": "^3.3.1" 27 | }, 28 | "resolutions": { 29 | "lodash": "2.1.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github-linker-core 2 | [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image] [![Coverage Status][coveralls-image]][coveralls-url] 3 | 4 | > The [GitHub-Linker](https://github.com/stefanbuck/github-linker) core 5 | 6 | 7 | ## License 8 | 9 | Copyright (c) 2014 Stefan Buck. Licensed under the MIT license. 10 | 11 | 12 | 13 | [npm-url]: https://npmjs.org/package/github-linker-core 14 | [npm-image]: https://badge.fury.io/js/github-linker-core.svg 15 | [travis-url]: https://travis-ci.org/stefanbuck/github-linker-core 16 | [travis-image]: https://travis-ci.org/stefanbuck/github-linker-core.svg?branch=master 17 | [daviddm-url]: https://david-dm.org/stefanbuck/github-linker-core.svg?theme=shields.io 18 | [daviddm-image]: https://david-dm.org/stefanbuck/github-linker-core 19 | [coveralls-url]: https://coveralls.io/r/stefanbuck/github-linker-core 20 | [coveralls-image]: https://coveralls.io/repos/stefanbuck/github-linker-core/badge.png 21 | -------------------------------------------------------------------------------- /lib/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require('lodash'); 4 | 5 | var getType = function(url, lookup) { 6 | 7 | var urlContains = function(indicator) { 8 | url = url.split('#')[0]; 9 | return url.indexOf(indicator) === url.length - indicator.length; 10 | }; 11 | 12 | return _.find(lookup, function(type, urlFragment) { 13 | return urlContains(urlFragment); 14 | }); 15 | }; 16 | 17 | var stripQuotes = function(jqElement) { 18 | return jqElement.html().replace(/"|'/g, ''); 19 | }; 20 | 21 | var manifestType = function(url) { 22 | var lookup = { 23 | '/package.json': 'npm', 24 | '/bower.json': 'bower', 25 | '/composer.json': 'composer' 26 | }; 27 | return getType(url, lookup); 28 | }; 29 | 30 | var requireType = function(url) { 31 | var lookup = { 32 | '.js': 'js', 33 | '.coffee': 'coffee' 34 | }; 35 | return getType(url, lookup); 36 | }; 37 | 38 | var showLoader = function($) { 39 | var $loaderContainer = $('.page-context-loader'); 40 | $loaderContainer.addClass('is-context-loading'); 41 | }; 42 | 43 | module.exports = { 44 | stripQuotes: stripQuotes, 45 | manifestType: manifestType, 46 | requireType: requireType, 47 | showLoader: showLoader 48 | }; 49 | -------------------------------------------------------------------------------- /test/fixtures/composer.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "playground-repo", 4 | "description": "My personal playground", 5 | "version": "0.0.1", 6 | "type": "library", 7 | "keywords": [], 8 | "homepage": "https://github.com/stefanbuck/playground-repo", 9 | "time": "2014-09-19", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Stefan Buck", 14 | "email": "dev@stefanbuck.com", 15 | "homepage": "http://stefanbuck.com", 16 | "role": "Developer" 17 | } 18 | ], 19 | "support": { 20 | "email": "dev@stefanbuck.com", 21 | "irc": "irc://irc.freenode.org/composer" 22 | }, 23 | "require": { 24 | "php": ">=5.3.2", 25 | "laravel/framework": "~4.2", 26 | "unknown-package-name": "*" 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "~4.0", 30 | "doctrine/dbal": "~2.3" 31 | }, 32 | "conflict": {}, 33 | "replace": {}, 34 | "provide": {}, 35 | "suggest'": { 36 | "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", 37 | "doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-linker-core", 3 | "description": "The GitHub Linker core", 4 | "version": "0.0.1", 5 | "homepage": "https://github.com/stefanbuck/github-linker", 6 | "bugs": "https://github.com/stefanbuck/github-linker-core/issues", 7 | "license": "MIT", 8 | "main": "index.js", 9 | "author": { 10 | "name": "Stefan Buck", 11 | "email": "dev@stefanbuck.com", 12 | "url": "http://stefanbuck.com" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/stefanbuck/github-linker-core" 17 | }, 18 | "keywords": [], 19 | "dependencies": { 20 | "github-linker-registries": "^1.0.0", 21 | "jquery": "^2.1.1", 22 | "lodash": "2.4.1" 23 | }, 24 | "devDependencies": { 25 | "coveralls": "^2.11.1", 26 | "gulp": "^3.8.8", 27 | "gulp-bump": "^0.1.11", 28 | "gulp-istanbul": "^0.3.0", 29 | "gulp-jscs": "^1.1.2", 30 | "gulp-jshint": "^1.8.4", 31 | "gulp-load-plugins": "^0.6.0", 32 | "gulp-mocha": "^1.1.0", 33 | "gulp-plumber": "^0.6.5", 34 | "gulp-util": "^3.0.1", 35 | "jsdom": "^1.0.0-pre.6", 36 | "jshint-stylish": "^0.4.0", 37 | "should": "^4.0.4" 38 | }, 39 | "scripts": { 40 | "coveralls": "gulp test && cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 41 | "test": "gulp test" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-repo", 3 | "description": "My personal playground", 4 | "version": "0.0.1", 5 | "homepage": "https://github.com/stefanbuck/playground-repo", 6 | "bugs": "https://github.com/stefanbuck/playground-repo/issues", 7 | "license": "MIT", 8 | "main": "index.js", 9 | "author": { 10 | "name": "Stefan Buck", 11 | "email": "dev@stefanbuck.com", 12 | "url": "http://stefanbuck.com" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/stefanbuck/playground-repo" 17 | }, 18 | "keywords": [], 19 | "dependencies": { 20 | "lodash": "2.4.1", 21 | "request": "^2.40.0", 22 | "modernizr": "Modernizr/Modernizr", 23 | "backbone": "jashkenas/backbone#master", 24 | "jquery": "jquery/jquery#1.x-master", 25 | "unknown-package-name": "latest" 26 | }, 27 | "devDependencies": { 28 | "chai": "^1.9.1", 29 | "gulp": "^3.6.2" 30 | }, 31 | "optionalDependencies": { 32 | "should": "^3.3.1" 33 | }, 34 | "peerDependencies": { 35 | "yo": ">=1.0.0" 36 | }, 37 | "scripts": { 38 | "coveralls": "gulp test && cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 39 | "test": "gulp test" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'); 4 | var plugins = require('gulp-load-plugins')(); 5 | 6 | var paths = { 7 | lint: ['./gulpfile.js', './lib/**/*.js', './index.js'], 8 | watch: ['./gulpfile.js', './lib/**/*.js', './index.js', './test/**/*.js', '!test/{temp,temp/**}'], 9 | tests: ['./test/**/*.js', '!test/{temp,temp/**}', '!test/fixtures/**'], 10 | source: ['./lib/**/*.js', './index.js'] 11 | }; 12 | 13 | gulp.task('lint', function () { 14 | return gulp.src(paths.lint) 15 | .pipe(plugins.jshint('.jshintrc')) 16 | .pipe(plugins.jscs()) 17 | .pipe(plugins.jshint.reporter('jshint-stylish')); 18 | }); 19 | 20 | gulp.task('istanbul', function (cb) { 21 | gulp.src(paths.source) 22 | .pipe(plugins.istanbul()) // Covering files 23 | .on('finish', function () { 24 | gulp.src(paths.tests) 25 | .pipe(plugins.plumber()) 26 | .pipe(plugins.mocha()) 27 | .pipe(plugins.istanbul.writeReports()) // Creating the reports after tests runned 28 | .on('finish', function() { 29 | process.chdir(__dirname); 30 | cb(); 31 | }); 32 | }); 33 | }); 34 | 35 | gulp.task('bump', ['test'], function () { 36 | var bumpType = plugins.util.env.type || 'patch'; // major.minor.patch 37 | 38 | return gulp.src(['./package.json']) 39 | .pipe(plugins.bump({ type: bumpType })) 40 | .pipe(gulp.dest('./')); 41 | }); 42 | 43 | gulp.task('watch', ['test'], function () { 44 | gulp.watch(paths.watch, ['test']); 45 | }); 46 | 47 | gulp.task('test', ['lint', 'istanbul']); 48 | 49 | gulp.task('release', ['bump']); 50 | 51 | gulp.task('default', ['test']); 52 | -------------------------------------------------------------------------------- /test/test_require_coffee_remote.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var assert = require('should'); 5 | var _ = require('lodash'); 6 | var env = require('jsdom').env; 7 | 8 | describe('require.coffee', function() { 9 | 10 | describe('local', function() { 11 | var $, result; 12 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/require.coffee'; 13 | 14 | before(function(done) { 15 | $ = result = null; 16 | 17 | env(url, function(err, window) { 18 | if (err) { 19 | return done(err); 20 | } 21 | $ = require('jquery')(window); 22 | 23 | githubLinkerCore($, url, function(err, _result) { 24 | if (err) { 25 | throw err; 26 | } 27 | result = _result; 28 | done(); 29 | }); 30 | }); 31 | }); 32 | 33 | it('found dependencies', function() { 34 | 35 | // TODO Evaluate why this doesn't work 36 | // result.should.have.length(2); 37 | 38 | result.length.should.equal(2); 39 | }); 40 | 41 | it('http://nodejs.org/api/path.html', function() { 42 | var item = _.findWhere(result, { 43 | name: 'path' 44 | }); 45 | 46 | item.link.should.equal('http://nodejs.org/api/path.html'); 47 | 48 | item.el.attr('href').should.equal('http://nodejs.org/api/path.html'); 49 | item.el.hasClass('tooltipped').should.be.false; 50 | }); 51 | 52 | it('https://github.com/lodash/lodash', function() { 53 | var item = _.findWhere(result, { 54 | name: 'lodash' 55 | }); 56 | 57 | item.link.should.equal('https://github.com/lodash/lodash'); 58 | 59 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 60 | item.el.hasClass('tooltipped').should.be.false; 61 | }); 62 | 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /test/test_require_coffee_local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('should'); 7 | var _ = require('lodash'); 8 | var env = require('jsdom').env; 9 | 10 | describe('require.coffee', function() { 11 | 12 | describe('local', function() { 13 | var $, result; 14 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/require.coffee'; 15 | var file = path.resolve(__dirname, 'fixtures/require.coffee.html'); 16 | 17 | before(function(done) { 18 | $ = result = null; 19 | var html = fs.readFileSync(file, 'utf-8'); 20 | 21 | env(html, function(err, window) { 22 | if (err) { 23 | return done(err); 24 | } 25 | $ = require('jquery')(window); 26 | 27 | githubLinkerCore($, url, function(err, _result) { 28 | if (err) { 29 | throw err; 30 | } 31 | result = _result; 32 | done(); 33 | }); 34 | }); 35 | }); 36 | 37 | it('found dependencies', function() { 38 | 39 | // TODO Evaluate why this doesn't work 40 | // result.should.have.length(2); 41 | 42 | result.length.should.equal(2); 43 | }); 44 | 45 | it('http://nodejs.org/api/path.html', function() { 46 | var item = _.findWhere(result, { 47 | name: 'path' 48 | }); 49 | 50 | item.link.should.equal('http://nodejs.org/api/path.html'); 51 | 52 | item.el.attr('href').should.equal('http://nodejs.org/api/path.html'); 53 | item.el.hasClass('tooltipped').should.be.false; 54 | }); 55 | 56 | it('https://github.com/lodash/lodash', function() { 57 | var item = _.findWhere(result, { 58 | name: 'lodash' 59 | }); 60 | 61 | item.link.should.equal('https://github.com/lodash/lodash'); 62 | 63 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 64 | item.el.hasClass('tooltipped').should.be.false; 65 | }); 66 | 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /test/test_utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../lib/utils'); 4 | var assert = require('should'); 5 | 6 | describe('utils', function() { 7 | 8 | describe('manifestType', function() { 9 | 10 | it('package.json', function() { 11 | utils.manifestType('https://github.com/stefanbuck/github-linker-core/blob/master/package.json').should.equal('npm'); 12 | }); 13 | 14 | it('bower.json', function() { 15 | utils.manifestType('https://github.com/stefanbuck/github-linker-core/blob/master/bower.json').should.equal('bower'); 16 | }); 17 | 18 | it('composer.json', function() { 19 | utils.manifestType('https://github.com/stefanbuck/github-linker-core/blob/master/composer.json').should.equal('composer'); 20 | }); 21 | 22 | it('unknown.json', function() { 23 | (utils.manifestType('https://github.com/stefanbuck/github-linker-core/blob/master/unknown.json') === undefined).should.equal(true); 24 | }); 25 | }); 26 | 27 | describe('requireType', function() { 28 | 29 | it('file.js', function() { 30 | utils.requireType('https://github.com/stefanbuck/github-linker-core/blob/master/file.js').should.equal('js'); 31 | }); 32 | 33 | it('file.coffee', function() { 34 | utils.requireType('https://github.com/stefanbuck/github-linker-core/blob/master/file.coffee').should.equal('coffee'); 35 | }); 36 | 37 | it('file.txt', function() { 38 | (utils.requireType('https://github.com/stefanbuck/github-linker-core/blob/master/file.txt') === undefined).should.equal(true); 39 | }); 40 | }); 41 | 42 | describe('advanced urls', function() { 43 | 44 | it('with line marker', function() { 45 | utils.manifestType('https://github.com/stefanbuck/github-linker-core/blob/master/package.json#L1').should.equal('npm'); 46 | utils.requireType('https://github.com/stefanbuck/github-linker-core/blob/master/file.js#L1').should.equal('js'); 47 | }); 48 | }); 49 | 50 | describe('stripQuotes', function() { 51 | 52 | it('lodash', function() { 53 | utils.stripQuotes({html: function(){return 'lodash';}}).should.equal('lodash'); 54 | }); 55 | 56 | it('"lodash"', function() { 57 | utils.stripQuotes({html: function(){return '"lodash"';}}).should.equal('lodash'); 58 | }); 59 | 60 | it('\'lodash\'', function() { 61 | utils.stripQuotes({html: function(){return '\'lodash\'';}}).should.equal('lodash'); 62 | }); 63 | 64 | it('"lodash\'', function() { 65 | utils.stripQuotes({html: function(){return '"lodash\'';}}).should.equal('lodash'); 66 | }); 67 | 68 | }); 69 | }); 70 | -------------------------------------------------------------------------------- /lib/manifest.js: -------------------------------------------------------------------------------- 1 | /* 2 | * github-linker-core 3 | * https://github.com/stefanbuck/github-linker 4 | * 5 | * Copyright (c) 2014 Stefan Buck 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | var linkBuilder = require('./link_builder').manifest; 12 | var utils = require('./utils'); 13 | 14 | var SORRY = 'Sorry, there is no link for this package available'; 15 | 16 | var mainField = function($, type) { 17 | if (type === 'npm' || type === 'bower') { 18 | var $main = $('span.nt').filter(function() { 19 | return $(this).text().replace(/"|'/g, '') === 'main'; 20 | }).next().next('[class^="s"]'); 21 | if ($main.length > 0) { 22 | var entryFile = utils.stripQuotes($main); 23 | if (entryFile) { 24 | $main.wrap(''); 25 | } 26 | } 27 | } 28 | }; 29 | 30 | var dependencieField = function($, type) { 31 | var $root, $row, $item, $version, name, version, link; 32 | var selectors = []; 33 | if (type === 'npm') { 34 | selectors = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']; 35 | } else if (type === 'bower') { 36 | selectors = ['dependencies', 'devDependencies', 'resolutions']; 37 | } else if (type === 'composer') { 38 | selectors = ['require', 'require-dev', 'conflict', 'replace', 'provide', 'suggest']; 39 | } 40 | 41 | var result = []; 42 | 43 | selectors.forEach(function(selector) { 44 | $root = $('.nt').filter(function() { 45 | return $(this).text().replace(/"|'/g, '') === selector; 46 | }); 47 | 48 | if (!$root || $root.length === 0) { 49 | return; 50 | } 51 | 52 | $row = $root.closest('tr').next(); 53 | 54 | while ($row) { 55 | $item = $row.find('.nt'); 56 | $version = $row.find('.s2'); 57 | 58 | if (!$item.length || !$version.length) { 59 | return; 60 | } 61 | 62 | name = utils.stripQuotes($item); 63 | version = utils.stripQuotes($version); 64 | 65 | link = linkBuilder(type, name, version); 66 | 67 | if (link) { 68 | $item = $item.wrap('').parent(); 69 | } else { 70 | $item.addClass('tooltipped tooltipped-e').attr('aria-label', SORRY); 71 | } 72 | 73 | result.push({ 74 | el: $item, 75 | version: version, 76 | name: name, 77 | link: link 78 | }); 79 | 80 | $row = $row.next(); 81 | } 82 | }); 83 | return result; 84 | }; 85 | 86 | module.exports = function($, url, cb) { 87 | 88 | var type = utils.manifestType(url); 89 | 90 | var result = dependencieField($, type); 91 | mainField($, type); 92 | 93 | cb(null, result); 94 | }; 95 | -------------------------------------------------------------------------------- /lib/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | * github-linker-core 3 | * https://github.com/stefanbuck/github-linker 4 | * 5 | * Copyright (c) 2014 Stefan Buck 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | var path = require('path'); 12 | var linkBuilder = require('./link_builder').require; 13 | var utils = require('./utils'); 14 | 15 | var GITHUBCOM = 'https://github.com'; 16 | var SORRY = 'Can\'t resolve this require for you, sorry.'; 17 | var RESOLVE_INDICATOR = 'resolve:'; 18 | 19 | var attemptToLoadURL = function($, urls, cb) { 20 | var url = urls.shift(); 21 | $.ajax({ 22 | url: url, 23 | type: 'HEAD', 24 | timeout: 3000 25 | }).then(function() { 26 | cb(url); 27 | }).fail(function() { 28 | if (urls.length > 0) { 29 | attemptToLoadURL($, urls, cb); 30 | } else { 31 | cb(null); 32 | } 33 | }); 34 | }; 35 | 36 | var registerClickListener = function($, fileExtension) { 37 | fileExtension = '.' + fileExtension; 38 | 39 | $('body').on('click', 'a.github-linker', function(e) { 40 | utils.showLoader($); 41 | var $el = $(this); 42 | var link = $el.data('href'); 43 | 44 | if (link) { 45 | e.stopPropagation(); 46 | 47 | var urls = []; 48 | if (link.indexOf(GITHUBCOM) === 0) { 49 | if (path.extname(link)) { 50 | urls.push(link); 51 | } else { 52 | urls.push(link + fileExtension); 53 | } 54 | urls = urls.concat([ 55 | link + '/index' + fileExtension, 56 | link.replace('blob', 'tree') 57 | ]); 58 | } else { 59 | urls = link.split(','); 60 | } 61 | 62 | $el.addClass('tooltipped tooltipped-e').attr('aria-label', 'Loading ...'); 63 | attemptToLoadURL($, urls, function(link) { 64 | if (link) { 65 | window.location.href = link; 66 | } else { 67 | $el.attr('aria-label', SORRY); 68 | } 69 | }); 70 | } 71 | }); 72 | }; 73 | 74 | module.exports = function($, url, cb) { 75 | 76 | var $requires, $coffeeRequires, $item, name, link, resolveLink; 77 | var result = []; 78 | var type = utils.requireType(url); 79 | 80 | // Search for require dom elements 81 | $requires = $('span.nx').filter(function() { 82 | return $(this).text() === 'require'; 83 | }).next().next('[class^="s"]'); 84 | 85 | if (type === 'coffee') { 86 | $coffeeRequires = $('span.nx').filter(function() { 87 | return $(this).text() === 'require'; 88 | }).next('[class^="s"]'); 89 | $requires = $.merge($coffeeRequires, $requires); 90 | } 91 | 92 | $requires.each(function(index, item) { 93 | $item = $(item); 94 | 95 | name = utils.stripQuotes($item); 96 | link = linkBuilder(url, name); 97 | resolveLink = false; 98 | 99 | if (link) { 100 | if ( link.indexOf(RESOLVE_INDICATOR) === 0) { 101 | link = link.replace(RESOLVE_INDICATOR, ''); 102 | resolveLink = true; 103 | $item = $item.wrap('').parent(); 104 | } else { 105 | $item = $item.wrap('').parent(); 106 | } 107 | } else { 108 | $item.addClass('tooltipped tooltipped-e').attr('aria-label', SORRY); 109 | } 110 | 111 | result.push({ 112 | el: $item, 113 | name: name, 114 | link: link, 115 | resolveLink: resolveLink 116 | }); 117 | }); 118 | 119 | registerClickListener($, type); 120 | 121 | cb(null, result); 122 | }; 123 | -------------------------------------------------------------------------------- /lib/link_builder.js: -------------------------------------------------------------------------------- 1 | /* 2 | * github-linker-core 3 | * https://github.com/stefanbuck/github-linker 4 | * 5 | * Copyright (c) 2014 Stefan Buck 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | var util = require('util'); 12 | var path = require('path'); 13 | var registries = require('github-linker-registries'); 14 | 15 | // List of nodejs core modules (v0.11.13) 16 | // see: https://github.com/joyent/node/blob/master/lib/repl.js#L72 17 | var NODE_CORE_MODULES = ['assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode', 'querystring', 'readline', 'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'vm', 'zlib', 'smalloc', 'tracing']; 18 | 19 | var NODE_API = 'http://nodejs.org/api/%s.html'; 20 | var NPM_API = 'https://www.npmjs.org/package/'; 21 | var BOWER_API = 'http://bower.io/search/?q='; 22 | 23 | var GITHUBCOM = 'https://github.com'; 24 | var RESOLVE_INDICATOR = 'resolve:'; 25 | var INVALID_REQUIRE_VALUES = ['.', '...', '/']; 26 | 27 | var manifestBuilder = function(type, name, version) { 28 | 29 | var link = registries[type][name]; 30 | 31 | if (version.split('/').length === 2) { 32 | link = GITHUBCOM + '/' + version.replace('#', '/tree/'); 33 | 34 | } else if (!link) { 35 | 36 | if (type === 'npm') { 37 | link = NPM_API + name; 38 | } else if (type === 'bower') { 39 | link = BOWER_API + name; 40 | } 41 | } 42 | 43 | return link || ''; 44 | }; 45 | 46 | var isLocalPath = function(val) { 47 | if (val === '..') { 48 | return true; 49 | } 50 | var result = val.match(/^(\.\/|\.\.\/)/gm); 51 | if (result && result.length > 0) { 52 | return true; 53 | } 54 | return false; 55 | }; 56 | 57 | // Method taken from https://github.com/npm/npm-package-arg/blob/97487d38bcf1879d7c32dd577b181abb65af4e02/npa.js 58 | var validPackageName = function (name) { 59 | if (!name) { 60 | return false; 61 | } 62 | var n = name.trim(); 63 | if (!n || n.charAt(0) === '.' || !n.match(/^[a-zA-Z0-9]/) || n.match(/[\/\(\)&\?#\|<>@:%\s\\\*'"!~`]/) || n.toLowerCase() === 'node_modules' || n !== encodeURIComponent(n) || n.toLowerCase() === 'favicon.ico') { 64 | return false; 65 | } 66 | return n; 67 | }; 68 | 69 | // Method taken from https://github.com/npm/npm-package-arg/blob/97487d38bcf1879d7c32dd577b181abb65af4e02/npa.js 70 | function maybeGitHubShorthand (arg) { 71 | return /^[^@%\/\s\.-][^@%\/\s]*\/[^@\s\/%]+(?:#.*)?$/.test(arg); 72 | } 73 | 74 | var requireBuilder = function(url, requireValue) { 75 | 76 | var link = ''; 77 | 78 | if (INVALID_REQUIRE_VALUES.indexOf(requireValue) !== -1) { 79 | return link; 80 | } 81 | 82 | if (NODE_CORE_MODULES.indexOf(requireValue) !== -1) { 83 | 84 | link = util.format(NODE_API, requireValue); 85 | 86 | } else if (registries.npm[requireValue]) { 87 | 88 | link = registries.npm[requireValue]; 89 | 90 | } else { 91 | if (isLocalPath(requireValue)) { 92 | var basePath = url.replace(GITHUBCOM, ''); 93 | link = path.resolve(path.dirname(basePath), requireValue); 94 | if (link.charAt(link.length - 1) === '/') { 95 | link = link.slice(0, -1); 96 | } 97 | link = RESOLVE_INDICATOR + GITHUBCOM + link; 98 | } else if (validPackageName(requireValue)) { 99 | link = RESOLVE_INDICATOR + NPM_API + requireValue; 100 | } else if (maybeGitHubShorthand(requireValue)) { 101 | link = GITHUBCOM + '/' + requireValue; 102 | } 103 | } 104 | 105 | return link; 106 | }; 107 | 108 | module.exports = { 109 | require: requireBuilder, 110 | manifest: manifestBuilder 111 | }; 112 | -------------------------------------------------------------------------------- /test/test_manifest_bower_remote.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var assert = require('should'); 5 | var _ = require('lodash'); 6 | var env = require('jsdom').env; 7 | 8 | describe('manifest', function() { 9 | 10 | describe('bower.json', function() { 11 | 12 | describe('remote', function() { 13 | 14 | this.timeout(4000); 15 | 16 | var $, result; 17 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/bower.json'; 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | 22 | env(url, function(err, window) { 23 | if (err) { 24 | return done(err); 25 | } 26 | $ = require('jquery')(window); 27 | githubLinkerCore($, url, function(err, _result) { 28 | if (err) { 29 | throw err; 30 | } 31 | result = _result; 32 | done(); 33 | }); 34 | }); 35 | }); 36 | 37 | it('found dependencies', function() { 38 | 39 | // TODO Evaluate why this doesn't work 40 | // result.should.have.length(10); 41 | 42 | result.length.should.equal(8); 43 | }); 44 | 45 | it('check order', function() { 46 | result.length.should.equal(8); 47 | var pkgNames = ['lodash', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'should', 'lodash']; 48 | _.each(result, function(item, index) { 49 | item.name.should.equal( pkgNames[index] ); 50 | }); 51 | }); 52 | 53 | it('check link replacement', function() { 54 | $('a.github-linker').length.should.equal(9); 55 | }); 56 | 57 | it('link https://github.com/lodash/lodash', function() { 58 | var item = _.findWhere(result, { 59 | name: 'lodash' 60 | }); 61 | 62 | (item.link === null).should.equal(false); 63 | item.link.should.equal('https://github.com/lodash/lodash'); 64 | 65 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 66 | item.el.hasClass('tooltipped').should.be.false; 67 | }); 68 | 69 | it('link https://github.com/Modernizr/Modernizr', function() { 70 | var item = _.findWhere(result, { 71 | name: 'modernizr' 72 | }); 73 | 74 | (item.link === null).should.equal(false); 75 | item.link.should.equal('https://github.com/Modernizr/Modernizr'); 76 | 77 | item.el.attr('href').should.equal('https://github.com/Modernizr/Modernizr'); 78 | item.el.hasClass('tooltipped').should.be.false; 79 | }); 80 | 81 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 82 | var item = _.findWhere(result, { 83 | name: 'backbone' 84 | }); 85 | 86 | (item.link === null).should.equal(false); 87 | item.link.should.equal('https://github.com/jashkenas/backbone/tree/master'); 88 | 89 | item.el.attr('href').should.equal('https://github.com/jashkenas/backbone/tree/master'); 90 | item.el.hasClass('tooltipped').should.be.false; 91 | }); 92 | 93 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 94 | var item = _.findWhere(result, { 95 | name: 'jquery' 96 | }); 97 | 98 | (item.link === null).should.equal(false); 99 | item.link.should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 100 | 101 | item.el.attr('href').should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 102 | item.el.hasClass('tooltipped').should.be.false; 103 | }); 104 | 105 | it('link http://bower.io/search/?q=unknown-package-name', function() { 106 | var item = _.findWhere(result, { 107 | name: 'unknown-package-name' 108 | }); 109 | 110 | (item.link === null).should.equal(false); 111 | item.link.should.equal('http://bower.io/search/?q=unknown-package-name'); 112 | }); 113 | 114 | it('entry file', function() { 115 | var mainFile = $('span.nt:contains("main")').parent().find('.github-linker').attr('href'); 116 | (!!mainFile).should.equal(true); 117 | mainFile.should.equal('index.js'); 118 | }); 119 | }); 120 | }); 121 | }); 122 | -------------------------------------------------------------------------------- /test/test_manifest_bower_local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('should'); 7 | var _ = require('lodash'); 8 | var env = require('jsdom').env; 9 | 10 | describe('manifest', function() { 11 | 12 | describe('bower.json', function() { 13 | 14 | describe('local', function() { 15 | var $, result; 16 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/bower.json'; 17 | var file = path.resolve(__dirname, 'fixtures/bower.json.html'); 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | var html = fs.readFileSync(file, 'utf-8'); 22 | 23 | env(html, function(err, window) { 24 | if (err) { 25 | return done(err); 26 | } 27 | $ = require('jquery')(window); 28 | 29 | githubLinkerCore($, url, function(err, _result) { 30 | if (err) { 31 | throw err; 32 | } 33 | result = _result; 34 | done(); 35 | }); 36 | }); 37 | }); 38 | 39 | it('found dependencies', function() { 40 | 41 | // TODO Evaluate why this doesn't work 42 | // result.should.have.length(10); 43 | 44 | result.length.should.equal(8); 45 | }); 46 | 47 | it('check order', function() { 48 | result.length.should.equal(8); 49 | var pkgNames = ['lodash', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'should', 'lodash']; 50 | _.each(result, function(item, index) { 51 | item.name.should.equal( pkgNames[index] ); 52 | }); 53 | }); 54 | 55 | it('check link replacement', function() { 56 | $('a.github-linker').length.should.equal(9); 57 | }); 58 | 59 | it('link https://github.com/lodash/lodash', function() { 60 | var item = _.findWhere(result, { 61 | name: 'lodash' 62 | }); 63 | 64 | (item.link === null).should.equal(false); 65 | item.link.should.equal('https://github.com/lodash/lodash'); 66 | 67 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 68 | item.el.hasClass('tooltipped').should.be.false; 69 | }); 70 | 71 | it('link https://github.com/Modernizr/Modernizr', function() { 72 | var item = _.findWhere(result, { 73 | name: 'modernizr' 74 | }); 75 | 76 | (item.link === null).should.equal(false); 77 | item.link.should.equal('https://github.com/Modernizr/Modernizr'); 78 | 79 | item.el.attr('href').should.equal('https://github.com/Modernizr/Modernizr'); 80 | item.el.hasClass('tooltipped').should.be.false; 81 | }); 82 | 83 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 84 | var item = _.findWhere(result, { 85 | name: 'backbone' 86 | }); 87 | 88 | (item.link === null).should.equal(false); 89 | item.link.should.equal('https://github.com/jashkenas/backbone/tree/master'); 90 | 91 | item.el.attr('href').should.equal('https://github.com/jashkenas/backbone/tree/master'); 92 | item.el.hasClass('tooltipped').should.be.false; 93 | }); 94 | 95 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 96 | var item = _.findWhere(result, { 97 | name: 'jquery' 98 | }); 99 | 100 | (item.link === null).should.equal(false); 101 | item.link.should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 102 | 103 | item.el.attr('href').should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 104 | item.el.hasClass('tooltipped').should.be.false; 105 | }); 106 | 107 | it('link http://bower.io/search/?q=unknown-package-name', function() { 108 | var item = _.findWhere(result, { 109 | name: 'unknown-package-name' 110 | }); 111 | 112 | (item.link === null).should.equal(false); 113 | item.link.should.equal('http://bower.io/search/?q=unknown-package-name'); 114 | }); 115 | 116 | it('entry file', function() { 117 | var mainFile = $('span.nt:contains("main")').parent().find('.github-linker').attr('href'); 118 | (!!mainFile).should.equal(true); 119 | mainFile.should.equal('index.js'); 120 | }); 121 | }); 122 | }); 123 | }); 124 | -------------------------------------------------------------------------------- /test/test_manifest_composer_remote.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var assert = require('should'); 5 | var _ = require('lodash'); 6 | var env = require('jsdom').env; 7 | 8 | describe('manifest', function() { 9 | 10 | describe('composer.json', function() { 11 | 12 | describe('remote', function() { 13 | 14 | this.timeout(4000); 15 | 16 | var $, result; 17 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/composer.json'; 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | 22 | env(url, function(err, window) { 23 | if (err) { 24 | return done(err); 25 | } 26 | $ = require('jquery')(window); 27 | githubLinkerCore($, url, function(err, _result) { 28 | if (err) { 29 | throw err; 30 | } 31 | result = _result; 32 | done(); 33 | }); 34 | }); 35 | }); 36 | 37 | it('found dependencies', function() { 38 | 39 | // TODO Evaluate why this doesn't work 40 | // result.should.have.length(7); 41 | result.length.should.equal(7); 42 | }); 43 | 44 | it('check order', function() { 45 | result.length.should.equal(7); 46 | var pkgNames = ['php', 'laravel/framework', 'unknown-package-name', 'phpunit/phpunit', 'doctrine/dbal', 'ext-openssl', 'doctrine/dbal']; 47 | _.each(result, function(item, index) { 48 | item.name.should.equal( pkgNames[index] ); 49 | }); 50 | }); 51 | 52 | it('check link replacement', function() { 53 | $('a.github-linker').length.should.equal(4); 54 | }); 55 | 56 | describe('require', function() { 57 | 58 | it('link php', function() { 59 | var item = _.findWhere(result, { 60 | name: 'php' 61 | }); 62 | 63 | (item.link === '').should.equal(true); 64 | item.el.hasClass('tooltipped').should.be.true; 65 | }); 66 | 67 | it('link laravel/framework', function() { 68 | var item = _.findWhere(result, { 69 | name: 'laravel/framework' 70 | }); 71 | 72 | (item.link === null).should.equal(false); 73 | item.link.should.equal('https://github.com/laravel/framework'); 74 | 75 | item.el.attr('href').should.equal('https://github.com/laravel/framework'); 76 | item.el.hasClass('tooltipped').should.be.false; 77 | }); 78 | 79 | it('link unknown-package-name', function() { 80 | var item = _.findWhere(result, { 81 | name: 'unknown-package-name' 82 | }); 83 | 84 | (item.link === '').should.equal(true); 85 | item.el.hasClass('tooltipped').should.be.true; 86 | }); 87 | }); 88 | 89 | describe('require-dev', function() { 90 | 91 | it('link phpunit/phpunit', function() { 92 | var item = _.findWhere(result, { 93 | name: 'phpunit/phpunit' 94 | }); 95 | 96 | (item.link === null).should.equal(false); 97 | item.link.should.equal('https://github.com/sebastianbergmann/phpunit'); 98 | 99 | item.el.attr('href').should.equal('https://github.com/sebastianbergmann/phpunit'); 100 | item.el.hasClass('tooltipped').should.be.false; 101 | }); 102 | 103 | it('link doctrine/dbal', function() { 104 | var item = _.findWhere(result, { 105 | name: 'doctrine/dbal' 106 | }); 107 | 108 | (item.link === null).should.equal(false); 109 | item.link.should.equal('https://github.com/doctrine/dbal'); 110 | 111 | item.el.attr('href').should.equal('https://github.com/doctrine/dbal'); 112 | item.el.hasClass('tooltipped').should.be.false; 113 | }); 114 | }); 115 | 116 | describe('suggest', function() { 117 | 118 | it('link ext-openssl', function() { 119 | var item = _.findWhere(result, { 120 | name: 'ext-openssl' 121 | }); 122 | 123 | (item.link === '').should.equal(true); 124 | item.el.hasClass('tooltipped').should.be.true; 125 | }); 126 | 127 | it('doctrine/dbal', function() { 128 | var item = result[result.length - 1]; 129 | 130 | (item.link === null).should.equal(false); 131 | item.link.should.equal('https://github.com/doctrine/dbal'); 132 | 133 | item.el.attr('href').should.equal('https://github.com/doctrine/dbal'); 134 | item.el.hasClass('tooltipped').should.be.false; 135 | }); 136 | }); 137 | 138 | }); 139 | }); 140 | }); 141 | -------------------------------------------------------------------------------- /test/test_manifest_composer_local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('should'); 7 | var _ = require('lodash'); 8 | var env = require('jsdom').env; 9 | 10 | describe('manifest', function() { 11 | 12 | describe('composer.json', function() { 13 | 14 | describe('local', function() { 15 | var $, result; 16 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/composer.json'; 17 | var file = path.resolve(__dirname, 'fixtures/composer.json.html'); 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | var html = fs.readFileSync(file, 'utf-8'); 22 | 23 | env(html, function(err, window) { 24 | if (err) { 25 | return done(err); 26 | } 27 | $ = require('jquery')(window); 28 | 29 | githubLinkerCore($, url, function(err, _result) { 30 | if (err) { 31 | throw err; 32 | } 33 | result = _result; 34 | done(); 35 | }); 36 | }); 37 | }); 38 | 39 | it('found dependencies', function() { 40 | 41 | // TODO Evaluate why this doesn't work 42 | // result.should.have.length(7); 43 | result.length.should.equal(7); 44 | }); 45 | 46 | it('check order', function() { 47 | result.length.should.equal(7); 48 | var pkgNames = ['php', 'laravel/framework', 'unknown-package-name', 'phpunit/phpunit', 'doctrine/dbal', 'ext-openssl', 'doctrine/dbal']; 49 | _.each(result, function(item, index) { 50 | item.name.should.equal( pkgNames[index] ); 51 | }); 52 | }); 53 | 54 | it('check link replacement', function() { 55 | $('a.github-linker').length.should.equal(4); 56 | }); 57 | 58 | describe('require', function() { 59 | 60 | it('link php', function() { 61 | var item = _.findWhere(result, { 62 | name: 'php' 63 | }); 64 | 65 | (item.link === '').should.equal(true); 66 | item.el.hasClass('tooltipped').should.be.true; 67 | }); 68 | 69 | it('link laravel/framework', function() { 70 | var item = _.findWhere(result, { 71 | name: 'laravel/framework' 72 | }); 73 | 74 | (item.link === null).should.equal(false); 75 | item.link.should.equal('https://github.com/laravel/framework'); 76 | 77 | item.el.attr('href').should.equal('https://github.com/laravel/framework'); 78 | item.el.hasClass('tooltipped').should.be.false; 79 | }); 80 | 81 | it('link unknown-package-name', function() { 82 | var item = _.findWhere(result, { 83 | name: 'unknown-package-name' 84 | }); 85 | 86 | (item.link === '').should.equal(true); 87 | item.el.hasClass('tooltipped').should.be.true; 88 | }); 89 | }); 90 | 91 | describe('require-dev', function() { 92 | 93 | it('link phpunit/phpunit', function() { 94 | var item = _.findWhere(result, { 95 | name: 'phpunit/phpunit' 96 | }); 97 | 98 | (item.link === null).should.equal(false); 99 | item.link.should.equal('https://github.com/sebastianbergmann/phpunit'); 100 | 101 | item.el.attr('href').should.equal('https://github.com/sebastianbergmann/phpunit'); 102 | item.el.hasClass('tooltipped').should.be.false; 103 | }); 104 | 105 | it('link doctrine/dbal', function() { 106 | var item = _.findWhere(result, { 107 | name: 'doctrine/dbal' 108 | }); 109 | 110 | (item.link === null).should.equal(false); 111 | item.link.should.equal('https://github.com/doctrine/dbal'); 112 | 113 | item.el.attr('href').should.equal('https://github.com/doctrine/dbal'); 114 | item.el.hasClass('tooltipped').should.be.false; 115 | }); 116 | }); 117 | 118 | describe('suggest', function() { 119 | 120 | it('link ext-openssl', function() { 121 | var item = _.findWhere(result, { 122 | name: 'ext-openssl' 123 | }); 124 | 125 | (item.link === '').should.equal(true); 126 | item.el.hasClass('tooltipped').should.be.true; 127 | }); 128 | 129 | it('doctrine/dbal', function() { 130 | var item = result[result.length - 1]; 131 | 132 | (item.link === null).should.equal(false); 133 | item.link.should.equal('https://github.com/doctrine/dbal'); 134 | 135 | item.el.attr('href').should.equal('https://github.com/doctrine/dbal'); 136 | item.el.hasClass('tooltipped').should.be.false; 137 | }); 138 | }); 139 | 140 | }); 141 | }); 142 | }); 143 | -------------------------------------------------------------------------------- /test/test_manifest_package_remote.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var assert = require('should'); 5 | var _ = require('lodash'); 6 | var env = require('jsdom').env; 7 | 8 | describe('manifest', function() { 9 | 10 | describe('package.json', function() { 11 | 12 | describe('remote', function() { 13 | 14 | this.timeout(4000); 15 | 16 | var $, result; 17 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/package.json'; 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | 22 | env(url, function(err, window) { 23 | if (err) { 24 | return done(err); 25 | } 26 | $ = require('jquery')(window); 27 | githubLinkerCore($, url, function(err, _result) { 28 | if (err) { 29 | throw err; 30 | } 31 | result = _result; 32 | done(); 33 | }); 34 | }); 35 | }); 36 | 37 | it('found dependencies', function() { 38 | 39 | // TODO Evaluate why this doesn't work 40 | // result.should.have.length(10); 41 | 42 | result.length.should.equal(10); 43 | }); 44 | 45 | it('check order', function() { 46 | result.length.should.equal(10); 47 | var pkgNames = ['lodash', 'request', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'gulp', 'yo', 'should']; 48 | _.each(result, function(item, index) { 49 | item.name.should.equal( pkgNames[index] ); 50 | }); 51 | }); 52 | 53 | it('check link replacement', function() { 54 | $('a.github-linker').length.should.equal(11); 55 | }); 56 | 57 | it('link https://github.com/lodash/lodash', function() { 58 | var item = _.findWhere(result, { 59 | name: 'lodash' 60 | }); 61 | 62 | (item.link === null).should.equal(false); 63 | item.link.should.equal('https://github.com/lodash/lodash'); 64 | 65 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 66 | item.el.hasClass('tooltipped').should.be.false; 67 | }); 68 | 69 | it('link https://www.npmjs.org/package/request', function() { 70 | var item = _.findWhere(result, { 71 | name: 'request' 72 | }); 73 | 74 | (item.link === null).should.equal(false); 75 | item.link.should.equal('https://www.npmjs.org/package/request'); 76 | 77 | item.el.attr('href').should.equal('https://www.npmjs.org/package/request'); 78 | item.el.hasClass('tooltipped').should.be.false; 79 | }); 80 | 81 | it('link https://github.com/Modernizr/Modernizr', function() { 82 | var item = _.findWhere(result, { 83 | name: 'modernizr' 84 | }); 85 | 86 | (item.link === null).should.equal(false); 87 | item.link.should.equal('https://github.com/Modernizr/Modernizr'); 88 | 89 | item.el.attr('href').should.equal('https://github.com/Modernizr/Modernizr'); 90 | item.el.hasClass('tooltipped').should.be.false; 91 | }); 92 | 93 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 94 | var item = _.findWhere(result, { 95 | name: 'backbone' 96 | }); 97 | 98 | (item.link === null).should.equal(false); 99 | item.link.should.equal('https://github.com/jashkenas/backbone/tree/master'); 100 | 101 | item.el.attr('href').should.equal('https://github.com/jashkenas/backbone/tree/master'); 102 | item.el.hasClass('tooltipped').should.be.false; 103 | }); 104 | 105 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 106 | var item = _.findWhere(result, { 107 | name: 'jquery' 108 | }); 109 | 110 | (item.link === null).should.equal(false); 111 | item.link.should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 112 | 113 | item.el.attr('href').should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 114 | item.el.hasClass('tooltipped').should.be.false; 115 | }); 116 | 117 | it('link https://www.npmjs.org/package/unknown-package-name', function() { 118 | var item = _.findWhere(result, { 119 | name: 'unknown-package-name' 120 | }); 121 | 122 | (item.link === null).should.equal(false); 123 | item.link.should.equal('https://www.npmjs.org/package/unknown-package-name'); 124 | 125 | item.el.attr('href').should.equal('https://www.npmjs.org/package/unknown-package-name'); 126 | item.el.hasClass('tooltipped').should.be.false; 127 | }); 128 | 129 | it('entry file', function() { 130 | var mainFile = $('span.nt:contains("main")').parent().find('.github-linker').attr('href'); 131 | (!!mainFile).should.equal(true); 132 | mainFile.should.equal('index.js'); 133 | }); 134 | }); 135 | }); 136 | }); 137 | -------------------------------------------------------------------------------- /test/test_manifest_package_local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('should'); 7 | var _ = require('lodash'); 8 | var env = require('jsdom').env; 9 | 10 | describe('manifest', function() { 11 | 12 | describe('package.json', function() { 13 | 14 | describe('local', function() { 15 | var $, result; 16 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/package.json'; 17 | var file = path.resolve(__dirname, 'fixtures/package.json.html'); 18 | 19 | before(function(done) { 20 | $ = result = null; 21 | var html = fs.readFileSync(file, 'utf-8'); 22 | 23 | env(html, function(err, window) { 24 | if (err) { 25 | return done(err); 26 | } 27 | $ = require('jquery')(window); 28 | 29 | githubLinkerCore($, url, function(err, _result) { 30 | if (err) { 31 | throw err; 32 | } 33 | result = _result; 34 | done(); 35 | }); 36 | }); 37 | }); 38 | 39 | it('found dependencies', function() { 40 | 41 | // TODO Evaluate why this doesn't work 42 | // result.should.have.length(10); 43 | 44 | result.length.should.equal(10); 45 | }); 46 | 47 | it('check order', function() { 48 | result.length.should.equal(10); 49 | var pkgNames = ['lodash', 'request', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'gulp', 'yo', 'should']; 50 | _.each(result, function(item, index) { 51 | item.name.should.equal( pkgNames[index] ); 52 | }); 53 | }); 54 | 55 | it('check link replacement', function() { 56 | $('a.github-linker').length.should.equal(11); 57 | }); 58 | 59 | it('link https://github.com/lodash/lodash', function() { 60 | var item = _.findWhere(result, { 61 | name: 'lodash' 62 | }); 63 | 64 | (item.link === null).should.equal(false); 65 | item.link.should.equal('https://github.com/lodash/lodash'); 66 | 67 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 68 | item.el.hasClass('tooltipped').should.be.false; 69 | }); 70 | 71 | it('link https://www.npmjs.org/package/request', function() { 72 | var item = _.findWhere(result, { 73 | name: 'request' 74 | }); 75 | 76 | (item.link === null).should.equal(false); 77 | item.link.should.equal('https://www.npmjs.org/package/request'); 78 | 79 | item.el.attr('href').should.equal('https://www.npmjs.org/package/request'); 80 | item.el.hasClass('tooltipped').should.be.false; 81 | }); 82 | 83 | it('link https://github.com/Modernizr/Modernizr', function() { 84 | var item = _.findWhere(result, { 85 | name: 'modernizr' 86 | }); 87 | 88 | (item.link === null).should.equal(false); 89 | item.link.should.equal('https://github.com/Modernizr/Modernizr'); 90 | 91 | item.el.attr('href').should.equal('https://github.com/Modernizr/Modernizr'); 92 | item.el.hasClass('tooltipped').should.be.false; 93 | }); 94 | 95 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 96 | var item = _.findWhere(result, { 97 | name: 'backbone' 98 | }); 99 | 100 | (item.link === null).should.equal(false); 101 | item.link.should.equal('https://github.com/jashkenas/backbone/tree/master'); 102 | 103 | item.el.attr('href').should.equal('https://github.com/jashkenas/backbone/tree/master'); 104 | item.el.hasClass('tooltipped').should.be.false; 105 | }); 106 | 107 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 108 | var item = _.findWhere(result, { 109 | name: 'jquery' 110 | }); 111 | 112 | (item.link === null).should.equal(false); 113 | item.link.should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 114 | 115 | item.el.attr('href').should.equal('https://github.com/jquery/jquery/tree/1.x-master'); 116 | item.el.hasClass('tooltipped').should.be.false; 117 | }); 118 | 119 | it('link https://www.npmjs.org/package/unknown-package-name', function() { 120 | var item = _.findWhere(result, { 121 | name: 'unknown-package-name' 122 | }); 123 | 124 | (item.link === null).should.equal(false); 125 | item.link.should.equal('https://www.npmjs.org/package/unknown-package-name'); 126 | 127 | item.el.attr('href').should.equal('https://www.npmjs.org/package/unknown-package-name'); 128 | item.el.hasClass('tooltipped').should.be.false; 129 | }); 130 | 131 | it('entry file', function() { 132 | var mainFile = $('span.nt:contains("main")').parent().find('.github-linker').attr('href'); 133 | (!!mainFile).should.equal(true); 134 | mainFile.should.equal('index.js'); 135 | }); 136 | }); 137 | }); 138 | }); 139 | -------------------------------------------------------------------------------- /test/test_require_remote.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var assert = require('should'); 5 | var _ = require('lodash'); 6 | var env = require('jsdom').env; 7 | 8 | describe('require.js', function() { 9 | 10 | describe('remote', function() { 11 | var $, result; 12 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/require.js'; 13 | 14 | before(function(done) { 15 | $ = result = null; 16 | 17 | env(url, function(err, window) { 18 | if (err) { 19 | return done(err); 20 | } 21 | $ = require('jquery')(window); 22 | 23 | githubLinkerCore($, url, function(err, _result) { 24 | if (err) { 25 | throw err; 26 | } 27 | result = _result; 28 | done(); 29 | }); 30 | }); 31 | }); 32 | 33 | it('found dependencies', function() { 34 | 35 | // TODO Evaluate why this doesn't work 36 | // result.should.have.length(20); 37 | 38 | result.length.should.equal(20); 39 | }); 40 | 41 | it('http://nodejs.org/api/path.html', function() { 42 | var item = _.findWhere(result, { 43 | name: 'path' 44 | }); 45 | 46 | item.link.should.equal('http://nodejs.org/api/path.html'); 47 | 48 | item.el.attr('href').should.equal('http://nodejs.org/api/path.html'); 49 | item.el.hasClass('tooltipped').should.be.false; 50 | }); 51 | 52 | it('https://github.com/lodash/lodash', function() { 53 | var item = _.findWhere(result, { 54 | name: 'lodash' 55 | }); 56 | 57 | item.link.should.equal('https://github.com/lodash/lodash'); 58 | 59 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 60 | item.el.hasClass('tooltipped').should.be.false; 61 | }); 62 | 63 | it('unknown-package-name', function() { 64 | var item = _.findWhere(result, { 65 | name: 'unknown-package-name' 66 | }); 67 | 68 | item.link.should.equal('https://www.npmjs.org/package/unknown-package-name'); 69 | item.el.data('href').should.equal('https://www.npmjs.org/package/unknown-package-name'); 70 | item.el.hasClass('tooltipped').should.be.false; 71 | }); 72 | 73 | it('./file.js', function() { 74 | var item = _.findWhere(result, { 75 | name: './file.js' 76 | }); 77 | 78 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file.js'); 79 | 80 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file.js'); 81 | item.el.hasClass('tooltipped').should.be.false; 82 | }); 83 | 84 | it('./folder/file.js', function() { 85 | var item = _.findWhere(result, { 86 | name: './folder/file.js' 87 | }); 88 | 89 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/folder/file.js'); 90 | 91 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/folder/file.js'); 92 | item.el.hasClass('tooltipped').should.be.false; 93 | }); 94 | 95 | it('./file-or-folder', function() { 96 | var item = _.findWhere(result, { 97 | name: './file-or-folder' 98 | }); 99 | 100 | item.resolveLink.should.be.ok; 101 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file-or-folder'); 102 | 103 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file-or-folder'); 104 | item.el.hasClass('tooltipped').should.be.false; 105 | }); 106 | 107 | it('../file.js', function() { 108 | var item = _.findWhere(result, { 109 | name: '../file.js' 110 | }); 111 | 112 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file.js'); 113 | 114 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file.js'); 115 | item.el.hasClass('tooltipped').should.be.false; 116 | }); 117 | 118 | it('../folder/file.js', function() { 119 | var item = _.findWhere(result, { 120 | name: '../folder/file.js' 121 | }); 122 | 123 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/folder/file.js'); 124 | 125 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/folder/file.js'); 126 | item.el.hasClass('tooltipped').should.be.false; 127 | }); 128 | 129 | it('../file-or-folder', function() { 130 | var item = _.findWhere(result, { 131 | name: '../file-or-folder' 132 | }); 133 | 134 | item.resolveLink.should.be.ok; 135 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file-or-folder'); 136 | 137 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file-or-folder'); 138 | item.el.hasClass('tooltipped').should.be.false; 139 | }); 140 | 141 | it('../../file.js', function() { 142 | var item = _.findWhere(result, { 143 | name: '../../file.js' 144 | }); 145 | 146 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file.js'); 147 | 148 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file.js'); 149 | item.el.hasClass('tooltipped').should.be.false; 150 | }); 151 | 152 | it('../../folder/file.js', function() { 153 | var item = _.findWhere(result, { 154 | name: '../../folder/file.js' 155 | }); 156 | 157 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/folder/file.js'); 158 | 159 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/folder/file.js'); 160 | item.el.hasClass('tooltipped').should.be.false; 161 | }); 162 | 163 | it('../../file-or-folder', function() { 164 | var item = _.findWhere(result, { 165 | name: '../../file-or-folder' 166 | }); 167 | 168 | item.resolveLink.should.be.ok; 169 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file-or-folder'); 170 | 171 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file-or-folder'); 172 | item.el.hasClass('tooltipped').should.be.false; 173 | }); 174 | 175 | it('./', function() { 176 | var item = _.findWhere(result, { 177 | name: './' 178 | }); 179 | 180 | item.resolveLink.should.be.ok; 181 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures'); 182 | 183 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures'); 184 | item.el.hasClass('tooltipped').should.be.false; 185 | }); 186 | 187 | it('..', function() { 188 | var item = _.findWhere(result, { 189 | name: '..' 190 | }); 191 | 192 | item.resolveLink.should.be.ok; 193 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 194 | 195 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 196 | item.el.hasClass('tooltipped').should.be.false; 197 | }); 198 | 199 | it('../', function() { 200 | var item = _.findWhere(result, { 201 | name: '../' 202 | }); 203 | 204 | item.resolveLink.should.be.ok; 205 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 206 | 207 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 208 | item.el.hasClass('tooltipped').should.be.false; 209 | }); 210 | 211 | it('../..', function() { 212 | var item = _.findWhere(result, { 213 | name: '../..' 214 | }); 215 | 216 | item.resolveLink.should.be.ok; 217 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 218 | 219 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 220 | item.el.hasClass('tooltipped').should.be.false; 221 | }); 222 | 223 | it('../../', function() { 224 | var item = _.findWhere(result, { 225 | name: '../../' 226 | }); 227 | 228 | item.resolveLink.should.be.ok; 229 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 230 | 231 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 232 | item.el.hasClass('tooltipped').should.be.false; 233 | }); 234 | 235 | it('.', function() { 236 | var item = _.findWhere(result, { 237 | name: '.' 238 | }); 239 | (item.link === '').should.equal(true); 240 | item.el.hasClass('tooltipped').should.be.true; 241 | }); 242 | 243 | it('...', function() { 244 | var item = _.findWhere(result, { 245 | name: '...' 246 | }); 247 | 248 | (item.link === '').should.equal(true); 249 | item.el.hasClass('tooltipped').should.be.true; 250 | }); 251 | 252 | it('/', function() { 253 | var item = _.findWhere(result, { 254 | name: '/' 255 | }); 256 | 257 | (item.link === '').should.equal(true); 258 | item.el.hasClass('tooltipped').should.be.true; 259 | }); 260 | 261 | }); 262 | }); 263 | -------------------------------------------------------------------------------- /test/test_require_local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var githubLinkerCore = require('../'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('should'); 7 | var _ = require('lodash'); 8 | var env = require('jsdom').env; 9 | 10 | describe('require.js', function() { 11 | 12 | describe('local', function() { 13 | var $, result; 14 | var url = 'https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/require.js'; 15 | var file = path.resolve(__dirname, 'fixtures/require.js.html'); 16 | 17 | before(function(done) { 18 | $ = result = null; 19 | var html = fs.readFileSync(file, 'utf-8'); 20 | 21 | env(html, function(err, window) { 22 | if (err) { 23 | return done(err); 24 | } 25 | $ = require('jquery')(window); 26 | 27 | githubLinkerCore($, url, function(err, _result) { 28 | if (err) { 29 | throw err; 30 | } 31 | result = _result; 32 | done(); 33 | }); 34 | }); 35 | }); 36 | 37 | it('found dependencies', function() { 38 | 39 | // TODO Evaluate why this doesn't work 40 | // result.should.have.length(23); 41 | 42 | result.length.should.equal(23); 43 | }); 44 | 45 | it('check link replacement', function() { 46 | $('a.github-linker').length.should.equal(18); 47 | }); 48 | 49 | it('http://nodejs.org/api/path.html', function() { 50 | var item = _.findWhere(result, { 51 | name: 'path' 52 | }); 53 | 54 | item.link.should.equal('http://nodejs.org/api/path.html'); 55 | 56 | item.el.attr('href').should.equal('http://nodejs.org/api/path.html'); 57 | item.el.hasClass('tooltipped').should.be.false; 58 | }); 59 | 60 | it('https://github.com/lodash/lodash', function() { 61 | var item = _.findWhere(result, { 62 | name: 'lodash' 63 | }); 64 | 65 | item.link.should.equal('https://github.com/lodash/lodash'); 66 | 67 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 68 | item.el.hasClass('tooltipped').should.be.false; 69 | }); 70 | 71 | it('unknown-package-name', function() { 72 | var item = _.findWhere(result, { 73 | name: 'unknown-package-name' 74 | }); 75 | 76 | item.link.should.equal('https://www.npmjs.org/package/unknown-package-name'); 77 | 78 | item.el.data('href').should.equal('https://www.npmjs.org/package/unknown-package-name'); 79 | item.el.hasClass('tooltipped').should.be.false; 80 | }); 81 | 82 | it('matthewmueller/uid', function() { 83 | var item = _.findWhere(result, { 84 | name: 'matthewmueller/uid' 85 | }); 86 | 87 | item.link.should.equal('https://github.com/matthewmueller/uid'); 88 | 89 | item.el.attr('href').should.equal('https://github.com/matthewmueller/uid'); 90 | item.el.hasClass('tooltipped').should.be.false; 91 | }); 92 | 93 | it('./file.js', function() { 94 | var item = _.findWhere(result, { 95 | name: './file.js' 96 | }); 97 | 98 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file.js'); 99 | 100 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file.js'); 101 | item.el.hasClass('tooltipped').should.be.false; 102 | }); 103 | 104 | it('./folder/file.js', function() { 105 | var item = _.findWhere(result, { 106 | name: './folder/file.js' 107 | }); 108 | 109 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/folder/file.js'); 110 | 111 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/folder/file.js'); 112 | item.el.hasClass('tooltipped').should.be.false; 113 | }); 114 | 115 | it('./file-or-folder', function() { 116 | var item = _.findWhere(result, { 117 | name: './file-or-folder' 118 | }); 119 | 120 | item.resolveLink.should.be.ok; 121 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file-or-folder'); 122 | 123 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures/file-or-folder'); 124 | item.el.hasClass('tooltipped').should.be.false; 125 | }); 126 | 127 | it('../file.js', function() { 128 | var item = _.findWhere(result, { 129 | name: '../file.js' 130 | }); 131 | 132 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file.js'); 133 | 134 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file.js'); 135 | item.el.hasClass('tooltipped').should.be.false; 136 | }); 137 | 138 | it('../folder/file.js', function() { 139 | var item = _.findWhere(result, { 140 | name: '../folder/file.js' 141 | }); 142 | 143 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/folder/file.js'); 144 | 145 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/folder/file.js'); 146 | item.el.hasClass('tooltipped').should.be.false; 147 | }); 148 | 149 | it('../file-or-folder', function() { 150 | var item = _.findWhere(result, { 151 | name: '../file-or-folder' 152 | }); 153 | 154 | item.resolveLink.should.be.ok; 155 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file-or-folder'); 156 | 157 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/file-or-folder'); 158 | item.el.hasClass('tooltipped').should.be.false; 159 | }); 160 | 161 | it('../../file.js', function() { 162 | var item = _.findWhere(result, { 163 | name: '../../file.js' 164 | }); 165 | 166 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file.js'); 167 | 168 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file.js'); 169 | item.el.hasClass('tooltipped').should.be.false; 170 | }); 171 | 172 | it('../../folder/file.js', function() { 173 | var item = _.findWhere(result, { 174 | name: '../../folder/file.js' 175 | }); 176 | 177 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/folder/file.js'); 178 | 179 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/folder/file.js'); 180 | item.el.hasClass('tooltipped').should.be.false; 181 | }); 182 | 183 | it('../../file-or-folder', function() { 184 | var item = _.findWhere(result, { 185 | name: '../../file-or-folder' 186 | }); 187 | 188 | item.resolveLink.should.be.ok; 189 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file-or-folder'); 190 | 191 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/file-or-folder'); 192 | item.el.hasClass('tooltipped').should.be.false; 193 | }); 194 | 195 | it('./', function() { 196 | var item = _.findWhere(result, { 197 | name: './' 198 | }); 199 | 200 | item.resolveLink.should.be.ok; 201 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures'); 202 | 203 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test/fixtures'); 204 | item.el.hasClass('tooltipped').should.be.false; 205 | }); 206 | 207 | it('..', function() { 208 | var item = _.findWhere(result, { 209 | name: '..' 210 | }); 211 | 212 | item.resolveLink.should.be.ok; 213 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 214 | 215 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 216 | item.el.hasClass('tooltipped').should.be.false; 217 | }); 218 | 219 | it('../', function() { 220 | var item = _.findWhere(result, { 221 | name: '../' 222 | }); 223 | 224 | item.resolveLink.should.be.ok; 225 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 226 | 227 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master/test'); 228 | item.el.hasClass('tooltipped').should.be.false; 229 | }); 230 | 231 | it('../..', function() { 232 | var item = _.findWhere(result, { 233 | name: '../..' 234 | }); 235 | 236 | item.resolveLink.should.be.ok; 237 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 238 | 239 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 240 | item.el.hasClass('tooltipped').should.be.false; 241 | }); 242 | 243 | it('../../', function() { 244 | var item = _.findWhere(result, { 245 | name: '../../' 246 | }); 247 | 248 | item.resolveLink.should.be.ok; 249 | item.link.should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 250 | 251 | item.el.data('href').should.equal('https://github.com/stefanbuck/github-linker-core/blob/master'); 252 | item.el.hasClass('tooltipped').should.be.false; 253 | }); 254 | 255 | it('.', function() { 256 | var item = _.findWhere(result, { 257 | name: '.' 258 | }); 259 | (item.link === '').should.equal(true); 260 | item.el.hasClass('tooltipped').should.be.true; 261 | }); 262 | 263 | it('...', function() { 264 | var item = _.findWhere(result, { 265 | name: '...' 266 | }); 267 | 268 | (item.link === '').should.equal(true); 269 | item.el.hasClass('tooltipped').should.be.true; 270 | }); 271 | 272 | it('/', function() { 273 | var item = _.findWhere(result, { 274 | name: '/' 275 | }); 276 | 277 | (item.link === '').should.equal(true); 278 | item.el.hasClass('tooltipped').should.be.true; 279 | }); 280 | 281 | it('resolve url', function() { 282 | var item = _.findWhere(result, { 283 | name: '../../file-or-folder' 284 | }); 285 | 286 | item.el.trigger('click'); 287 | }); 288 | 289 | }); 290 | }); 291 | -------------------------------------------------------------------------------- /test/fixtures/require.coffee.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | github-linker-core/require.coffee at master · stefanbuck/github-linker-core · GitHub 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Skip to content 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 |
77 | Sign up 78 | 79 |
80 | 81 | 95 | 96 | 110 | 111 |
112 |
113 | 114 | 115 | 116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 | 124 | 153 | 154 |

155 | 156 | /github-linker-core 159 | 160 | 161 | 162 | 163 | 164 |

165 |
166 |
167 | 168 |
169 |
170 |
171 | 172 |
173 |
174 | 197 |
198 | 212 | 213 | 214 |
215 |
216 | 217 |
218 | 219 | 220 |
223 |

HTTPS clone URL

224 |
225 | 227 | 228 | 229 | 230 |
231 |
232 | 233 | 234 |
237 |

Subversion checkout URL

238 |
239 | 241 | 242 | 243 | 244 |
245 |
246 | 247 | 248 |

You can clone with 249 | HTTPS 250 | or Subversion. 251 | 252 | 253 | 254 |

255 | 256 | 257 | 258 | Clone in Desktop 259 | 260 | 261 | 262 | 267 | 268 | Download ZIP 269 | 270 |
271 |
272 | 273 |
274 | 275 | 276 | 277 | 278 | 279 | 280 |
281 | 282 |
283 | 288 | 289 | branch: 290 | master 291 | 292 | 293 | 347 |
348 | 349 |
350 | 355 | 356 | 357 | 363 |
364 | 365 | 368 |
369 | 370 | 371 |
372 |
373 | Stefan Buck 374 | 375 | 376 | 379 |
380 | 381 |
382 |

383 | 384 | 1 385 | contributor 386 | 387 |

388 | 389 |
390 | 399 |
400 | 401 |
402 |
403 |
404 |
405 | 2 lines (2 sloc) 406 | 407 | 0.041 kb 408 |
409 |
410 |
411 | Raw 412 | Blame 413 | History 414 |
415 | 416 | 421 | 422 | 423 | 424 | 426 | 427 | 429 | 430 | 431 |
432 |
433 | 434 |
435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 |
require "path"
lodash = require("lodash")
445 | 446 |
447 | 448 |
449 |
450 | 451 | Jump to Line 452 | 458 | 459 |
460 | 461 |
462 | 463 |
464 |
465 | 466 | 467 |
468 | 469 |
470 | 493 |
494 | 495 | 496 |
497 |
498 |
499 | 500 |
501 |
502 | 511 |
512 | 513 | 514 | 515 |
516 | 517 | 518 | Something went wrong with that request. Please try again. 519 |
520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | -------------------------------------------------------------------------------- /test/fixtures/require.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | github-linker-core/require.js at master · stefanbuck/github-linker-core · GitHub 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Skip to content 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 |
77 | Sign up 78 | 79 |
80 | 81 | 95 | 96 | 110 | 111 |
112 |
113 | 114 | 115 | 116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 | 124 | 153 | 154 |

155 | 156 | /github-linker-core 159 | 160 | 161 | 162 | 163 | 164 |

165 |
166 |
167 | 168 |
169 |
170 |
171 | 172 |
173 |
174 | 197 |
198 | 212 | 213 | 214 |
215 |
216 | 217 |
218 | 219 | 220 |
223 |

HTTPS clone URL

224 |
225 | 227 | 228 | 229 | 230 |
231 |
232 | 233 | 234 |
237 |

Subversion checkout URL

238 |
239 | 241 | 242 | 243 | 244 |
245 |
246 | 247 | 248 |

You can clone with 249 | HTTPS 250 | or Subversion. 251 | 252 | 253 | 254 |

255 | 256 | 257 | 258 | Clone in Desktop 259 | 260 | 261 | 262 | 267 | 268 | Download ZIP 269 | 270 |
271 |
272 | 273 |
274 | 275 | 276 | 277 | 278 | 279 | 280 |
281 | 282 |
283 | 288 | 289 | branch: 290 | master 291 | 292 | 293 | 347 |
348 | 349 |
350 | 355 | 356 | 357 | 363 |
364 | 365 | 368 |
369 | 370 | 371 |
372 |
373 | Stefan Buck 374 | 375 | 376 | 379 |
380 | 381 |
382 |

383 | 384 | 1 385 | contributor 386 | 387 |

388 | 389 |
390 | 399 |
400 | 401 |
402 |
403 |
404 |
405 | 22 lines (20 sloc) 406 | 407 | 0.452 kb 408 |
409 |
410 |
411 | Raw 412 | Blame 413 | History 414 |
415 | 416 | 421 | 422 | 423 | 424 | 426 | 427 | 429 | 430 | 431 |
432 |
433 | 434 |
435 | 436 | 437 | 438 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 |
439 |
require('path');
require('lodash');
require('unknown-package-name');
require('./file.js');
require('./folder/file.js');
require('./file-or-folder');
require('../file.js');
require('../folder/file.js');
require('../file-or-folder');
require('../../file.js');
require('../../folder/file.js');
require('../../file-or-folder');
require('./');
require('..');
require('../');
require('../..');
require('../../');
require('.');
require('...');
require('/');
require('matthewmueller/uid');
require('component/tip@master');
require('yields/shortcuts@0.0.1:/index.js');
534 | 535 |
536 | 537 |
538 |
539 | 540 | Jump to Line 541 | 547 | 548 |
549 | 550 |
551 | 552 |
553 |
554 | 555 | 556 |
557 | 558 |
559 | 582 |
583 | 584 | 585 |
586 |
587 |
588 | 589 |
590 |
591 | 600 |
601 | 602 | 603 | 604 |
605 | 606 | 607 | Something went wrong with that request. Please try again. 608 |
609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | -------------------------------------------------------------------------------- /test/fixtures/bower.json.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | github-linker-core/bower.json at master · stefanbuck/github-linker-core · GitHub 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Skip to content 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 |
77 | Sign up 78 | 79 |
80 | 81 | 95 | 96 | 110 | 111 |
112 |
113 | 114 | 115 | 116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 | 124 | 153 | 154 |

155 | 156 | /github-linker-core 159 | 160 | 161 | 162 | 163 | 164 |

165 |
166 |
167 | 168 |
169 |
170 |
171 | 172 |
173 |
174 | 197 |
198 | 212 | 213 | 214 |
215 |
216 | 217 |
218 | 219 | 220 |
223 |

HTTPS clone URL

224 |
225 | 227 | 228 | 229 | 230 |
231 |
232 | 233 | 234 |
237 |

Subversion checkout URL

238 |
239 | 241 | 242 | 243 | 244 |
245 |
246 | 247 | 248 |

You can clone with 249 | HTTPS 250 | or Subversion. 251 | 252 | 253 | 254 |

255 | 256 | 257 | 258 | Clone in Desktop 259 | 260 | 261 | 262 | 267 | 268 | Download ZIP 269 | 270 |
271 |
272 | 273 |
274 | 275 | 276 | 277 | 278 | 279 | 280 |
281 | 282 |
283 | 288 | 289 | branch: 290 | master 291 | 292 | 293 | 347 |
348 | 349 |
350 | 355 | 356 | 357 | 363 |
364 | 365 | 368 |
369 | 370 | 371 |
372 |
373 | Stefan Buck 374 | 375 | 376 |
377 | add bower fixture 378 |
379 |
380 | 381 |
382 |

383 | 384 | 1 385 | contributor 386 | 387 |

388 | 389 |
390 | 399 |
400 | 401 |
402 |
403 |
404 |
405 | 32 lines (31 sloc) 406 | 407 | 0.828 kb 408 |
409 |
410 |
411 | Raw 412 | Blame 413 | History 414 |
415 | 416 | 421 | 422 | 423 | 424 | 426 | 427 | 429 | 430 | 431 |
432 |
433 | 434 |
435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 |
{
"name": "playground-repo",
"description": "My personal playground",
"version": "0.0.1",
"main": "index.js",
"license": "MIT",
"ignore": "",
"keywords": [],
"author": [
"Stefan Buck <dev@stefanbuck.com> (http://stefanbuck.com)"
],
"homepage": "https://github.com/stefanbuck/playground-repo",
"repository": {
"type": "git",
"url": "https://github.com/stefanbuck/playground-repo"
},
"dependencies": {
"lodash": "2.4.1",
"modernizr": "Modernizr/Modernizr",
"backbone": "jashkenas/backbone#master",
"jquery": "jquery/jquery#1.x-master",
"unknown-package-name": "latest"
},
"devDependencies": {
"chai": "^1.9.1",
"should": "^3.3.1"
},
"resolutions": {
"lodash": "2.1.0"
}
}
561 | 562 |
563 | 564 |
565 |
566 | 567 | Jump to Line 568 | 574 | 575 |
576 | 577 |
578 | 579 |
580 |
581 | 582 | 583 |
584 | 585 |
586 | 609 |
610 | 611 | 612 |
613 |
614 |
615 | 616 |
617 |
618 | 627 |
628 | 629 | 630 | 631 |
632 | 633 | 634 | Something went wrong with that request. Please try again. 635 |
636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | -------------------------------------------------------------------------------- /test/fixtures/composer.json.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | github-linker-core/composer.json at master · stefanbuck/github-linker-core · GitHub 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Skip to content 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 |
77 | Sign up 78 | 79 |
80 | 81 | 95 | 96 | 110 | 111 |
112 |
113 | 114 | 115 | 116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 | 124 | 153 | 154 |

155 | 156 | /github-linker-core 159 | 160 | 161 | 162 | 163 | 164 |

165 |
166 |
167 | 168 |
169 |
170 |
171 | 172 |
173 |
174 | 197 |
198 | 212 | 213 | 214 |
215 |
216 | 217 |
218 | 219 | 220 |
223 |

HTTPS clone URL

224 |
225 | 227 | 228 | 229 | 230 |
231 |
232 | 233 | 234 |
237 |

Subversion checkout URL

238 |
239 | 241 | 242 | 243 | 244 |
245 |
246 | 247 | 248 |

You can clone with 249 | HTTPS 250 | or Subversion. 251 | 252 | 253 | 254 |

255 | 256 | 257 | 258 | Clone in Desktop 259 | 260 | 261 | 262 | 267 | 268 | Download ZIP 269 | 270 |
271 |
272 | 273 |
274 | 275 | 276 | 277 | 278 | 279 | 280 |
281 | 282 |
283 | 288 | 289 | branch: 290 | master 291 | 292 | 293 | 347 |
348 | 349 |
350 | 355 | 356 | 357 | 363 |
364 | 365 | 368 |
369 | 370 | 371 |
372 |
373 | Stefan Buck 374 | 375 | 376 |
377 | add composer fixture 378 |
379 |
380 | 381 |
382 |

383 | 384 | 1 385 | contributor 386 | 387 |

388 | 389 |
390 | 399 |
400 | 401 |
402 |
403 |
404 |
405 | 40 lines (38 sloc) 406 | 407 | 1.086 kb 408 |
409 |
410 |
411 | Raw 412 | Blame 413 | History 414 |
415 | 416 | 421 | 422 | 423 | 424 | 426 | 427 | 429 | 430 | 431 |
432 |
433 | 434 |
435 | 436 | 437 | 438 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 |
439 |
{
"name": "playground-repo",
"description": "My personal playground",
"version": "0.0.1",
"type": "library",
"keywords": [],
"homepage": "https://github.com/stefanbuck/playground-repo",
"time": "2014-09-19",
"license": "MIT",
"authors": [
{
"name": "Stefan Buck",
"email": "dev@stefanbuck.com",
"homepage": "http://stefanbuck.com",
"role": "Developer"
}
],
"support": {
"email": "dev@stefanbuck.com",
"irc": "irc://irc.freenode.org/composer"
},
"require": {
"php": ">=5.3.2",
"laravel/framework": "~4.2",
"unknown-package-name": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"doctrine/dbal": "~2.3"
},
"conflict": {},
"replace": {},
"provide": {},
"suggest'": {
"ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",
"doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)"
}
}
594 | 595 |
596 | 597 |
598 |
599 | 600 | Jump to Line 601 | 607 | 608 |
609 | 610 |
611 | 612 |
613 |
614 | 615 | 616 |
617 | 618 |
619 | 642 |
643 | 644 | 645 |
646 |
647 |
648 | 649 |
650 |
651 | 660 |
661 | 662 | 663 | 664 |
665 | 666 | 667 | Something went wrong with that request. Please try again. 668 |
669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | --------------------------------------------------------------------------------