[137861] branches/gsoc15-portfile
chunyang at macports.org
chunyang at macports.org
Mon Jun 22 00:40:17 PDT 2015
Revision: 137861
https://trac.macports.org/changeset/137861
Author: chunyang at macports.org
Date: 2015-06-22 00:40:17 -0700 (Mon, 22 Jun 2015)
Log Message:
-----------
github2port: Don't request github api for now
Modified Paths:
--------------
branches/gsoc15-portfile/README.md
branches/gsoc15-portfile/github2port/github2port
Modified: branches/gsoc15-portfile/README.md
===================================================================
--- branches/gsoc15-portfile/README.md 2015-06-22 07:20:11 UTC (rev 137860)
+++ branches/gsoc15-portfile/README.md 2015-06-22 07:40:17 UTC (rev 137861)
@@ -1,11 +1,5 @@
# port-create
-## Installation
-`jq` and `curl` is needed to run `github2port`, to install:
-
- $ sudo port install jq
- $ sudo port install curl
-
## Usage
TODO
Modified: branches/gsoc15-portfile/github2port/github2port
===================================================================
--- branches/gsoc15-portfile/github2port/github2port 2015-06-22 07:20:11 UTC (rev 137860)
+++ branches/gsoc15-portfile/github2port/github2port 2015-06-22 07:40:17 UTC (rev 137861)
@@ -15,6 +15,10 @@
puts $channel " $argv0 https://github.com/jonas/tig/archive/tig-2.1.1.tar.gz"
}
+proc val_or_def {val def} {
+ expr {$val ne "" ? $val : $def}
+}
+
if {$argc != 1} {
usage
exit 1
@@ -66,13 +70,7 @@
set description replaceme
set homepage ""
-set json "/tmp/${author}-${project}.json"
-set api "https://api.github.com/repos/${author}/${project}"
-exec curl --silent --max-time 5 --output $json $api
-
-# Question: Is it possible to change the value of passed variable?
-proc parse_json {query} {
- global json
+proc parse_json {query json} {
set tmp [exec jq $query $json]
set tmp [string range $tmp 1 end-1]
@@ -83,16 +81,20 @@
}
}
-set tmp [parse_json .description]
-if {[expr {[string length $tmp] > 0}]} {
- set description $tmp
-}
+proc request_github {} {
+ global author project
+ global description homepage
-set tmp [parse_json .homepage]
-if {[expr {[string length $tmp] > 0}]} {
- set homepage $tmp
+ set json "/tmp/${author}-${project}.json"
+ set api "https://api.github.com/repos/${author}/${project}"
+ exec curl --silent --max-time 5 --output $json $api
+
+ set description [val_or_def [parse_json .description $json] $description]
+ set homepage [val_or_def [parse_json .description $json] $homepage]
}
+# request_github
+
puts "# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4"
puts "# \$Id\$"
puts ""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150622/54f8d296/attachment.html>
More information about the macports-changes
mailing list