summaryrefslogtreecommitdiff
path: root/gemtoo
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2009-09-06 14:31:34 +0200
committerHans de Graaff <hans@degraaff.org>2009-09-06 14:31:34 +0200
commitfc52d0046fd3a559e051216ffb16b01f8a9fc125 (patch)
treeae1e66a3ee4fd2e503eb75229d717e2c1d7bb3b1 /gemtoo
parentRemove rake virtual; it was unbundled from JRuby so it's no longer needed. (diff)
downloadruby-scripts-fc52d0046fd3a559e051216ffb16b01f8a9fc125.tar.gz
ruby-scripts-fc52d0046fd3a559e051216ffb16b01f8a9fc125.tar.bz2
ruby-scripts-fc52d0046fd3a559e051216ffb16b01f8a9fc125.zip
Initial version of gemtoo rubygems plugin.
Proof-of-concept in progress. Needs more work, documentation, tests, etc.
Diffstat (limited to 'gemtoo')
-rw-r--r--gemtoo/.autotest23
-rw-r--r--gemtoo/.gitignore1
-rw-r--r--gemtoo/History.txt6
-rw-r--r--gemtoo/Manifest.txt12
-rw-r--r--gemtoo/README.txt48
-rw-r--r--gemtoo/Rakefile12
-rw-r--r--gemtoo/lib/gemtoo.rb26
-rw-r--r--gemtoo/lib/rubygems/commands/src_compile_command.rb22
-rw-r--r--gemtoo/lib/rubygems/commands/src_install_command.rb22
-rw-r--r--gemtoo/lib/rubygems/commands/src_unpack_command.rb22
-rw-r--r--gemtoo/lib/rubygems_plugin.rb6
-rw-r--r--gemtoo/test/test_gemtoo.rb8
12 files changed, 208 insertions, 0 deletions
diff --git a/gemtoo/.autotest b/gemtoo/.autotest
new file mode 100644
index 0000000..ef753ad
--- /dev/null
+++ b/gemtoo/.autotest
@@ -0,0 +1,23 @@
+# -*- ruby -*-
+
+require 'autotest/restart'
+
+# Autotest.add_hook :initialize do |at|
+# at.extra_files << "../some/external/dependency.rb"
+#
+# at.libs << ":../some/external"
+#
+# at.add_exception 'vendor'
+#
+# at.add_mapping(/dependency.rb/) do |f, _|
+# at.files_matching(/test_.*rb$/)
+# end
+#
+# %w(TestA TestB).each do |klass|
+# at.extra_class_map[klass] = "test/test_misc.rb"
+# end
+# end
+
+# Autotest.add_hook :run_command do |at|
+# system "rake build"
+# end
diff --git a/gemtoo/.gitignore b/gemtoo/.gitignore
new file mode 100644
index 0000000..5fff1d9
--- /dev/null
+++ b/gemtoo/.gitignore
@@ -0,0 +1 @@
+pkg
diff --git a/gemtoo/History.txt b/gemtoo/History.txt
new file mode 100644
index 0000000..7ae5504
--- /dev/null
+++ b/gemtoo/History.txt
@@ -0,0 +1,6 @@
+=== 1.0.0 / 2009-08-30
+
+* 1 major enhancement
+
+ * Birthday!
+
diff --git a/gemtoo/Manifest.txt b/gemtoo/Manifest.txt
new file mode 100644
index 0000000..059b893
--- /dev/null
+++ b/gemtoo/Manifest.txt
@@ -0,0 +1,12 @@
+.autotest
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/gemtoo
+lib/gemtoo.rb
+lib/rubygems_plugin.rb
+lib/rubygems/commands/src_compile_command.rb
+lib/rubygems/commands/src_install_command.rb
+lib/rubygems/commands/src_unpack_command.rb
+test/test_gemtoo.rb
diff --git a/gemtoo/README.txt b/gemtoo/README.txt
new file mode 100644
index 0000000..f10c1cf
--- /dev/null
+++ b/gemtoo/README.txt
@@ -0,0 +1,48 @@
+= gemtoo
+
+* http://gentoo.org/
+
+== DESCRIPTION:
+
+FIX (describe your package)
+
+== FEATURES/PROBLEMS:
+
+* FIX (list of features or problems)
+
+== SYNOPSIS:
+
+ FIX (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIX (list of requirements)
+
+== INSTALL:
+
+* FIX (sudo gem install, anything else)
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2009 FIX
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/gemtoo/Rakefile b/gemtoo/Rakefile
new file mode 100644
index 0000000..6e1f786
--- /dev/null
+++ b/gemtoo/Rakefile
@@ -0,0 +1,12 @@
+# -*- ruby -*-
+
+require 'rubygems'
+require 'hoe'
+
+Hoe.spec 'gemtoo' do
+ developer('Hans de Graaff', 'graaff@gentoo.org')
+
+ # self.rubyforge_name = 'gemtoox' # if different than 'gemtoo'
+end
+
+# vim: syntax=ruby
diff --git a/gemtoo/lib/gemtoo.rb b/gemtoo/lib/gemtoo.rb
new file mode 100644
index 0000000..b60ae42
--- /dev/null
+++ b/gemtoo/lib/gemtoo.rb
@@ -0,0 +1,26 @@
+require 'rubygems/installer'
+require 'rubygems/config_file'
+
+class Gemtoo
+ VERSION = '1.0.0'
+
+
+ def self.src_unpack(name, options)
+ inst = Gem::Installer.new(name, options)
+ inst.extract_files
+ end
+
+
+ def self.src_compile(name, options)
+ inst = Gem::Installer.new(name, options)
+ inst.build_extensions
+ end
+
+ def self.src_install(name, options)
+ inst = Gem::Installer.new(name, options)
+ inst.generate_bin
+ inst.write_spec
+ end
+
+
+end
diff --git a/gemtoo/lib/rubygems/commands/src_compile_command.rb b/gemtoo/lib/rubygems/commands/src_compile_command.rb
new file mode 100644
index 0000000..3455eca
--- /dev/null
+++ b/gemtoo/lib/rubygems/commands/src_compile_command.rb
@@ -0,0 +1,22 @@
+require 'rubygems/command'
+require 'rubygems/install_update_options'
+
+class Gem::Commands::SrcCompileCommand < Gem::Command
+
+ include Gem::InstallUpdateOptions
+
+ def initialize
+ super 'src_compile', 'Execute Gentoo src_compile phase'
+
+ add_install_update_options
+ end
+
+ def execute
+ get_all_gem_names.each do |gem_name|
+ Gemtoo::src_compile gem_name, options
+ end
+
+ end
+
+
+end
diff --git a/gemtoo/lib/rubygems/commands/src_install_command.rb b/gemtoo/lib/rubygems/commands/src_install_command.rb
new file mode 100644
index 0000000..c2f3525
--- /dev/null
+++ b/gemtoo/lib/rubygems/commands/src_install_command.rb
@@ -0,0 +1,22 @@
+require 'rubygems/command'
+require 'rubygems/install_update_options'
+
+class Gem::Commands::SrcInstallCommand < Gem::Command
+
+ include Gem::InstallUpdateOptions
+
+ def initialize
+ super 'src_install', 'Execute Gentoo src_install phase'
+
+ add_install_update_options
+ end
+
+ def execute
+ get_all_gem_names.each do |gem_name|
+ Gemtoo::src_install gem_name, options
+ end
+
+ end
+
+
+end
diff --git a/gemtoo/lib/rubygems/commands/src_unpack_command.rb b/gemtoo/lib/rubygems/commands/src_unpack_command.rb
new file mode 100644
index 0000000..7159b40
--- /dev/null
+++ b/gemtoo/lib/rubygems/commands/src_unpack_command.rb
@@ -0,0 +1,22 @@
+require 'rubygems/command'
+require 'rubygems/install_update_options'
+
+class Gem::Commands::SrcUnpackCommand < Gem::Command
+
+ include Gem::InstallUpdateOptions
+
+ def initialize
+ super 'src_unpack', 'Execute Gentoo src_unpack phase'
+
+ add_install_update_options
+ end
+
+ def execute
+ get_all_gem_names.each do |gem_name|
+ Gemtoo::src_unpack gem_name, options
+ end
+
+ end
+
+
+end
diff --git a/gemtoo/lib/rubygems_plugin.rb b/gemtoo/lib/rubygems_plugin.rb
new file mode 100644
index 0000000..3c6eb36
--- /dev/null
+++ b/gemtoo/lib/rubygems_plugin.rb
@@ -0,0 +1,6 @@
+require 'rubygems/command_manager'
+require 'gemtoo'
+
+Gem::CommandManager.instance.register_command :src_unpack
+Gem::CommandManager.instance.register_command :src_compile
+Gem::CommandManager.instance.register_command :src_install
diff --git a/gemtoo/test/test_gemtoo.rb b/gemtoo/test/test_gemtoo.rb
new file mode 100644
index 0000000..e001984
--- /dev/null
+++ b/gemtoo/test/test_gemtoo.rb
@@ -0,0 +1,8 @@
+require "test/unit"
+require "gemtoo"
+
+class TestGemtoo < Test::Unit::TestCase
+ def test_sanity
+ flunk "write tests or I will kneecap you"
+ end
+end