使用Python解析Ruby Gemfile、.gemspec和Cocoapod .podspec文件。
项目描述
gemfileparser2使用Python解析Ruby Gemfile,支持Ruby Gemfiles和.gemspec文件以及Cocoapod .podspec文件。
这是对https://github.com/gemfileparser/gemfileparser的维护分支,该分支已不再活跃(尽管它由同一群人维护)
安装
在虚拟环境中,使用以下命令
pip install gemfileparser2
用法
from gemfileparser2 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 - 晶钻名称
需求 - 版本需求
自动需求 - 自动需求值
来源 - 产品的来源 URL
父级 - 依赖的 gem
分组 - gem 所属的组(默认:运行时)
示例
from gemfileparser2 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>
许可证
gemfileparser2 在您选择下双许可,您可以选择GNU GPL 版本 3(或更新)许可证或MIT 许可证。
建议任何使用此项目的人都尊重 GPL-3+ 许可证并使用该许可证本身进行衍生作品 - 因此使它们也成为自由软件。但,由您决定。
当向 gemfileparser2 做出贡献时,您同意将这些贡献许可给相同的许可证选择。
项目详情
下载文件
下载您平台的文件。如果您不确定选择哪个,请了解安装包的更多信息。
源分发
gemfileparser2-0.9.4.tar.gz (83.6 kB 查看散列值)
构建分发
gemfileparser2-0.9.4-py3-none-any.whl (19.5 kB 查看散列值)
关闭
gemfileparser2-0.9.4.tar.gz 的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 7b37e2a01c2564c19bd5c133cf06b569f5d4ad39f1b20a735f408d393c95ce06 |
|
MD5 | 84d54c934867bd9018425c6876c9b371 |
|
BLAKE2b-256 | afbda64f1e4320b125a2685fec90c760339ba2da09d8a49d763a2e61ff4a592e |
关闭
gemfileparser2-0.9.4-py3-none-any.whl 的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 372e9dff807854a37cdc58c692e150a6bea31031e7d5ce8a2762dd63437b22c0 |
|
MD5 | b1b09ac9ed0538f31d77ef61ae0118ed |
|
BLAKE2b-256 | ed69ee5b89373713a7a34222a8c71d5be1643935cdf06017f65aed2fb2f604f9 |