使用Python解析Ruby Gemfile、.gemspec和Cocoapod .podspec文件。
项目描述
gemfileparser使用Python解析Ruby Gemfile,支持Ruby Gemfiles和.gemspec文件以及Cocoapod .podspec文件。
安装
在虚拟环境中,使用以下命令:
pip install gemfileparser
否则从git克隆,请在虚拟环境中使用以下命令:
git clone https://github.com/gemfileparser/gemfileparser.git cd gemfileparser python setup.py install
用法
from gemfileparser import GemfileParser parser = GemfileParser(<path to Gemfile>, <name of the application (optional)>) dependency_dictionary = parser.parse()
parse()方法返回一个以下格式的dict对象
{ 'development': [list of dependency objects inside group 'development'], 'runtime': [list of runtime dependency objects], . . }
每个依赖对象包含以下属性
name - 宝石的名称
requirement - 版本要求
autorequire - 自动加载值
source - 宝石的源URL
parent - 哪个宝石的依赖项
group - 宝石所属的组(默认:runtime)
示例
from gemfileparser import GemfileParser n = GemfileParser('Gemfile', 'diaspora') deps = n.parse() for key in deps: if deps[key]: print key for dependency in deps[key]: print("\t", dependency)
测试
执行以下步骤以运行测试
pip install -e . pip install pytest pytest -vvs tests
版权
版权(c)2020 Gemfileparser 作者(列在AUTHORS文件中)
版权(c)2015-2018 Balasankar C <balasankarc@autistici.org>
许可协议
gemfileparser 可以根据您的选择,在 GNU GPL 版本 3(或更高)许可证 或 MIT 许可证 下进行双重许可。
建议使用此项目的任何人尊重 GPL-3+ 许可证,并自行使用该许可证进行衍生作品 - 因此,使它们也成为自由软件。但,最终决定权在您。
当向 gemfileparser 贡献时,您同意在这些贡献上使用相同的许可证。
项目详情
关闭
gemfileparser-0.8.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 839592e49ea3fd985cec003ef58f8e77009a69ed7644a0c0acc94cf6dd9b8d6e |
|
MD5 | 670b8e9dbbfa7a27f06b5de5a84b855b |
|
BLAKE2b-256 | 085f7277029065a98d7eef536e138a49edb4f551038e4d0ebc312bcf06ea086d |
关闭
gemfileparser-0.8.0-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | aed669b729c1f850308d1c373fe425d0c1ce768fa5bdac593e05715c64e2bffc |
|
MD5 | 454742bbde04b8b2ccef9da84fbb43d1 |
|
BLAKE2b-256 | edb5c3f4d21e121a65172f43b08b2699e469e3853455b5def48097f40164bb44 |