rabin 7 年之前
父节点
当前提交
322d9fdd20
共有 9 个文件被更改,包括 58 次插入10 次删除
  1. 5 0
      src/core.py
  2. 13 3
      src/docker/build/dev/php/libevent/Dockerfile
  3. 2 2
      src/main.py
  4. 6 0
      src/tool/__init__.py
  5. 3 5
      src/tool/composer.py
  6. 0 0
      src/tool/dever.py
  7. 0 0
      src/tool/docker.py
  8. 0 0
      src/tool/git.py
  9. 29 0
      src/tool/php7.py

+ 5 - 0
src/core.py

@@ -300,6 +300,11 @@ class Core(object):
 	@classmethod
 	def getClass(self, name, path=''):
 		obj = self.getObject(name, path)
+		if path:
+			if not hasattr(obj, name):
+				print 'error ' + name
+				sys.exit()
+			obj = getattr(obj, name)
 		name = name.capitalize()
 		if not hasattr(obj, name):
 			print 'error ' + name

+ 13 - 3
src/docker/build/dev/php/libevent/Dockerfile

@@ -2,6 +2,16 @@ FROM docker.dever.cc/dev/php/v7:latest
 
 MAINTAINER Rabin "https://github.com/shemic"
 
-RUN apk add --no-cache --update php7-dev libevent-dev php7-xml && \
-	pecl install event && \
-	echo extension=event.so > /etc/php7/conf.d/30-event.ini
+RUN apk add --no-cache --update php7-dev m4 autoconf gcc g++ make openssl-dev curl && \
+	cd /tmp && \
+	curl -O http://pecl.php.net/get/event-2.3.0.tgz && \
+	tar -xzvf event-2.3.0.tgz && \
+	cd event-2.3.0 && \
+	phpize && \
+	./configure --with-php-config=/usr/bin/php-config && \
+	make && \
+	make install && \
+	cd .. && \
+
+	apk del php7-dev m4 autoconf gcc g++ make openssl-dev curl && \
+	rm -rf /tmp/* /var/cache/apk/*

+ 2 - 2
src/main.py

@@ -23,7 +23,7 @@
 	dm showi 显示所有镜像
 	dm rmi 删除所有未使用的镜像
 	后续实现:
-	dm use php 使用php工具包
+	dm use composer 使用composer工具包
 	dm install redis 安装redis
 	dm install laravel 安装laravel类库
 	dm remove redis 删除redis
@@ -55,7 +55,7 @@ class Main(object):
 			use = Env.use()
 			if not use:
 				use = Env.use(self.use)
-			cls = Core.getClass(use)
+			cls = Core.getClass(use, 'tool.')
 			cls.init()
 
 	@classmethod

+ 6 - 0
src/tool/__init__.py

@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+    dever-manage tools
+    author:rabin
+"""

+ 3 - 5
src/php.py → src/tool/composer.py

@@ -7,15 +7,13 @@
 """
 from core import *
 
-class Php(object):
-	path = 'src/php/'
-	share = '/share/lib/php'
+class Composer(object):
 	@classmethod
 	def init(self):
-		method = Core.getMethod(Php_Action, Args.action)
+		method = Core.getMethod(Composer_Action, Args.action)
 		method()
 
-class Php_Action(object):
+class Composer_Action(object):
 	@staticmethod
 	def install():
 		Composer.install(Args.name)

+ 0 - 0
src/dever.py → src/tool/dever.py


+ 0 - 0
src/docker.py → src/tool/docker.py


+ 0 - 0
src/git.py → src/tool/git.py


+ 29 - 0
src/tool/php7.py

@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+    dever-manage tools
+    name:php.py
+    author:rabin
+"""
+from core import *
+
+class Php(object):
+	path = 'src/php/'
+	share = '/share/lib/php'
+	@classmethod
+	def init(self):
+		method = Core.getMethod(Php_Action, Args.action)
+		method()
+
+class Php_Action(object):
+	@staticmethod
+	def install():
+		Php_Install.install(Args.name)
+		print 'install '+Args.name+':yes'
+
+
+class Php_Install(object):
+	@staticmethod
+	def libevent(name):
+		Core.popen('php.install ' + name, True)
+		print 'finished'