跳转到主要内容

使用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

许可证

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 查看散列值

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面