Coder Social home page Coder Social logo

erlpkg's People

Contributors

vereis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

erlpkg's Issues

Pkgutil tests aren't very good

Pkgutils is implemented in such a way that the exposed functions change based on whether or not it is currently being run from inside of an Erlpkg.

This is because originally I believed this to be the best way of allowing IO dependent unit testing to be tested but this isn't the case.

Instead I suggest that all calls to pkgutil functions which reflect upon the calling Erlpkg instead are implemented as follows:

%% EXISTING CODE:
-spec pkg_extract_file(file:filename_all()) -> file:filename_all().
-spec pkg_extract_file(file:filename_all(), file:name_all()) -> file:filename_all().

%% PROPOSED CHANGE:
-spec pkg_extract_file(zip:handle(), file:filename_all()) -> file:filename_all().
-spec pkg_extract_file(zip:handle(), file:filename_all(), file:name_all()) -> file:filename_all().

%% and implement a new pkg_extract/1 and pkg_extract/2 which looks like
pkg_extract_file(FileName) ->
    pkg_extract(pkg_open(), FileName, pkg_tmp_dir()).
pkg_extract_file(FileName, ExtractDir) ->
    pkg_extract(pkg_open(), FileName, ExtractDir).
-endif.

This will allow us to unit test pkgutils as it will be able to operate on external erlpkgs instead of being limited to reflecting upon the running erlpkg.

These changes will only be changes to internal functions since the exposed interface will stay the same unless for some reason this seems like something pkgutils should be able to do?

Proposed function changes:

[pkg_extract/0,
pkg_extract/1,
pkg_extract_file/1,
pkg_extract_file/2,
pkg_extract_dir/1,
pkg_extract_dir/2,
pkg_reflect/0,
pkg_reflect/1].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.