-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add npm source #296
Merged
Merged
Add npm source #296
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pytest | ||
coverage | ||
codecov | ||
requests-mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
import pytest | ||
|
||
from conda_forge_tick.update_upstream_versions import NPM, get_latest_version | ||
from conda_forge_tick.utils import parse_meta_yaml | ||
|
||
|
||
sample_npm = """ | ||
{% set name = "configurable-http-proxy" %} | ||
{% set version = "3.1.0" %} | ||
{% set node_version = os.environ.get('NODEJS_VERSION') or '6.*' %} | ||
{% set node_major = node_version.split('.')[0] %} | ||
{% set build = 1 %} | ||
|
||
package: | ||
name: {{ name }} | ||
version: {{ version }} | ||
|
||
source: | ||
fn: {{ name }}-{{ version }}.tar.gz | ||
url: https://registry.npmjs.org/{{ name }}/-/{{ name }}-{{ version }}.tgz | ||
sha256: eb41627ed15505261dbbb48eb4b9f1c6cd31a884b0f1afa9001a671b67262ad0 | ||
|
||
build: | ||
number: {{ build }} | ||
string: "node{{node_major}}_{{ build}}" | ||
script: npm pack; npm install -g {{name}}-{{version}}.tgz # [not win] | ||
|
||
requirements: | ||
build: | ||
- nodejs {{node_version}} | ||
run: | ||
- nodejs {{node_version}} | ||
|
||
test: | ||
commands: | ||
- configurable-http-proxy -h | ||
|
||
about: | ||
home: https://github.com/jupyterhub/configurable-http-proxy | ||
license: BSD 3-Clause | ||
license_file: LICENSE | ||
summary: node-http-proxy plus a REST API | ||
|
||
extra: | ||
recipe-maintainers: | ||
- minrk | ||
- willingc | ||
""" | ||
|
||
sample_npm_response = """ | ||
{ | ||
"_id": "configurable-http-proxy", | ||
"_rev": "49-72888ab1d40c9ffb823e9ef7fb94292a", | ||
"description": "A configurable-on-the-fly HTTP Proxy", | ||
"dist-tags": { | ||
"latest": "3.1.1" | ||
}, | ||
"name": "configurable-http-proxy", | ||
"versions": { | ||
"3.1.1": { | ||
"_id": "configurable-http-proxy@3.1.1", | ||
"_nodeVersion": "8.7.0", | ||
"_npmOperationalInternal": { | ||
"host": "s3://npm-registry-packages", | ||
"tmp": "tmp/configurable-http-proxy-3.1.1.tgz_1516041466749_0.20442280289717019" | ||
}, | ||
"_npmUser": { | ||
"email": "benjaminrk@gmail.com", | ||
"name": "minrk" | ||
}, | ||
"_npmVersion": "5.4.2", | ||
"author": { | ||
"name": "Jupyter Developers" | ||
}, | ||
"bin": { | ||
"configurable-http-proxy": "bin/configurable-http-proxy" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jupyterhub/configurable-http-proxy/issues" | ||
}, | ||
"dependencies": { | ||
"commander": "~2.13.0", | ||
"http-proxy": "~1.16.2", | ||
"lynx": "^0.2.0", | ||
"strftime": "~0.10.0", | ||
"winston": "~2.4.0" | ||
}, | ||
"description": "A configurable-on-the-fly HTTP Proxy", | ||
"devDependencies": { | ||
"jasmine": "^2.5.1", | ||
"jshint": "^2.9.2", | ||
"nyc": "^11.0.2", | ||
"prettier": "^1.4.4", | ||
"request": "^2.81.0", | ||
"request-promise-native": "^1.0.4", | ||
"ws": "^4.0.0" | ||
}, | ||
"directories": { | ||
}, | ||
"dist": { | ||
"integrity": "sha512-e+fxBy5cCayuNpxt3tcigBIuFsU/+oN48eK3aQtCBV12glavbBMxJa3ut2AEDHhXa/g3pC8r2BorKthrofHGRw==", | ||
"shasum": "bc386574c519efeb8437960234d598be8fdd2030", | ||
"tarball": "https://registry.npmjs.org/configurable-http-proxy/-/configurable-http-proxy-3.1.1.tgz" | ||
}, | ||
"engineStrict": true, | ||
"engines": { | ||
"node": ">= 4.0" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib/configproxy.js", | ||
"lib/store.js", | ||
"lib/trie.js", | ||
"lib/error/*.html", | ||
"bin/configurable-http-proxy" | ||
], | ||
"gitHead": "91eb3e6c0e21a23d0c34277df42dfcbe71d52b8c", | ||
"homepage": "https://github.com/jupyterhub/configurable-http-proxy#readme", | ||
"license": "BSD-3-Clause", | ||
"main": "index.js", | ||
"maintainers": [ | ||
{ | ||
"email": "rgbkrk@gmail.com", | ||
"name": "rgbkrk" | ||
}, | ||
{ | ||
"email": "benjaminrk@gmail.com", | ||
"name": "minrk" | ||
} | ||
], | ||
"name": "configurable-http-proxy", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jupyterhub/configurable-http-proxy.git" | ||
}, | ||
"scripts": { | ||
"codecov": "nyc report --reporter=lcov && codecov", | ||
"coverage-html": "nyc report --reporter=html", | ||
"fmt": "prettier --write *.js bin/* lib/*.js test/*.js --trailing-comma es5 --print-width 100", | ||
"lint": "jshint bin/ lib/ test/", | ||
"test": "nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json" | ||
}, | ||
"version": "3.1.1" | ||
} | ||
} | ||
} | ||
""" | ||
|
||
latest_url_test_list = [ | ||
( | ||
sample_npm, "3.1.1", NPM(), { | ||
"https://registry.npmjs.org/configurable-http-proxy": sample_npm_response | ||
} | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("inp, ver, source, urls", latest_url_test_list) | ||
def test_latest_version(inp, ver, source, urls, requests_mock): | ||
pmy = parse_meta_yaml(inp)["source"] | ||
[requests_mock.get(url, text=text) for url, text in urls.items()] | ||
assert ver == get_latest_version(pmy, [source]) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the right way to transform the package into the thing that
get_latest_version
is expecting?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use
get_attrs
https://github.com/regro/cf-scripts/blob/master/conda_forge_tick/make_graph.py#L24 (although this currently pulls themeta.yaml
itself from github. I guess at some point we should separate the request from the rest of it for these kinds of things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, guess I can mock that, too...