Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
First crack at posting package.json for discovery!
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 14, 2017
1 parent 314b9b5 commit 7b95d45
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 194 deletions.
162 changes: 162 additions & 0 deletions gratipay/utils/ghost.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

PACKAGE_JSON = '''\
{
"name": "ghost",
"version": "1.0.0-alpha.21",
"description": "Just a blogging platform.",
"author": "Ghost Foundation",
"homepage": "http://ghost.org",
"keywords": [
"ghost",
"blog",
"cms"
],
"repository": {
"type": "git",
"url": "git://github.com/TryGhost/Ghost.git"
},
"bugs": "https://github.com/TryGhost/Ghost/issues",
"contributors": "https://github.com/TryGhost/Ghost/graphs/contributors",
"license": "MIT",
"main": "./core/index",
"scripts": {
"start": "node index",
"test": "grunt validate --verbose",
"init": "yarn global add knex-migrator ember-cli grunt-cli && yarn install && grunt symlink && grunt init || true"
},
"engines": {
"node": "^4.5.0 || ^6.9.0"
},
"dependencies": {
"amperize": "0.3.4",
"archiver": "1.3.0",
"bcryptjs": "2.4.3",
"bluebird": "3.5.0",
"body-parser": "1.17.1",
"bookshelf": "0.10.3",
"brute-knex": "https://github.com/cobbspur/brute-knex/tarball/37439f56965b17d29bb4ff9b3f3222b2f4bd6ce3",
"bson-objectid": "1.1.5",
"chalk": "1.1.3",
"cheerio": "0.22.0",
"compression": "1.6.2",
"connect-slashes": "1.3.1",
"cookie-session": "1.2.0",
"cors": "2.8.3",
"csv-parser": "1.11.0",
"debug": "2.6.6",
"downsize": "0.0.8",
"express": "4.15.2",
"express-brute": "1.0.1",
"express-hbs": "1.0.4",
"extract-zip-fork": "1.5.1",
"fs-extra": "3.0.1",
"ghost-gql": "0.0.6",
"ghost-ignition": "2.8.11",
"ghost-storage-base": "0.0.1",
"glob": "5.0.15",
"gscan": "1.1.0",
"html-to-text": "3.2.0",
"icojs": "0.7.2",
"image-size": "0.5.2",
"intl": "1.2.5",
"intl-messageformat": "1.3.0",
"jsdom": "9.12.0",
"jsonpath": "0.2.11",
"knex": "0.12.9",
"knex-migrator": "2.0.16",
"lodash": "4.17.4",
"markdown-it": "8.3.1",
"markdown-it-footnote": "3.0.1",
"markdown-it-lazy-headers": "0.1.3",
"markdown-it-mark": "2.0.0",
"markdown-it-named-headers": "0.0.4",
"mobiledoc-dom-renderer": "0.6.5",
"moment": "2.18.1",
"moment-timezone": "0.5.13",
"multer": "1.3.0",
"mysql": "2.13.0",
"nconf": "0.8.4",
"netjet": "1.1.3",
"nodemailer": "0.7.1",
"oauth2orize": "1.8.0",
"passport": "0.3.2",
"passport-ghost": "2.3.1",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"path-match": "1.2.4",
"rss": "1.2.2",
"sanitize-html": "1.14.1",
"semver": "5.3.0",
"simple-dom": "0.3.2",
"simple-html-tokenizer": "0.4.1",
"superagent": "3.5.2",
"unidecode": "0.1.8",
"uuid": "3.0.1",
"validator": "6.3.0",
"xml": "1.0.1"
},
"optionalDependencies": {
"sqlite3": "3.1.8"
},
"devDependencies": {
"grunt": "1.0.1",
"grunt-bg-shell": "2.3.3",
"grunt-cli": "1.2.0",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-compress": "1.3.0",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-jshint": "1.0.0",
"grunt-contrib-symlink": "^1.0.0",
"grunt-contrib-uglify": "2.0.0",
"grunt-contrib-watch": "1.0.0",
"grunt-cssnano": "2.1.0",
"grunt-docker": "0.0.11",
"grunt-express-server": "0.5.3",
"grunt-jscs": "3.0.1",
"grunt-mocha-cli": "2.1.0",
"grunt-mocha-istanbul": "5.0.2",
"grunt-shell": "1.3.1",
"grunt-subgrunt": "1.2.0",
"grunt-update-submodules": "0.4.1",
"istanbul": "0.4.5",
"jshint": "2.9.4",
"jshint-stylish": "2.2.1",
"matchdep": "1.0.1",
"minimist": "1.2.0",
"mocha": "3.3.0",
"nock": "9.0.13",
"rewire": "2.5.2",
"run-sequence": "1.2.2",
"should": "11.2.1",
"should-http": "0.1.1",
"sinon": "1.17.7",
"supertest": "3.0.0",
"tmp": "0.0.31"
},
"greenkeeper": {
"ignore": [
"glob",
"nodemailer",
"grunt",
"grunt-bg-shell",
"grunt-cli",
"grunt-contrib-clean",
"grunt-contrib-compress",
"grunt-contrib-copy",
"grunt-contrib-jshint",
"grunt-contrib-uglify",
"grunt-contrib-watch",
"grunt-docker",
"grunt-express-server",
"grunt-jscs",
"grunt-mocha-cli",
"grunt-mocha-istanbul",
"grunt-shell",
"grunt-subgrunt",
"grunt-update-submodules",
"sinon"
]
}
}'''
25 changes: 25 additions & 0 deletions gratipay/utils/listings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals


class FakeProject(object):

def __init__(self, website, package):
self.website = website
self.package = package
self.name = package.name
self.url_path = '/on/{}/{}/'.format(package.package_manager, package.name)

def get_image_url(self, size):
assert size in ('large', 'small'), size
return self.website.asset('package-default-{}.png'.format(size))


def with_unclaimed_packages_wrapped(website, projects_and_unclaimed_packages):
out = []
for project, unclaimed_package in projects_and_unclaimed_packages:
if unclaimed_package:
assert project is None
project = FakeProject(website, unclaimed_package)
out.append(project)
return out
4 changes: 4 additions & 0 deletions scss/pages/npm.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
}
}

form {
margin-top: 30px;
}

textarea {
height: 192px;
width: 100%;
Expand Down
26 changes: 23 additions & 3 deletions tests/ttw/test_package_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,28 @@ def test_auth_gets_discovery_page_by_default(self):
self.visit('/on/npm/')
assert self.css('.instructions').text == 'Paste a package.json to find packages:'

def est_pasting_a_package_json_works(self):
self.make_participant('alice')
def test_pasting_a_package_json_works(self):
self.make_package(name='amperize', description='Amperize!')
glob = self.make_package(name='glob', description='Glob!', emails=['[email protected]'])
self.make_package(name='netjet', description='Netjet!', emails=['[email protected]'])
self.claim_package(self.make_participant('alice'), 'amperize')
self.claim_package(self.make_participant('bob'), 'glob')

glob.team.update(name='Glub')

self.sign_in('alice')
self.visit('/on/npm/')
import pdb; pdb.set_trace()
self.css('textarea').fill('''\
{ "dependencies": { "glob": "..." , "amperize": "..."}
, "optionalDependencies": {"netjet": "...", "falafel": "..."}
}
''')
self.css('form button').click()

names = [x.text for x in self.css('.listing-name')]
assert names == ['glob \u2192 Glub', 'amperize', 'netjet', 'falafel']

enabled = [not x.has_class('disabled') for x in self.css('td.item')]
assert enabled == [True, True, True, False]
Loading

0 comments on commit 7b95d45

Please sign in to comment.