Xu Xiaodong avatar Xu Xiaodong committed dccd0e9

update create_gem_ebuild.rb

Comments (0)

Files changed (1)

create_gem_ebuild.rb

 # author:    Xu Xiaodong <xxdlhy@gmail.com>
 # license:   GPL
 # created:   2011 May 07
-# modified:  2011 May 07
+# modified:  2011 May 08
 #
 
 require 'uri'
 
   def create
     url = URI.parse("http://rubygems.org/api/v1/gems/#{@name}.json")
-    Yajl::HttpStream.get(url) do |metainfo|
-      desc = metainfo['info']
-      ver  = metainfo['version']
-      home = metainfo['homepage_uri']
+    Yajl::HttpStream.get(url) do |meta|
+      desc   = meta['info']
+      ver    = meta['version']
+      home   = meta['homepage_uri']
+      depend = meta['dependencies']['runtime']
 
       Dir.chdir('/usr/local/portage/dev-ruby')
       Dir.mkdir(@name)
       Dir.chdir(@name)
 
       lines = []
-      lines << %Q{# Copyright 1999-2011 Gentoo Foundation}
-      lines << %Q{# Distributed under the terms of the GNU General Public License v2}
-      lines << %Q{}
-      lines << %Q{EAPI=3}
-      lines << %Q{USE_RUBY="ruby19"}
-      lines << %Q{}
-      lines << %Q{RUBY_FAKEGEM_BINWRAP=""}
-      lines << %Q{}
-      lines << %Q{RUBY_FAKEGEM_TASK_DOC=""}
-      lines << %Q{RUBY_FAKEGEM_TASK_TEST=""}
-      lines << %Q{}
-      lines << %Q{inherit ruby-fakegem}
-      lines << %Q{}
-      lines << %Q{DESCRIPTION="#{desc}"}
-      lines << %Q{HOMEPAGE="#{home}"}
-      lines << %Q{}
-      lines << %Q{LICENSE="MIT"}
-      lines << %Q{SLOT="3.0"}
-      lines << %Q{KEYWORDS="~amd64 ~x86"}
-      lines << %Q{}
-      lines << %Q{IUSE=""}
+      lines << %Q<# Copyright 1999-2011 Gentoo Foundation>
+      lines << %Q<# Distributed under the terms of the GNU General Public License v2>
+      lines << %Q<>
+      lines << %Q<EAPI=3>
+      lines << %Q<USE_RUBY="ruby19">
+      lines << %Q<>
+      lines << %Q<RUBY_FAKEGEM_BINWRAP="">
+      lines << %Q<>
+      lines << %Q<RUBY_FAKEGEM_TASK_DOC="">
+      lines << %Q<RUBY_FAKEGEM_TASK_TEST="">
+      lines << %Q<>
+      lines << %Q<inherit ruby-fakegem>
+      lines << %Q<>
+      lines << %Q<DESCRIPTION="#{desc}">
+      lines << %Q<HOMEPAGE="#{home}">
+      lines << %Q<>
+      lines << %Q<LICENSE="MIT">
+      lines << %Q<SLOT="3.0">
+      lines << %Q<KEYWORDS="~amd64 ~x86">
+      lines << %Q<>
+      lines << %Q<IUSE="">
+      lines << %Q<>
+      lines << %Q<ruby_add_rdepend ">
+
+      depend_name = nil
+      depend.each do |hash|
+        depend_name = hash['name']
+        lines << %Q<\tdev-ruby/#{depend_name}>
+      end
+
+      lines << %Q<">
+      lines << %Q<>
+      lines << %Q<all_ruby_install() {>
+      lines << %Q<\tall_fakegem_install>
+      lines << %Q<}>
       lines.join("\n")
 
       filename = "#{@name}-#{ver}.ebuild"
       system('ebuild', filename, 'manifest')
     end
   end
+
 end
 
 if __FILE__ == $0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.