解析ruby的gemfiles

gemfileparser的Python项目详细描述


安装

如果使用pip,请使用命令sudo pip install gemfileparser
否则使用以下命令
git clone https://github.com/balasankarc/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 - Name of the gem
requirement - Version requirement
autorequire - Autorequire value
source - Source URL of the gem
parent - Dependency of which gem
group - Group in which gem is a member of (default : 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 "  ", dependency

许可证

gemfileparser在GNU GPL version 3 (or above) License下发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
分析线程“main”java中的异常。时间总体安排DateTimeParseException:未能在索引0处分析文本“”   java为什么术语“工作单元”如此重要,为什么JDBC自动提交违反了这种模式?   java您的SQL语法有错误,但查询在MySQL工作台中运行   如何将api post请求从Java写入c#   java集成Hbase和Hive的优势是什么   使用Ecplise从数据库检索列表时遇到问题的java   java使用Guice需要做什么?   java在控制器中使用@Autowired和@Qualifier更改服务的数据源   通过Java API将具有值的字段添加到MongoDB中的现有文档中   java设置了JFrame背景,为什么这不起作用?   java和安卓中的异常处理   java如何在glassfish服务器中配置oracle精简连接池?   java如何使用spring@Lookup注释?   java Log4J调试不起作用?   java有没有人有一个好的代码示例/库,可以通过S3预签名的URL执行大文件(5GB)PUT操作?   java如何避免“除非模拟类型是可注入的或动态的,否则无法进入方法”?   浮点Java IEEE 754浮点到IBM浮点字节[4]转换