Permalink
Browse files

New build-pagico.rb help to build pagico easily

  • Loading branch information...
1 parent fce361e commit d534f74a0fc84f7a17731ccf91ccdf279f10aa4e @tualatrix committed May 3, 2012
Showing with 35 additions and 0 deletions.
  1. +35 −0 builder/build-pagico.rb
View
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+
+require 'optparse'
+require 'fileutils'
+
+OptionParser.new do |o|
+ o.on('-m MODE') { |mode| $mode = mode }
+ o.on('-r REVERSION') { |reversion| $reversion = reversion }
+ o.on('-h') { puts o; exit }
+ o.parse!
+end
+
+source_path = File.expand_path("~/Downloads/Pagico_#{$mode}_r#{$reversion}.zip")
+if (File.exist?(source_path))
+ puts "The file is ready"
+else
+ puts "#{source_path} can not found"
+ exit
+end
+
+source_root = File.expand_path("~/Sources")
+project_root = File.expand_path("~/Sources/pagico")
+de_path = File.expand_path("~/Sources/pagico/CodeX")
+
+if File.exist? (de_path)
+ FileUtils::rm_rf(de_path)
+ puts "The file is already there, delete it at first"
+end
+
+system("unzip #{source_path} -d #{project_root}")
+system("cd #{project_root} && debuild")
+name = `cd #{source_root} && ls pagico_*~r*.deb`.strip
+new_name = "#{name.split('.deb')[0]}_#{$mode}.deb"
+puts("cd #{source_root} && mv #{name} ~/Desktop/#{new_name}")
+system("cd #{source_root} && mv #{name} ~/Desktop/#{new_name}")

0 comments on commit d534f74

Please sign in to comment.