From 2df1f3f33b073ed58cbe01958d60ab42d634c62a Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 15 Dec 2009 07:35:55 +0200 Subject: [PATCH] 'gemify' the source --- History.txt | 4 ++ Manifest.txt | 43 ++++++++++++++++ README.rdoc | 49 +++++++++++++++++++ Rakefile | 32 ++++++++++++ convert_ruby.cpp => ext/v8/convert_ruby.cpp | 0 convert_ruby.h => ext/v8/convert_ruby.h | 0 .../v8/convert_string.cpp | 0 convert_string.h => ext/v8/convert_string.h | 0 convert_v8.cpp => ext/v8/convert_v8.cpp | 0 convert_v8.h => ext/v8/convert_v8.h | 0 converters.h => ext/v8/converters.h | 0 extconf.rb => ext/v8/extconf.rb | 0 v8.cpp => ext/v8/v8.cpp | 0 v8_context.cpp => ext/v8/v8_context.cpp | 0 v8_context.h => ext/v8/v8_context.h | 0 v8_cxt.cpp => ext/v8/v8_cxt.cpp | 0 v8_cxt.h => ext/v8/v8_cxt.h | 0 v8_object.cpp => ext/v8/v8_object.cpp | 0 v8_object.h => ext/v8/v8_object.h | 0 v8_ref.cpp => ext/v8/v8_ref.cpp | 0 v8_ref.h => ext/v8/v8_ref.h | 0 v8_script.cpp => ext/v8/v8_script.cpp | 0 v8_script.h => ext/v8/v8_script.h | 0 v8_standalone.cpp => ext/v8/v8_standalone.cpp | 0 v8_standalone.h => ext/v8/v8_standalone.h | 0 v8_str.cpp => ext/v8/v8_str.cpp | 0 v8_str.h => ext/v8/v8_str.h | 0 v8_template.cpp => ext/v8/v8_template.cpp | 0 v8_template.h => ext/v8/v8_template.h | 0 lib/v8.rb | 7 +++ lib/v8/context.rb | 6 +++ script/console | 10 ++++ script/destroy | 14 ++++++ script/generate | 14 ++++++ tasks/rspec.rake | 21 ++++++++ therubyracer.gemspec | 34 +++++++++++++ 36 files changed, 234 insertions(+) create mode 100644 History.txt create mode 100644 Manifest.txt create mode 100644 README.rdoc create mode 100644 Rakefile rename convert_ruby.cpp => ext/v8/convert_ruby.cpp (100%) rename convert_ruby.h => ext/v8/convert_ruby.h (100%) rename convert_string.cpp => ext/v8/convert_string.cpp (100%) rename convert_string.h => ext/v8/convert_string.h (100%) rename convert_v8.cpp => ext/v8/convert_v8.cpp (100%) rename convert_v8.h => ext/v8/convert_v8.h (100%) rename converters.h => ext/v8/converters.h (100%) rename extconf.rb => ext/v8/extconf.rb (100%) rename v8.cpp => ext/v8/v8.cpp (100%) rename v8_context.cpp => ext/v8/v8_context.cpp (100%) rename v8_context.h => ext/v8/v8_context.h (100%) rename v8_cxt.cpp => ext/v8/v8_cxt.cpp (100%) rename v8_cxt.h => ext/v8/v8_cxt.h (100%) rename v8_object.cpp => ext/v8/v8_object.cpp (100%) rename v8_object.h => ext/v8/v8_object.h (100%) rename v8_ref.cpp => ext/v8/v8_ref.cpp (100%) rename v8_ref.h => ext/v8/v8_ref.h (100%) rename v8_script.cpp => ext/v8/v8_script.cpp (100%) rename v8_script.h => ext/v8/v8_script.h (100%) rename v8_standalone.cpp => ext/v8/v8_standalone.cpp (100%) rename v8_standalone.h => ext/v8/v8_standalone.h (100%) rename v8_str.cpp => ext/v8/v8_str.cpp (100%) rename v8_str.h => ext/v8/v8_str.h (100%) rename v8_template.cpp => ext/v8/v8_template.cpp (100%) rename v8_template.h => ext/v8/v8_template.h (100%) create mode 100644 lib/v8.rb create mode 100644 lib/v8/context.rb create mode 100755 script/console create mode 100755 script/destroy create mode 100755 script/generate create mode 100644 tasks/rspec.rake create mode 100644 therubyracer.gemspec diff --git a/History.txt b/History.txt new file mode 100644 index 0000000..59c311a --- /dev/null +++ b/History.txt @@ -0,0 +1,4 @@ +=== 0.0.1 2009-12-14 + +* 1 major enhancement: + * Initial release diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 0000000..ba07215 --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,43 @@ +Doxyfile +History.txt +Manifest.txt +README.rdoc +Rakefile +config.sh +docs/data_conversion.txt +ext/v8/convert_ruby.cpp +ext/v8/convert_ruby.h +ext/v8/convert_string.cpp +ext/v8/convert_string.h +ext/v8/convert_v8.cpp +ext/v8/convert_v8.h +ext/v8/converters.h +ext/v8/extconf.rb +ext/v8/v8.cpp +ext/v8/v8_context.cpp +ext/v8/v8_context.h +ext/v8/v8_cxt.cpp +ext/v8/v8_cxt.h +ext/v8/v8_object.cpp +ext/v8/v8_object.h +ext/v8/v8_ref.cpp +ext/v8/v8_ref.h +ext/v8/v8_script.cpp +ext/v8/v8_script.h +ext/v8/v8_standalone.cpp +ext/v8/v8_standalone.h +ext/v8/v8_str.cpp +ext/v8/v8_str.h +ext/v8/v8_template.cpp +ext/v8/v8_template.h +lib/v8.rb +lib/v8/v8.bundle +script/console +script/destroy +script/generate +spec/spec.opts +spec/spec_helper.rb +spec/therubyracer_spec.rb +spike.rb +tasks/rspec.rake +therubyracer.gemspec diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..465cd31 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,49 @@ += therubyracer + +* http://github.com/cowboyd/therubyracer + +== DESCRIPTION: + +Embed the V8 Javascript interpreter into Ruby. + +== FEATURES/PROBLEMS: + +* Inspires fun. +* Not close to production ready. + +== SYNOPSIS: + + Check back in February 2009 for an alpha release. + +== REQUIREMENTS: + +* libv8 >= 0.4.0 + +== INSTALL: + +* sudo gem install therubyracer + +== LICENSE: + +(The MIT License) + +Copyright (c) 2009 FIXME full name + +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. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..9adfc49 --- /dev/null +++ b/Rakefile @@ -0,0 +1,32 @@ +require 'rubygems' +gem 'hoe', '>= 2.1.0' +require 'hoe' +require 'fileutils' +require './lib/v8' + +gem 'rake-compiler', '>= 0.4.1' +require "rake/extensiontask" + + +Hoe.plugin :newgem + +# Generate all the Rake tasks +# Run 'rake -T' to see list of generated tasks (from gem root directory) +$hoe = Hoe.spec 'therubyracer' do + developer 'Charles Lowell', 'cowboyd@thefrontside.net' + developer 'Bill Robertson', 'billrobertson42@gmail.com' + self.rubyforge_name = self.name + self.spec_extras = { :extensions => ["ext/v8/extconf.rb"] } + self.clean_globs << "lib/v8/*.{o,so,bundle,a,log,dll}" +end + +Rake::ExtensionTask.new("v8", $hoe.spec) do |ext| + ext.lib_dir = "lib/v8" +end + +require 'newgem/tasks' +Dir['tasks/**/*.rake'].each { |t| load t } + +# TODO - want other tests/tasks run by default? Add them to the list +# remove_task :default +# task :default => [:spec, :features] diff --git a/convert_ruby.cpp b/ext/v8/convert_ruby.cpp similarity index 100% rename from convert_ruby.cpp rename to ext/v8/convert_ruby.cpp diff --git a/convert_ruby.h b/ext/v8/convert_ruby.h similarity index 100% rename from convert_ruby.h rename to ext/v8/convert_ruby.h diff --git a/convert_string.cpp b/ext/v8/convert_string.cpp similarity index 100% rename from convert_string.cpp rename to ext/v8/convert_string.cpp diff --git a/convert_string.h b/ext/v8/convert_string.h similarity index 100% rename from convert_string.h rename to ext/v8/convert_string.h diff --git a/convert_v8.cpp b/ext/v8/convert_v8.cpp similarity index 100% rename from convert_v8.cpp rename to ext/v8/convert_v8.cpp diff --git a/convert_v8.h b/ext/v8/convert_v8.h similarity index 100% rename from convert_v8.h rename to ext/v8/convert_v8.h diff --git a/converters.h b/ext/v8/converters.h similarity index 100% rename from converters.h rename to ext/v8/converters.h diff --git a/extconf.rb b/ext/v8/extconf.rb similarity index 100% rename from extconf.rb rename to ext/v8/extconf.rb diff --git a/v8.cpp b/ext/v8/v8.cpp similarity index 100% rename from v8.cpp rename to ext/v8/v8.cpp diff --git a/v8_context.cpp b/ext/v8/v8_context.cpp similarity index 100% rename from v8_context.cpp rename to ext/v8/v8_context.cpp diff --git a/v8_context.h b/ext/v8/v8_context.h similarity index 100% rename from v8_context.h rename to ext/v8/v8_context.h diff --git a/v8_cxt.cpp b/ext/v8/v8_cxt.cpp similarity index 100% rename from v8_cxt.cpp rename to ext/v8/v8_cxt.cpp diff --git a/v8_cxt.h b/ext/v8/v8_cxt.h similarity index 100% rename from v8_cxt.h rename to ext/v8/v8_cxt.h diff --git a/v8_object.cpp b/ext/v8/v8_object.cpp similarity index 100% rename from v8_object.cpp rename to ext/v8/v8_object.cpp diff --git a/v8_object.h b/ext/v8/v8_object.h similarity index 100% rename from v8_object.h rename to ext/v8/v8_object.h diff --git a/v8_ref.cpp b/ext/v8/v8_ref.cpp similarity index 100% rename from v8_ref.cpp rename to ext/v8/v8_ref.cpp diff --git a/v8_ref.h b/ext/v8/v8_ref.h similarity index 100% rename from v8_ref.h rename to ext/v8/v8_ref.h diff --git a/v8_script.cpp b/ext/v8/v8_script.cpp similarity index 100% rename from v8_script.cpp rename to ext/v8/v8_script.cpp diff --git a/v8_script.h b/ext/v8/v8_script.h similarity index 100% rename from v8_script.h rename to ext/v8/v8_script.h diff --git a/v8_standalone.cpp b/ext/v8/v8_standalone.cpp similarity index 100% rename from v8_standalone.cpp rename to ext/v8/v8_standalone.cpp diff --git a/v8_standalone.h b/ext/v8/v8_standalone.h similarity index 100% rename from v8_standalone.h rename to ext/v8/v8_standalone.h diff --git a/v8_str.cpp b/ext/v8/v8_str.cpp similarity index 100% rename from v8_str.cpp rename to ext/v8/v8_str.cpp diff --git a/v8_str.h b/ext/v8/v8_str.h similarity index 100% rename from v8_str.h rename to ext/v8/v8_str.h diff --git a/v8_template.cpp b/ext/v8/v8_template.cpp similarity index 100% rename from v8_template.cpp rename to ext/v8/v8_template.cpp diff --git a/v8_template.h b/ext/v8/v8_template.h similarity index 100% rename from v8_template.h rename to ext/v8/v8_template.h diff --git a/lib/v8.rb b/lib/v8.rb new file mode 100644 index 0000000..db826ae --- /dev/null +++ b/lib/v8.rb @@ -0,0 +1,7 @@ +$:.unshift(File.dirname(__FILE__)) unless + $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) + +module V8 + VERSION = '0.4.0' + require 'v8/v8' #native glue +end \ No newline at end of file diff --git a/lib/v8/context.rb b/lib/v8/context.rb new file mode 100644 index 0000000..b9a7ea4 --- /dev/null +++ b/lib/v8/context.rb @@ -0,0 +1,6 @@ +module V8 + # This doesn't do anything at the moment. But the ruby interface will go here + # The native interface is under the V8::C module. + class Context + end +end \ No newline at end of file diff --git a/script/console b/script/console new file mode 100755 index 0000000..d9a141e --- /dev/null +++ b/script/console @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# File: script/console +irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' + +libs = " -r irb/completion" +# Perhaps use a console_lib to store any extra methods I may want available in the cosole +# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" +libs << " -r #{File.dirname(__FILE__) + '/../lib/therubyracer.rb'}" +puts "Loading therubyracer gem" +exec "#{irb} #{libs} --simple-prompt" \ No newline at end of file diff --git a/script/destroy b/script/destroy new file mode 100755 index 0000000..e48464d --- /dev/null +++ b/script/destroy @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/destroy' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Destroy.new.run(ARGV) diff --git a/script/generate b/script/generate new file mode 100755 index 0000000..c27f655 --- /dev/null +++ b/script/generate @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/generate' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Generate.new.run(ARGV) diff --git a/tasks/rspec.rake b/tasks/rspec.rake new file mode 100644 index 0000000..31a99b0 --- /dev/null +++ b/tasks/rspec.rake @@ -0,0 +1,21 @@ +begin + require 'spec' +rescue LoadError + require 'rubygems' unless ENV['NO_RUBYGEMS'] + require 'spec' +end +begin + require 'spec/rake/spectask' +rescue LoadError + puts <<-EOS +To use rspec for testing you must install rspec gem: + gem install rspec +EOS + exit(0) +end + +desc "Run the specs under spec/models" +Spec::Rake::SpecTask.new do |t| + t.spec_opts = ['--options', "spec/spec.opts"] + t.spec_files = FileList['spec/**/*_spec.rb'] +end diff --git a/therubyracer.gemspec b/therubyracer.gemspec new file mode 100644 index 0000000..2613cd7 --- /dev/null +++ b/therubyracer.gemspec @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{therubyracer} + s.version = "0.4.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Charles Lowell", "Bill Robertson"] + s.date = %q{2009-12-15} + s.description = %q{FIX (describe your package)} + s.email = ["cowboyd@thefrontside.net", "billrobertson42@gmail.com"] + s.extensions = ["ext/v8/extconf.rb"] + s.extra_rdoc_files = ["History.txt", "Manifest.txt", "docs/data_conversion.txt"] + s.files = ["Doxyfile", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "config.sh", "docs/data_conversion.txt", "ext/v8/convert_ruby.cpp", "ext/v8/convert_ruby.h", "ext/v8/convert_string.cpp", "ext/v8/convert_string.h", "ext/v8/convert_v8.cpp", "ext/v8/convert_v8.h", "ext/v8/converters.h", "ext/v8/extconf.rb", "ext/v8/v8.cpp", "ext/v8/v8_context.cpp", "ext/v8/v8_context.h", "ext/v8/v8_cxt.cpp", "ext/v8/v8_cxt.h", "ext/v8/v8_object.cpp", "ext/v8/v8_object.h", "ext/v8/v8_ref.cpp", "ext/v8/v8_ref.h", "ext/v8/v8_script.cpp", "ext/v8/v8_script.h", "ext/v8/v8_standalone.cpp", "ext/v8/v8_standalone.h", "ext/v8/v8_str.cpp", "ext/v8/v8_str.h", "ext/v8/v8_template.cpp", "ext/v8/v8_template.h", "lib/v8.rb", "lib/v8/v8.bundle", "script/console", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/therubyracer_spec.rb", "spike.rb", "tasks/rspec.rake"] + s.homepage = %q{http://github.com/#{github_username}/#{project_name}} + s.rdoc_options = ["--main", "README.rdoc"] + s.require_paths = ["lib", "ext"] + s.rubyforge_project = %q{therubyracer} + s.rubygems_version = %q{1.3.5} + s.summary = %q{FIX (describe your package)} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 2.3.3"]) + else + s.add_dependency(%q, [">= 2.3.3"]) + end + else + s.add_dependency(%q, [">= 2.3.3"]) + end +end