Seize the day

POST : SDP for win32/빌드,배포 자동화

리얼 배포 자동화

빌드가 끝나면 deploy 폴더에 빌드 결과물이 복사가 된다. 

EasyRegistry 프로젝트는 아래 3개 파일을 서버로 업로드 하면 프로그램 실행시 자동 업데이트 알림창이 뜨게 된다. 

EasyRegistrySetup.exe

version.xml

EasyRegistry.txt


업로드 하는 것 조차 실수할 여지가 있기에 자동화가 중요하다. bat 파일만 실행하면 자동으로 업로드가 된다. 


ruby로 만들어 보았는데 루비 설치폴더에서 

gem install net-sftp

를 한 번 실행하여 sftp를 설치하여야 한다. 

  require 'net/sftp'

  # we need "gem install net-sftp "


  puts 'We deploy new EasyRegistry version.'

  print 'id:'

  id = gets.chomp

  print 'password:'

  pwd = gets.chomp

  

  Net::SFTP.start('mdiwebma.com', id, :password => pwd) do |sftp|

    # upload a file or directory to the remote host

    puts "uploading files...."

    

    sftp.upload!("EasyRegistry.txt", "/home/mdiwebma/public_html/easyregistry/EasyRegistry.txt")

    sftp.upload!("EasyRegistrySetup.exe", "/home/mdiwebma/public_html/easyregistry/EasyRegistrySetup.exe")

    sftp.upload!("version.xml", "/home/mdiwebma/public_html/easyregistry/version.xml")

    

    puts "bye~"

   

  end

  

  

  puts "done~"


인터넷망이 외부에서 접근이 안되는 곳일 경우  pwd에 패스워드를 미리 입력해 두면 매번 아이디 패스워드를 입력 받을 필요가 없어진다. 


루비 sftp 의 API는 http://net-ssh.github.io/sftp/v2/api/index.html 여기를 참조..


웹 페이지에서도 매번 버전 표기나 업데이트 내역을 수정할 필요가 없이 version.xml 과 EasyReigstry.txt에서 내용을 읽어와 뿌려주는 index.php 파일을 만들었다. 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>EasyRegistry 공식 배포 페이지</title>

</head>

<body>

<h1>레지스트리 도우미 EasyRegistry </h1>

<a href='EasyRegistrySetup.exe'><h3>다운로드하기 Download</h3></a>

<?

 include "XMLparse.php";

 $test_xml = 'version.xml'; 

 $xml = file_get_contents($test_xml); 

 //print_r($xml); 

 $parser = new XMLParser($xml); 

 $parser->Parse(); 

 $test = $parser->document;

 echo "<h3>최신버전: ";

 echo $test->version[0]->tagData . "</h3>"; 

 echo "<h3>업데이트 날짜: ";

 echo $test->date[0]->tagData . "</h3>"; 

?>

<table><tr>

<td>

 <img src="easyregistry.jpg" />

</td>


<td>

 <img src="search.jpg" />

</td>

</tr></table>

<?

 $log_path= 'EasyRegistry.txt'; 

 $log_content = file_get_contents($log_path); 

 echo "<pre>";

 echo $log_content;

 echo "</pre>";

?>

</body>

</html>


http://mdiwebma.com/easyregistry/

여기서 확인이 가능하다. 버전과 날짜, 하단의 업데이트 내역은 version.xml과 EasyRegistry.txt 에서 읽어와 보여주는 것이다. 





top

posted at

2013. 8. 30. 02:08


CONTENTS

Seize the day
BLOG main image
김대정의 앱 개발 노트와 사는 이야기
RSS 2.0Tattertools
공지
아카이브
최근 글 최근 댓글
카테고리 태그 구름사이트 링크