Browse Source

Add package index feature

Loïc Hoguin 12 years ago
parent
commit
9a6989a611
2 changed files with 48 additions and 0 deletions
  1. 40 0
      erlang.mk
  2. 8 0
      packages.v1.txt

+ 40 - 0
erlang.mk

@@ -16,6 +16,15 @@
 
 PROJECT ?= $(notdir $(CURDIR))
 
+# Packages database file.
+
+PKG_FILE ?= $(CURDIR)/.erlang.mk.packages.v1
+PKG_FILE_URL ?= https://raw.github.com/extend/erlang.mk/master/packages.v1.txt
+
+define get_pkg_file
+	wget -O $(PKG_FILE) $(PKG_FILE_URL)
+endef
+
 # Verbosity and tweaks.
 
 V ?= 0
@@ -108,7 +117,14 @@ clean:
 
 define get_dep
 	@mkdir -p $(DEPS_DIR)
+ifeq (,$(findstring pkg://,$(word 1,$(dep_$(1)))))
 	git clone -n -- $(word 1,$(dep_$(1))) $(DEPS_DIR)/$(1)
+else
+	$(if $(wildcard $(PKG_FILE)),,$(call get_pkg_file))
+	git clone -n -- `awk 'BEGIN { FS = "\t" }; \
+		$$$$1 == "$(subst pkg://,,$(word 1,$(dep_$(1))))" { print $$$$2 }' \
+		$(PKG_FILE)` $(DEPS_DIR)/$(1)
+endif
 	cd $(DEPS_DIR)/$(1) ; git checkout -q $(word 2,$(dep_$(1)))
 endef
 
@@ -180,3 +196,27 @@ build-plt: deps app
 
 dialyze:
 	@dialyzer --src src --plt .$(PROJECT).plt --no_native $(DIALYZER_OPTS)
+
+# Packages.
+
+$(PKG_FILE):
+	$(call get_pkg_file)
+
+pkg-list: $(PKG_FILE)
+	@cat $(PKG_FILE) | awk 'BEGIN { FS = "\t" }; { print \
+		"Name:\t\t" $$1 "\n" \
+		"Repository:\t" $$2 "\n" \
+		"Website:\t" $$3 "\n" \
+		"Description:\t" $$4 "\n" }'
+
+ifdef q
+pkg-search: $(PKG_FILE)
+	@cat $(PKG_FILE) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \
+		"Name:\t\t" $$1 "\n" \
+		"Repository:\t" $$2 "\n" \
+		"Website:\t" $$3 "\n" \
+		"Description:\t" $$4 "\n" }'
+else
+pkg-search:
+	@echo "Usage: make pkg-search q=STRING"
+endif

+ 8 - 0
packages.v1.txt

@@ -0,0 +1,8 @@
+bullet	https://github.com/extend/bullet	http://ninenines.eu	Simple, reliable, efficient streaming for Cowboy.
+cowboy	https://github.com/extend/cowboy	http://ninenines.eu	Small, fast and modular HTTP server.
+erlydtl	https://github.com/evanmiller/erlydtl	https://code.google.com/p/erlydtl/	ErlyDTL compiles Django Template Language to Erlang bytecode.
+farwest_core	https://github.com/extend/farwest_core	http//ninenines.eu	Modern web application development platform.
+farwest_ui	https://github.com/extend/farwest_ui	http://ninenines.eu	Development and administration UI for Farwest.
+jsx	https://github.com/talentdeficit/jsx	https://github.com/talentdeficit/jsx	An Erlang application for consuming, producing and manipulating JSON.
+ranch	https://github.com/extend/ranch	http://ninenines.eu	Socket acceptor pool for TCP protocols.
+sheriff	https://github.com/extend/sheriff	http://ninenines.eu	Parse transform for type based validation.